<@U08614ZV82F> Is there filterObject method in the...
# permit-saas
t
@Ask Inkeep Is there filterObject method in the permit-node sdk yet?
a
Thanks for tagging me @Taofiq Aiyelabegan. I'll look through relevant sources and get back to you shortly.
Based on the available sources, I don't see a
filterObjects
method documented in the Node.js SDK (
permit-node
) . (1) The
filterObjects
function is currently available in: • ​*Go SDK*​ – documented with usage examples (2) , (3) • ​*Python SDK*​ – the
filter_objects
method exists in the Python enforcer (4) For Node.js, the documented approach for filtering is to use ​*bulk checks*​ at the application level. Here's an example: (5)
Copy code
const { Permit } = require("permitio") ;

const permit = new Permit({ token: "<YOUR_API_KEY>" }) ;

// Build the check requests for each item
const checkRequests = documents.map(doc => ({
  user:   "<mailto:alice@example.com|alice@example.com>",
  action: "read",
  resource: `document:${doc.id}`
}) ) ;

// Perform a single bulk check for all items
const permittedResults = await permit.bulkCheck(checkRequests) ;
This lets you filter objects by batching authorization checks, though it requires fetching the data first and then filtering based on the results. Check out these potentially useful sources: • Data Filtering • Advanced Authorization Queries • Implementing Database Permissions Would you like a general answer on alternative approaches, or would you like me to help with the bulk check pat
d
Hey @Taofiq Aiyelabegan thanks for your message 🙂 At this time filterObjects is not available with Node.js sdk but the bulking suggested by the bot is a nice option. I reached out to the team if there are any other options and will get back to you if there are other workarounds.
Hi @Taofiq Aiyelabegan At this time filterObjects is not available for node.js SDK. As mentioned by the bot, the recommended approach at this time is to use bulk Checks at the application level
t
Thank you @david , figured out the filterObjects and it worked for my use case
🎉 1