typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
414 stars 75 forks source link

GenerateScopedSearchKeyParams missing `collection` #119

Open DanSnow opened 2 years ago

DanSnow commented 2 years ago

Description

I think the collection definition is probably missing here

https://github.com/typesense/typesense-js/blob/master/src/Typesense/Keys.ts#L12

Steps to reproduce

Expected Behavior

Can use collection to generate a scoped search key

Actual Behavior

Type error

Metadata

Typsense Version:

OS:

jasonbosco commented 2 years ago

@DanSnow collection is actually not a parameter that's applicable to scoped API Keys. Instead, you want to set permissions for specific collections at the level of the parent API key.

Could you expand on your use case for expecting collection here?

DanSnow commented 2 years ago

Thanks for the explanation. My colleague told me that collection exists and it works here. So I thought it is just a mistake in the type defination.

Our use case is: We have a static site generator to generate multiple sites. And we used TypeSense as the search provider which stores all the articles across all the sites. We want to limit the search only to a specific site.

So I'm supposed to limit the collection in the parent API key and adding collection to scoped key parameter doesn't actually work. Did I understand correctly?