typesense-js icon indicating copy to clipboard operation
typesense-js copied to clipboard

GenerateScopedSearchKeyParams missing `collection`

Open DanSnow opened this issue 3 years ago • 2 comments

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:

DanSnow avatar May 20 '22 09:05 DanSnow

@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?

jasonbosco avatar May 20 '22 21:05 jasonbosco

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?

DanSnow avatar May 22 '22 15:05 DanSnow