@eventmodelers/node-kit 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/package.json +36 -0
- package/src/cli.js +176 -0
- package/templates/.claude/skills/connect/SKILL.md +169 -0
- package/templates/.claude/skills/load-slice/SKILL.md +86 -0
- package/templates/realtime-agent/node_modules/.package-lock.json +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/LICENSE +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/README.md +190 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/AuthClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts +716 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js +1108 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts +2473 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js +5217 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js +20 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts +76 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js +269 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/base64url.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js +31 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/error-codes.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts +258 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js +290 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts +54 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js +200 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/fetch.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts +94 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js +406 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/helpers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js +349 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/locks.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js +29 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts +2498 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js +23 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts +96 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js +66 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/web3/solana.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts +284 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts +583 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.dom.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts +85 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js +272 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js +707 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js +4 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/AuthClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts +716 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js +1105 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts +2473 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js +5214 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts +76 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js +257 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/base64url.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js +28 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/error-codes.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts +258 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js +267 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts +54 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js +190 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/fetch.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts +94 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js +378 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/helpers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts +9 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js +18 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js +341 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/locks.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js +26 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts +2498 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js +20 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts +96 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js +60 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/web3/solana.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts +284 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts +583 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.dom.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts +85 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js +264 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js +689 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/package.json +44 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthAdminApi.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/AuthClient.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueAdminApi.ts +1267 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/GoTrueClient.ts +6360 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/index.ts +13 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/base64url.ts +308 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/constants.ts +34 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/error-codes.ts +90 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/errors.ts +359 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/fetch.ts +320 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/helpers.ts +476 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/local-storage.ts +21 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/locks.ts +420 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/polyfills.ts +23 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/types.ts +2917 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/ethereum.ts +184 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/web3/solana.ts +186 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.dom.ts +636 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.errors.ts +329 -0
- package/templates/realtime-agent/node_modules/@supabase/auth-js/src/lib/webauthn.ts +946 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/README.md +134 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts +177 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js +309 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/helper.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js +12 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts +122 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js +98 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/main/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts +177 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js +305 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js +7 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/helper.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts +122 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js +91 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/module/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/package.json +52 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/FunctionsClient.ts +335 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/edge-runtime.d.ts +214 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/helper.ts +8 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/index.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/types.ts +146 -0
- package/templates/realtime-agent/node_modules/@supabase/functions-js/src/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/LICENSE.md +22 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/README.md +121 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/ajax.js +116 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/channel.js +331 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/constants.js +35 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/index.js +212 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/longpoll.js +192 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/presence.js +208 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/push.js +134 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/serializer.js +133 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/socket.js +756 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/timer.js +48 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/types.js +184 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/assets/js/phoenix/utils.js +16 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/package.json +58 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/favicon.ico +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix-orange.png +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js +1825 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js.map +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.js +1847 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.min.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs +1802 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.mjs.map +7 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/phoenix.png +0 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/ajax.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts +167 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts +29 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts +107 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts +70 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/push.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts +74 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts +291 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts +280 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/priv/static/types/utils.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/phoenix/tsconfig.json +20 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/README.md +213 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs +5025 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts +3828 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts +3828 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs +5017 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/package.json +69 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestBuilder.ts +688 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestClient.ts +447 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestError.ts +41 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestFilterBuilder.ts +2137 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestQueryBuilder.ts +1703 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/PostgrestTransformBuilder.ts +981 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/constants.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/index.ts +34 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/parser.ts +476 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/result.ts +550 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/types.ts +129 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/select-query-parser/utils.ts +704 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/common.ts +83 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/common/rpc.ts +148 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/feature-flags.ts +17 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/types/types.ts +161 -0
- package/templates/realtime-agent/node_modules/@supabase/postgrest-js/src/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/README.md +326 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts +442 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js +719 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts +275 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js +697 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js +18 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js +29 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts +33 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js +155 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts +109 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js +241 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js +11 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts +82 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js +130 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js +103 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js +93 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js +114 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js +3 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/main/phoenix/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts +442 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js +714 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts +275 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js +693 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js +6 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/index.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js +40 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/constants.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts +10 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js +26 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts +33 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js +152 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts +109 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js +229 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js +8 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/version.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts +82 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js +126 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js +100 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js +90 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts +38 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js +111 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts +5 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.d.ts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js +2 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/module/phoenix/types.js.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo +1 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/package.json +58 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts +1118 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimeClient.ts +868 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/RealtimePresence.ts +71 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/index.ts +53 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/constants.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts +30 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/serializer.ts +203 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/transformers.ts +270 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts +204 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts +149 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts +116 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts +168 -0
- package/templates/realtime-agent/node_modules/@supabase/realtime-js/src/phoenix/types.ts +32 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/README.md +1262 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs +2995 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts +2956 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts +2956 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs +2979 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/dist/umd/supabase.js +1 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/package.json +62 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/StorageClient.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/index.ts +19 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts +104 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/errors.ts +160 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/fetch.ts +303 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/headers.ts +43 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/common/helpers.ts +146 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/constants.ts +4 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/types.ts +654 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts +62 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts +420 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts +414 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts +1423 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts +644 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts +39 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts +73 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts +90 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/README.md +238 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs +89 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts +58 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts +58 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs +88 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/cors.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs +660 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts +616 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.cts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts +616 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.d.mts.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs +607 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/dist/umd/supabase.js +24 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/package.json +122 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/SupabaseClient.ts +625 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/cors.ts +84 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/index.ts +106 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts +8 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/constants.ts +35 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/fetch.ts +36 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/helpers.ts +98 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts +93 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts +158 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/types.ts +196 -0
- package/templates/realtime-agent/node_modules/@supabase/supabase-js/src/lib/version.ts +7 -0
- package/templates/realtime-agent/node_modules/iceberg-js/LICENSE +21 -0
- package/templates/realtime-agent/node_modules/iceberg-js/README.md +439 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs +596 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.cjs.map +1 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.cts +547 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.d.ts +547 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs +587 -0
- package/templates/realtime-agent/node_modules/iceberg-js/dist/index.mjs.map +1 -0
- package/templates/realtime-agent/node_modules/iceberg-js/package.json +77 -0
- package/templates/realtime-agent/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/templates/realtime-agent/node_modules/tslib/LICENSE.txt +12 -0
- package/templates/realtime-agent/node_modules/tslib/README.md +164 -0
- package/templates/realtime-agent/node_modules/tslib/SECURITY.md +41 -0
- package/templates/realtime-agent/node_modules/tslib/modules/index.d.ts +38 -0
- package/templates/realtime-agent/node_modules/tslib/modules/index.js +70 -0
- package/templates/realtime-agent/node_modules/tslib/modules/package.json +3 -0
- package/templates/realtime-agent/node_modules/tslib/package.json +47 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.d.ts +460 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.html +1 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.js +402 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.es6.mjs +401 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.html +1 -0
- package/templates/realtime-agent/node_modules/tslib/tslib.js +484 -0
- package/templates/realtime-agent/package-lock.json +114 -0
- package/templates/realtime-agent/package.json +11 -0
- package/templates/realtime-agent/src/index.js +152 -0
- package/templates/root/AGENT.md +37 -0
- package/templates/root/model.md +1 -0
- package/templates/root/prompt.md +91 -0
- package/templates/root/ralph.sh +47 -0
|
@@ -0,0 +1,2995 @@
|
|
|
1
|
+
let iceberg_js = require("iceberg-js");
|
|
2
|
+
|
|
3
|
+
//#region \0@oxc-project+runtime@0.101.0/helpers/typeof.js
|
|
4
|
+
function _typeof(o) {
|
|
5
|
+
"@babel/helpers - typeof";
|
|
6
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
7
|
+
return typeof o$1;
|
|
8
|
+
} : function(o$1) {
|
|
9
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
10
|
+
}, _typeof(o);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region \0@oxc-project+runtime@0.101.0/helpers/toPrimitive.js
|
|
15
|
+
function toPrimitive(t, r) {
|
|
16
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
17
|
+
var e = t[Symbol.toPrimitive];
|
|
18
|
+
if (void 0 !== e) {
|
|
19
|
+
var i = e.call(t, r || "default");
|
|
20
|
+
if ("object" != _typeof(i)) return i;
|
|
21
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
22
|
+
}
|
|
23
|
+
return ("string" === r ? String : Number)(t);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region \0@oxc-project+runtime@0.101.0/helpers/toPropertyKey.js
|
|
28
|
+
function toPropertyKey(t) {
|
|
29
|
+
var i = toPrimitive(t, "string");
|
|
30
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region \0@oxc-project+runtime@0.101.0/helpers/defineProperty.js
|
|
35
|
+
function _defineProperty(e, r, t) {
|
|
36
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
37
|
+
value: t,
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0
|
|
41
|
+
}) : e[r] = t, e;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region \0@oxc-project+runtime@0.101.0/helpers/objectSpread2.js
|
|
46
|
+
function ownKeys(e, r) {
|
|
47
|
+
var t = Object.keys(e);
|
|
48
|
+
if (Object.getOwnPropertySymbols) {
|
|
49
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
50
|
+
r && (o = o.filter(function(r$1) {
|
|
51
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
52
|
+
})), t.push.apply(t, o);
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
function _objectSpread2(e) {
|
|
57
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
58
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
59
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
60
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
61
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
62
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/lib/common/errors.ts
|
|
70
|
+
/**
|
|
71
|
+
* Base error class for all Storage errors
|
|
72
|
+
* Supports both 'storage' and 'vectors' namespaces
|
|
73
|
+
*/
|
|
74
|
+
var StorageError = class extends Error {
|
|
75
|
+
constructor(message, namespace = "storage", status, statusCode) {
|
|
76
|
+
super(message);
|
|
77
|
+
this.__isStorageError = true;
|
|
78
|
+
this.namespace = namespace;
|
|
79
|
+
this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
|
|
80
|
+
this.status = status;
|
|
81
|
+
this.statusCode = statusCode;
|
|
82
|
+
}
|
|
83
|
+
toJSON() {
|
|
84
|
+
return {
|
|
85
|
+
name: this.name,
|
|
86
|
+
message: this.message,
|
|
87
|
+
status: this.status,
|
|
88
|
+
statusCode: this.statusCode
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Type guard to check if an error is a StorageError
|
|
94
|
+
* @param error - The error to check
|
|
95
|
+
* @returns True if the error is a StorageError
|
|
96
|
+
*/
|
|
97
|
+
function isStorageError(error) {
|
|
98
|
+
return typeof error === "object" && error !== null && "__isStorageError" in error;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* API error returned from Storage service
|
|
102
|
+
* Includes HTTP status code and service-specific error code
|
|
103
|
+
*/
|
|
104
|
+
var StorageApiError = class extends StorageError {
|
|
105
|
+
constructor(message, status, statusCode, namespace = "storage") {
|
|
106
|
+
super(message, namespace, status, statusCode);
|
|
107
|
+
this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
|
|
108
|
+
this.status = status;
|
|
109
|
+
this.statusCode = statusCode;
|
|
110
|
+
}
|
|
111
|
+
toJSON() {
|
|
112
|
+
return _objectSpread2({}, super.toJSON());
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Unknown error that doesn't match expected error patterns
|
|
117
|
+
* Wraps the original error for debugging
|
|
118
|
+
*/
|
|
119
|
+
var StorageUnknownError = class extends StorageError {
|
|
120
|
+
constructor(message, originalError, namespace = "storage") {
|
|
121
|
+
super(message, namespace);
|
|
122
|
+
this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
|
|
123
|
+
this.originalError = originalError;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated Use StorageError with namespace='vectors' instead
|
|
128
|
+
* Alias for backward compatibility with existing vector storage code
|
|
129
|
+
*/
|
|
130
|
+
var StorageVectorsError = class extends StorageError {
|
|
131
|
+
constructor(message) {
|
|
132
|
+
super(message, "vectors");
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Type guard to check if an error is a StorageVectorsError
|
|
137
|
+
* @param error - The error to check
|
|
138
|
+
* @returns True if the error is a StorageVectorsError
|
|
139
|
+
*/
|
|
140
|
+
function isStorageVectorsError(error) {
|
|
141
|
+
return isStorageError(error) && error["namespace"] === "vectors";
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated Use StorageApiError with namespace='vectors' instead
|
|
145
|
+
* Alias for backward compatibility with existing vector storage code
|
|
146
|
+
*/
|
|
147
|
+
var StorageVectorsApiError = class extends StorageApiError {
|
|
148
|
+
constructor(message, status, statusCode) {
|
|
149
|
+
super(message, status, statusCode, "vectors");
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated Use StorageUnknownError with namespace='vectors' instead
|
|
154
|
+
* Alias for backward compatibility with existing vector storage code
|
|
155
|
+
*/
|
|
156
|
+
var StorageVectorsUnknownError = class extends StorageUnknownError {
|
|
157
|
+
constructor(message, originalError) {
|
|
158
|
+
super(message, originalError, "vectors");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Error codes specific to S3 Vectors API
|
|
163
|
+
* Maps AWS service errors to application-friendly error codes
|
|
164
|
+
*/
|
|
165
|
+
let StorageVectorsErrorCode = /* @__PURE__ */ function(StorageVectorsErrorCode$1) {
|
|
166
|
+
/** Internal server fault (HTTP 500) */
|
|
167
|
+
StorageVectorsErrorCode$1["InternalError"] = "InternalError";
|
|
168
|
+
/** Resource already exists / conflict (HTTP 409) */
|
|
169
|
+
StorageVectorsErrorCode$1["S3VectorConflictException"] = "S3VectorConflictException";
|
|
170
|
+
/** Resource not found (HTTP 404) */
|
|
171
|
+
StorageVectorsErrorCode$1["S3VectorNotFoundException"] = "S3VectorNotFoundException";
|
|
172
|
+
/** Delete bucket while not empty (HTTP 400) */
|
|
173
|
+
StorageVectorsErrorCode$1["S3VectorBucketNotEmpty"] = "S3VectorBucketNotEmpty";
|
|
174
|
+
/** Exceeds bucket quota/limit (HTTP 400) */
|
|
175
|
+
StorageVectorsErrorCode$1["S3VectorMaxBucketsExceeded"] = "S3VectorMaxBucketsExceeded";
|
|
176
|
+
/** Exceeds index quota/limit (HTTP 400) */
|
|
177
|
+
StorageVectorsErrorCode$1["S3VectorMaxIndexesExceeded"] = "S3VectorMaxIndexesExceeded";
|
|
178
|
+
return StorageVectorsErrorCode$1;
|
|
179
|
+
}({});
|
|
180
|
+
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/lib/common/headers.ts
|
|
183
|
+
/**
|
|
184
|
+
* Sets a header with case-insensitive deduplication.
|
|
185
|
+
* Removes any existing headers whose name matches (case-insensitive),
|
|
186
|
+
* then sets the value under the lowercase key. Does not mutate the input object.
|
|
187
|
+
*
|
|
188
|
+
* @param headers - Existing headers object
|
|
189
|
+
* @param name - Header name to set (stored as lowercase)
|
|
190
|
+
* @param value - Header value
|
|
191
|
+
* @returns New headers object with the header set
|
|
192
|
+
*/
|
|
193
|
+
function setHeader(headers, name, value) {
|
|
194
|
+
const result = _objectSpread2({}, headers);
|
|
195
|
+
const nameLower = name.toLowerCase();
|
|
196
|
+
for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key];
|
|
197
|
+
result[nameLower] = value;
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Normalizes all header keys to lowercase with case-insensitive deduplication.
|
|
202
|
+
* When duplicate keys exist (differing only in case), the last value wins.
|
|
203
|
+
* Does not mutate the input object.
|
|
204
|
+
*
|
|
205
|
+
* @param headers - Headers object to normalize
|
|
206
|
+
* @returns New headers object with all keys lowercased
|
|
207
|
+
*/
|
|
208
|
+
function normalizeHeaders(headers) {
|
|
209
|
+
const result = {};
|
|
210
|
+
for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value;
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/lib/common/helpers.ts
|
|
216
|
+
/**
|
|
217
|
+
* Resolves the fetch implementation to use
|
|
218
|
+
* Uses custom fetch if provided, otherwise uses native fetch
|
|
219
|
+
*
|
|
220
|
+
* @param customFetch - Optional custom fetch implementation
|
|
221
|
+
* @returns Resolved fetch function
|
|
222
|
+
*/
|
|
223
|
+
const resolveFetch = (customFetch) => {
|
|
224
|
+
if (customFetch) return (...args) => customFetch(...args);
|
|
225
|
+
return (...args) => fetch(...args);
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Determine if input is a plain object
|
|
229
|
+
* An object is plain if it's created by either {}, new Object(), or Object.create(null)
|
|
230
|
+
*
|
|
231
|
+
* @param value - Value to check
|
|
232
|
+
* @returns True if value is a plain object
|
|
233
|
+
* @source https://github.com/sindresorhus/is-plain-obj
|
|
234
|
+
*/
|
|
235
|
+
const isPlainObject = (value) => {
|
|
236
|
+
if (typeof value !== "object" || value === null) return false;
|
|
237
|
+
const prototype = Object.getPrototypeOf(value);
|
|
238
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Recursively converts object keys from snake_case to camelCase
|
|
242
|
+
* Used for normalizing API responses
|
|
243
|
+
*
|
|
244
|
+
* @param item - Object to convert
|
|
245
|
+
* @returns Converted object with camelCase keys
|
|
246
|
+
*/
|
|
247
|
+
const recursiveToCamel = (item) => {
|
|
248
|
+
if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
|
|
249
|
+
else if (typeof item === "function" || item !== Object(item)) return item;
|
|
250
|
+
const result = {};
|
|
251
|
+
Object.entries(item).forEach(([key, value]) => {
|
|
252
|
+
const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, ""));
|
|
253
|
+
result[newKey] = recursiveToCamel(value);
|
|
254
|
+
});
|
|
255
|
+
return result;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Validates if a given bucket name is valid according to Supabase Storage API rules
|
|
259
|
+
* Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName()
|
|
260
|
+
*
|
|
261
|
+
* Rules:
|
|
262
|
+
* - Length: 1-100 characters
|
|
263
|
+
* - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters
|
|
264
|
+
* - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ?
|
|
265
|
+
* - Forbidden: path separators (/, \), path traversal (..), leading/trailing whitespace
|
|
266
|
+
*
|
|
267
|
+
* AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
|
|
268
|
+
*
|
|
269
|
+
* @param bucketName - The bucket name to validate
|
|
270
|
+
* @returns true if valid, false otherwise
|
|
271
|
+
*/
|
|
272
|
+
const isValidBucketName = (bucketName) => {
|
|
273
|
+
if (!bucketName || typeof bucketName !== "string") return false;
|
|
274
|
+
if (bucketName.length === 0 || bucketName.length > 100) return false;
|
|
275
|
+
if (bucketName.trim() !== bucketName) return false;
|
|
276
|
+
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
277
|
+
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/lib/common/fetch.ts
|
|
282
|
+
/**
|
|
283
|
+
* Extracts error message from various error response formats
|
|
284
|
+
* @param err - Error object from API
|
|
285
|
+
* @returns Human-readable error message
|
|
286
|
+
*/
|
|
287
|
+
const _getErrorMessage = (err) => {
|
|
288
|
+
if (typeof err === "object" && err !== null) {
|
|
289
|
+
const e = err;
|
|
290
|
+
if (typeof e.msg === "string") return e.msg;
|
|
291
|
+
if (typeof e.message === "string") return e.message;
|
|
292
|
+
if (typeof e.error_description === "string") return e.error_description;
|
|
293
|
+
if (typeof e.error === "string") return e.error;
|
|
294
|
+
if (typeof e.error === "object" && e.error !== null) {
|
|
295
|
+
const nested = e.error;
|
|
296
|
+
if (typeof nested.message === "string") return nested.message;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return JSON.stringify(err);
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Handles fetch errors and converts them to Storage error types
|
|
303
|
+
* @param error - The error caught from fetch
|
|
304
|
+
* @param reject - Promise rejection function
|
|
305
|
+
* @param options - Fetch options that may affect error handling
|
|
306
|
+
* @param namespace - Error namespace ('storage' or 'vectors')
|
|
307
|
+
*/
|
|
308
|
+
const handleError = async (error, reject, options, namespace) => {
|
|
309
|
+
if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") {
|
|
310
|
+
const responseError = error;
|
|
311
|
+
let status = parseInt(String(responseError.status), 10);
|
|
312
|
+
if (!Number.isFinite(status)) status = 500;
|
|
313
|
+
responseError.json().then((err) => {
|
|
314
|
+
const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
|
|
315
|
+
reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
|
|
316
|
+
}).catch(() => {
|
|
317
|
+
const statusCode = status + "";
|
|
318
|
+
reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
|
|
319
|
+
});
|
|
320
|
+
} else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Builds request parameters for fetch calls
|
|
324
|
+
* @param method - HTTP method
|
|
325
|
+
* @param options - Custom fetch options
|
|
326
|
+
* @param parameters - Additional fetch parameters like AbortSignal
|
|
327
|
+
* @param body - Request body (will be JSON stringified if plain object)
|
|
328
|
+
* @returns Complete fetch request parameters
|
|
329
|
+
*/
|
|
330
|
+
const _getRequestParams = (method, options, parameters, body) => {
|
|
331
|
+
const params = {
|
|
332
|
+
method,
|
|
333
|
+
headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
|
|
334
|
+
};
|
|
335
|
+
if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters);
|
|
336
|
+
if (isPlainObject(body)) {
|
|
337
|
+
var _contentType;
|
|
338
|
+
const headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
|
|
339
|
+
let contentType;
|
|
340
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value;
|
|
341
|
+
params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json");
|
|
342
|
+
params.body = JSON.stringify(body);
|
|
343
|
+
} else params.body = body;
|
|
344
|
+
if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
|
|
345
|
+
return _objectSpread2(_objectSpread2({}, params), parameters);
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Internal request handler that wraps fetch with error handling
|
|
349
|
+
* @param fetcher - Fetch function to use
|
|
350
|
+
* @param method - HTTP method
|
|
351
|
+
* @param url - Request URL
|
|
352
|
+
* @param options - Custom fetch options
|
|
353
|
+
* @param parameters - Additional fetch parameters
|
|
354
|
+
* @param body - Request body
|
|
355
|
+
* @param namespace - Error namespace ('storage' or 'vectors')
|
|
356
|
+
* @returns Promise with parsed response or error
|
|
357
|
+
*/
|
|
358
|
+
async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
|
|
359
|
+
return new Promise((resolve, reject) => {
|
|
360
|
+
fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
|
|
361
|
+
if (!result.ok) throw result;
|
|
362
|
+
if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
|
|
363
|
+
if (namespace === "vectors") {
|
|
364
|
+
const contentType = result.headers.get("content-type");
|
|
365
|
+
if (result.headers.get("content-length") === "0" || result.status === 204) return {};
|
|
366
|
+
if (!contentType || !contentType.includes("application/json")) return {};
|
|
367
|
+
}
|
|
368
|
+
return result.json();
|
|
369
|
+
}).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Creates a fetch API with the specified namespace
|
|
374
|
+
* @param namespace - Error namespace ('storage' or 'vectors')
|
|
375
|
+
* @returns Object with HTTP method functions
|
|
376
|
+
*/
|
|
377
|
+
function createFetchApi(namespace = "storage") {
|
|
378
|
+
return {
|
|
379
|
+
get: async (fetcher, url, options, parameters) => {
|
|
380
|
+
return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
|
|
381
|
+
},
|
|
382
|
+
post: async (fetcher, url, body, options, parameters) => {
|
|
383
|
+
return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
|
|
384
|
+
},
|
|
385
|
+
put: async (fetcher, url, body, options, parameters) => {
|
|
386
|
+
return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
|
|
387
|
+
},
|
|
388
|
+
head: async (fetcher, url, options, parameters) => {
|
|
389
|
+
return _handleRequest(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
|
|
390
|
+
},
|
|
391
|
+
remove: async (fetcher, url, body, options, parameters) => {
|
|
392
|
+
return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
const defaultApi = createFetchApi("storage");
|
|
397
|
+
const { get, post, put, head, remove } = defaultApi;
|
|
398
|
+
const vectorsApi = createFetchApi("vectors");
|
|
399
|
+
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/lib/common/BaseApiClient.ts
|
|
402
|
+
/**
|
|
403
|
+
* @ignore
|
|
404
|
+
* Base API client class for all Storage API classes
|
|
405
|
+
* Provides common infrastructure for error handling and configuration
|
|
406
|
+
*
|
|
407
|
+
* @typeParam TError - The error type (StorageError or subclass)
|
|
408
|
+
*/
|
|
409
|
+
var BaseApiClient = class {
|
|
410
|
+
/**
|
|
411
|
+
* Creates a new BaseApiClient instance
|
|
412
|
+
* @param url - Base URL for API requests
|
|
413
|
+
* @param headers - Default headers for API requests
|
|
414
|
+
* @param fetch - Optional custom fetch implementation
|
|
415
|
+
* @param namespace - Error namespace ('storage' or 'vectors')
|
|
416
|
+
*/
|
|
417
|
+
constructor(url, headers = {}, fetch$1, namespace = "storage") {
|
|
418
|
+
this.shouldThrowOnError = false;
|
|
419
|
+
this.url = url;
|
|
420
|
+
this.headers = normalizeHeaders(headers);
|
|
421
|
+
this.fetch = resolveFetch(fetch$1);
|
|
422
|
+
this.namespace = namespace;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Enable throwing errors instead of returning them.
|
|
426
|
+
* When enabled, errors are thrown instead of returned in { data, error } format.
|
|
427
|
+
*
|
|
428
|
+
* @returns this - For method chaining
|
|
429
|
+
*/
|
|
430
|
+
throwOnError() {
|
|
431
|
+
this.shouldThrowOnError = true;
|
|
432
|
+
return this;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Set an HTTP header for the request.
|
|
436
|
+
* Creates a shallow copy of headers to avoid mutating shared state.
|
|
437
|
+
*
|
|
438
|
+
* @param name - Header name
|
|
439
|
+
* @param value - Header value
|
|
440
|
+
* @returns this - For method chaining
|
|
441
|
+
*/
|
|
442
|
+
setHeader(name, value) {
|
|
443
|
+
this.headers = setHeader(this.headers, name, value);
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Handles API operation with standardized error handling
|
|
448
|
+
* Eliminates repetitive try-catch blocks across all API methods
|
|
449
|
+
*
|
|
450
|
+
* This wrapper:
|
|
451
|
+
* 1. Executes the operation
|
|
452
|
+
* 2. Returns { data, error: null } on success
|
|
453
|
+
* 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
|
|
454
|
+
* 4. Throws error on failure (if shouldThrowOnError is true)
|
|
455
|
+
*
|
|
456
|
+
* @typeParam T - The expected data type from the operation
|
|
457
|
+
* @param operation - Async function that performs the API call
|
|
458
|
+
* @returns Promise with { data, error } tuple
|
|
459
|
+
*
|
|
460
|
+
* @example Handling an operation
|
|
461
|
+
* ```typescript
|
|
462
|
+
* async listBuckets() {
|
|
463
|
+
* return this.handleOperation(async () => {
|
|
464
|
+
* return await get(this.fetch, `${this.url}/bucket`, {
|
|
465
|
+
* headers: this.headers,
|
|
466
|
+
* })
|
|
467
|
+
* })
|
|
468
|
+
* }
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
async handleOperation(operation) {
|
|
472
|
+
var _this = this;
|
|
473
|
+
try {
|
|
474
|
+
return {
|
|
475
|
+
data: await operation(),
|
|
476
|
+
error: null
|
|
477
|
+
};
|
|
478
|
+
} catch (error) {
|
|
479
|
+
if (_this.shouldThrowOnError) throw error;
|
|
480
|
+
if (isStorageError(error)) return {
|
|
481
|
+
data: null,
|
|
482
|
+
error
|
|
483
|
+
};
|
|
484
|
+
throw error;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/packages/StreamDownloadBuilder.ts
|
|
491
|
+
var StreamDownloadBuilder = class {
|
|
492
|
+
constructor(downloadFn, shouldThrowOnError) {
|
|
493
|
+
this.downloadFn = downloadFn;
|
|
494
|
+
this.shouldThrowOnError = shouldThrowOnError;
|
|
495
|
+
}
|
|
496
|
+
then(onfulfilled, onrejected) {
|
|
497
|
+
return this.execute().then(onfulfilled, onrejected);
|
|
498
|
+
}
|
|
499
|
+
async execute() {
|
|
500
|
+
var _this = this;
|
|
501
|
+
try {
|
|
502
|
+
return {
|
|
503
|
+
data: (await _this.downloadFn()).body,
|
|
504
|
+
error: null
|
|
505
|
+
};
|
|
506
|
+
} catch (error) {
|
|
507
|
+
if (_this.shouldThrowOnError) throw error;
|
|
508
|
+
if (isStorageError(error)) return {
|
|
509
|
+
data: null,
|
|
510
|
+
error
|
|
511
|
+
};
|
|
512
|
+
throw error;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/packages/BlobDownloadBuilder.ts
|
|
519
|
+
let _Symbol$toStringTag;
|
|
520
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
521
|
+
var BlobDownloadBuilder = class {
|
|
522
|
+
constructor(downloadFn, shouldThrowOnError) {
|
|
523
|
+
this.downloadFn = downloadFn;
|
|
524
|
+
this.shouldThrowOnError = shouldThrowOnError;
|
|
525
|
+
this[_Symbol$toStringTag] = "BlobDownloadBuilder";
|
|
526
|
+
this.promise = null;
|
|
527
|
+
}
|
|
528
|
+
asStream() {
|
|
529
|
+
return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError);
|
|
530
|
+
}
|
|
531
|
+
then(onfulfilled, onrejected) {
|
|
532
|
+
return this.getPromise().then(onfulfilled, onrejected);
|
|
533
|
+
}
|
|
534
|
+
catch(onrejected) {
|
|
535
|
+
return this.getPromise().catch(onrejected);
|
|
536
|
+
}
|
|
537
|
+
finally(onfinally) {
|
|
538
|
+
return this.getPromise().finally(onfinally);
|
|
539
|
+
}
|
|
540
|
+
getPromise() {
|
|
541
|
+
if (!this.promise) this.promise = this.execute();
|
|
542
|
+
return this.promise;
|
|
543
|
+
}
|
|
544
|
+
async execute() {
|
|
545
|
+
var _this = this;
|
|
546
|
+
try {
|
|
547
|
+
return {
|
|
548
|
+
data: await (await _this.downloadFn()).blob(),
|
|
549
|
+
error: null
|
|
550
|
+
};
|
|
551
|
+
} catch (error) {
|
|
552
|
+
if (_this.shouldThrowOnError) throw error;
|
|
553
|
+
if (isStorageError(error)) return {
|
|
554
|
+
data: null,
|
|
555
|
+
error
|
|
556
|
+
};
|
|
557
|
+
throw error;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/packages/StorageFileApi.ts
|
|
564
|
+
const DEFAULT_SEARCH_OPTIONS = {
|
|
565
|
+
limit: 100,
|
|
566
|
+
offset: 0,
|
|
567
|
+
sortBy: {
|
|
568
|
+
column: "name",
|
|
569
|
+
order: "asc"
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
const DEFAULT_FILE_OPTIONS = {
|
|
573
|
+
cacheControl: "3600",
|
|
574
|
+
contentType: "text/plain;charset=UTF-8",
|
|
575
|
+
upsert: false
|
|
576
|
+
};
|
|
577
|
+
var StorageFileApi = class extends BaseApiClient {
|
|
578
|
+
constructor(url, headers = {}, bucketId, fetch$1) {
|
|
579
|
+
super(url, headers, fetch$1, "storage");
|
|
580
|
+
this.bucketId = bucketId;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
|
|
584
|
+
*
|
|
585
|
+
* @param method HTTP method.
|
|
586
|
+
* @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
587
|
+
* @param fileBody The body of the file to be stored in the bucket.
|
|
588
|
+
*/
|
|
589
|
+
async uploadOrUpdate(method, path, fileBody, fileOptions) {
|
|
590
|
+
var _this = this;
|
|
591
|
+
return _this.handleOperation(async () => {
|
|
592
|
+
let body;
|
|
593
|
+
const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
594
|
+
let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
|
|
595
|
+
const metadata = options.metadata;
|
|
596
|
+
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
597
|
+
body = new FormData();
|
|
598
|
+
body.append("cacheControl", options.cacheControl);
|
|
599
|
+
if (metadata) body.append("metadata", _this.encodeMetadata(metadata));
|
|
600
|
+
body.append("", fileBody);
|
|
601
|
+
} else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
|
|
602
|
+
body = fileBody;
|
|
603
|
+
if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
|
|
604
|
+
if (metadata && !body.has("metadata")) body.append("metadata", _this.encodeMetadata(metadata));
|
|
605
|
+
} else {
|
|
606
|
+
body = fileBody;
|
|
607
|
+
headers["cache-control"] = `max-age=${options.cacheControl}`;
|
|
608
|
+
headers["content-type"] = options.contentType;
|
|
609
|
+
if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
|
|
610
|
+
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
611
|
+
}
|
|
612
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
613
|
+
const cleanPath = _this._removeEmptyFolders(path);
|
|
614
|
+
const _path = _this._getFinalPath(cleanPath);
|
|
615
|
+
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
|
|
616
|
+
return {
|
|
617
|
+
path: cleanPath,
|
|
618
|
+
id: data.Id,
|
|
619
|
+
fullPath: data.Key
|
|
620
|
+
};
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Uploads a file to an existing bucket.
|
|
625
|
+
*
|
|
626
|
+
* @category Storage
|
|
627
|
+
* @subcategory File Buckets
|
|
628
|
+
* @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
629
|
+
* @param fileBody The body of the file to be stored in the bucket.
|
|
630
|
+
* @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
|
|
631
|
+
* @returns Promise with response containing file path, id, and fullPath or error
|
|
632
|
+
*
|
|
633
|
+
* @example Upload file
|
|
634
|
+
* ```js
|
|
635
|
+
* const avatarFile = event.target.files[0]
|
|
636
|
+
* const { data, error } = await supabase
|
|
637
|
+
* .storage
|
|
638
|
+
* .from('avatars')
|
|
639
|
+
* .upload('public/avatar1.png', avatarFile, {
|
|
640
|
+
* cacheControl: '3600',
|
|
641
|
+
* upsert: false
|
|
642
|
+
* })
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* Response:
|
|
646
|
+
* ```json
|
|
647
|
+
* {
|
|
648
|
+
* "data": {
|
|
649
|
+
* "path": "public/avatar1.png",
|
|
650
|
+
* "fullPath": "avatars/public/avatar1.png"
|
|
651
|
+
* },
|
|
652
|
+
* "error": null
|
|
653
|
+
* }
|
|
654
|
+
* ```
|
|
655
|
+
*
|
|
656
|
+
* @example Upload file using `ArrayBuffer` from base64 file data
|
|
657
|
+
* ```js
|
|
658
|
+
* import { decode } from 'base64-arraybuffer'
|
|
659
|
+
*
|
|
660
|
+
* const { data, error } = await supabase
|
|
661
|
+
* .storage
|
|
662
|
+
* .from('avatars')
|
|
663
|
+
* .upload('public/avatar1.png', decode('base64FileData'), {
|
|
664
|
+
* contentType: 'image/png'
|
|
665
|
+
* })
|
|
666
|
+
* ```
|
|
667
|
+
*
|
|
668
|
+
* @remarks
|
|
669
|
+
* - RLS policy permissions required:
|
|
670
|
+
* - `buckets` table permissions: none
|
|
671
|
+
* - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files
|
|
672
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
673
|
+
* - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.
|
|
674
|
+
*/
|
|
675
|
+
async upload(path, fileBody, fileOptions) {
|
|
676
|
+
return this.uploadOrUpdate("POST", path, fileBody, fileOptions);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Upload a file with a token generated from `createSignedUploadUrl`.
|
|
680
|
+
*
|
|
681
|
+
* @category Storage
|
|
682
|
+
* @subcategory File Buckets
|
|
683
|
+
* @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
684
|
+
* @param token The token generated from `createSignedUploadUrl`
|
|
685
|
+
* @param fileBody The body of the file to be stored in the bucket.
|
|
686
|
+
* @param fileOptions HTTP headers (cacheControl, contentType, etc.).
|
|
687
|
+
* **Note:** The `upsert` option has no effect here. To enable upsert behavior,
|
|
688
|
+
* pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead.
|
|
689
|
+
* @returns Promise with response containing file path and fullPath or error
|
|
690
|
+
*
|
|
691
|
+
* @example Upload to a signed URL
|
|
692
|
+
* ```js
|
|
693
|
+
* const { data, error } = await supabase
|
|
694
|
+
* .storage
|
|
695
|
+
* .from('avatars')
|
|
696
|
+
* .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)
|
|
697
|
+
* ```
|
|
698
|
+
*
|
|
699
|
+
* Response:
|
|
700
|
+
* ```json
|
|
701
|
+
* {
|
|
702
|
+
* "data": {
|
|
703
|
+
* "path": "folder/cat.jpg",
|
|
704
|
+
* "fullPath": "avatars/folder/cat.jpg"
|
|
705
|
+
* },
|
|
706
|
+
* "error": null
|
|
707
|
+
* }
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* @remarks
|
|
711
|
+
* - RLS policy permissions required:
|
|
712
|
+
* - `buckets` table permissions: none
|
|
713
|
+
* - `objects` table permissions: none
|
|
714
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
715
|
+
*/
|
|
716
|
+
async uploadToSignedUrl(path, token, fileBody, fileOptions) {
|
|
717
|
+
var _this3 = this;
|
|
718
|
+
const cleanPath = _this3._removeEmptyFolders(path);
|
|
719
|
+
const _path = _this3._getFinalPath(cleanPath);
|
|
720
|
+
const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
|
|
721
|
+
url.searchParams.set("token", token);
|
|
722
|
+
return _this3.handleOperation(async () => {
|
|
723
|
+
let body;
|
|
724
|
+
const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
725
|
+
let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
726
|
+
const metadata = options.metadata;
|
|
727
|
+
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
728
|
+
body = new FormData();
|
|
729
|
+
body.append("cacheControl", options.cacheControl);
|
|
730
|
+
if (metadata) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
731
|
+
body.append("", fileBody);
|
|
732
|
+
} else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
|
|
733
|
+
body = fileBody;
|
|
734
|
+
if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
|
|
735
|
+
if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
736
|
+
} else {
|
|
737
|
+
body = fileBody;
|
|
738
|
+
headers["cache-control"] = `max-age=${options.cacheControl}`;
|
|
739
|
+
headers["content-type"] = options.contentType;
|
|
740
|
+
if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata));
|
|
741
|
+
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
742
|
+
}
|
|
743
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
744
|
+
return {
|
|
745
|
+
path: cleanPath,
|
|
746
|
+
fullPath: (await put(_this3.fetch, url.toString(), body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}))).Key
|
|
747
|
+
};
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Creates a signed upload URL.
|
|
752
|
+
* Signed upload URLs can be used to upload files to the bucket without further authentication.
|
|
753
|
+
* They are valid for 2 hours.
|
|
754
|
+
*
|
|
755
|
+
* @category Storage
|
|
756
|
+
* @subcategory File Buckets
|
|
757
|
+
* @param path The file path, including the current file name. For example `folder/image.png`.
|
|
758
|
+
* @param options.upsert If set to true, allows the file to be overwritten if it already exists.
|
|
759
|
+
* @returns Promise with response containing signed upload URL, token, and path or error
|
|
760
|
+
*
|
|
761
|
+
* @example Create Signed Upload URL
|
|
762
|
+
* ```js
|
|
763
|
+
* const { data, error } = await supabase
|
|
764
|
+
* .storage
|
|
765
|
+
* .from('avatars')
|
|
766
|
+
* .createSignedUploadUrl('folder/cat.jpg')
|
|
767
|
+
* ```
|
|
768
|
+
*
|
|
769
|
+
* Response:
|
|
770
|
+
* ```json
|
|
771
|
+
* {
|
|
772
|
+
* "data": {
|
|
773
|
+
* "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=<TOKEN>",
|
|
774
|
+
* "path": "folder/cat.jpg",
|
|
775
|
+
* "token": "<TOKEN>"
|
|
776
|
+
* },
|
|
777
|
+
* "error": null
|
|
778
|
+
* }
|
|
779
|
+
* ```
|
|
780
|
+
*
|
|
781
|
+
* @remarks
|
|
782
|
+
* - RLS policy permissions required:
|
|
783
|
+
* - `buckets` table permissions: none
|
|
784
|
+
* - `objects` table permissions: `insert`
|
|
785
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
786
|
+
*/
|
|
787
|
+
async createSignedUploadUrl(path, options) {
|
|
788
|
+
var _this4 = this;
|
|
789
|
+
return _this4.handleOperation(async () => {
|
|
790
|
+
let _path = _this4._getFinalPath(path);
|
|
791
|
+
const headers = _objectSpread2({}, _this4.headers);
|
|
792
|
+
if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
|
|
793
|
+
const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
|
|
794
|
+
const url = new URL(_this4.url + data.url);
|
|
795
|
+
const token = url.searchParams.get("token");
|
|
796
|
+
if (!token) throw new StorageError("No token returned by API");
|
|
797
|
+
return {
|
|
798
|
+
signedUrl: url.toString(),
|
|
799
|
+
path,
|
|
800
|
+
token
|
|
801
|
+
};
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Replaces an existing file at the specified path with a new one.
|
|
806
|
+
*
|
|
807
|
+
* @category Storage
|
|
808
|
+
* @subcategory File Buckets
|
|
809
|
+
* @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
|
|
810
|
+
* @param fileBody The body of the file to be stored in the bucket.
|
|
811
|
+
* @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.
|
|
812
|
+
* **Note:** The `upsert` option has no effect here. `update()` always replaces the
|
|
813
|
+
* file at the given path, so the `x-upsert` header is not sent. To control upsert
|
|
814
|
+
* behavior, use `upload()` instead.
|
|
815
|
+
* @returns Promise with response containing file path, id, and fullPath or error
|
|
816
|
+
*
|
|
817
|
+
* @example Update file
|
|
818
|
+
* ```js
|
|
819
|
+
* const avatarFile = event.target.files[0]
|
|
820
|
+
* const { data, error } = await supabase
|
|
821
|
+
* .storage
|
|
822
|
+
* .from('avatars')
|
|
823
|
+
* .update('public/avatar1.png', avatarFile, {
|
|
824
|
+
* cacheControl: '3600'
|
|
825
|
+
* })
|
|
826
|
+
* ```
|
|
827
|
+
*
|
|
828
|
+
* Response:
|
|
829
|
+
* ```json
|
|
830
|
+
* {
|
|
831
|
+
* "data": {
|
|
832
|
+
* "path": "public/avatar1.png",
|
|
833
|
+
* "fullPath": "avatars/public/avatar1.png"
|
|
834
|
+
* },
|
|
835
|
+
* "error": null
|
|
836
|
+
* }
|
|
837
|
+
* ```
|
|
838
|
+
*
|
|
839
|
+
* @example Update file using `ArrayBuffer` from base64 file data
|
|
840
|
+
* ```js
|
|
841
|
+
* import {decode} from 'base64-arraybuffer'
|
|
842
|
+
*
|
|
843
|
+
* const { data, error } = await supabase
|
|
844
|
+
* .storage
|
|
845
|
+
* .from('avatars')
|
|
846
|
+
* .update('public/avatar1.png', decode('base64FileData'), {
|
|
847
|
+
* contentType: 'image/png'
|
|
848
|
+
* })
|
|
849
|
+
* ```
|
|
850
|
+
*
|
|
851
|
+
* @remarks
|
|
852
|
+
* - RLS policy permissions required:
|
|
853
|
+
* - `buckets` table permissions: none
|
|
854
|
+
* - `objects` table permissions: `update` and `select`
|
|
855
|
+
* - `update()` always replaces the file at the given path regardless of the `upsert` option.
|
|
856
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
857
|
+
* - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.
|
|
858
|
+
*/
|
|
859
|
+
async update(path, fileBody, fileOptions) {
|
|
860
|
+
return this.uploadOrUpdate("PUT", path, fileBody, fileOptions);
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Moves an existing file to a new path in the same bucket.
|
|
864
|
+
*
|
|
865
|
+
* @category Storage
|
|
866
|
+
* @subcategory File Buckets
|
|
867
|
+
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
868
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
|
|
869
|
+
* @param options The destination options.
|
|
870
|
+
* @returns Promise with response containing success message or error
|
|
871
|
+
*
|
|
872
|
+
* @example Move file
|
|
873
|
+
* ```js
|
|
874
|
+
* const { data, error } = await supabase
|
|
875
|
+
* .storage
|
|
876
|
+
* .from('avatars')
|
|
877
|
+
* .move('public/avatar1.png', 'private/avatar2.png')
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
880
|
+
* Response:
|
|
881
|
+
* ```json
|
|
882
|
+
* {
|
|
883
|
+
* "data": {
|
|
884
|
+
* "message": "Successfully moved"
|
|
885
|
+
* },
|
|
886
|
+
* "error": null
|
|
887
|
+
* }
|
|
888
|
+
* ```
|
|
889
|
+
*
|
|
890
|
+
* @remarks
|
|
891
|
+
* - RLS policy permissions required:
|
|
892
|
+
* - `buckets` table permissions: none
|
|
893
|
+
* - `objects` table permissions: `update` and `select`
|
|
894
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
895
|
+
*/
|
|
896
|
+
async move(fromPath, toPath, options) {
|
|
897
|
+
var _this6 = this;
|
|
898
|
+
return _this6.handleOperation(async () => {
|
|
899
|
+
return await post(_this6.fetch, `${_this6.url}/object/move`, {
|
|
900
|
+
bucketId: _this6.bucketId,
|
|
901
|
+
sourceKey: fromPath,
|
|
902
|
+
destinationKey: toPath,
|
|
903
|
+
destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
|
|
904
|
+
}, { headers: _this6.headers });
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Copies an existing file to a new path in the same bucket.
|
|
909
|
+
*
|
|
910
|
+
* @category Storage
|
|
911
|
+
* @subcategory File Buckets
|
|
912
|
+
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
913
|
+
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
|
|
914
|
+
* @param options The destination options.
|
|
915
|
+
* @returns Promise with response containing copied file path or error
|
|
916
|
+
*
|
|
917
|
+
* @example Copy file
|
|
918
|
+
* ```js
|
|
919
|
+
* const { data, error } = await supabase
|
|
920
|
+
* .storage
|
|
921
|
+
* .from('avatars')
|
|
922
|
+
* .copy('public/avatar1.png', 'private/avatar2.png')
|
|
923
|
+
* ```
|
|
924
|
+
*
|
|
925
|
+
* Response:
|
|
926
|
+
* ```json
|
|
927
|
+
* {
|
|
928
|
+
* "data": {
|
|
929
|
+
* "path": "avatars/private/avatar2.png"
|
|
930
|
+
* },
|
|
931
|
+
* "error": null
|
|
932
|
+
* }
|
|
933
|
+
* ```
|
|
934
|
+
*
|
|
935
|
+
* @remarks
|
|
936
|
+
* - RLS policy permissions required:
|
|
937
|
+
* - `buckets` table permissions: none
|
|
938
|
+
* - `objects` table permissions: `insert` and `select`
|
|
939
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
940
|
+
*/
|
|
941
|
+
async copy(fromPath, toPath, options) {
|
|
942
|
+
var _this7 = this;
|
|
943
|
+
return _this7.handleOperation(async () => {
|
|
944
|
+
return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
|
|
945
|
+
bucketId: _this7.bucketId,
|
|
946
|
+
sourceKey: fromPath,
|
|
947
|
+
destinationKey: toPath,
|
|
948
|
+
destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
|
|
949
|
+
}, { headers: _this7.headers })).Key };
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
|
|
954
|
+
*
|
|
955
|
+
* @category Storage
|
|
956
|
+
* @subcategory File Buckets
|
|
957
|
+
* @param path The file path, including the current file name. For example `folder/image.png`.
|
|
958
|
+
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
959
|
+
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
960
|
+
* @param options.transform Transform the asset before serving it to the client.
|
|
961
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
962
|
+
* @returns Promise with response containing signed URL or error
|
|
963
|
+
*
|
|
964
|
+
* @example Create Signed URL
|
|
965
|
+
* ```js
|
|
966
|
+
* const { data, error } = await supabase
|
|
967
|
+
* .storage
|
|
968
|
+
* .from('avatars')
|
|
969
|
+
* .createSignedUrl('folder/avatar1.png', 60)
|
|
970
|
+
* ```
|
|
971
|
+
*
|
|
972
|
+
* Response:
|
|
973
|
+
* ```json
|
|
974
|
+
* {
|
|
975
|
+
* "data": {
|
|
976
|
+
* "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
|
|
977
|
+
* },
|
|
978
|
+
* "error": null
|
|
979
|
+
* }
|
|
980
|
+
* ```
|
|
981
|
+
*
|
|
982
|
+
* @example Create a signed URL for an asset with transformations
|
|
983
|
+
* ```js
|
|
984
|
+
* const { data } = await supabase
|
|
985
|
+
* .storage
|
|
986
|
+
* .from('avatars')
|
|
987
|
+
* .createSignedUrl('folder/avatar1.png', 60, {
|
|
988
|
+
* transform: {
|
|
989
|
+
* width: 100,
|
|
990
|
+
* height: 100,
|
|
991
|
+
* }
|
|
992
|
+
* })
|
|
993
|
+
* ```
|
|
994
|
+
*
|
|
995
|
+
* @example Create a signed URL which triggers the download of the asset
|
|
996
|
+
* ```js
|
|
997
|
+
* const { data } = await supabase
|
|
998
|
+
* .storage
|
|
999
|
+
* .from('avatars')
|
|
1000
|
+
* .createSignedUrl('folder/avatar1.png', 60, {
|
|
1001
|
+
* download: true,
|
|
1002
|
+
* })
|
|
1003
|
+
* ```
|
|
1004
|
+
*
|
|
1005
|
+
* @remarks
|
|
1006
|
+
* - RLS policy permissions required:
|
|
1007
|
+
* - `buckets` table permissions: none
|
|
1008
|
+
* - `objects` table permissions: `select`
|
|
1009
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1010
|
+
*/
|
|
1011
|
+
async createSignedUrl(path, expiresIn, options) {
|
|
1012
|
+
var _this8 = this;
|
|
1013
|
+
return _this8.handleOperation(async () => {
|
|
1014
|
+
let _path = _this8._getFinalPath(path);
|
|
1015
|
+
const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
|
|
1016
|
+
let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers });
|
|
1017
|
+
const query = new URLSearchParams();
|
|
1018
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
1019
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1020
|
+
const queryString = query.toString();
|
|
1021
|
+
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) };
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
|
|
1026
|
+
*
|
|
1027
|
+
* @category Storage
|
|
1028
|
+
* @subcategory File Buckets
|
|
1029
|
+
* @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
|
|
1030
|
+
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
1031
|
+
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
1032
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
1033
|
+
* @returns Promise with response containing array of objects with signedUrl, path, and error or error
|
|
1034
|
+
*
|
|
1035
|
+
* @example Create Signed URLs
|
|
1036
|
+
* ```js
|
|
1037
|
+
* const { data, error } = await supabase
|
|
1038
|
+
* .storage
|
|
1039
|
+
* .from('avatars')
|
|
1040
|
+
* .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
|
|
1041
|
+
* ```
|
|
1042
|
+
*
|
|
1043
|
+
* Response:
|
|
1044
|
+
* ```json
|
|
1045
|
+
* {
|
|
1046
|
+
* "data": [
|
|
1047
|
+
* {
|
|
1048
|
+
* "error": null,
|
|
1049
|
+
* "path": "folder/avatar1.png",
|
|
1050
|
+
* "signedURL": "/object/sign/avatars/folder/avatar1.png?token=<TOKEN>",
|
|
1051
|
+
* "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
|
|
1052
|
+
* },
|
|
1053
|
+
* {
|
|
1054
|
+
* "error": null,
|
|
1055
|
+
* "path": "folder/avatar2.png",
|
|
1056
|
+
* "signedURL": "/object/sign/avatars/folder/avatar2.png?token=<TOKEN>",
|
|
1057
|
+
* "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=<TOKEN>"
|
|
1058
|
+
* }
|
|
1059
|
+
* ],
|
|
1060
|
+
* "error": null
|
|
1061
|
+
* }
|
|
1062
|
+
* ```
|
|
1063
|
+
*
|
|
1064
|
+
* @remarks
|
|
1065
|
+
* - RLS policy permissions required:
|
|
1066
|
+
* - `buckets` table permissions: none
|
|
1067
|
+
* - `objects` table permissions: `select`
|
|
1068
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1069
|
+
*/
|
|
1070
|
+
async createSignedUrls(paths, expiresIn, options) {
|
|
1071
|
+
var _this9 = this;
|
|
1072
|
+
return _this9.handleOperation(async () => {
|
|
1073
|
+
const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
|
|
1074
|
+
expiresIn,
|
|
1075
|
+
paths
|
|
1076
|
+
}, { headers: _this9.headers });
|
|
1077
|
+
const query = new URLSearchParams();
|
|
1078
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
1079
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1080
|
+
const queryString = query.toString();
|
|
1081
|
+
return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null }));
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
|
|
1086
|
+
*
|
|
1087
|
+
* @category Storage
|
|
1088
|
+
* @subcategory File Buckets
|
|
1089
|
+
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
1090
|
+
* @param options.transform Transform the asset before serving it to the client.
|
|
1091
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
1092
|
+
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
1093
|
+
* @returns BlobDownloadBuilder instance for downloading the file
|
|
1094
|
+
*
|
|
1095
|
+
* @example Download file
|
|
1096
|
+
* ```js
|
|
1097
|
+
* const { data, error } = await supabase
|
|
1098
|
+
* .storage
|
|
1099
|
+
* .from('avatars')
|
|
1100
|
+
* .download('folder/avatar1.png')
|
|
1101
|
+
* ```
|
|
1102
|
+
*
|
|
1103
|
+
* Response:
|
|
1104
|
+
* ```json
|
|
1105
|
+
* {
|
|
1106
|
+
* "data": <BLOB>,
|
|
1107
|
+
* "error": null
|
|
1108
|
+
* }
|
|
1109
|
+
* ```
|
|
1110
|
+
*
|
|
1111
|
+
* @example Download file with transformations
|
|
1112
|
+
* ```js
|
|
1113
|
+
* const { data, error } = await supabase
|
|
1114
|
+
* .storage
|
|
1115
|
+
* .from('avatars')
|
|
1116
|
+
* .download('folder/avatar1.png', {
|
|
1117
|
+
* transform: {
|
|
1118
|
+
* width: 100,
|
|
1119
|
+
* height: 100,
|
|
1120
|
+
* quality: 80
|
|
1121
|
+
* }
|
|
1122
|
+
* })
|
|
1123
|
+
* ```
|
|
1124
|
+
*
|
|
1125
|
+
* @example Download with cache control (useful in Edge Functions)
|
|
1126
|
+
* ```js
|
|
1127
|
+
* const { data, error } = await supabase
|
|
1128
|
+
* .storage
|
|
1129
|
+
* .from('avatars')
|
|
1130
|
+
* .download('folder/avatar1.png', {}, { cache: 'no-store' })
|
|
1131
|
+
* ```
|
|
1132
|
+
*
|
|
1133
|
+
* @example Download with abort signal
|
|
1134
|
+
* ```js
|
|
1135
|
+
* const controller = new AbortController()
|
|
1136
|
+
* setTimeout(() => controller.abort(), 5000)
|
|
1137
|
+
*
|
|
1138
|
+
* const { data, error } = await supabase
|
|
1139
|
+
* .storage
|
|
1140
|
+
* .from('avatars')
|
|
1141
|
+
* .download('folder/avatar1.png', {}, { signal: controller.signal })
|
|
1142
|
+
* ```
|
|
1143
|
+
*
|
|
1144
|
+
* @remarks
|
|
1145
|
+
* - RLS policy permissions required:
|
|
1146
|
+
* - `buckets` table permissions: none
|
|
1147
|
+
* - `objects` table permissions: `select`
|
|
1148
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1149
|
+
*/
|
|
1150
|
+
download(path, options, parameters) {
|
|
1151
|
+
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image/authenticated" : "object";
|
|
1152
|
+
const query = new URLSearchParams();
|
|
1153
|
+
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
1154
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1155
|
+
const queryString = query.toString();
|
|
1156
|
+
const _path = this._getFinalPath(path);
|
|
1157
|
+
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
|
|
1158
|
+
headers: this.headers,
|
|
1159
|
+
noResolveJson: true
|
|
1160
|
+
}, parameters);
|
|
1161
|
+
return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Retrieves the details of an existing file.
|
|
1165
|
+
*
|
|
1166
|
+
* Returns detailed file metadata including size, content type, and timestamps.
|
|
1167
|
+
* Note: The API returns `last_modified` field, not `updated_at`.
|
|
1168
|
+
*
|
|
1169
|
+
* @category Storage
|
|
1170
|
+
* @subcategory File Buckets
|
|
1171
|
+
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
1172
|
+
* @returns Promise with response containing file metadata or error
|
|
1173
|
+
*
|
|
1174
|
+
* @example Get file info
|
|
1175
|
+
* ```js
|
|
1176
|
+
* const { data, error } = await supabase
|
|
1177
|
+
* .storage
|
|
1178
|
+
* .from('avatars')
|
|
1179
|
+
* .info('folder/avatar1.png')
|
|
1180
|
+
*
|
|
1181
|
+
* if (data) {
|
|
1182
|
+
* console.log('Last modified:', data.lastModified)
|
|
1183
|
+
* console.log('Size:', data.size)
|
|
1184
|
+
* }
|
|
1185
|
+
* ```
|
|
1186
|
+
*/
|
|
1187
|
+
async info(path) {
|
|
1188
|
+
var _this10 = this;
|
|
1189
|
+
const _path = _this10._getFinalPath(path);
|
|
1190
|
+
return _this10.handleOperation(async () => {
|
|
1191
|
+
return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Checks the existence of a file.
|
|
1196
|
+
*
|
|
1197
|
+
* @category Storage
|
|
1198
|
+
* @subcategory File Buckets
|
|
1199
|
+
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
1200
|
+
* @returns Promise with response containing boolean indicating file existence or error
|
|
1201
|
+
*
|
|
1202
|
+
* @example Check file existence
|
|
1203
|
+
* ```js
|
|
1204
|
+
* const { data, error } = await supabase
|
|
1205
|
+
* .storage
|
|
1206
|
+
* .from('avatars')
|
|
1207
|
+
* .exists('folder/avatar1.png')
|
|
1208
|
+
* ```
|
|
1209
|
+
*/
|
|
1210
|
+
async exists(path) {
|
|
1211
|
+
var _this11 = this;
|
|
1212
|
+
const _path = _this11._getFinalPath(path);
|
|
1213
|
+
try {
|
|
1214
|
+
await head(_this11.fetch, `${_this11.url}/object/${_path}`, { headers: _this11.headers });
|
|
1215
|
+
return {
|
|
1216
|
+
data: true,
|
|
1217
|
+
error: null
|
|
1218
|
+
};
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
if (_this11.shouldThrowOnError) throw error;
|
|
1221
|
+
if (isStorageError(error)) {
|
|
1222
|
+
var _error$originalError;
|
|
1223
|
+
const status = error instanceof StorageApiError ? error.status : error instanceof StorageUnknownError ? (_error$originalError = error.originalError) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status : void 0;
|
|
1224
|
+
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
1225
|
+
data: false,
|
|
1226
|
+
error
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
throw error;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
|
|
1234
|
+
* This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.
|
|
1235
|
+
*
|
|
1236
|
+
* @category Storage
|
|
1237
|
+
* @subcategory File Buckets
|
|
1238
|
+
* @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
|
|
1239
|
+
* @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
1240
|
+
* @param options.transform Transform the asset before serving it to the client.
|
|
1241
|
+
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
1242
|
+
* @returns Object with public URL
|
|
1243
|
+
*
|
|
1244
|
+
* @example Returns the URL for an asset in a public bucket
|
|
1245
|
+
* ```js
|
|
1246
|
+
* const { data } = supabase
|
|
1247
|
+
* .storage
|
|
1248
|
+
* .from('public-bucket')
|
|
1249
|
+
* .getPublicUrl('folder/avatar1.png')
|
|
1250
|
+
* ```
|
|
1251
|
+
*
|
|
1252
|
+
* Response:
|
|
1253
|
+
* ```json
|
|
1254
|
+
* {
|
|
1255
|
+
* "data": {
|
|
1256
|
+
* "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png"
|
|
1257
|
+
* }
|
|
1258
|
+
* }
|
|
1259
|
+
* ```
|
|
1260
|
+
*
|
|
1261
|
+
* @example Returns the URL for an asset in a public bucket with transformations
|
|
1262
|
+
* ```js
|
|
1263
|
+
* const { data } = supabase
|
|
1264
|
+
* .storage
|
|
1265
|
+
* .from('public-bucket')
|
|
1266
|
+
* .getPublicUrl('folder/avatar1.png', {
|
|
1267
|
+
* transform: {
|
|
1268
|
+
* width: 100,
|
|
1269
|
+
* height: 100,
|
|
1270
|
+
* }
|
|
1271
|
+
* })
|
|
1272
|
+
* ```
|
|
1273
|
+
*
|
|
1274
|
+
* @example Returns the URL which triggers the download of an asset in a public bucket
|
|
1275
|
+
* ```js
|
|
1276
|
+
* const { data } = supabase
|
|
1277
|
+
* .storage
|
|
1278
|
+
* .from('public-bucket')
|
|
1279
|
+
* .getPublicUrl('folder/avatar1.png', {
|
|
1280
|
+
* download: true,
|
|
1281
|
+
* })
|
|
1282
|
+
* ```
|
|
1283
|
+
*
|
|
1284
|
+
* @remarks
|
|
1285
|
+
* - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [supabase.com/dashboard](https://supabase.com/dashboard), clicking the overflow menu on a bucket and choosing "Make public"
|
|
1286
|
+
* - RLS policy permissions required:
|
|
1287
|
+
* - `buckets` table permissions: none
|
|
1288
|
+
* - `objects` table permissions: none
|
|
1289
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1290
|
+
*/
|
|
1291
|
+
getPublicUrl(path, options) {
|
|
1292
|
+
const _path = this._getFinalPath(path);
|
|
1293
|
+
const query = new URLSearchParams();
|
|
1294
|
+
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
1295
|
+
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
1296
|
+
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
1297
|
+
const queryString = query.toString();
|
|
1298
|
+
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image" : "object";
|
|
1299
|
+
return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Deletes files within the same bucket
|
|
1303
|
+
*
|
|
1304
|
+
* Returns an array of FileObject entries for the deleted files. Note that deprecated
|
|
1305
|
+
* fields like `bucket_id` may or may not be present in the response - do not rely on them.
|
|
1306
|
+
*
|
|
1307
|
+
* @category Storage
|
|
1308
|
+
* @subcategory File Buckets
|
|
1309
|
+
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
1310
|
+
* @returns Promise with response containing array of deleted file objects or error
|
|
1311
|
+
*
|
|
1312
|
+
* @example Delete file
|
|
1313
|
+
* ```js
|
|
1314
|
+
* const { data, error } = await supabase
|
|
1315
|
+
* .storage
|
|
1316
|
+
* .from('avatars')
|
|
1317
|
+
* .remove(['folder/avatar1.png'])
|
|
1318
|
+
* ```
|
|
1319
|
+
*
|
|
1320
|
+
* Response:
|
|
1321
|
+
* ```json
|
|
1322
|
+
* {
|
|
1323
|
+
* "data": [],
|
|
1324
|
+
* "error": null
|
|
1325
|
+
* }
|
|
1326
|
+
* ```
|
|
1327
|
+
*
|
|
1328
|
+
* @remarks
|
|
1329
|
+
* - RLS policy permissions required:
|
|
1330
|
+
* - `buckets` table permissions: none
|
|
1331
|
+
* - `objects` table permissions: `delete` and `select`
|
|
1332
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1333
|
+
*/
|
|
1334
|
+
async remove(paths) {
|
|
1335
|
+
var _this12 = this;
|
|
1336
|
+
return _this12.handleOperation(async () => {
|
|
1337
|
+
return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Get file metadata
|
|
1342
|
+
* @param id the file id to retrieve metadata
|
|
1343
|
+
*/
|
|
1344
|
+
/**
|
|
1345
|
+
* Update file metadata
|
|
1346
|
+
* @param id the file id to update metadata
|
|
1347
|
+
* @param meta the new file metadata
|
|
1348
|
+
*/
|
|
1349
|
+
/**
|
|
1350
|
+
* Lists all the files and folders within a path of the bucket.
|
|
1351
|
+
*
|
|
1352
|
+
* **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,
|
|
1353
|
+
* `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.
|
|
1354
|
+
* Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
|
|
1355
|
+
* by this method.
|
|
1356
|
+
*
|
|
1357
|
+
* @category Storage
|
|
1358
|
+
* @subcategory File Buckets
|
|
1359
|
+
* @param path The folder path.
|
|
1360
|
+
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
1361
|
+
* @param parameters Optional fetch parameters including signal for cancellation
|
|
1362
|
+
* @returns Promise with response containing array of files/folders or error
|
|
1363
|
+
*
|
|
1364
|
+
* @example List files in a bucket
|
|
1365
|
+
* ```js
|
|
1366
|
+
* const { data, error } = await supabase
|
|
1367
|
+
* .storage
|
|
1368
|
+
* .from('avatars')
|
|
1369
|
+
* .list('folder', {
|
|
1370
|
+
* limit: 100,
|
|
1371
|
+
* offset: 0,
|
|
1372
|
+
* sortBy: { column: 'name', order: 'asc' },
|
|
1373
|
+
* })
|
|
1374
|
+
*
|
|
1375
|
+
* // Handle files vs folders
|
|
1376
|
+
* data?.forEach(item => {
|
|
1377
|
+
* if (item.id !== null) {
|
|
1378
|
+
* // It's a file
|
|
1379
|
+
* console.log('File:', item.name, 'Size:', item.metadata?.size)
|
|
1380
|
+
* } else {
|
|
1381
|
+
* // It's a folder
|
|
1382
|
+
* console.log('Folder:', item.name)
|
|
1383
|
+
* }
|
|
1384
|
+
* })
|
|
1385
|
+
* ```
|
|
1386
|
+
*
|
|
1387
|
+
* Response:
|
|
1388
|
+
* ```json
|
|
1389
|
+
* {
|
|
1390
|
+
* "data": [
|
|
1391
|
+
* {
|
|
1392
|
+
* "name": "avatar1.png",
|
|
1393
|
+
* "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2",
|
|
1394
|
+
* "updated_at": "2024-05-22T23:06:05.580Z",
|
|
1395
|
+
* "created_at": "2024-05-22T23:04:34.443Z",
|
|
1396
|
+
* "last_accessed_at": "2024-05-22T23:04:34.443Z",
|
|
1397
|
+
* "metadata": {
|
|
1398
|
+
* "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"",
|
|
1399
|
+
* "size": 32175,
|
|
1400
|
+
* "mimetype": "image/png",
|
|
1401
|
+
* "cacheControl": "max-age=3600",
|
|
1402
|
+
* "lastModified": "2024-05-22T23:06:05.574Z",
|
|
1403
|
+
* "contentLength": 32175,
|
|
1404
|
+
* "httpStatusCode": 200
|
|
1405
|
+
* }
|
|
1406
|
+
* }
|
|
1407
|
+
* ],
|
|
1408
|
+
* "error": null
|
|
1409
|
+
* }
|
|
1410
|
+
* ```
|
|
1411
|
+
*
|
|
1412
|
+
* @example Search files in a bucket
|
|
1413
|
+
* ```js
|
|
1414
|
+
* const { data, error } = await supabase
|
|
1415
|
+
* .storage
|
|
1416
|
+
* .from('avatars')
|
|
1417
|
+
* .list('folder', {
|
|
1418
|
+
* limit: 100,
|
|
1419
|
+
* offset: 0,
|
|
1420
|
+
* sortBy: { column: 'name', order: 'asc' },
|
|
1421
|
+
* search: 'jon'
|
|
1422
|
+
* })
|
|
1423
|
+
* ```
|
|
1424
|
+
*
|
|
1425
|
+
* @remarks
|
|
1426
|
+
* - RLS policy permissions required:
|
|
1427
|
+
* - `buckets` table permissions: none
|
|
1428
|
+
* - `objects` table permissions: `select`
|
|
1429
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1430
|
+
*/
|
|
1431
|
+
async list(path, options, parameters) {
|
|
1432
|
+
var _this13 = this;
|
|
1433
|
+
return _this13.handleOperation(async () => {
|
|
1434
|
+
const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
|
|
1435
|
+
return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Lists all the files and folders within a bucket using the V2 API with pagination support.
|
|
1440
|
+
*
|
|
1441
|
+
* **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —
|
|
1442
|
+
* they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available
|
|
1443
|
+
* on entries in the `objects` array.
|
|
1444
|
+
*
|
|
1445
|
+
* @experimental this method signature might change in the future
|
|
1446
|
+
*
|
|
1447
|
+
* @category Storage
|
|
1448
|
+
* @subcategory File Buckets
|
|
1449
|
+
* @param options Search options including prefix, cursor for pagination, limit, with_delimiter
|
|
1450
|
+
* @param parameters Optional fetch parameters including signal for cancellation
|
|
1451
|
+
* @returns Promise with response containing folders/objects arrays with pagination info or error
|
|
1452
|
+
*
|
|
1453
|
+
* @example List files with pagination
|
|
1454
|
+
* ```js
|
|
1455
|
+
* const { data, error } = await supabase
|
|
1456
|
+
* .storage
|
|
1457
|
+
* .from('avatars')
|
|
1458
|
+
* .listV2({
|
|
1459
|
+
* prefix: 'folder/',
|
|
1460
|
+
* limit: 100,
|
|
1461
|
+
* })
|
|
1462
|
+
*
|
|
1463
|
+
* // Handle pagination
|
|
1464
|
+
* if (data?.hasNext) {
|
|
1465
|
+
* const nextPage = await supabase
|
|
1466
|
+
* .storage
|
|
1467
|
+
* .from('avatars')
|
|
1468
|
+
* .listV2({
|
|
1469
|
+
* prefix: 'folder/',
|
|
1470
|
+
* cursor: data.nextCursor,
|
|
1471
|
+
* })
|
|
1472
|
+
* }
|
|
1473
|
+
*
|
|
1474
|
+
* // Handle files vs folders
|
|
1475
|
+
* data?.objects.forEach(file => {
|
|
1476
|
+
* if (file.id !== null) {
|
|
1477
|
+
* console.log('File:', file.name, 'Size:', file.metadata?.size)
|
|
1478
|
+
* }
|
|
1479
|
+
* })
|
|
1480
|
+
* data?.folders.forEach(folder => {
|
|
1481
|
+
* console.log('Folder:', folder.name)
|
|
1482
|
+
* })
|
|
1483
|
+
* ```
|
|
1484
|
+
*/
|
|
1485
|
+
async listV2(options, parameters) {
|
|
1486
|
+
var _this14 = this;
|
|
1487
|
+
return _this14.handleOperation(async () => {
|
|
1488
|
+
const body = _objectSpread2({}, options);
|
|
1489
|
+
return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
encodeMetadata(metadata) {
|
|
1493
|
+
return JSON.stringify(metadata);
|
|
1494
|
+
}
|
|
1495
|
+
toBase64(data) {
|
|
1496
|
+
if (typeof Buffer !== "undefined") return Buffer.from(data).toString("base64");
|
|
1497
|
+
return btoa(data);
|
|
1498
|
+
}
|
|
1499
|
+
_getFinalPath(path) {
|
|
1500
|
+
return `${this.bucketId}/${path.replace(/^\/+/, "")}`;
|
|
1501
|
+
}
|
|
1502
|
+
_removeEmptyFolders(path) {
|
|
1503
|
+
return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/");
|
|
1504
|
+
}
|
|
1505
|
+
/** Modifies the `query`, appending values the from `transform` */
|
|
1506
|
+
applyTransformOptsToQuery(query, transform) {
|
|
1507
|
+
if (transform.width) query.set("width", transform.width.toString());
|
|
1508
|
+
if (transform.height) query.set("height", transform.height.toString());
|
|
1509
|
+
if (transform.resize) query.set("resize", transform.resize);
|
|
1510
|
+
if (transform.format) query.set("format", transform.format);
|
|
1511
|
+
if (transform.quality) query.set("quality", transform.quality.toString());
|
|
1512
|
+
return query;
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region src/lib/version.ts
|
|
1518
|
+
const version = "2.105.4";
|
|
1519
|
+
|
|
1520
|
+
//#endregion
|
|
1521
|
+
//#region src/lib/constants.ts
|
|
1522
|
+
const DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version}` };
|
|
1523
|
+
|
|
1524
|
+
//#endregion
|
|
1525
|
+
//#region src/packages/StorageBucketApi.ts
|
|
1526
|
+
var StorageBucketApi = class extends BaseApiClient {
|
|
1527
|
+
constructor(url, headers = {}, fetch$1, opts) {
|
|
1528
|
+
const baseUrl = new URL(url);
|
|
1529
|
+
if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
|
|
1530
|
+
if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
|
|
1531
|
+
}
|
|
1532
|
+
const finalUrl = baseUrl.href.replace(/\/$/, "");
|
|
1533
|
+
const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
|
|
1534
|
+
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Retrieves the details of all Storage buckets within an existing project.
|
|
1538
|
+
*
|
|
1539
|
+
* @category Storage
|
|
1540
|
+
* @subcategory File Buckets
|
|
1541
|
+
* @param options Query parameters for listing buckets
|
|
1542
|
+
* @param options.limit Maximum number of buckets to return
|
|
1543
|
+
* @param options.offset Number of buckets to skip
|
|
1544
|
+
* @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
|
|
1545
|
+
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
1546
|
+
* @param options.search Search term to filter bucket names
|
|
1547
|
+
* @returns Promise with response containing array of buckets or error
|
|
1548
|
+
*
|
|
1549
|
+
* @example List buckets
|
|
1550
|
+
* ```js
|
|
1551
|
+
* const { data, error } = await supabase
|
|
1552
|
+
* .storage
|
|
1553
|
+
* .listBuckets()
|
|
1554
|
+
* ```
|
|
1555
|
+
*
|
|
1556
|
+
* @example List buckets with options
|
|
1557
|
+
* ```js
|
|
1558
|
+
* const { data, error } = await supabase
|
|
1559
|
+
* .storage
|
|
1560
|
+
* .listBuckets({
|
|
1561
|
+
* limit: 10,
|
|
1562
|
+
* offset: 0,
|
|
1563
|
+
* sortColumn: 'created_at',
|
|
1564
|
+
* sortOrder: 'desc',
|
|
1565
|
+
* search: 'prod'
|
|
1566
|
+
* })
|
|
1567
|
+
* ```
|
|
1568
|
+
*
|
|
1569
|
+
* @remarks
|
|
1570
|
+
* - RLS policy permissions required:
|
|
1571
|
+
* - `buckets` table permissions: `select`
|
|
1572
|
+
* - `objects` table permissions: none
|
|
1573
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1574
|
+
*/
|
|
1575
|
+
async listBuckets(options) {
|
|
1576
|
+
var _this = this;
|
|
1577
|
+
return _this.handleOperation(async () => {
|
|
1578
|
+
const queryString = _this.listBucketOptionsToQueryString(options);
|
|
1579
|
+
return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Retrieves the details of an existing Storage bucket.
|
|
1584
|
+
*
|
|
1585
|
+
* @category Storage
|
|
1586
|
+
* @subcategory File Buckets
|
|
1587
|
+
* @param id The unique identifier of the bucket you would like to retrieve.
|
|
1588
|
+
* @returns Promise with response containing bucket details or error
|
|
1589
|
+
*
|
|
1590
|
+
* @example Get bucket
|
|
1591
|
+
* ```js
|
|
1592
|
+
* const { data, error } = await supabase
|
|
1593
|
+
* .storage
|
|
1594
|
+
* .getBucket('avatars')
|
|
1595
|
+
* ```
|
|
1596
|
+
*
|
|
1597
|
+
* Response:
|
|
1598
|
+
* ```json
|
|
1599
|
+
* {
|
|
1600
|
+
* "data": {
|
|
1601
|
+
* "id": "avatars",
|
|
1602
|
+
* "name": "avatars",
|
|
1603
|
+
* "owner": "",
|
|
1604
|
+
* "public": false,
|
|
1605
|
+
* "file_size_limit": 1024,
|
|
1606
|
+
* "allowed_mime_types": [
|
|
1607
|
+
* "image/png"
|
|
1608
|
+
* ],
|
|
1609
|
+
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
1610
|
+
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
1611
|
+
* },
|
|
1612
|
+
* "error": null
|
|
1613
|
+
* }
|
|
1614
|
+
* ```
|
|
1615
|
+
*
|
|
1616
|
+
* @remarks
|
|
1617
|
+
* - RLS policy permissions required:
|
|
1618
|
+
* - `buckets` table permissions: `select`
|
|
1619
|
+
* - `objects` table permissions: none
|
|
1620
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1621
|
+
*/
|
|
1622
|
+
async getBucket(id) {
|
|
1623
|
+
var _this2 = this;
|
|
1624
|
+
return _this2.handleOperation(async () => {
|
|
1625
|
+
return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Creates a new Storage bucket
|
|
1630
|
+
*
|
|
1631
|
+
* @category Storage
|
|
1632
|
+
* @subcategory File Buckets
|
|
1633
|
+
* @param id A unique identifier for the bucket you are creating.
|
|
1634
|
+
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
|
|
1635
|
+
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
1636
|
+
* The global file size limit takes precedence over this value.
|
|
1637
|
+
* The default value is null, which doesn't set a per bucket file size limit.
|
|
1638
|
+
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
|
|
1639
|
+
* The default value is null, which allows files with all mime types to be uploaded.
|
|
1640
|
+
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
1641
|
+
* @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
|
|
1642
|
+
* - default bucket type is `STANDARD`
|
|
1643
|
+
* @returns Promise with response containing newly created bucket name or error
|
|
1644
|
+
*
|
|
1645
|
+
* @example Create bucket
|
|
1646
|
+
* ```js
|
|
1647
|
+
* const { data, error } = await supabase
|
|
1648
|
+
* .storage
|
|
1649
|
+
* .createBucket('avatars', {
|
|
1650
|
+
* public: false,
|
|
1651
|
+
* allowedMimeTypes: ['image/png'],
|
|
1652
|
+
* fileSizeLimit: 1024
|
|
1653
|
+
* })
|
|
1654
|
+
* ```
|
|
1655
|
+
*
|
|
1656
|
+
* Response:
|
|
1657
|
+
* ```json
|
|
1658
|
+
* {
|
|
1659
|
+
* "data": {
|
|
1660
|
+
* "name": "avatars"
|
|
1661
|
+
* },
|
|
1662
|
+
* "error": null
|
|
1663
|
+
* }
|
|
1664
|
+
* ```
|
|
1665
|
+
*
|
|
1666
|
+
* @remarks
|
|
1667
|
+
* - RLS policy permissions required:
|
|
1668
|
+
* - `buckets` table permissions: `insert`
|
|
1669
|
+
* - `objects` table permissions: none
|
|
1670
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1671
|
+
*/
|
|
1672
|
+
async createBucket(id, options = { public: false }) {
|
|
1673
|
+
var _this3 = this;
|
|
1674
|
+
return _this3.handleOperation(async () => {
|
|
1675
|
+
return await post(_this3.fetch, `${_this3.url}/bucket`, {
|
|
1676
|
+
id,
|
|
1677
|
+
name: id,
|
|
1678
|
+
type: options.type,
|
|
1679
|
+
public: options.public,
|
|
1680
|
+
file_size_limit: options.fileSizeLimit,
|
|
1681
|
+
allowed_mime_types: options.allowedMimeTypes
|
|
1682
|
+
}, { headers: _this3.headers });
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Updates a Storage bucket
|
|
1687
|
+
*
|
|
1688
|
+
* @category Storage
|
|
1689
|
+
* @subcategory File Buckets
|
|
1690
|
+
* @param id A unique identifier for the bucket you are updating.
|
|
1691
|
+
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
|
|
1692
|
+
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
1693
|
+
* The global file size limit takes precedence over this value.
|
|
1694
|
+
* The default value is null, which doesn't set a per bucket file size limit.
|
|
1695
|
+
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
|
|
1696
|
+
* The default value is null, which allows files with all mime types to be uploaded.
|
|
1697
|
+
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
|
|
1698
|
+
* @returns Promise with response containing success message or error
|
|
1699
|
+
*
|
|
1700
|
+
* @example Update bucket
|
|
1701
|
+
* ```js
|
|
1702
|
+
* const { data, error } = await supabase
|
|
1703
|
+
* .storage
|
|
1704
|
+
* .updateBucket('avatars', {
|
|
1705
|
+
* public: false,
|
|
1706
|
+
* allowedMimeTypes: ['image/png'],
|
|
1707
|
+
* fileSizeLimit: 1024
|
|
1708
|
+
* })
|
|
1709
|
+
* ```
|
|
1710
|
+
*
|
|
1711
|
+
* Response:
|
|
1712
|
+
* ```json
|
|
1713
|
+
* {
|
|
1714
|
+
* "data": {
|
|
1715
|
+
* "message": "Successfully updated"
|
|
1716
|
+
* },
|
|
1717
|
+
* "error": null
|
|
1718
|
+
* }
|
|
1719
|
+
* ```
|
|
1720
|
+
*
|
|
1721
|
+
* @remarks
|
|
1722
|
+
* - RLS policy permissions required:
|
|
1723
|
+
* - `buckets` table permissions: `select` and `update`
|
|
1724
|
+
* - `objects` table permissions: none
|
|
1725
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1726
|
+
*/
|
|
1727
|
+
async updateBucket(id, options) {
|
|
1728
|
+
var _this4 = this;
|
|
1729
|
+
return _this4.handleOperation(async () => {
|
|
1730
|
+
return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
|
|
1731
|
+
id,
|
|
1732
|
+
name: id,
|
|
1733
|
+
public: options.public,
|
|
1734
|
+
file_size_limit: options.fileSizeLimit,
|
|
1735
|
+
allowed_mime_types: options.allowedMimeTypes
|
|
1736
|
+
}, { headers: _this4.headers });
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Removes all objects inside a single bucket.
|
|
1741
|
+
*
|
|
1742
|
+
* @category Storage
|
|
1743
|
+
* @subcategory File Buckets
|
|
1744
|
+
* @param id The unique identifier of the bucket you would like to empty.
|
|
1745
|
+
* @returns Promise with success message or error
|
|
1746
|
+
*
|
|
1747
|
+
* @example Empty bucket
|
|
1748
|
+
* ```js
|
|
1749
|
+
* const { data, error } = await supabase
|
|
1750
|
+
* .storage
|
|
1751
|
+
* .emptyBucket('avatars')
|
|
1752
|
+
* ```
|
|
1753
|
+
*
|
|
1754
|
+
* Response:
|
|
1755
|
+
* ```json
|
|
1756
|
+
* {
|
|
1757
|
+
* "data": {
|
|
1758
|
+
* "message": "Successfully emptied"
|
|
1759
|
+
* },
|
|
1760
|
+
* "error": null
|
|
1761
|
+
* }
|
|
1762
|
+
* ```
|
|
1763
|
+
*
|
|
1764
|
+
* @remarks
|
|
1765
|
+
* - RLS policy permissions required:
|
|
1766
|
+
* - `buckets` table permissions: `select`
|
|
1767
|
+
* - `objects` table permissions: `select` and `delete`
|
|
1768
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1769
|
+
*/
|
|
1770
|
+
async emptyBucket(id) {
|
|
1771
|
+
var _this5 = this;
|
|
1772
|
+
return _this5.handleOperation(async () => {
|
|
1773
|
+
return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
|
|
1778
|
+
* You must first `empty()` the bucket.
|
|
1779
|
+
*
|
|
1780
|
+
* @category Storage
|
|
1781
|
+
* @subcategory File Buckets
|
|
1782
|
+
* @param id The unique identifier of the bucket you would like to delete.
|
|
1783
|
+
* @returns Promise with success message or error
|
|
1784
|
+
*
|
|
1785
|
+
* @example Delete bucket
|
|
1786
|
+
* ```js
|
|
1787
|
+
* const { data, error } = await supabase
|
|
1788
|
+
* .storage
|
|
1789
|
+
* .deleteBucket('avatars')
|
|
1790
|
+
* ```
|
|
1791
|
+
*
|
|
1792
|
+
* Response:
|
|
1793
|
+
* ```json
|
|
1794
|
+
* {
|
|
1795
|
+
* "data": {
|
|
1796
|
+
* "message": "Successfully deleted"
|
|
1797
|
+
* },
|
|
1798
|
+
* "error": null
|
|
1799
|
+
* }
|
|
1800
|
+
* ```
|
|
1801
|
+
*
|
|
1802
|
+
* @remarks
|
|
1803
|
+
* - RLS policy permissions required:
|
|
1804
|
+
* - `buckets` table permissions: `select` and `delete`
|
|
1805
|
+
* - `objects` table permissions: none
|
|
1806
|
+
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
1807
|
+
*/
|
|
1808
|
+
async deleteBucket(id) {
|
|
1809
|
+
var _this6 = this;
|
|
1810
|
+
return _this6.handleOperation(async () => {
|
|
1811
|
+
return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
listBucketOptionsToQueryString(options) {
|
|
1815
|
+
const params = {};
|
|
1816
|
+
if (options) {
|
|
1817
|
+
if ("limit" in options) params.limit = String(options.limit);
|
|
1818
|
+
if ("offset" in options) params.offset = String(options.offset);
|
|
1819
|
+
if (options.search) params.search = options.search;
|
|
1820
|
+
if (options.sortColumn) params.sortColumn = options.sortColumn;
|
|
1821
|
+
if (options.sortOrder) params.sortOrder = options.sortOrder;
|
|
1822
|
+
}
|
|
1823
|
+
return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
//#endregion
|
|
1828
|
+
//#region src/packages/StorageAnalyticsClient.ts
|
|
1829
|
+
/**
|
|
1830
|
+
* Client class for managing Analytics Buckets using Iceberg tables
|
|
1831
|
+
* Provides methods for creating, listing, and deleting analytics buckets
|
|
1832
|
+
*/
|
|
1833
|
+
var StorageAnalyticsClient = class extends BaseApiClient {
|
|
1834
|
+
/**
|
|
1835
|
+
* @alpha
|
|
1836
|
+
*
|
|
1837
|
+
* Creates a new StorageAnalyticsClient instance
|
|
1838
|
+
*
|
|
1839
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
1840
|
+
*
|
|
1841
|
+
* @category Storage
|
|
1842
|
+
* @subcategory Analytics Buckets
|
|
1843
|
+
* @param url - The base URL for the storage API
|
|
1844
|
+
* @param headers - HTTP headers to include in requests
|
|
1845
|
+
* @param fetch - Optional custom fetch implementation
|
|
1846
|
+
*
|
|
1847
|
+
* @example Using supabase-js (recommended)
|
|
1848
|
+
* ```typescript
|
|
1849
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
1850
|
+
*
|
|
1851
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
1852
|
+
* const { data, error } = await supabase.storage.analytics.listBuckets()
|
|
1853
|
+
* ```
|
|
1854
|
+
*
|
|
1855
|
+
* @example Standalone import for bundle-sensitive environments
|
|
1856
|
+
* ```typescript
|
|
1857
|
+
* import { StorageAnalyticsClient } from '@supabase/storage-js'
|
|
1858
|
+
*
|
|
1859
|
+
* const client = new StorageAnalyticsClient(url, headers)
|
|
1860
|
+
* ```
|
|
1861
|
+
*/
|
|
1862
|
+
constructor(url, headers = {}, fetch$1) {
|
|
1863
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
1864
|
+
const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
|
|
1865
|
+
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* @alpha
|
|
1869
|
+
*
|
|
1870
|
+
* Creates a new analytics bucket using Iceberg tables
|
|
1871
|
+
* Analytics buckets are optimized for analytical queries and data processing
|
|
1872
|
+
*
|
|
1873
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
1874
|
+
*
|
|
1875
|
+
* @category Storage
|
|
1876
|
+
* @subcategory Analytics Buckets
|
|
1877
|
+
* @param name A unique name for the bucket you are creating
|
|
1878
|
+
* @returns Promise with response containing newly created analytics bucket or error
|
|
1879
|
+
*
|
|
1880
|
+
* @example Create analytics bucket
|
|
1881
|
+
* ```js
|
|
1882
|
+
* const { data, error } = await supabase
|
|
1883
|
+
* .storage
|
|
1884
|
+
* .analytics
|
|
1885
|
+
* .createBucket('analytics-data')
|
|
1886
|
+
* ```
|
|
1887
|
+
*
|
|
1888
|
+
* Response:
|
|
1889
|
+
* ```json
|
|
1890
|
+
* {
|
|
1891
|
+
* "data": {
|
|
1892
|
+
* "name": "analytics-data",
|
|
1893
|
+
* "type": "ANALYTICS",
|
|
1894
|
+
* "format": "iceberg",
|
|
1895
|
+
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
1896
|
+
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
1897
|
+
* },
|
|
1898
|
+
* "error": null
|
|
1899
|
+
* }
|
|
1900
|
+
* ```
|
|
1901
|
+
*
|
|
1902
|
+
* @remarks
|
|
1903
|
+
* - Creates a new analytics bucket using Iceberg tables
|
|
1904
|
+
* - Analytics buckets are optimized for analytical queries and data processing
|
|
1905
|
+
*/
|
|
1906
|
+
async createBucket(name) {
|
|
1907
|
+
var _this = this;
|
|
1908
|
+
return _this.handleOperation(async () => {
|
|
1909
|
+
return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* @alpha
|
|
1914
|
+
*
|
|
1915
|
+
* Retrieves the details of all Analytics Storage buckets within an existing project
|
|
1916
|
+
* Only returns buckets of type 'ANALYTICS'
|
|
1917
|
+
*
|
|
1918
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
1919
|
+
*
|
|
1920
|
+
* @category Storage
|
|
1921
|
+
* @subcategory Analytics Buckets
|
|
1922
|
+
* @param options Query parameters for listing buckets
|
|
1923
|
+
* @param options.limit Maximum number of buckets to return
|
|
1924
|
+
* @param options.offset Number of buckets to skip
|
|
1925
|
+
* @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')
|
|
1926
|
+
* @param options.sortOrder Sort order ('asc' or 'desc')
|
|
1927
|
+
* @param options.search Search term to filter bucket names
|
|
1928
|
+
* @returns Promise with response containing array of analytics buckets or error
|
|
1929
|
+
*
|
|
1930
|
+
* @example List analytics buckets
|
|
1931
|
+
* ```js
|
|
1932
|
+
* const { data, error } = await supabase
|
|
1933
|
+
* .storage
|
|
1934
|
+
* .analytics
|
|
1935
|
+
* .listBuckets({
|
|
1936
|
+
* limit: 10,
|
|
1937
|
+
* offset: 0,
|
|
1938
|
+
* sortColumn: 'created_at',
|
|
1939
|
+
* sortOrder: 'desc'
|
|
1940
|
+
* })
|
|
1941
|
+
* ```
|
|
1942
|
+
*
|
|
1943
|
+
* Response:
|
|
1944
|
+
* ```json
|
|
1945
|
+
* {
|
|
1946
|
+
* "data": [
|
|
1947
|
+
* {
|
|
1948
|
+
* "name": "analytics-data",
|
|
1949
|
+
* "type": "ANALYTICS",
|
|
1950
|
+
* "format": "iceberg",
|
|
1951
|
+
* "created_at": "2024-05-22T22:26:05.100Z",
|
|
1952
|
+
* "updated_at": "2024-05-22T22:26:05.100Z"
|
|
1953
|
+
* }
|
|
1954
|
+
* ],
|
|
1955
|
+
* "error": null
|
|
1956
|
+
* }
|
|
1957
|
+
* ```
|
|
1958
|
+
*
|
|
1959
|
+
* @remarks
|
|
1960
|
+
* - Retrieves the details of all Analytics Storage buckets within an existing project
|
|
1961
|
+
* - Only returns buckets of type 'ANALYTICS'
|
|
1962
|
+
*/
|
|
1963
|
+
async listBuckets(options) {
|
|
1964
|
+
var _this2 = this;
|
|
1965
|
+
return _this2.handleOperation(async () => {
|
|
1966
|
+
const queryParams = new URLSearchParams();
|
|
1967
|
+
if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
|
|
1968
|
+
if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
|
|
1969
|
+
if (options === null || options === void 0 ? void 0 : options.sortColumn) queryParams.set("sortColumn", options.sortColumn);
|
|
1970
|
+
if (options === null || options === void 0 ? void 0 : options.sortOrder) queryParams.set("sortOrder", options.sortOrder);
|
|
1971
|
+
if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
|
|
1972
|
+
const queryString = queryParams.toString();
|
|
1973
|
+
const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
|
|
1974
|
+
return await get(_this2.fetch, url, { headers: _this2.headers });
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* @alpha
|
|
1979
|
+
*
|
|
1980
|
+
* Deletes an existing analytics bucket
|
|
1981
|
+
* A bucket can't be deleted with existing objects inside it
|
|
1982
|
+
* You must first empty the bucket before deletion
|
|
1983
|
+
*
|
|
1984
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
1985
|
+
*
|
|
1986
|
+
* @category Storage
|
|
1987
|
+
* @subcategory Analytics Buckets
|
|
1988
|
+
* @param bucketName The unique identifier of the bucket you would like to delete
|
|
1989
|
+
* @returns Promise with response containing success message or error
|
|
1990
|
+
*
|
|
1991
|
+
* @example Delete analytics bucket
|
|
1992
|
+
* ```js
|
|
1993
|
+
* const { data, error } = await supabase
|
|
1994
|
+
* .storage
|
|
1995
|
+
* .analytics
|
|
1996
|
+
* .deleteBucket('analytics-data')
|
|
1997
|
+
* ```
|
|
1998
|
+
*
|
|
1999
|
+
* Response:
|
|
2000
|
+
* ```json
|
|
2001
|
+
* {
|
|
2002
|
+
* "data": {
|
|
2003
|
+
* "message": "Successfully deleted"
|
|
2004
|
+
* },
|
|
2005
|
+
* "error": null
|
|
2006
|
+
* }
|
|
2007
|
+
* ```
|
|
2008
|
+
*
|
|
2009
|
+
* @remarks
|
|
2010
|
+
* - Deletes an analytics bucket
|
|
2011
|
+
*/
|
|
2012
|
+
async deleteBucket(bucketName) {
|
|
2013
|
+
var _this3 = this;
|
|
2014
|
+
return _this3.handleOperation(async () => {
|
|
2015
|
+
return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* @alpha
|
|
2020
|
+
*
|
|
2021
|
+
* Get an Iceberg REST Catalog client configured for a specific analytics bucket
|
|
2022
|
+
* Use this to perform advanced table and namespace operations within the bucket
|
|
2023
|
+
* The returned client provides full access to the Apache Iceberg REST Catalog API
|
|
2024
|
+
* with the Supabase `{ data, error }` pattern for consistent error handling on all operations.
|
|
2025
|
+
*
|
|
2026
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2027
|
+
*
|
|
2028
|
+
* @category Storage
|
|
2029
|
+
* @subcategory Analytics Buckets
|
|
2030
|
+
* @param bucketName - The name of the analytics bucket (warehouse) to connect to
|
|
2031
|
+
* @returns The wrapped Iceberg catalog client
|
|
2032
|
+
* @throws {StorageError} If the bucket name is invalid
|
|
2033
|
+
*
|
|
2034
|
+
* @example Get catalog and create table
|
|
2035
|
+
* ```js
|
|
2036
|
+
* // First, create an analytics bucket
|
|
2037
|
+
* const { data: bucket, error: bucketError } = await supabase
|
|
2038
|
+
* .storage
|
|
2039
|
+
* .analytics
|
|
2040
|
+
* .createBucket('analytics-data')
|
|
2041
|
+
*
|
|
2042
|
+
* // Get the Iceberg catalog for that bucket
|
|
2043
|
+
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
2044
|
+
*
|
|
2045
|
+
* // Create a namespace
|
|
2046
|
+
* const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })
|
|
2047
|
+
*
|
|
2048
|
+
* // Create a table with schema
|
|
2049
|
+
* const { data: tableMetadata, error: tableError } = await catalog.createTable(
|
|
2050
|
+
* { namespace: ['default'] },
|
|
2051
|
+
* {
|
|
2052
|
+
* name: 'events',
|
|
2053
|
+
* schema: {
|
|
2054
|
+
* type: 'struct',
|
|
2055
|
+
* fields: [
|
|
2056
|
+
* { id: 1, name: 'id', type: 'long', required: true },
|
|
2057
|
+
* { id: 2, name: 'timestamp', type: 'timestamp', required: true },
|
|
2058
|
+
* { id: 3, name: 'user_id', type: 'string', required: false }
|
|
2059
|
+
* ],
|
|
2060
|
+
* 'schema-id': 0,
|
|
2061
|
+
* 'identifier-field-ids': [1]
|
|
2062
|
+
* },
|
|
2063
|
+
* 'partition-spec': {
|
|
2064
|
+
* 'spec-id': 0,
|
|
2065
|
+
* fields: []
|
|
2066
|
+
* },
|
|
2067
|
+
* 'write-order': {
|
|
2068
|
+
* 'order-id': 0,
|
|
2069
|
+
* fields: []
|
|
2070
|
+
* },
|
|
2071
|
+
* properties: {
|
|
2072
|
+
* 'write.format.default': 'parquet'
|
|
2073
|
+
* }
|
|
2074
|
+
* }
|
|
2075
|
+
* )
|
|
2076
|
+
* ```
|
|
2077
|
+
*
|
|
2078
|
+
* @example List tables in namespace
|
|
2079
|
+
* ```js
|
|
2080
|
+
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
2081
|
+
*
|
|
2082
|
+
* // List all tables in the default namespace
|
|
2083
|
+
* const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })
|
|
2084
|
+
* if (listError) {
|
|
2085
|
+
* if (listError.isNotFound()) {
|
|
2086
|
+
* console.log('Namespace not found')
|
|
2087
|
+
* }
|
|
2088
|
+
* return
|
|
2089
|
+
* }
|
|
2090
|
+
* console.log(tables) // [{ namespace: ['default'], name: 'events' }]
|
|
2091
|
+
* ```
|
|
2092
|
+
*
|
|
2093
|
+
* @example Working with namespaces
|
|
2094
|
+
* ```js
|
|
2095
|
+
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
2096
|
+
*
|
|
2097
|
+
* // List all namespaces
|
|
2098
|
+
* const { data: namespaces } = await catalog.listNamespaces()
|
|
2099
|
+
*
|
|
2100
|
+
* // Create namespace with properties
|
|
2101
|
+
* await catalog.createNamespace(
|
|
2102
|
+
* { namespace: ['production'] },
|
|
2103
|
+
* { properties: { owner: 'data-team', env: 'prod' } }
|
|
2104
|
+
* )
|
|
2105
|
+
* ```
|
|
2106
|
+
*
|
|
2107
|
+
* @example Cleanup operations
|
|
2108
|
+
* ```js
|
|
2109
|
+
* const catalog = supabase.storage.analytics.from('analytics-data')
|
|
2110
|
+
*
|
|
2111
|
+
* // Drop table with purge option (removes all data)
|
|
2112
|
+
* const { error: dropError } = await catalog.dropTable(
|
|
2113
|
+
* { namespace: ['default'], name: 'events' },
|
|
2114
|
+
* { purge: true }
|
|
2115
|
+
* )
|
|
2116
|
+
*
|
|
2117
|
+
* if (dropError?.isNotFound()) {
|
|
2118
|
+
* console.log('Table does not exist')
|
|
2119
|
+
* }
|
|
2120
|
+
*
|
|
2121
|
+
* // Drop namespace (must be empty)
|
|
2122
|
+
* await catalog.dropNamespace({ namespace: ['default'] })
|
|
2123
|
+
* ```
|
|
2124
|
+
*
|
|
2125
|
+
* @remarks
|
|
2126
|
+
* This method provides a bridge between Supabase's bucket management and the standard
|
|
2127
|
+
* Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.
|
|
2128
|
+
* All authentication and configuration is handled automatically using your Supabase credentials.
|
|
2129
|
+
*
|
|
2130
|
+
* **Error Handling**: Invalid bucket names throw immediately. All catalog
|
|
2131
|
+
* operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.
|
|
2132
|
+
* Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.
|
|
2133
|
+
* Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.
|
|
2134
|
+
*
|
|
2135
|
+
* **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently
|
|
2136
|
+
* deletes all table data. Without it, the table is marked as deleted but data remains.
|
|
2137
|
+
*
|
|
2138
|
+
* **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.
|
|
2139
|
+
* For complete API documentation and advanced usage, refer to the
|
|
2140
|
+
* [iceberg-js documentation](https://supabase.github.io/iceberg-js/).
|
|
2141
|
+
*/
|
|
2142
|
+
from(bucketName) {
|
|
2143
|
+
var _this4 = this;
|
|
2144
|
+
if (!isValidBucketName(bucketName)) throw new StorageError("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");
|
|
2145
|
+
const catalog = new iceberg_js.IcebergRestCatalog({
|
|
2146
|
+
baseUrl: this.url,
|
|
2147
|
+
catalogName: bucketName,
|
|
2148
|
+
auth: {
|
|
2149
|
+
type: "custom",
|
|
2150
|
+
getHeaders: async () => _this4.headers
|
|
2151
|
+
},
|
|
2152
|
+
fetch: this.fetch
|
|
2153
|
+
});
|
|
2154
|
+
const shouldThrowOnError = this.shouldThrowOnError;
|
|
2155
|
+
return new Proxy(catalog, { get(target, prop) {
|
|
2156
|
+
const value = target[prop];
|
|
2157
|
+
if (typeof value !== "function") return value;
|
|
2158
|
+
return async (...args) => {
|
|
2159
|
+
try {
|
|
2160
|
+
return {
|
|
2161
|
+
data: await value.apply(target, args),
|
|
2162
|
+
error: null
|
|
2163
|
+
};
|
|
2164
|
+
} catch (error) {
|
|
2165
|
+
if (shouldThrowOnError) throw error;
|
|
2166
|
+
return {
|
|
2167
|
+
data: null,
|
|
2168
|
+
error
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
};
|
|
2172
|
+
} });
|
|
2173
|
+
}
|
|
2174
|
+
};
|
|
2175
|
+
|
|
2176
|
+
//#endregion
|
|
2177
|
+
//#region src/packages/VectorIndexApi.ts
|
|
2178
|
+
/**
|
|
2179
|
+
* @hidden
|
|
2180
|
+
* Base implementation for vector index operations.
|
|
2181
|
+
* Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.
|
|
2182
|
+
*/
|
|
2183
|
+
var VectorIndexApi = class extends BaseApiClient {
|
|
2184
|
+
/** Creates a new VectorIndexApi instance */
|
|
2185
|
+
constructor(url, headers = {}, fetch$1) {
|
|
2186
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
2187
|
+
const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
2188
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
2189
|
+
}
|
|
2190
|
+
/** Creates a new vector index within a bucket */
|
|
2191
|
+
async createIndex(options) {
|
|
2192
|
+
var _this = this;
|
|
2193
|
+
return _this.handleOperation(async () => {
|
|
2194
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
/** Retrieves metadata for a specific vector index */
|
|
2198
|
+
async getIndex(vectorBucketName, indexName) {
|
|
2199
|
+
var _this2 = this;
|
|
2200
|
+
return _this2.handleOperation(async () => {
|
|
2201
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
2202
|
+
vectorBucketName,
|
|
2203
|
+
indexName
|
|
2204
|
+
}, { headers: _this2.headers });
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
/** Lists vector indexes within a bucket with optional filtering and pagination */
|
|
2208
|
+
async listIndexes(options) {
|
|
2209
|
+
var _this3 = this;
|
|
2210
|
+
return _this3.handleOperation(async () => {
|
|
2211
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
/** Deletes a vector index and all its data */
|
|
2215
|
+
async deleteIndex(vectorBucketName, indexName) {
|
|
2216
|
+
var _this4 = this;
|
|
2217
|
+
return _this4.handleOperation(async () => {
|
|
2218
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
2219
|
+
vectorBucketName,
|
|
2220
|
+
indexName
|
|
2221
|
+
}, { headers: _this4.headers }) || {};
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
//#endregion
|
|
2227
|
+
//#region src/packages/VectorDataApi.ts
|
|
2228
|
+
/**
|
|
2229
|
+
* @hidden
|
|
2230
|
+
* Base implementation for vector data operations.
|
|
2231
|
+
* Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
|
|
2232
|
+
*/
|
|
2233
|
+
var VectorDataApi = class extends BaseApiClient {
|
|
2234
|
+
/** Creates a new VectorDataApi instance */
|
|
2235
|
+
constructor(url, headers = {}, fetch$1) {
|
|
2236
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
2237
|
+
const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
2238
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
2239
|
+
}
|
|
2240
|
+
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
2241
|
+
async putVectors(options) {
|
|
2242
|
+
var _this = this;
|
|
2243
|
+
if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
|
|
2244
|
+
return _this.handleOperation(async () => {
|
|
2245
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
/** Retrieves vectors by their keys in batch */
|
|
2249
|
+
async getVectors(options) {
|
|
2250
|
+
var _this2 = this;
|
|
2251
|
+
return _this2.handleOperation(async () => {
|
|
2252
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
/** Lists vectors in an index with pagination */
|
|
2256
|
+
async listVectors(options) {
|
|
2257
|
+
var _this3 = this;
|
|
2258
|
+
if (options.segmentCount !== void 0) {
|
|
2259
|
+
if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
|
|
2260
|
+
if (options.segmentIndex !== void 0) {
|
|
2261
|
+
if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
return _this3.handleOperation(async () => {
|
|
2265
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
|
+
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
2269
|
+
async queryVectors(options) {
|
|
2270
|
+
var _this4 = this;
|
|
2271
|
+
return _this4.handleOperation(async () => {
|
|
2272
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2275
|
+
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
2276
|
+
async deleteVectors(options) {
|
|
2277
|
+
var _this5 = this;
|
|
2278
|
+
if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
|
|
2279
|
+
return _this5.handleOperation(async () => {
|
|
2280
|
+
return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
//#endregion
|
|
2286
|
+
//#region src/packages/VectorBucketApi.ts
|
|
2287
|
+
/**
|
|
2288
|
+
* @hidden
|
|
2289
|
+
* Base implementation for vector bucket operations.
|
|
2290
|
+
* Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.
|
|
2291
|
+
*/
|
|
2292
|
+
var VectorBucketApi = class extends BaseApiClient {
|
|
2293
|
+
/** Creates a new VectorBucketApi instance */
|
|
2294
|
+
constructor(url, headers = {}, fetch$1) {
|
|
2295
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
2296
|
+
const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
2297
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
2298
|
+
}
|
|
2299
|
+
/** Creates a new vector bucket */
|
|
2300
|
+
async createBucket(vectorBucketName) {
|
|
2301
|
+
var _this = this;
|
|
2302
|
+
return _this.handleOperation(async () => {
|
|
2303
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
/** Retrieves metadata for a specific vector bucket */
|
|
2307
|
+
async getBucket(vectorBucketName) {
|
|
2308
|
+
var _this2 = this;
|
|
2309
|
+
return _this2.handleOperation(async () => {
|
|
2310
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
/** Lists vector buckets with optional filtering and pagination */
|
|
2314
|
+
async listBuckets(options = {}) {
|
|
2315
|
+
var _this3 = this;
|
|
2316
|
+
return _this3.handleOperation(async () => {
|
|
2317
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
/** Deletes a vector bucket (must be empty first) */
|
|
2321
|
+
async deleteBucket(vectorBucketName) {
|
|
2322
|
+
var _this4 = this;
|
|
2323
|
+
return _this4.handleOperation(async () => {
|
|
2324
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2329
|
+
//#endregion
|
|
2330
|
+
//#region src/packages/StorageVectorsClient.ts
|
|
2331
|
+
/**
|
|
2332
|
+
*
|
|
2333
|
+
* @alpha
|
|
2334
|
+
*
|
|
2335
|
+
* Main client for interacting with S3 Vectors API
|
|
2336
|
+
* Provides access to bucket, index, and vector data operations
|
|
2337
|
+
*
|
|
2338
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2339
|
+
*
|
|
2340
|
+
* **Usage Patterns:**
|
|
2341
|
+
*
|
|
2342
|
+
* ```typescript
|
|
2343
|
+
* const { data, error } = await supabase
|
|
2344
|
+
* .storage
|
|
2345
|
+
* .vectors
|
|
2346
|
+
* .createBucket('embeddings-prod')
|
|
2347
|
+
*
|
|
2348
|
+
* // Access index operations via buckets
|
|
2349
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2350
|
+
* await bucket.createIndex({
|
|
2351
|
+
* indexName: 'documents',
|
|
2352
|
+
* dataType: 'float32',
|
|
2353
|
+
* dimension: 1536,
|
|
2354
|
+
* distanceMetric: 'cosine'
|
|
2355
|
+
* })
|
|
2356
|
+
*
|
|
2357
|
+
* // Access vector operations via index
|
|
2358
|
+
* const index = bucket.index('documents')
|
|
2359
|
+
* await index.putVectors({
|
|
2360
|
+
* vectors: [
|
|
2361
|
+
* { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
|
|
2362
|
+
* ]
|
|
2363
|
+
* })
|
|
2364
|
+
*
|
|
2365
|
+
* // Query similar vectors
|
|
2366
|
+
* const { data } = await index.queryVectors({
|
|
2367
|
+
* queryVector: { float32: [...] },
|
|
2368
|
+
* topK: 5,
|
|
2369
|
+
* returnDistance: true
|
|
2370
|
+
* })
|
|
2371
|
+
* ```
|
|
2372
|
+
*/
|
|
2373
|
+
var StorageVectorsClient = class extends VectorBucketApi {
|
|
2374
|
+
/**
|
|
2375
|
+
* @alpha
|
|
2376
|
+
*
|
|
2377
|
+
* Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.
|
|
2378
|
+
*
|
|
2379
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2380
|
+
*
|
|
2381
|
+
* @category Storage
|
|
2382
|
+
* @subcategory Vector Buckets
|
|
2383
|
+
* @param url - Base URL of the Storage Vectors REST API.
|
|
2384
|
+
* @param options.headers - Optional headers (for example `Authorization`) applied to every request.
|
|
2385
|
+
* @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
|
|
2386
|
+
*
|
|
2387
|
+
* @example Using supabase-js (recommended)
|
|
2388
|
+
* ```typescript
|
|
2389
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
2390
|
+
*
|
|
2391
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
2392
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2393
|
+
* ```
|
|
2394
|
+
*
|
|
2395
|
+
* @example Standalone import for bundle-sensitive environments
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* import { StorageVectorsClient } from '@supabase/storage-js'
|
|
2398
|
+
*
|
|
2399
|
+
* const client = new StorageVectorsClient(url, options)
|
|
2400
|
+
* ```
|
|
2401
|
+
*/
|
|
2402
|
+
constructor(url, options = {}) {
|
|
2403
|
+
super(url, options.headers || {}, options.fetch);
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
*
|
|
2407
|
+
* @alpha
|
|
2408
|
+
*
|
|
2409
|
+
* Access operations for a specific vector bucket
|
|
2410
|
+
* Returns a scoped client for index and vector operations within the bucket
|
|
2411
|
+
*
|
|
2412
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2413
|
+
*
|
|
2414
|
+
* @category Storage
|
|
2415
|
+
* @subcategory Vector Buckets
|
|
2416
|
+
* @param vectorBucketName - Name of the vector bucket
|
|
2417
|
+
* @returns Bucket-scoped client with index and vector operations
|
|
2418
|
+
*
|
|
2419
|
+
* @example Accessing a vector bucket
|
|
2420
|
+
* ```typescript
|
|
2421
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2422
|
+
* ```
|
|
2423
|
+
*/
|
|
2424
|
+
from(vectorBucketName) {
|
|
2425
|
+
return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch);
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
*
|
|
2429
|
+
* @alpha
|
|
2430
|
+
*
|
|
2431
|
+
* Creates a new vector bucket
|
|
2432
|
+
* Vector buckets are containers for vector indexes and their data
|
|
2433
|
+
*
|
|
2434
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2435
|
+
*
|
|
2436
|
+
* @category Storage
|
|
2437
|
+
* @subcategory Vector Buckets
|
|
2438
|
+
* @param vectorBucketName - Unique name for the vector bucket
|
|
2439
|
+
* @returns Promise with empty response on success or error
|
|
2440
|
+
*
|
|
2441
|
+
* @example Creating a vector bucket
|
|
2442
|
+
* ```typescript
|
|
2443
|
+
* const { data, error } = await supabase
|
|
2444
|
+
* .storage
|
|
2445
|
+
* .vectors
|
|
2446
|
+
* .createBucket('embeddings-prod')
|
|
2447
|
+
* ```
|
|
2448
|
+
*/
|
|
2449
|
+
async createBucket(vectorBucketName) {
|
|
2450
|
+
var _superprop_getCreateBucket = () => super.createBucket, _this = this;
|
|
2451
|
+
return _superprop_getCreateBucket().call(_this, vectorBucketName);
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
*
|
|
2455
|
+
* @alpha
|
|
2456
|
+
*
|
|
2457
|
+
* Retrieves metadata for a specific vector bucket
|
|
2458
|
+
*
|
|
2459
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2460
|
+
*
|
|
2461
|
+
* @category Storage
|
|
2462
|
+
* @subcategory Vector Buckets
|
|
2463
|
+
* @param vectorBucketName - Name of the vector bucket
|
|
2464
|
+
* @returns Promise with bucket metadata or error
|
|
2465
|
+
*
|
|
2466
|
+
* @example Get bucket metadata
|
|
2467
|
+
* ```typescript
|
|
2468
|
+
* const { data, error } = await supabase
|
|
2469
|
+
* .storage
|
|
2470
|
+
* .vectors
|
|
2471
|
+
* .getBucket('embeddings-prod')
|
|
2472
|
+
*
|
|
2473
|
+
* console.log('Bucket created:', data?.vectorBucket.creationTime)
|
|
2474
|
+
* ```
|
|
2475
|
+
*/
|
|
2476
|
+
async getBucket(vectorBucketName) {
|
|
2477
|
+
var _superprop_getGetBucket = () => super.getBucket, _this2 = this;
|
|
2478
|
+
return _superprop_getGetBucket().call(_this2, vectorBucketName);
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
*
|
|
2482
|
+
* @alpha
|
|
2483
|
+
*
|
|
2484
|
+
* Lists all vector buckets with optional filtering and pagination
|
|
2485
|
+
*
|
|
2486
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2487
|
+
*
|
|
2488
|
+
* @category Storage
|
|
2489
|
+
* @subcategory Vector Buckets
|
|
2490
|
+
* @param options - Optional filters (prefix, maxResults, nextToken)
|
|
2491
|
+
* @returns Promise with list of buckets or error
|
|
2492
|
+
*
|
|
2493
|
+
* @example List vector buckets
|
|
2494
|
+
* ```typescript
|
|
2495
|
+
* const { data, error } = await supabase
|
|
2496
|
+
* .storage
|
|
2497
|
+
* .vectors
|
|
2498
|
+
* .listBuckets({ prefix: 'embeddings-' })
|
|
2499
|
+
*
|
|
2500
|
+
* data?.vectorBuckets.forEach(bucket => {
|
|
2501
|
+
* console.log(bucket.vectorBucketName)
|
|
2502
|
+
* })
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
async listBuckets(options = {}) {
|
|
2506
|
+
var _superprop_getListBuckets = () => super.listBuckets, _this3 = this;
|
|
2507
|
+
return _superprop_getListBuckets().call(_this3, options);
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
*
|
|
2511
|
+
* @alpha
|
|
2512
|
+
*
|
|
2513
|
+
* Deletes a vector bucket (bucket must be empty)
|
|
2514
|
+
* All indexes must be deleted before deleting the bucket
|
|
2515
|
+
*
|
|
2516
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2517
|
+
*
|
|
2518
|
+
* @category Storage
|
|
2519
|
+
* @subcategory Vector Buckets
|
|
2520
|
+
* @param vectorBucketName - Name of the vector bucket to delete
|
|
2521
|
+
* @returns Promise with empty response on success or error
|
|
2522
|
+
*
|
|
2523
|
+
* @example Delete a vector bucket
|
|
2524
|
+
* ```typescript
|
|
2525
|
+
* const { data, error } = await supabase
|
|
2526
|
+
* .storage
|
|
2527
|
+
* .vectors
|
|
2528
|
+
* .deleteBucket('embeddings-old')
|
|
2529
|
+
* ```
|
|
2530
|
+
*/
|
|
2531
|
+
async deleteBucket(vectorBucketName) {
|
|
2532
|
+
var _superprop_getDeleteBucket = () => super.deleteBucket, _this4 = this;
|
|
2533
|
+
return _superprop_getDeleteBucket().call(_this4, vectorBucketName);
|
|
2534
|
+
}
|
|
2535
|
+
};
|
|
2536
|
+
/**
|
|
2537
|
+
*
|
|
2538
|
+
* @alpha
|
|
2539
|
+
*
|
|
2540
|
+
* Scoped client for operations within a specific vector bucket
|
|
2541
|
+
* Provides index management and access to vector operations
|
|
2542
|
+
*
|
|
2543
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2544
|
+
*/
|
|
2545
|
+
var VectorBucketScope = class extends VectorIndexApi {
|
|
2546
|
+
/**
|
|
2547
|
+
* @alpha
|
|
2548
|
+
*
|
|
2549
|
+
* Creates a helper that automatically scopes all index operations to the provided bucket.
|
|
2550
|
+
*
|
|
2551
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2552
|
+
*
|
|
2553
|
+
* @category Storage
|
|
2554
|
+
* @subcategory Vector Buckets
|
|
2555
|
+
* @example Creating a vector bucket scope
|
|
2556
|
+
* ```typescript
|
|
2557
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2558
|
+
* ```
|
|
2559
|
+
*/
|
|
2560
|
+
constructor(url, headers, vectorBucketName, fetch$1) {
|
|
2561
|
+
super(url, headers, fetch$1);
|
|
2562
|
+
this.vectorBucketName = vectorBucketName;
|
|
2563
|
+
}
|
|
2564
|
+
/**
|
|
2565
|
+
*
|
|
2566
|
+
* @alpha
|
|
2567
|
+
*
|
|
2568
|
+
* Creates a new vector index in this bucket
|
|
2569
|
+
* Convenience method that automatically includes the bucket name
|
|
2570
|
+
*
|
|
2571
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2572
|
+
*
|
|
2573
|
+
* @category Storage
|
|
2574
|
+
* @subcategory Vector Buckets
|
|
2575
|
+
* @param options - Index configuration (vectorBucketName is automatically set)
|
|
2576
|
+
* @returns Promise with empty response on success or error
|
|
2577
|
+
*
|
|
2578
|
+
* @example Creating a vector index
|
|
2579
|
+
* ```typescript
|
|
2580
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2581
|
+
* await bucket.createIndex({
|
|
2582
|
+
* indexName: 'documents-openai',
|
|
2583
|
+
* dataType: 'float32',
|
|
2584
|
+
* dimension: 1536,
|
|
2585
|
+
* distanceMetric: 'cosine',
|
|
2586
|
+
* metadataConfiguration: {
|
|
2587
|
+
* nonFilterableMetadataKeys: ['raw_text']
|
|
2588
|
+
* }
|
|
2589
|
+
* })
|
|
2590
|
+
* ```
|
|
2591
|
+
*/
|
|
2592
|
+
async createIndex(options) {
|
|
2593
|
+
var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
|
|
2594
|
+
return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
*
|
|
2598
|
+
* @alpha
|
|
2599
|
+
*
|
|
2600
|
+
* Lists indexes in this bucket
|
|
2601
|
+
* Convenience method that automatically includes the bucket name
|
|
2602
|
+
*
|
|
2603
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2604
|
+
*
|
|
2605
|
+
* @category Storage
|
|
2606
|
+
* @subcategory Vector Buckets
|
|
2607
|
+
* @param options - Listing options (vectorBucketName is automatically set)
|
|
2608
|
+
* @returns Promise with response containing indexes array and pagination token or error
|
|
2609
|
+
*
|
|
2610
|
+
* @example List indexes
|
|
2611
|
+
* ```typescript
|
|
2612
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2613
|
+
* const { data } = await bucket.listIndexes({ prefix: 'documents-' })
|
|
2614
|
+
* ```
|
|
2615
|
+
*/
|
|
2616
|
+
async listIndexes(options = {}) {
|
|
2617
|
+
var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
|
|
2618
|
+
return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
*
|
|
2622
|
+
* @alpha
|
|
2623
|
+
*
|
|
2624
|
+
* Retrieves metadata for a specific index in this bucket
|
|
2625
|
+
* Convenience method that automatically includes the bucket name
|
|
2626
|
+
*
|
|
2627
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2628
|
+
*
|
|
2629
|
+
* @category Storage
|
|
2630
|
+
* @subcategory Vector Buckets
|
|
2631
|
+
* @param indexName - Name of the index to retrieve
|
|
2632
|
+
* @returns Promise with index metadata or error
|
|
2633
|
+
*
|
|
2634
|
+
* @example Get index metadata
|
|
2635
|
+
* ```typescript
|
|
2636
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2637
|
+
* const { data } = await bucket.getIndex('documents-openai')
|
|
2638
|
+
* console.log('Dimension:', data?.index.dimension)
|
|
2639
|
+
* ```
|
|
2640
|
+
*/
|
|
2641
|
+
async getIndex(indexName) {
|
|
2642
|
+
var _superprop_getGetIndex = () => super.getIndex, _this7 = this;
|
|
2643
|
+
return _superprop_getGetIndex().call(_this7, _this7.vectorBucketName, indexName);
|
|
2644
|
+
}
|
|
2645
|
+
/**
|
|
2646
|
+
*
|
|
2647
|
+
* @alpha
|
|
2648
|
+
*
|
|
2649
|
+
* Deletes an index from this bucket
|
|
2650
|
+
* Convenience method that automatically includes the bucket name
|
|
2651
|
+
*
|
|
2652
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2653
|
+
*
|
|
2654
|
+
* @category Storage
|
|
2655
|
+
* @subcategory Vector Buckets
|
|
2656
|
+
* @param indexName - Name of the index to delete
|
|
2657
|
+
* @returns Promise with empty response on success or error
|
|
2658
|
+
*
|
|
2659
|
+
* @example Delete an index
|
|
2660
|
+
* ```typescript
|
|
2661
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
2662
|
+
* await bucket.deleteIndex('old-index')
|
|
2663
|
+
* ```
|
|
2664
|
+
*/
|
|
2665
|
+
async deleteIndex(indexName) {
|
|
2666
|
+
var _superprop_getDeleteIndex = () => super.deleteIndex, _this8 = this;
|
|
2667
|
+
return _superprop_getDeleteIndex().call(_this8, _this8.vectorBucketName, indexName);
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
*
|
|
2671
|
+
* @alpha
|
|
2672
|
+
*
|
|
2673
|
+
* Access operations for a specific index within this bucket
|
|
2674
|
+
* Returns a scoped client for vector data operations
|
|
2675
|
+
*
|
|
2676
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2677
|
+
*
|
|
2678
|
+
* @category Storage
|
|
2679
|
+
* @subcategory Vector Buckets
|
|
2680
|
+
* @param indexName - Name of the index
|
|
2681
|
+
* @returns Index-scoped client with vector data operations
|
|
2682
|
+
*
|
|
2683
|
+
* @example Accessing an index
|
|
2684
|
+
* ```typescript
|
|
2685
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2686
|
+
*
|
|
2687
|
+
* // Insert vectors
|
|
2688
|
+
* await index.putVectors({
|
|
2689
|
+
* vectors: [
|
|
2690
|
+
* { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
|
|
2691
|
+
* ]
|
|
2692
|
+
* })
|
|
2693
|
+
*
|
|
2694
|
+
* // Query similar vectors
|
|
2695
|
+
* const { data } = await index.queryVectors({
|
|
2696
|
+
* queryVector: { float32: [...] },
|
|
2697
|
+
* topK: 5
|
|
2698
|
+
* })
|
|
2699
|
+
* ```
|
|
2700
|
+
*/
|
|
2701
|
+
index(indexName) {
|
|
2702
|
+
return new VectorIndexScope(this.url, this.headers, this.vectorBucketName, indexName, this.fetch);
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
/**
|
|
2706
|
+
*
|
|
2707
|
+
* @alpha
|
|
2708
|
+
*
|
|
2709
|
+
* Scoped client for operations within a specific vector index
|
|
2710
|
+
* Provides vector data operations (put, get, list, query, delete)
|
|
2711
|
+
*
|
|
2712
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2713
|
+
*/
|
|
2714
|
+
var VectorIndexScope = class extends VectorDataApi {
|
|
2715
|
+
/**
|
|
2716
|
+
*
|
|
2717
|
+
* @alpha
|
|
2718
|
+
*
|
|
2719
|
+
* Creates a helper that automatically scopes all vector operations to the provided bucket/index names.
|
|
2720
|
+
*
|
|
2721
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2722
|
+
*
|
|
2723
|
+
* @category Storage
|
|
2724
|
+
* @subcategory Vector Buckets
|
|
2725
|
+
* @example Creating a vector index scope
|
|
2726
|
+
* ```typescript
|
|
2727
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2728
|
+
* ```
|
|
2729
|
+
*/
|
|
2730
|
+
constructor(url, headers, vectorBucketName, indexName, fetch$1) {
|
|
2731
|
+
super(url, headers, fetch$1);
|
|
2732
|
+
this.vectorBucketName = vectorBucketName;
|
|
2733
|
+
this.indexName = indexName;
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
*
|
|
2737
|
+
* @alpha
|
|
2738
|
+
*
|
|
2739
|
+
* Inserts or updates vectors in this index
|
|
2740
|
+
* Convenience method that automatically includes bucket and index names
|
|
2741
|
+
*
|
|
2742
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2743
|
+
*
|
|
2744
|
+
* @category Storage
|
|
2745
|
+
* @subcategory Vector Buckets
|
|
2746
|
+
* @param options - Vector insertion options (bucket and index names automatically set)
|
|
2747
|
+
* @returns Promise with empty response on success or error
|
|
2748
|
+
*
|
|
2749
|
+
* @example Insert vectors into an index
|
|
2750
|
+
* ```typescript
|
|
2751
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2752
|
+
* await index.putVectors({
|
|
2753
|
+
* vectors: [
|
|
2754
|
+
* {
|
|
2755
|
+
* key: 'doc-1',
|
|
2756
|
+
* data: { float32: [0.1, 0.2, ...] },
|
|
2757
|
+
* metadata: { title: 'Introduction', page: 1 }
|
|
2758
|
+
* }
|
|
2759
|
+
* ]
|
|
2760
|
+
* })
|
|
2761
|
+
* ```
|
|
2762
|
+
*/
|
|
2763
|
+
async putVectors(options) {
|
|
2764
|
+
var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
|
|
2765
|
+
return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2766
|
+
vectorBucketName: _this9.vectorBucketName,
|
|
2767
|
+
indexName: _this9.indexName
|
|
2768
|
+
}));
|
|
2769
|
+
}
|
|
2770
|
+
/**
|
|
2771
|
+
*
|
|
2772
|
+
* @alpha
|
|
2773
|
+
*
|
|
2774
|
+
* Retrieves vectors by keys from this index
|
|
2775
|
+
* Convenience method that automatically includes bucket and index names
|
|
2776
|
+
*
|
|
2777
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2778
|
+
*
|
|
2779
|
+
* @category Storage
|
|
2780
|
+
* @subcategory Vector Buckets
|
|
2781
|
+
* @param options - Vector retrieval options (bucket and index names automatically set)
|
|
2782
|
+
* @returns Promise with response containing vectors array or error
|
|
2783
|
+
*
|
|
2784
|
+
* @example Get vectors by keys
|
|
2785
|
+
* ```typescript
|
|
2786
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2787
|
+
* const { data } = await index.getVectors({
|
|
2788
|
+
* keys: ['doc-1', 'doc-2'],
|
|
2789
|
+
* returnMetadata: true
|
|
2790
|
+
* })
|
|
2791
|
+
* ```
|
|
2792
|
+
*/
|
|
2793
|
+
async getVectors(options) {
|
|
2794
|
+
var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
|
|
2795
|
+
return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2796
|
+
vectorBucketName: _this10.vectorBucketName,
|
|
2797
|
+
indexName: _this10.indexName
|
|
2798
|
+
}));
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
*
|
|
2802
|
+
* @alpha
|
|
2803
|
+
*
|
|
2804
|
+
* Lists vectors in this index with pagination
|
|
2805
|
+
* Convenience method that automatically includes bucket and index names
|
|
2806
|
+
*
|
|
2807
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2808
|
+
*
|
|
2809
|
+
* @category Storage
|
|
2810
|
+
* @subcategory Vector Buckets
|
|
2811
|
+
* @param options - Listing options (bucket and index names automatically set)
|
|
2812
|
+
* @returns Promise with response containing vectors array and pagination token or error
|
|
2813
|
+
*
|
|
2814
|
+
* @example List vectors with pagination
|
|
2815
|
+
* ```typescript
|
|
2816
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2817
|
+
* const { data } = await index.listVectors({
|
|
2818
|
+
* maxResults: 500,
|
|
2819
|
+
* returnMetadata: true
|
|
2820
|
+
* })
|
|
2821
|
+
* ```
|
|
2822
|
+
*/
|
|
2823
|
+
async listVectors(options = {}) {
|
|
2824
|
+
var _superprop_getListVectors = () => super.listVectors, _this11 = this;
|
|
2825
|
+
return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2826
|
+
vectorBucketName: _this11.vectorBucketName,
|
|
2827
|
+
indexName: _this11.indexName
|
|
2828
|
+
}));
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
*
|
|
2832
|
+
* @alpha
|
|
2833
|
+
*
|
|
2834
|
+
* Queries for similar vectors in this index
|
|
2835
|
+
* Convenience method that automatically includes bucket and index names
|
|
2836
|
+
*
|
|
2837
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2838
|
+
*
|
|
2839
|
+
* @category Storage
|
|
2840
|
+
* @subcategory Vector Buckets
|
|
2841
|
+
* @param options - Query options (bucket and index names automatically set)
|
|
2842
|
+
* @returns Promise with response containing matches array of similar vectors ordered by distance or error
|
|
2843
|
+
*
|
|
2844
|
+
* @example Query similar vectors
|
|
2845
|
+
* ```typescript
|
|
2846
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2847
|
+
* const { data } = await index.queryVectors({
|
|
2848
|
+
* queryVector: { float32: [0.1, 0.2, ...] },
|
|
2849
|
+
* topK: 5,
|
|
2850
|
+
* filter: { category: 'technical' },
|
|
2851
|
+
* returnDistance: true,
|
|
2852
|
+
* returnMetadata: true
|
|
2853
|
+
* })
|
|
2854
|
+
* ```
|
|
2855
|
+
*/
|
|
2856
|
+
async queryVectors(options) {
|
|
2857
|
+
var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
|
|
2858
|
+
return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2859
|
+
vectorBucketName: _this12.vectorBucketName,
|
|
2860
|
+
indexName: _this12.indexName
|
|
2861
|
+
}));
|
|
2862
|
+
}
|
|
2863
|
+
/**
|
|
2864
|
+
*
|
|
2865
|
+
* @alpha
|
|
2866
|
+
*
|
|
2867
|
+
* Deletes vectors by keys from this index
|
|
2868
|
+
* Convenience method that automatically includes bucket and index names
|
|
2869
|
+
*
|
|
2870
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2871
|
+
*
|
|
2872
|
+
* @category Storage
|
|
2873
|
+
* @subcategory Vector Buckets
|
|
2874
|
+
* @param options - Deletion options (bucket and index names automatically set)
|
|
2875
|
+
* @returns Promise with empty response on success or error
|
|
2876
|
+
*
|
|
2877
|
+
* @example Delete vectors by keys
|
|
2878
|
+
* ```typescript
|
|
2879
|
+
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
2880
|
+
* await index.deleteVectors({
|
|
2881
|
+
* keys: ['doc-1', 'doc-2', 'doc-3']
|
|
2882
|
+
* })
|
|
2883
|
+
* ```
|
|
2884
|
+
*/
|
|
2885
|
+
async deleteVectors(options) {
|
|
2886
|
+
var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
|
|
2887
|
+
return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2888
|
+
vectorBucketName: _this13.vectorBucketName,
|
|
2889
|
+
indexName: _this13.indexName
|
|
2890
|
+
}));
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
|
|
2894
|
+
//#endregion
|
|
2895
|
+
//#region src/StorageClient.ts
|
|
2896
|
+
var StorageClient = class extends StorageBucketApi {
|
|
2897
|
+
/**
|
|
2898
|
+
* Creates a client for Storage buckets, files, analytics, and vectors.
|
|
2899
|
+
*
|
|
2900
|
+
* @category Storage
|
|
2901
|
+
* @subcategory File Buckets
|
|
2902
|
+
*
|
|
2903
|
+
* @example Using supabase-js (recommended)
|
|
2904
|
+
* ```ts
|
|
2905
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
2906
|
+
*
|
|
2907
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
2908
|
+
* const avatars = supabase.storage.from('avatars')
|
|
2909
|
+
* ```
|
|
2910
|
+
*
|
|
2911
|
+
* @example Standalone import for bundle-sensitive environments
|
|
2912
|
+
* ```ts
|
|
2913
|
+
* import { StorageClient } from '@supabase/storage-js'
|
|
2914
|
+
*
|
|
2915
|
+
* const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
|
|
2916
|
+
* apikey: 'your-publishable-key',
|
|
2917
|
+
* })
|
|
2918
|
+
* const avatars = storage.from('avatars')
|
|
2919
|
+
* ```
|
|
2920
|
+
*/
|
|
2921
|
+
constructor(url, headers = {}, fetch$1, opts) {
|
|
2922
|
+
super(url, headers, fetch$1, opts);
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Perform file operation in a bucket.
|
|
2926
|
+
*
|
|
2927
|
+
* @category Storage
|
|
2928
|
+
* @subcategory File Buckets
|
|
2929
|
+
*
|
|
2930
|
+
* @param id The bucket id to operate on.
|
|
2931
|
+
*
|
|
2932
|
+
* @example Accessing a bucket
|
|
2933
|
+
* ```typescript
|
|
2934
|
+
* const avatars = supabase.storage.from('avatars')
|
|
2935
|
+
* ```
|
|
2936
|
+
*/
|
|
2937
|
+
from(id) {
|
|
2938
|
+
return new StorageFileApi(this.url, this.headers, id, this.fetch);
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
*
|
|
2942
|
+
* @alpha
|
|
2943
|
+
*
|
|
2944
|
+
* Access vector storage operations.
|
|
2945
|
+
*
|
|
2946
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2947
|
+
*
|
|
2948
|
+
* @category Storage
|
|
2949
|
+
* @subcategory Vector Buckets
|
|
2950
|
+
*
|
|
2951
|
+
* @returns A StorageVectorsClient instance configured with the current storage settings.
|
|
2952
|
+
*/
|
|
2953
|
+
get vectors() {
|
|
2954
|
+
return new StorageVectorsClient(this.url + "/vector", {
|
|
2955
|
+
headers: this.headers,
|
|
2956
|
+
fetch: this.fetch
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
*
|
|
2961
|
+
* @alpha
|
|
2962
|
+
*
|
|
2963
|
+
* Access analytics storage operations using Iceberg tables.
|
|
2964
|
+
*
|
|
2965
|
+
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
2966
|
+
*
|
|
2967
|
+
* @category Storage
|
|
2968
|
+
* @subcategory Analytics Buckets
|
|
2969
|
+
*
|
|
2970
|
+
* @returns A StorageAnalyticsClient instance configured with the current storage settings.
|
|
2971
|
+
*/
|
|
2972
|
+
get analytics() {
|
|
2973
|
+
return new StorageAnalyticsClient(this.url + "/iceberg", this.headers, this.fetch);
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
|
|
2977
|
+
//#endregion
|
|
2978
|
+
exports.StorageAnalyticsClient = StorageAnalyticsClient;
|
|
2979
|
+
exports.StorageApiError = StorageApiError;
|
|
2980
|
+
exports.StorageClient = StorageClient;
|
|
2981
|
+
exports.StorageError = StorageError;
|
|
2982
|
+
exports.StorageUnknownError = StorageUnknownError;
|
|
2983
|
+
exports.StorageVectorsApiError = StorageVectorsApiError;
|
|
2984
|
+
exports.StorageVectorsClient = StorageVectorsClient;
|
|
2985
|
+
exports.StorageVectorsError = StorageVectorsError;
|
|
2986
|
+
exports.StorageVectorsErrorCode = StorageVectorsErrorCode;
|
|
2987
|
+
exports.StorageVectorsUnknownError = StorageVectorsUnknownError;
|
|
2988
|
+
exports.VectorBucketApi = VectorBucketApi;
|
|
2989
|
+
exports.VectorBucketScope = VectorBucketScope;
|
|
2990
|
+
exports.VectorDataApi = VectorDataApi;
|
|
2991
|
+
exports.VectorIndexApi = VectorIndexApi;
|
|
2992
|
+
exports.VectorIndexScope = VectorIndexScope;
|
|
2993
|
+
exports.isStorageError = isStorageError;
|
|
2994
|
+
exports.isStorageVectorsError = isStorageVectorsError;
|
|
2995
|
+
//# sourceMappingURL=index.cjs.map
|