Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature Request [getBindingsProxy]: add a convenient way to get hold of bindings of a specific types #4792

Open
dario-piotrowicz opened this issue Jan 19, 2024 · 1 comment 路 May be fixed by #5229
Labels
enhancement New feature or request

Comments

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Jan 19, 2024

The getBindingsProxy utility (introduced in #4523) should include as part of its return object some utility methods that allow users to get hold of specific type of binding proxies

Something along the line of

import { getBindingsProxy } from "wrangler";

const { getBindingsOfType } = await getBindingsProxy();

const kvs = getBindingsOfType('kv');
const d1s = getBindingsOfType('d1');

// ...

Or maybe the bindings could be already organized per-type as in:

import { getBindingsProxy } from "wrangler";

const { groupedBindings } = await getBindingsProxy();

const kvs = groupedBindings.kv;
const d1s = groupedBindings.d1;

// ...
@dario-piotrowicz dario-piotrowicz added the enhancement New feature or request label Jan 19, 2024
@dario-piotrowicz dario-piotrowicz changed the title 馃殌 Feature Request [getBindingsProxy]: ensure that getBindingsProxy reads the .dev.vars file 馃殌 Feature Request [getBindingsProxy]: add a convenient way to get hold of bindings of a specific types Jan 19, 2024
@dario-piotrowicz
Copy link
Member Author

cc. @alexanderniebuhr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant