fastly / js-compute-runtime

JavaScript SDK and runtime for building Fastly Compute applications
https://developer.fastly.com/learning/compute/javascript/
Apache License 2.0
199 stars 26 forks source link

Feature Request: KVStore.keys #919

Open dios-david opened 1 month ago

dios-david commented 1 month ago

The HTTP API of KV Store has a /keys endpoint to list the keys of all the items within a kv store.

Would it be possible to support this in the JS compute SDK as well?

guybedford commented 3 weeks ago

We are working on adding this. Implementing this first depends on https://github.com/fastly/js-compute-runtime/issues/922.

alberthastings commented 1 week ago

In the meantime, and until it is included in the JS Compute SDK, would it be correct to implement it as follows?: I create the backend https://api.fastly.com. I create a secret store and store a FASTLY_API_TOKEN in it. Every time my application receives a request, I retrieve the FASTLY_API_TOKEN from the secret store, and call "/resources/stores/kv/{storeId}/keys".

computermouth commented 1 week ago

@alberthastings Yes that's a reasonable route. Your paths forward are:

  1. use the API directly (as you outlined with the API token in a Secret Store)
  2. wait for the JS SDK support
  3. use the implementation in the Rust SDK