udacity / cloudflare-typescript-workers

Types and mocks for building a tested Typescript Cloudflare Worker, generates three NPM packages
Apache License 2.0
139 stars 12 forks source link

Add type definition on CloudflareWorkerKV for list() #9

Closed dhaynespls closed 4 years ago

dhaynespls commented 4 years ago

Hi!

Love that someone's built out types for workers.

In the definition for CloudflareWorkerKV located here: https://sourcegraph.com/github.com/udacity/cloudflare-typescript-workers/-/blob/packages/types-cloudflare-worker/src/global.ts#L384

there isn't a function definition for listing keys documented here: https://developers.cloudflare.com/workers/reference/storage/listing-keys/

Should be a super simple addition.

sodabrew commented 4 years ago

Yep, Cloudflare helpfully provided the type def! Would you be up for opening a PR?

Types The full signature of the list method (in TypeScript) is:

Namespace.list({prefix?: string, limit?: number, cursor?: string})

All arguments are optional:

  • prefix is a string that represents a prefix you can use to filter all keys.
  • limit is the maximum number of keys returned. The default is 1000, which is the maximum. It is unlikely that you will want to change this default, but it is included for completeness.
  • cursor is a string used for paginating responses. See below for more.
dhaynespls commented 4 years ago

Yup! Working on it right now.

dhaynespls commented 4 years ago

Should be good to go, let me know if I missed anything!