https://authzed.com logo
#spicedb
Title
# spicedb
i

Igor.Shmukler

09/13/2022, 5:32 PM
@Joey i kind of was able to get lookups working. in case you find it useful, as unlike the python counterpart, I think that NodeJS SDK is MAYBE missing a piece. yet, it is not in a convenient to use way.
Copy code
const lookupResourcesRequest = v1.LookupResourcesRequest.create({
        resourceObjectType: 'event',
        permission: 'read',
        subject: v1.SubjectReference.create({
          object: userRef
        })
      });
      const lookupResourcesResponseStream = spiceDBclient.lookupResources(
        lookupResourcesRequest
      );

      const events = [];

      lookupResourcesResponseStream.on('data', (response) => {
        console.log('response:', response);
        events.push(response.resourceObjectId);
      });
      lookupResourcesResponseStream.on('end', () => {
        console.log('events:', events);
      });