Skip to content

fix: allow siteID and token to be passed in Functions v2 and Edge Fun… #217

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/store_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ export const getStore: {
return new Store({ client, name: input })
}

if (typeof input?.name === 'string' && typeof input?.siteID === 'string' && typeof input?.token === 'string') {
const { name, siteID, token } = input
const clientOptions = getClientOptions(input, { siteID, token })

if (!name || !siteID || !token) {
throw new MissingBlobsEnvironmentError(['name', 'siteID', 'token'])
}

const client = new Client(clientOptions)

return new Store({ client, name })
}

if (typeof input?.name === 'string') {
const { name } = input
const clientOptions = getClientOptions(input)
Expand Down
Loading