diff --git a/.gitattributes b/.gitattributes index a9a88850fc9dcd51bad9b12db4de48141aa19783..20164a4feccdcc0ae640ac782fa3ef464e342fe6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text node_modules/@esbuild/win32-x64/esbuild.exe filter=lfs diff=lfs merge=lfs -text node_modules/@rollup/rollup-win32-x64-gnu/rollup.win32-x64-gnu.node filter=lfs diff=lfs merge=lfs -text node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node filter=lfs diff=lfs merge=lfs -text +node_modules/@tailwindcss/oxide-win32-x64-msvc/tailwindcss-oxide.win32-x64-msvc.node filter=lfs diff=lfs merge=lfs -text diff --git a/node_modules/@supabase/realtime-js/LICENSE b/node_modules/@supabase/realtime-js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ddeba6a00ae5ec536d5429e040bc73ef2c6a07d6 --- /dev/null +++ b/node_modules/@supabase/realtime-js/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Supabase + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@supabase/realtime-js/README.md b/node_modules/@supabase/realtime-js/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f2e3d9835c8d140f0d93b1d586abe6272bd1d774 --- /dev/null +++ b/node_modules/@supabase/realtime-js/README.md @@ -0,0 +1,447 @@ +
+

+ + + + + Supabase Logo + + + +

Supabase Realtime JS SDK

+ +

Send ephemeral messages with Broadcast, track and synchronize state with Presence, and listen to database changes with Postgres Change Data Capture (CDC).

+ +

+ Guides + · + Reference Docs + · + Multiplayer Demo +

+

+ +
+ +[![Build](https://github.com/supabase/supabase-js/workflows/CI/badge.svg)](https://github.com/supabase/supabase-js/actions?query=branch%3Amaster) +[![Package](https://img.shields.io/npm/v/@supabase/realtime-js)](https://www.npmjs.com/package/@supabase/realtime-js) +[![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license) +[![pkg.pr.new](https://pkg.pr.new/badge/supabase/realtime-js)](https://pkg.pr.new/~/supabase/realtime-js) + +
+ +# Overview + +This SDK enables you to use the following Supabase Realtime's features: + +- **Broadcast**: send ephemeral messages from client to clients with minimal latency. Use cases include sharing cursor positions between users. +- **Presence**: track and synchronize shared state across clients with the help of CRDTs. Use cases include tracking which users are currently viewing a specific webpage. +- **Postgres Change Data Capture (CDC)**: listen for changes in your PostgreSQL database and send them to clients. + +# Usage + +## Installing the Package + +```bash +npm install @supabase/realtime-js +``` + +## Creating a Channel + +```js +import { RealtimeClient } from '@supabase/realtime-js' + +const client = new RealtimeClient(REALTIME_URL, { + params: { + apikey: API_KEY, + }, +}) + +const channel = client.channel('test-channel', {}) + +channel.subscribe((status, err) => { + if (status === 'SUBSCRIBED') { + console.log('Connected!') + } + + if (status === 'CHANNEL_ERROR') { + console.log(`There was an error subscribing to channel: ${err.message}`) + } + + if (status === 'TIMED_OUT') { + console.log('Realtime server did not respond in time.') + } + + if (status === 'CLOSED') { + console.log('Realtime channel was unexpectedly closed.') + } +}) +``` + +### Notes: + +- `REALTIME_URL` is `'ws://localhost:4000/socket'` when developing locally and `'wss://.supabase.co/realtime/v1'` when connecting to your Supabase project. +- `API_KEY` is a JWT whose claims must contain `exp` and `role` (existing database role). +- Channel name can be any `string`. +- Setting `private` to `true` means that the client will use RLS to determine if the user can connect or not to a given channel. + +## Broadcast + +Your client can send and receive messages based on the `event`. + +```js +// Setup... + +const channel = client.channel('broadcast-test', { broadcast: { ack: false, self: false } }) + +channel.on('broadcast', { event: 'some-event' }, (payload) => console.log(payload)) + +channel.subscribe(async (status) => { + if (status === 'SUBSCRIBED') { + // Send message to other clients listening to 'broadcast-test' channel + await channel.send({ + type: 'broadcast', + event: 'some-event', + payload: { hello: 'world' }, + }) + } +}) +``` + +### Notes: + +- Setting `ack` to `true` means that the `channel.send` promise will resolve once server replies with acknowledgment that it received the broadcast message request. +- Setting `self` to `true` means that the client will receive the broadcast message it sent out. + +### Broadcast Replay + +Broadcast Replay enables **private** channels to access messages that were sent earlier. Only messages published via [Broadcast From the Database](https://supabase.com/docs/guides/realtime/broadcast#trigger-broadcast-messages-from-your-database) are available for replay. + +You can configure replay with the following options: + +- **`since`** (Required): The epoch timestamp in milliseconds, specifying the earliest point from which messages should be retrieved. +- **`limit`** (Optional): The number of messages to return. This must be a positive integer, with a maximum value of 25. + +Example: + +```typescript +const twelveHours = 12 * 60 * 60 * 1000 +const twelveHoursAgo = Date.now() - twelveHours + +const config = { private: true, broadcast: { replay: { since: twelveHoursAgo, limit: 10 } } } + +supabase + .channel('main:room', { config }) + .on('broadcast', { event: 'my_event' }, (payload) => { + if (payload?.meta?.replayed) { + console.log('This message was sent earlier:', payload) + } else { + console.log('This is a new message', payload) + } + // ... + }) + .subscribe() +``` + +## Presence + +Your client can track and sync state that's stored in the channel. + +```js +// Setup... + +const channel = client.channel('presence-test', { + config: { + presence: { + key: '', + }, + }, +}) + +channel.on('presence', { event: 'sync' }, () => { + console.log('Online users: ', channel.presenceState()) +}) + +channel.on('presence', { event: 'join' }, ({ newPresences }) => { + console.log('New users have joined: ', newPresences) +}) + +channel.on('presence', { event: 'leave' }, ({ leftPresences }) => { + console.log('Users have left: ', leftPresences) +}) + +channel.subscribe(async (status) => { + if (status === 'SUBSCRIBED') { + const status = await channel.track({ user_id: 1 }) + console.log(status) + } +}) +``` + +> `config.presence.enabled` (set automatically if you add an `.on('presence', ...)` listener) +> controls whether _this_ client receives presence state and updates from other clients — +> without it, `presenceState()` stays empty for you. It does not affect whether other clients +> see you: calling `track()` always makes you visible to subscribers that do have presence +> enabled. On RLS-protected channels, receiving presence updates additionally requires the +> `presence.read` policy to authorize this client. + +## Postgres CDC + +Receive database changes on the client. + +```js +// Setup... + +const channel = client.channel('db-changes') + +channel.on('postgres_changes', { event: '*', schema: 'public' }, (payload) => { + console.log('All changes in public schema: ', payload) +}) + +channel.on( + 'postgres_changes', + { event: 'INSERT', schema: 'public', table: 'messages' }, + (payload) => { + console.log('All inserts in messages table: ', payload) + } +) + +channel.on( + 'postgres_changes', + { event: 'UPDATE', schema: 'public', table: 'users', filter: 'username=eq.Realtime' }, + (payload) => { + console.log('All updates on users table when username is Realtime: ', payload) + } +) + +channel.subscribe(async (status) => { + if (status === 'SUBSCRIBED') { + console.log('Ready to receive database changes!') + } +}) +``` + +### Filters + +The `filter` option accepts **either** a raw string **or** a +`postgresChangesFilter()` builder — both produce the exact same wire format, so +you can mix and match and existing string filters keep working unchanged: + +```js +// Raw string — always supported, fully backward compatible +{ event: 'UPDATE', schema: 'public', table: 'users', filter: 'id=eq.1' } + +// Builder — type-checked, ergonomic; the SDK serializes it for you +{ event: 'UPDATE', schema: 'public', table: 'users', filter: postgresChangesFilter().eq('id', 1) } +``` + +A filter is a `column=operator.value` expression evaluated server-side. The +following operators are supported: + +| Operator | String form | Builder | Meaning | +| --------------------- | ---------------------------- | -------------------------------------- | --------------------------------- | +| `eq` | `id=eq.1` | `.eq('id', 1)` | equal | +| `neq` | `id=neq.1` | `.neq('id', 1)` | not equal | +| `lt` `lte` `gt` `gte` | `age=gte.18` | `.gte('age', 18)` | comparison | +| `in` | `status=in.(active,pending)` | `.in('status', ['active', 'pending'])` | in list | +| `like` `ilike` | `title=like.%foo%` | `.like('title', '%foo%')` | pattern match (case in/sensitive) | +| `is` | `deleted_at=is.null` | `.is('deleted_at', null)` | `IS null/true/false/unknown` | +| `match` `imatch` | `title=match.^foo` | `.match('title', '^foo')` | POSIX regex match (`~` / `~*`) | +| `isdistinct` | `value=isdistinct.1` | `.isDistinct('value', 1)` | NULL-safe inequality | + +**Negation** — prefix any operator with `not.` (string) or use +`.not(column, operator, value)` (builder): + +```js +// String +{ event: '*', schema: 'public', table: 'posts', filter: 'status=not.in.(draft,archived)' } + +// Builder +{ + event: '*', + schema: 'public', + table: 'posts', + filter: postgresChangesFilter().not('status', 'in', ['draft', 'archived']), +} +``` + +**AND composition** — multiple conditions are combined with commas and applied +as an `AND`. With the builder you just chain calls: + +```js +// String +{ event: 'UPDATE', schema: 'public', table: 'orders', filter: 'amount=gt.100,status=in.(open,pending)' } + +// Builder — equivalent, chained +{ + event: 'UPDATE', + schema: 'public', + table: 'orders', + filter: postgresChangesFilter().gt('amount', 100).in('status', ['open', 'pending']), +} +``` + +#### Building filters with `postgresChangesFilter()` + +The builder (modeled on the `postgrest-js` filter methods) is the recommended, +type-checked way to compose filters — but it is entirely optional; raw strings +remain fully supported. + +```js +import { postgresChangesFilter } from '@supabase/realtime-js' + +channel.on( + 'postgres_changes', + { + event: 'UPDATE', + schema: 'public', + table: 'orders', + // → 'amount=gt.100,status=not.in.(draft,archived)' + filter: postgresChangesFilter().gt('amount', 100).not('status', 'in', ['draft', 'archived']), + }, + (payload) => console.log(payload) +) +``` + +The builder exposes `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `like`, +`ilike`, `match`, `imatch`, `is`, `isDistinct` and `not`. Call `.build()` if you +need the raw string yourself (e.g. to log it or store it). + +**Values are sent verbatim** — the server has no quoting/escaping, so spaces and +quotes are preserved as-is. The server separates conditions by commas outside +parentheses, so a literal comma in a scalar value can't be expressed (commas +inside `in.(…)` are fine); the builder throws on such values rather than +silently producing a broken filter. + +> **Note for PostgREST users:** Realtime evaluates filters server-side over a +> single table's WAL — there is no resource embedding (`!inner`, embedded +> filters) and no `or()` grouping. Use `%` (not `*`) for `like`/`ilike` +> wildcards, since filters travel in the WebSocket payload rather than a URL. + +### Selecting columns + +Use `select` to receive only a subset of columns instead of the full row. This +reduces payload size (helpful for large `bytea`/`jsonb` columns). The selected +columns must be selectable by the subscribing role: + +```js +channel.on( + 'postgres_changes', + { event: '*', schema: 'public', table: 'users', select: ['id', 'first_name'] }, + (payload) => { + // payload.new only contains { id, first_name } + console.log(payload) + } +) +``` + +## Get All Channels + +You can see all the channels that your client has instantiatied. + +```js +// Setup... + +client.getChannels() +``` + +## Cleanup + +It is highly recommended that you clean up your channels after you're done with them. + +- Remove a single channel + +```js +// Setup... + +const channel = client.channel('some-channel-to-remove') + +channel.unsubscribe() +client.removeChannel(channel) +``` + +- Remove all channels and close the connection + +```js +// Setup... + +client.removeAllChannels() +client.disconnect() +``` + +## Development + +This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/supabase-js). To work on this package: + +### Building + +```bash +# Complete build (from monorepo root) +pnpm nx build realtime-js + +# Build with watch mode for development +pnpm nx build realtime-js --watch + +# Individual build targets +pnpm nx build:main realtime-js # CommonJS build (dist/main/) +pnpm nx build:module realtime-js # ES Modules build (dist/module/) + +# Other useful commands +pnpm nx clean realtime-js # Clean build artifacts +pnpm nx lint realtime-js # Run ESLint +pnpm nx typecheck realtime-js # TypeScript type checking +``` + +#### Build Outputs + +- **CommonJS (`dist/main/`)** - For Node.js environments +- **ES Modules (`dist/module/`)** - For modern bundlers (Webpack, Vite, Rollup) +- **TypeScript definitions (`dist/module/index.d.ts`)** - Type definitions for TypeScript projects + +Note: Unlike some other packages, realtime-js doesn't include a UMD build since it's primarily used in Node.js or bundled applications. + +#### Validating Package Exports + +```bash +# Check if package exports are correctly configured +pnpm nx check-exports realtime-js +``` + +This command uses ["Are the types wrong?"](https://github.com/arethetypeswrong/arethetypeswrong.github.io) to verify that the package exports work correctly in different environments. Run this before publishing to ensure your package can be imported correctly by all consumers. + +### Testing + +**No Docker or Supabase instance required!** The realtime-js tests use mocked WebSocket connections, so they're completely self-contained. + +```bash +# Run unit tests (from monorepo root) +pnpm nx test realtime-js + +# Run tests with coverage report +pnpm nx test:coverage realtime-js + +# Run tests in watch mode during development +pnpm nx test:watch realtime-js +``` + +#### Test Scripts Explained + +- **test** - Runs all unit tests once using Vitest +- **test:coverage** - Runs tests and generates coverage report with terminal output +- **test:watch** - Runs tests in interactive watch mode for development + +The tests mock WebSocket connections using `mock-socket`, so you can run them anytime without any external dependencies. + +### Contributing + +We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started. + +For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. + +## Credits + +This repo draws heavily from [phoenix-js](https://github.com/phoenixframework/phoenix/tree/master/assets/js/phoenix). + +## License + +MIT. diff --git a/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e1121cd15183ae324d1a5480483c5d364620a66 --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts @@ -0,0 +1,62 @@ +import type RealtimeChannel from './RealtimeChannel'; +export type Presence = { + presence_ref: string; +} & T; +export type RealtimePresenceState = { + [key: string]: Presence[]; +}; +export type RealtimePresenceJoinPayload = { + event: `${REALTIME_PRESENCE_LISTEN_EVENTS.JOIN}`; + key: string; + currentPresences: Presence[]; + newPresences: Presence[]; +}; +export type RealtimePresenceLeavePayload = { + event: `${REALTIME_PRESENCE_LISTEN_EVENTS.LEAVE}`; + key: string; + currentPresences: Presence[]; + leftPresences: Presence[]; +}; +export declare enum REALTIME_PRESENCE_LISTEN_EVENTS { + SYNC = "sync", + JOIN = "join", + LEAVE = "leave" +} +export type RealtimePresenceOptions = { + events?: { + state: string; + diff: string; + }; +}; +export default class RealtimePresence { + channel: RealtimeChannel; + get state(): RealtimePresenceState; + private presenceAdapter; + /** + * Creates a Presence helper that keeps the local presence state in sync with the server. + * + * @param channel - The realtime channel to bind to. + * @param opts - Optional custom event names, e.g. `{ events: { state: 'state', diff: 'diff' } }`. + * + * @category Realtime + * + * @example Example for a presence channel + * ```ts + * const presence = new RealtimePresence(channel) + * + * channel.on('presence', ({ event, key }) => { + * console.log(`Presence ${event} on ${key}`) + * }) + * ``` + */ + constructor(channel: RealtimeChannel, opts?: RealtimePresenceOptions); +} +//# sourceMappingURL=RealtimePresence.d.ts.map \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..166fa89a293032036e67d6abda873478a1dead3d --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"RealtimePresence.d.ts","sourceRoot":"","sources":["../../src/RealtimePresence.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAA;AAGpD,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,EAAE,IAAI;IAC5D,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,CAAC,CAAA;AAEL,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,EAAE,IAAI;IACzE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI;IAC1E,KAAK,EAAE,GAAG,+BAA+B,CAAC,IAAI,EAAE,CAAA;IAChD,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/B,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI;IAC3E,KAAK,EAAE,GAAG,+BAA+B,CAAC,KAAK,EAAE,CAAA;IACjD,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/B,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;CAC7B,CAAA;AAED,oBAAY,+BAA+B;IACzC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACzC,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAyB1B,OAAO,EAAE,eAAe;IAxBjC,IAAI,KAAK,0BAER;IAED,OAAO,CAAC,eAAe,CAAiB;IAExC;;;;;;;;;;;;;;;;OAgBG;gBAEM,OAAO,EAAE,eAAe,EAC/B,IAAI,CAAC,EAAE,uBAAuB;CAIjC"} \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js new file mode 100644 index 0000000000000000000000000000000000000000..7ce1f5e80cab55aa392b2ac8383878b1785b1950 --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js @@ -0,0 +1,38 @@ +/* + This file draws heavily from https://github.com/phoenixframework/phoenix/blob/d344ec0a732ab4ee204215b31de69cf4be72e3bf/assets/js/phoenix/presence.js + License: https://github.com/phoenixframework/phoenix/blob/d344ec0a732ab4ee204215b31de69cf4be72e3bf/LICENSE.md +*/ +import PresenceAdapter from './phoenix/presenceAdapter'; +export var REALTIME_PRESENCE_LISTEN_EVENTS; +(function (REALTIME_PRESENCE_LISTEN_EVENTS) { + REALTIME_PRESENCE_LISTEN_EVENTS["SYNC"] = "sync"; + REALTIME_PRESENCE_LISTEN_EVENTS["JOIN"] = "join"; + REALTIME_PRESENCE_LISTEN_EVENTS["LEAVE"] = "leave"; +})(REALTIME_PRESENCE_LISTEN_EVENTS || (REALTIME_PRESENCE_LISTEN_EVENTS = {})); +export default class RealtimePresence { + get state() { + return this.presenceAdapter.state; + } + /** + * Creates a Presence helper that keeps the local presence state in sync with the server. + * + * @param channel - The realtime channel to bind to. + * @param opts - Optional custom event names, e.g. `{ events: { state: 'state', diff: 'diff' } }`. + * + * @category Realtime + * + * @example Example for a presence channel + * ```ts + * const presence = new RealtimePresence(channel) + * + * channel.on('presence', ({ event, key }) => { + * console.log(`Presence ${event} on ${key}`) + * }) + * ``` + */ + constructor(channel, opts) { + this.channel = channel; + this.presenceAdapter = new PresenceAdapter(this.channel.channelAdapter, opts); + } +} +//# sourceMappingURL=RealtimePresence.js.map \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3aa22598d8af07c6bc724083408372d580ca266f --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RealtimePresence.js","sourceRoot":"","sources":["../../src/RealtimePresence.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAGF,OAAO,eAAe,MAAM,2BAA2B,CAAA;AAwBvD,MAAM,CAAN,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACzC,gDAAa,CAAA;IACb,gDAAa,CAAA;IACb,kDAAe,CAAA;AACjB,CAAC,EAJW,+BAA+B,KAA/B,+BAA+B,QAI1C;AAMD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAA;IACnC,CAAC;IAID;;;;;;;;;;;;;;;;OAgBG;IACH,YACS,OAAwB,EAC/B,IAA8B;QADvB,YAAO,GAAP,OAAO,CAAiB;QAG/B,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAA;IAC/E,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo b/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo new file mode 100644 index 0000000000000000000000000000000000000000..f3c5d70ae5c5c77fd560a84d6a9479ea8c1a6c5f --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/tsconfig.module.tsbuildinfo @@ -0,0 +1 @@ +{"fileNames":["../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.d.ts","../src/lib/version.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/types.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/push.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/index.d.ts","../src/phoenix/types.ts","../src/lib/constants.ts","../src/lib/websocket-factory.ts","../src/lib/serializer.ts","../src/lib/transformers.ts","../src/phoenix/socketAdapter.ts","../src/RealtimeClient.ts","../src/phoenix/channelAdapter.ts","../src/phoenix/presenceAdapter.ts","../src/RealtimePresence.ts","../src/lib/normalizeChannelError.ts","../src/RealtimePostgresFilterBuilder.ts","../src/RealtimeChannel.ts","../src/index.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.typedarray.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.buffer.d.ts","../../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/child_process.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/cluster.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/console.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/constants.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/crypto.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dgram.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/domain.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dom-events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http2.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/https.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/inspector.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/module.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/net.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/os.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/path.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/process.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/punycode.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/querystring.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/repl.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/sea.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/web.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/test.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tls.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/trace_events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tty.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/url.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/util.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/v8.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/vm.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/wasi.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/zlib.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/index.d.ts","../../../../node_modules/.pnpm/@types+jsonwebtoken@8.5.9/node_modules/@types/jsonwebtoken/index.d.ts"],"fileIdsList":[[63,64,65,66,90,133],[90,133],[62,63,64,65,66,67,68,69,90,133],[63,67,90,133],[63,90,133],[62,63,64,67,90,133],[61,62,90,133],[90,133,182],[90,130,133],[90,132,133],[133],[90,133,138,167],[90,133,134,139,145,146,153,164,175],[90,133,134,135,145,153],[85,86,87,90,133],[90,133,136,176],[90,133,137,138,146,154],[90,133,138,164,172],[90,133,139,141,145,153],[90,132,133,140],[90,133,141,142],[90,133,143,145],[90,132,133,145],[90,133,145,146,147,164,175],[90,133,145,146,147,160,164,167],[90,128,133],[90,133,141,145,148,153,164,175],[90,133,145,146,148,149,153,164,172,175],[90,133,148,150,164,172,175],[88,89,90,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[90,133,145,151],[90,133,152,175,180],[90,133,141,145,153,164],[90,133,154],[90,133,155],[90,132,133,156],[90,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[90,133,158],[90,133,159],[90,133,145,160,161],[90,133,160,162,176,178],[90,133,145,164,165,167],[90,133,166,167],[90,133,164,165],[90,133,167],[90,133,168],[90,130,133,164,169],[90,133,145,170,171],[90,133,170,171],[90,133,138,153,164,172],[90,133,173],[90,133,153,174],[90,133,148,159,175],[90,133,138,176],[90,133,164,177],[90,133,152,178],[90,133,179],[90,133,145,147,156,164,167,175,178,180],[90,133,164,181],[90,100,104,133,175],[90,100,133,164,175],[90,95,133],[90,97,100,133,172,175],[90,133,153,172],[90,95,133,182],[90,97,100,133,153,175],[90,92,93,96,99,133,145,164,175],[90,100,107,133],[90,92,98,133],[90,100,121,122,133],[90,96,100,133,167,175,182],[90,121,133,182],[90,94,95,133,182],[90,100,133],[90,94,95,96,97,98,99,100,101,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,123,124,125,126,127,133],[90,100,115,133],[90,100,107,108,133],[90,98,100,108,109,133],[90,99,133],[90,92,95,100,133],[90,100,104,108,109,133],[90,104,133],[90,98,100,103,133,175],[90,92,97,100,107,133],[90,133,164],[90,95,100,121,133,180,182],[59,71,72,75,77,78,80,81,82,90,133],[59,71,72,73,74,75,76,83,90,133],[59,90,133],[59,79,83,90,133],[59,73,77,80,83,90,133],[59,60,71,90,133],[59,70,71,72,76,83,90,133],[59,70,71,78,80,90,133],[59,70,71,72,77,90,133],[59,70,90,133]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"440cb49331c56cd592851f31d646721775359ba1eec5451c1a2b011840e14740","signature":"be0899822ae6a4989051302579dfb478226abcbb204ae2fff49ff68bb35ad362"},{"version":"1621da3c4da45c37b79d6d361f7de9f0ea40b171dd11ef1ef1bb026665965fc9","impliedFormat":1},{"version":"3878700a966f0201a3e2b9aea8b75cc65008741c359889314e7b0c56c0c07b56","impliedFormat":1},{"version":"f040575209f695a7616fba0045e6a0c88d19d77b246a0098caeb4c9384447d15","impliedFormat":1},{"version":"1fcc4bb6d083b31e1587711ab5a8b0467b52a125f9735467774285bc8cc127e6","impliedFormat":1},{"version":"2193f35e13aee12b162670006604b914edb47fa0e391f39a8fe94a5402b60139","impliedFormat":1},{"version":"0e085cc503ad1332728d56244e9f7a603404beca17c0c5b2d815ed29e0727d4b","impliedFormat":1},{"version":"deda38d3245acb0404dd845dae172547c895c99c442082f176071cbb40d092f3","impliedFormat":1},{"version":"89659dc89f3a21d2a29c898297c96d56ef49f25eee0ee54aace7bd00758b6334","impliedFormat":1},{"version":"df4e0cf0d4a4ea996065de24fb0f621f96321f048869fbf4ef58a55593084d16","impliedFormat":1},{"version":"e6f3d02d69394dae0771c088b3c0b982cf15b6a91678c59f1d5fbd7c5e6ad8f8","impliedFormat":1},{"version":"b8a1713ca8c673a77f367cb999fb99e38857a3a63773563f957ba7aa35773c64","signature":"ef182902b33ac9b9ad90c163b313722d2bc9d8c2cfefeb418b3205d70504a486"},{"version":"999422164f1c0a7e6752769e1895f37ddcc30ef38bb747a2f95c859dd14c99d7","signature":"24911a68c2bf41d4c1ef50f348c4a8ff5dce2c24fdbad4b3dfa6b13416586347"},{"version":"2ff46c35f9aa3a1b53d02da9fdb7dcacf993dc5d7b2b47e9d504b3aa0d78de0b","signature":"5a800cb44fd70e436adf02e020dea317b0026786910e4bbc7ca014208c894ffd"},{"version":"1f4bc648881142502012c47a20f58810bd05fbb77ce1bbc8ec375cdb3c48128e","signature":"2b6c6039f4d2f656904d66f82231488f4852f861d27147884895097f74e3e812"},{"version":"a7f36938ca5806a4dcf38b49552c99361173d8e71a50fe87576b3820163a26b8","signature":"963de0b3445cc4323b606aeb7f9ce711425700088c766aac88fbd5fffd4b5c5f"},{"version":"6533d0e6ba8c44aa52b5149c6e1c3ab4a2e30a9d335ace2bbd86f98efe8d0b15","signature":"f433c0d7201ac0aa6904dbd08e9ab5fa3edf986ffa839ba90153201775d30a46"},{"version":"45b389dd47cf9fad7d097bbbf6bdba054d324f160ac768046a75695213b23b2f","signature":"cc06f33fc3cf6fe668cb89ea339a94b9d4a34ac1a97f72b9c7cf8d461eaf3416"},{"version":"8d68260e686f4c39abfd4534611598dbf46e78effb8d3fb53f8aedf45c1f0195","signature":"648f8efc20f2b0f36b1e90235aae754e3570fc78aeac5fd870ea447f0664a3d7"},{"version":"ff8007a9dd6ce59acb658e3002a53bfb71adc96ad0f312df17cc92023b56f9fb","signature":"26e665c1d4e03ceb2ea99fad6492cf213acc650bf41939cd8388ba3b60900427"},{"version":"8f46c9fad693160b323821763473ad0694db52eb158276ea14bc0fcd6b709e67","signature":"95bdd836ed77c23e530fcd3a0823df8fd611035590dfd8d38ee164c56f2bd2c4"},{"version":"9d2514a52535fcc0b50cadddeaca991246cff67acd4f046dd2a9ced348333708","signature":"db8fefaee4e14c6b8dd507c69ceebee78422cb938374d30dfd1f21e84d6a75f1"},{"version":"b034df3bfd937ddf8b2cb2431c0444360682bbca7e46665cb1fb132289395816","signature":"f96537f0fcfd0379e3254479573ffebc8a67c13a2cd3144c744b032af33800b9"},{"version":"69c17ac55199aa7405f50dc5ade2e339f7dcc47af334f88a38f756b9d8de6779","signature":"c2d50e73c775fee10c2361880cd227f3497a67677536208cd0e8a5d5ab562a0d"},{"version":"261881658863312a66b3912ec63de3d2a8cfda57cc3f244d2ad7248b255a6bb4","signature":"435279e408da8dba444c8ba93bbefddcae9e99b33acfc9a7c3318583e8f4a745"},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"49a5a44f2e68241a1d2bd9ec894535797998841c09729e506a7cbfcaa40f2180","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"1ca84b44ad1d8e4576f24904d8b95dd23b94ea67e1575f89614ac90062fc67f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d586db0a09a9495ebb5dece28f54df9684bfbd6e1f568426ca153126dac4a40","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"567b7f607f400873151d7bc63a049514b53c3c00f5f56e9e95695d93b66a138e","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","impliedFormat":1},{"version":"84c1930e33d1bb12ad01bcbe11d656f9646bd21b2fb2afd96e8e10615a021aef","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"2bf469abae4cc9c0f340d4e05d9d26e37f936f9c8ca8f007a6534f109dcc77e4","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4c21aaa8257d7950a5b75a251d9075b6a371208fc948c9c8402f6690ef3b5b55","impliedFormat":1},{"version":"b5895e6353a5d708f55d8685c38a235c3a6d8138e374dee8ceb8ffde5aa8002a","impliedFormat":1},{"version":"54c4f21f578864961efc94e8f42bc893a53509e886370ec7dd602e0151b9266c","impliedFormat":1},{"version":"de735eca2c51dd8b860254e9fdb6d9ec19fe402dfe597c23090841ce3937cfc5","impliedFormat":1},{"version":"4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"5155da3047ef977944d791a2188ff6e6c225f6975cc1910ab7bb6838ab84cede","impliedFormat":1},{"version":"93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"e16d218a30f6a6810b57f7e968124eaa08c7bb366133ea34bbf01e7cd6b8c0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb8692dea24c27821f77e397272d9ed2eda0b95e4a75beb0fdda31081d15a8ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"5b6844ad931dcc1d3aca53268f4bd671428421464b1286746027aede398094f2","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"0dbcebe2126d03936c70545e96a6e41007cf065be38a1ce4d32a39fcedefead4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","impliedFormat":1},{"version":"461e54289e6287e8494a0178ba18182acce51a02bca8dea219149bf2cf96f105","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"e31e51c55800014d926e3f74208af49cb7352803619855c89296074d1ecbb524","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"dfb96ba5177b68003deec9e773c47257da5c4c8a74053d8956389d832df72002","affectsGlobalScope":true,"impliedFormat":1},{"version":"92d3070580cf72b4bb80959b7f16ede9a3f39e6f4ef2ac87cfa4561844fdc69f","affectsGlobalScope":true,"impliedFormat":1},{"version":"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","impliedFormat":1},{"version":"613deebaec53731ff6b74fe1a89f094b708033db6396b601df3e6d5ab0ec0a47","impliedFormat":1},{"version":"d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c","impliedFormat":1},{"version":"e56eb632f0281c9f8210eb8c86cc4839a427a4ffffcfd2a5e40b956050b3e042","affectsGlobalScope":true,"impliedFormat":1},{"version":"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","impliedFormat":1},{"version":"cac793cc47c29e26e4ac3601dcb00b4435ebed26203485790e44f2ad8b6ad847","impliedFormat":1},{"version":"bb4ed283cfb3db7ec1d4bb79c37f5e96d39b340f1f4de995c4b0b836c8d5fa05","impliedFormat":1}],"root":[60,[71,84]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"importHelpers":true,"module":6,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"outDir":"./module","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"stripInternal":true,"target":4},"referencedMap":[[67,1],[61,2],[70,3],[62,2],[68,4],[66,4],[69,5],[65,6],[64,2],[63,7],[183,8],[130,9],[131,9],[132,10],[90,11],[133,12],[134,13],[135,14],[85,2],[88,15],[86,2],[87,2],[136,16],[137,17],[138,18],[139,19],[140,20],[141,21],[142,21],[144,2],[143,22],[145,23],[146,24],[147,25],[129,26],[89,2],[148,27],[149,28],[150,29],[182,30],[151,31],[152,32],[153,33],[154,34],[155,35],[156,36],[157,37],[158,38],[159,39],[160,40],[161,40],[162,41],[163,2],[164,42],[166,43],[165,44],[167,45],[168,46],[169,47],[170,48],[171,49],[172,50],[173,51],[174,52],[175,53],[176,54],[177,55],[178,56],[179,57],[180,58],[181,59],[91,2],[59,2],[57,2],[58,2],[10,2],[12,2],[11,2],[2,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[3,2],[21,2],[22,2],[4,2],[23,2],[27,2],[24,2],[25,2],[26,2],[28,2],[29,2],[30,2],[5,2],[31,2],[32,2],[33,2],[34,2],[6,2],[38,2],[35,2],[36,2],[37,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[51,2],[9,2],[52,2],[53,2],[54,2],[56,2],[55,2],[1,2],[107,60],[117,61],[106,60],[127,62],[98,63],[97,64],[126,8],[120,65],[125,66],[100,67],[114,68],[99,69],[123,70],[95,71],[94,8],[124,72],[96,73],[101,74],[102,2],[105,74],[92,2],[128,75],[118,76],[109,77],[110,78],[112,79],[108,80],[111,81],[121,8],[103,82],[104,83],[113,84],[93,85],[116,76],[115,74],[119,2],[122,86],[83,87],[77,88],[82,89],[80,90],[84,91],[72,92],[81,89],[74,89],[75,89],[60,89],[73,89],[78,93],[79,94],[76,95],[71,96]],"latestChangedDtsFile":"./module/index.d.ts","version":"5.8.3"} \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo b/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo new file mode 100644 index 0000000000000000000000000000000000000000..62d9f95973a60a53d6703f5ce11c179ae69af14e --- /dev/null +++ b/node_modules/@supabase/realtime-js/dist/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"fileNames":["../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.d.ts","../src/lib/version.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/constants.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/longpoll.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/types.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/timer.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/socket.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/push.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/channel.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/presence.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/serializer.d.ts","../../../../node_modules/.pnpm/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/types/index.d.ts","../src/phoenix/types.ts","../src/lib/constants.ts","../src/lib/websocket-factory.ts","../src/lib/serializer.ts","../src/lib/transformers.ts","../src/phoenix/socketAdapter.ts","../src/RealtimeClient.ts","../src/phoenix/channelAdapter.ts","../src/phoenix/presenceAdapter.ts","../src/RealtimePresence.ts","../src/lib/normalizeChannelError.ts","../src/RealtimePostgresFilterBuilder.ts","../src/RealtimeChannel.ts","../src/index.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/disposable.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/indexable.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/iterators.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/compatibility/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.typedarray.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.buffer.d.ts","../../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/globals.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/buffer.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/child_process.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/cluster.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/console.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/constants.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/crypto.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dgram.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/diagnostics_channel.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/domain.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/dom-events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/http2.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/https.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/inspector.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/module.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/net.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/os.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/path.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/process.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/punycode.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/querystring.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/readline/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/repl.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/sea.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/consumers.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/stream/web.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/test.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tls.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/trace_events.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/tty.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/url.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/util.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/v8.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/vm.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/wasi.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/zlib.d.ts","../../../../node_modules/.pnpm/@types+node@20.19.9/node_modules/@types/node/index.d.ts","../../../../node_modules/.pnpm/@types+jsonwebtoken@8.5.9/node_modules/@types/jsonwebtoken/index.d.ts"],"fileIdsList":[[63,64,65,66,90,133],[90,133],[62,63,64,65,66,67,68,69,90,133],[63,67,90,133],[63,90,133],[62,63,64,67,90,133],[61,62,90,133],[90,133,182],[90,130,133],[90,132,133],[133],[90,133,138,167],[90,133,134,139,145,146,153,164,175],[90,133,134,135,145,153],[85,86,87,90,133],[90,133,136,176],[90,133,137,138,146,154],[90,133,138,164,172],[90,133,139,141,145,153],[90,132,133,140],[90,133,141,142],[90,133,143,145],[90,132,133,145],[90,133,145,146,147,164,175],[90,133,145,146,147,160,164,167],[90,128,133],[90,133,141,145,148,153,164,175],[90,133,145,146,148,149,153,164,172,175],[90,133,148,150,164,172,175],[88,89,90,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[90,133,145,151],[90,133,152,175,180],[90,133,141,145,153,164],[90,133,154],[90,133,155],[90,132,133,156],[90,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181],[90,133,158],[90,133,159],[90,133,145,160,161],[90,133,160,162,176,178],[90,133,145,164,165,167],[90,133,166,167],[90,133,164,165],[90,133,167],[90,133,168],[90,130,133,164,169],[90,133,145,170,171],[90,133,170,171],[90,133,138,153,164,172],[90,133,173],[90,133,153,174],[90,133,148,159,175],[90,133,138,176],[90,133,164,177],[90,133,152,178],[90,133,179],[90,133,145,147,156,164,167,175,178,180],[90,133,164,181],[90,100,104,133,175],[90,100,133,164,175],[90,95,133],[90,97,100,133,172,175],[90,133,153,172],[90,95,133,182],[90,97,100,133,153,175],[90,92,93,96,99,133,145,164,175],[90,100,107,133],[90,92,98,133],[90,100,121,122,133],[90,96,100,133,167,175,182],[90,121,133,182],[90,94,95,133,182],[90,100,133],[90,94,95,96,97,98,99,100,101,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,123,124,125,126,127,133],[90,100,115,133],[90,100,107,108,133],[90,98,100,108,109,133],[90,99,133],[90,92,95,100,133],[90,100,104,108,109,133],[90,104,133],[90,98,100,103,133,175],[90,92,97,100,107,133],[90,133,164],[90,95,100,121,133,180,182],[59,71,72,75,77,78,80,81,82,90,133],[59,71,72,73,74,75,76,83,90,133],[59,90,133],[59,79,83,90,133],[59,73,77,80,83,90,133],[59,60,71,90,133],[59,70,71,72,76,83,90,133],[59,70,71,78,80,90,133],[59,70,71,72,77,90,133],[59,70,90,133]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"440cb49331c56cd592851f31d646721775359ba1eec5451c1a2b011840e14740","signature":"be0899822ae6a4989051302579dfb478226abcbb204ae2fff49ff68bb35ad362"},{"version":"1621da3c4da45c37b79d6d361f7de9f0ea40b171dd11ef1ef1bb026665965fc9","impliedFormat":1},{"version":"3878700a966f0201a3e2b9aea8b75cc65008741c359889314e7b0c56c0c07b56","impliedFormat":1},{"version":"f040575209f695a7616fba0045e6a0c88d19d77b246a0098caeb4c9384447d15","impliedFormat":1},{"version":"1fcc4bb6d083b31e1587711ab5a8b0467b52a125f9735467774285bc8cc127e6","impliedFormat":1},{"version":"2193f35e13aee12b162670006604b914edb47fa0e391f39a8fe94a5402b60139","impliedFormat":1},{"version":"0e085cc503ad1332728d56244e9f7a603404beca17c0c5b2d815ed29e0727d4b","impliedFormat":1},{"version":"deda38d3245acb0404dd845dae172547c895c99c442082f176071cbb40d092f3","impliedFormat":1},{"version":"89659dc89f3a21d2a29c898297c96d56ef49f25eee0ee54aace7bd00758b6334","impliedFormat":1},{"version":"df4e0cf0d4a4ea996065de24fb0f621f96321f048869fbf4ef58a55593084d16","impliedFormat":1},{"version":"e6f3d02d69394dae0771c088b3c0b982cf15b6a91678c59f1d5fbd7c5e6ad8f8","impliedFormat":1},{"version":"b8a1713ca8c673a77f367cb999fb99e38857a3a63773563f957ba7aa35773c64","signature":"ef182902b33ac9b9ad90c163b313722d2bc9d8c2cfefeb418b3205d70504a486"},{"version":"999422164f1c0a7e6752769e1895f37ddcc30ef38bb747a2f95c859dd14c99d7","signature":"24911a68c2bf41d4c1ef50f348c4a8ff5dce2c24fdbad4b3dfa6b13416586347"},{"version":"2ff46c35f9aa3a1b53d02da9fdb7dcacf993dc5d7b2b47e9d504b3aa0d78de0b","signature":"5a800cb44fd70e436adf02e020dea317b0026786910e4bbc7ca014208c894ffd"},{"version":"1f4bc648881142502012c47a20f58810bd05fbb77ce1bbc8ec375cdb3c48128e","signature":"2b6c6039f4d2f656904d66f82231488f4852f861d27147884895097f74e3e812"},{"version":"a7f36938ca5806a4dcf38b49552c99361173d8e71a50fe87576b3820163a26b8","signature":"963de0b3445cc4323b606aeb7f9ce711425700088c766aac88fbd5fffd4b5c5f"},{"version":"6533d0e6ba8c44aa52b5149c6e1c3ab4a2e30a9d335ace2bbd86f98efe8d0b15","signature":"f433c0d7201ac0aa6904dbd08e9ab5fa3edf986ffa839ba90153201775d30a46"},{"version":"45b389dd47cf9fad7d097bbbf6bdba054d324f160ac768046a75695213b23b2f","signature":"cc06f33fc3cf6fe668cb89ea339a94b9d4a34ac1a97f72b9c7cf8d461eaf3416"},{"version":"8d68260e686f4c39abfd4534611598dbf46e78effb8d3fb53f8aedf45c1f0195","signature":"648f8efc20f2b0f36b1e90235aae754e3570fc78aeac5fd870ea447f0664a3d7"},{"version":"ff8007a9dd6ce59acb658e3002a53bfb71adc96ad0f312df17cc92023b56f9fb","signature":"26e665c1d4e03ceb2ea99fad6492cf213acc650bf41939cd8388ba3b60900427"},{"version":"8f46c9fad693160b323821763473ad0694db52eb158276ea14bc0fcd6b709e67","signature":"95bdd836ed77c23e530fcd3a0823df8fd611035590dfd8d38ee164c56f2bd2c4"},{"version":"9d2514a52535fcc0b50cadddeaca991246cff67acd4f046dd2a9ced348333708","signature":"db8fefaee4e14c6b8dd507c69ceebee78422cb938374d30dfd1f21e84d6a75f1"},{"version":"b034df3bfd937ddf8b2cb2431c0444360682bbca7e46665cb1fb132289395816","signature":"f96537f0fcfd0379e3254479573ffebc8a67c13a2cd3144c744b032af33800b9"},{"version":"69c17ac55199aa7405f50dc5ade2e339f7dcc47af334f88a38f756b9d8de6779","signature":"c2d50e73c775fee10c2361880cd227f3497a67677536208cd0e8a5d5ab562a0d"},{"version":"261881658863312a66b3912ec63de3d2a8cfda57cc3f244d2ad7248b255a6bb4","signature":"435279e408da8dba444c8ba93bbefddcae9e99b33acfc9a7c3318583e8f4a745"},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"a79e62f1e20467e11a904399b8b18b18c0c6eea6b50c1168bf215356d5bebfaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"49a5a44f2e68241a1d2bd9ec894535797998841c09729e506a7cbfcaa40f2180","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"1ca84b44ad1d8e4576f24904d8b95dd23b94ea67e1575f89614ac90062fc67f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d586db0a09a9495ebb5dece28f54df9684bfbd6e1f568426ca153126dac4a40","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"567b7f607f400873151d7bc63a049514b53c3c00f5f56e9e95695d93b66a138e","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3e58c4c18a031cbb17abec7a4ad0bd5ae9fc70c1f4ba1e7fb921ad87c504aca","impliedFormat":1},{"version":"84c1930e33d1bb12ad01bcbe11d656f9646bd21b2fb2afd96e8e10615a021aef","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4b87f767c7bc841511113c876a6b8bf1fd0cb0b718c888ad84478b372ec486b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d04e3640dd9eb67f7f1e5bd3d0bf96c784666f7aefc8ac1537af6f2d38d4c29","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"2bf469abae4cc9c0f340d4e05d9d26e37f936f9c8ca8f007a6534f109dcc77e4","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"71450bbc2d82821d24ca05699a533e72758964e9852062c53b30f31c36978ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ada07543808f3b967624645a8e1ccd446f8b01ade47842acf1328aec899fed0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4c21aaa8257d7950a5b75a251d9075b6a371208fc948c9c8402f6690ef3b5b55","impliedFormat":1},{"version":"b5895e6353a5d708f55d8685c38a235c3a6d8138e374dee8ceb8ffde5aa8002a","impliedFormat":1},{"version":"54c4f21f578864961efc94e8f42bc893a53509e886370ec7dd602e0151b9266c","impliedFormat":1},{"version":"de735eca2c51dd8b860254e9fdb6d9ec19fe402dfe597c23090841ce3937cfc5","impliedFormat":1},{"version":"4ff41188773cbf465807dd2f7059c7494cbee5115608efc297383832a1150c43","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"5155da3047ef977944d791a2188ff6e6c225f6975cc1910ab7bb6838ab84cede","impliedFormat":1},{"version":"93f437e1398a4f06a984f441f7fa7a9f0535c04399619b5c22e0b87bdee182cb","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"e16d218a30f6a6810b57f7e968124eaa08c7bb366133ea34bbf01e7cd6b8c0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb8692dea24c27821f77e397272d9ed2eda0b95e4a75beb0fdda31081d15a8ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"8145e07aad6da5f23f2fcd8c8e4c5c13fb26ee986a79d03b0829b8fce152d8b2","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"5b6844ad931dcc1d3aca53268f4bd671428421464b1286746027aede398094f2","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"125d792ec6c0c0f657d758055c494301cc5fdb327d9d9d5960b3f129aff76093","impliedFormat":1},{"version":"0dbcebe2126d03936c70545e96a6e41007cf065be38a1ce4d32a39fcedefead4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1851a3b4db78664f83901bb9cac9e45e03a37bb5933cc5bf37e10bb7e91ab4eb","impliedFormat":1},{"version":"461e54289e6287e8494a0178ba18182acce51a02bca8dea219149bf2cf96f105","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"e31e51c55800014d926e3f74208af49cb7352803619855c89296074d1ecbb524","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"dfb96ba5177b68003deec9e773c47257da5c4c8a74053d8956389d832df72002","affectsGlobalScope":true,"impliedFormat":1},{"version":"92d3070580cf72b4bb80959b7f16ede9a3f39e6f4ef2ac87cfa4561844fdc69f","affectsGlobalScope":true,"impliedFormat":1},{"version":"d3dffd70e6375b872f0b4e152de4ae682d762c61a24881ecc5eb9f04c5caf76f","impliedFormat":1},{"version":"613deebaec53731ff6b74fe1a89f094b708033db6396b601df3e6d5ab0ec0a47","impliedFormat":1},{"version":"d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c","impliedFormat":1},{"version":"e56eb632f0281c9f8210eb8c86cc4839a427a4ffffcfd2a5e40b956050b3e042","affectsGlobalScope":true,"impliedFormat":1},{"version":"e8a979b8af001c9fc2e774e7809d233c8ca955a28756f52ee5dee88ccb0611d2","impliedFormat":1},{"version":"cac793cc47c29e26e4ac3601dcb00b4435ebed26203485790e44f2ad8b6ad847","impliedFormat":1},{"version":"bb4ed283cfb3db7ec1d4bb79c37f5e96d39b340f1f4de995c4b0b836c8d5fa05","impliedFormat":1}],"root":[60,[71,84]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"importHelpers":true,"module":1,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"outDir":"./main","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"stripInternal":true,"target":4},"referencedMap":[[67,1],[61,2],[70,3],[62,2],[68,4],[66,4],[69,5],[65,6],[64,2],[63,7],[183,8],[130,9],[131,9],[132,10],[90,11],[133,12],[134,13],[135,14],[85,2],[88,15],[86,2],[87,2],[136,16],[137,17],[138,18],[139,19],[140,20],[141,21],[142,21],[144,2],[143,22],[145,23],[146,24],[147,25],[129,26],[89,2],[148,27],[149,28],[150,29],[182,30],[151,31],[152,32],[153,33],[154,34],[155,35],[156,36],[157,37],[158,38],[159,39],[160,40],[161,40],[162,41],[163,2],[164,42],[166,43],[165,44],[167,45],[168,46],[169,47],[170,48],[171,49],[172,50],[173,51],[174,52],[175,53],[176,54],[177,55],[178,56],[179,57],[180,58],[181,59],[91,2],[59,2],[57,2],[58,2],[10,2],[12,2],[11,2],[2,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[3,2],[21,2],[22,2],[4,2],[23,2],[27,2],[24,2],[25,2],[26,2],[28,2],[29,2],[30,2],[5,2],[31,2],[32,2],[33,2],[34,2],[6,2],[38,2],[35,2],[36,2],[37,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[51,2],[9,2],[52,2],[53,2],[54,2],[56,2],[55,2],[1,2],[107,60],[117,61],[106,60],[127,62],[98,63],[97,64],[126,8],[120,65],[125,66],[100,67],[114,68],[99,69],[123,70],[95,71],[94,8],[124,72],[96,73],[101,74],[102,2],[105,74],[92,2],[128,75],[118,76],[109,77],[110,78],[112,79],[108,80],[111,81],[121,8],[103,82],[104,83],[113,84],[93,85],[116,76],[115,74],[119,2],[122,86],[83,87],[77,88],[82,89],[80,90],[84,91],[72,92],[81,89],[74,89],[75,89],[60,89],[73,89],[78,93],[79,94],[76,95],[71,96]],"latestChangedDtsFile":"./main/index.d.ts","version":"5.8.3"} \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/migrations/README.md b/node_modules/@supabase/realtime-js/migrations/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bfcf0c2b24c27a832052e0516f5b955fecaf3f67 --- /dev/null +++ b/node_modules/@supabase/realtime-js/migrations/README.md @@ -0,0 +1,25 @@ +# Migration notes for `@supabase/realtime-js` + +Each file in this directory describes one migration theme — what changed in `@supabase/realtime-js`, who is affected, and what callers need to do. + +Files are shipped with the npm package, so the migration notes you see here are pinned to the version of `@supabase/realtime-js` you have installed. Upgrading the package brings the relevant migration notes along with it. + +## How agents should use this directory + +When helping a developer upgrade `@supabase/realtime-js`: + +1. Read the migration files in `node_modules/@supabase/realtime-js/migrations/` for the version they have installed. +2. Cross-reference against the version they are upgrading to. +3. Apply the migration steps described in each relevant file. + +## How humans should use this directory + +Browse the files for the migration theme you care about. Each file is self-contained and explains its own scope, audience, and steps. + +## File naming + +One file per migration theme, named by topic rather than version (e.g. `.md`, kebab-case). A single version can ship multiple theme files; a single theme can span multiple versions. Each file documents its own `Since` / `Will require action by` version range internally. + +## Cross-cutting migration notes + +Migrations that span multiple Supabase packages (e.g. Node.js version drops, monorepo restructures) live in [`docs/MIGRATION.md`](../../../../docs/MIGRATION.md) at the repository root, not here. This directory is scoped to `@supabase/realtime-js` only. diff --git a/node_modules/@supabase/realtime-js/migrations/httpsend-server-version.md b/node_modules/@supabase/realtime-js/migrations/httpsend-server-version.md new file mode 100644 index 0000000000000000000000000000000000000000..5ce0ec58c0abc599d602fed9246209955c60e5d9 --- /dev/null +++ b/node_modules/@supabase/realtime-js/migrations/httpsend-server-version.md @@ -0,0 +1,88 @@ +# `httpSend()` server version requirement + +**Since:** v2.107.0 +**Applies to:** anyone calling `RealtimeChannel.httpSend()` (or `RealtimeChannel.broadcast()` configured to use HTTP) + +`httpSend()` sends broadcast events through a per-event REST endpoint: + +``` +POST /api/broadcast/:topic/events/:event +``` + +This endpoint was added in **Realtime server v2.97.0** ([supabase/realtime#1864](https://github.com/supabase/realtime/pull/1864)). It also enables binary broadcast payloads (`application/octet-stream`), which the older batch endpoint does not support. + +## What changed + +- `httpSend()` calls the new per-event endpoint and expects HTTP `202`. +- On `404`, the client now rejects with a message that names the requirement and the escape hatches (see below) instead of returning the generic `Not Found` text from the server. +- The original `RealtimeChannel.send()` (and its REST fallback) still target the older `POST /api/broadcast` batch endpoint and are unaffected. + +## Who is affected + +You are affected if **all** of the following are true: + +1. You upgraded `@supabase/realtime-js` (or `@supabase/supabase-js`) to **v2.107.0 or later**, **and** +2. You call `httpSend()` (or `broadcast()` with `type: 'broadcast'` routed through HTTP), **and** +3. Your Realtime server is **older than v2.97.0**. + +If you only use the WebSocket `send()` API, or your Realtime server is already on v2.97.0+, nothing changes for you. + +## How to verify the server version + +The Realtime server does not currently emit a version header, so the easiest checks are: + +- **Hosted Supabase:** version is rolled forward continuously and is on v2.97.0+. +- **Local development with the Supabase CLI:** recent CLI versions bundle Realtime v2.97.0+. Update the CLI to the latest stable. +- **Self-hosted:** check the `image:` tag of the Realtime container in your `docker-compose.yml`. + +## What to do + +### If you are on a recent Supabase CLI + +You should already be on a compatible Realtime version. If you still see the 404 error, update the CLI: + +```bash +# macOS / Homebrew +brew upgrade supabase/tap/supabase + +# npm +npm install -g supabase + +# scoop / etc — see https://supabase.com/docs/guides/local-development +``` + +Then restart the local Supabase stack. + +### If you need to pin a specific Realtime version locally + +The CLI honors a per-project pin file. Create the file with the desired image tag: + +```bash +mkdir -p supabase/.temp +echo "v2.97.3" > supabase/.temp/realtime-version +supabase stop && supabase start +``` + +(This is the same mechanism the `@supabase/supabase-js` test harness uses internally.) + +### If you self-host + +Bump the Realtime image in your deployment to `v2.97.3` or newer: + +```yaml +services: + realtime: + image: supabase/realtime:v2.97.3 +``` + +### If you cannot update the server right now + +Downgrade `@supabase/realtime-js` (and `@supabase/supabase-js`) back to **v2.106.x**, which only uses the older `POST /api/broadcast` batch endpoint: + +```bash +npm install @supabase/supabase-js@2.106.2 +``` + +## Why the message is more specific now + +Prior to this release, a 404 from the new endpoint surfaced as a plain `Not Found` error, which was hard to act on. The client now rejects with a message that points at this migration file and the escape hatches above. diff --git a/node_modules/@supabase/realtime-js/package.json b/node_modules/@supabase/realtime-js/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d0ad2aa412fd5a5640ef6feddbc78344c8ef391b --- /dev/null +++ b/node_modules/@supabase/realtime-js/package.json @@ -0,0 +1,63 @@ +{ + "name": "@supabase/realtime-js", + "version": "2.112.3", + "description": "Listen to realtime updates to your PostgreSQL database", + "keywords": [ + "realtime", + "phoenix", + "elixir", + "javascript", + "typescript", + "firebase", + "supabase" + ], + "homepage": "https://github.com/supabase/supabase-js/tree/master/packages/core/realtime-js", + "bugs": "https://github.com/supabase/supabase-js/issues", + "files": [ + "dist", + "src", + "migrations", + "AGENTS.md" + ], + "main": "dist/main/index.js", + "module": "dist/module/index.js", + "types": "dist/module/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/supabase/supabase-js.git", + "directory": "packages/core/realtime-js" + }, + "author": "Supabase", + "license": "MIT", + "dependencies": { + "@supabase/phoenix": "0.4.5", + "tslib": "2.8.1" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.18.2", + "@types/jsonwebtoken": "^8.5.8", + "@vitest/coverage-v8": "^4.1.5", + "jsdom": "^26.0.0", + "jsonwebtoken": "^9.0.0", + "mock-socket": "^9.3.1", + "typedoc": "^0.27.9", + "typescript": "~5.8.3", + "vitest": "4.1.6", + "web-worker": "1.2.0" + }, + "engines": { + "node": ">=22.0.0" + }, + "scripts": { + "build": "npm run build:main && npm run build:module", + "build:main": "tsc -p tsconfig.json", + "build:module": "tsc -p tsconfig.module.json", + "test": "vitest run", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage.enabled true --coverage.reporter=text", + "docs": "typedoc --options ../../../typedoc.base.mjs src/index.ts --out docs/v2", + "docs:json": "typedoc --options ../../../typedoc.base.mjs --json docs/v2/spec.json --excludeExternals src/index.ts", + "check-exports": "attw --pack .", + "test:ci": "vitest run --coverage" + } +} \ No newline at end of file diff --git a/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts b/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ccf75137b868c6051f92b2d9450b23af8880682 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/RealtimeChannel.ts @@ -0,0 +1,1340 @@ +import { CHANNEL_EVENTS, CHANNEL_STATES } from './lib/constants' +import type { ChannelState } from './lib/constants' +import type RealtimeClient from './RealtimeClient' +import RealtimePresence, { REALTIME_PRESENCE_LISTEN_EVENTS } from './RealtimePresence' +import type { + RealtimePresenceJoinPayload, + RealtimePresenceLeavePayload, + RealtimePresenceState, +} from './RealtimePresence' +import * as Transformers from './lib/transformers' +import { httpEndpointURL } from './lib/transformers' +import { normalizeChannelError } from './lib/normalizeChannelError' +import ChannelAdapter from './phoenix/channelAdapter' +import { ChannelBindingCallback, ChannelOnErrorCallback } from './phoenix/types' +import type { Timer } from './phoenix/types' +import { RealtimePostgresFilterBuilder } from './RealtimePostgresFilterBuilder' +import type { RealtimePostgresChangesFilterOperator } from './RealtimePostgresFilterBuilder' + +export type { RealtimePostgresChangesFilterOperator } from './RealtimePostgresFilterBuilder' +export { + RealtimePostgresFilterBuilder, + postgresChangesFilter, +} from './RealtimePostgresFilterBuilder' + +type ReplayOption = { + since: number + limit?: number +} + +export type RealtimeChannelOptions = { + config: { + /** + * self option enables client to receive message it broadcast + * ack option instructs server to acknowledge that broadcast message was received + * replay option instructs server to replay broadcast messages + * replication_ready option instructs the server to emit a `system` event once the + * Postgres replication connection backing this channel is established and ready to + * stream changes. Listen for it with `channel.on('system', {}, (payload) => ...)`; + * the payload's `status` is `'ok'` (`message: 'Replication connection established'`) + * on success or `'error'` if the connection is not ready in time. + */ + broadcast?: { + self?: boolean + ack?: boolean + replay?: ReplayOption + replication_ready?: boolean + } + /** + * key option is used to track presence payload across clients + * + * enabled controls whether this client receives presence state and updates from other + * clients — set it to true (or add an `.on('presence', ...)` listener, which enables it + * automatically) if you want to see who else is present. Without it, this client's + * `presenceState()` stays empty and no `presence` events fire for you, because the + * underlying presence state machine buffers incoming updates until it has received an + * initial snapshot, which is only requested when this flag is set. + * + * It does not gate the other direction: calling `track()` always makes this client + * visible to other subscribers that have presence enabled, regardless of this client's + * own `enabled` setting. On RLS-protected (private) channels, receiving presence updates + * additionally requires the `presence.read` policy to authorize this client. + */ + presence?: { key?: string; enabled?: boolean } + /** + * defines if the channel is private or not and if RLS policies will be used to check data + */ + private?: boolean + } +} + +type RealtimeChangesPayloadBase = { + schema: string + table: string +} + +type RealtimeBroadcastChangesPayloadBase = RealtimeChangesPayloadBase & { + id: string +} + +export type RealtimeBroadcastInsertPayload = + RealtimeBroadcastChangesPayloadBase & { + operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}` + record: T + old_record: null + } + +export type RealtimeBroadcastUpdatePayload = + RealtimeBroadcastChangesPayloadBase & { + operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}` + record: T + old_record: T + } + +export type RealtimeBroadcastDeletePayload = + RealtimeBroadcastChangesPayloadBase & { + operation: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}` + record: null + old_record: T + } + +export type RealtimeBroadcastPayload = + | RealtimeBroadcastInsertPayload + | RealtimeBroadcastUpdatePayload + | RealtimeBroadcastDeletePayload + +type RealtimePostgresChangesPayloadBase = { + schema: string + table: string + commit_timestamp: string + errors: string[] +} + +export type RealtimePostgresInsertPayload = + RealtimePostgresChangesPayloadBase & { + eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}` + new: T + old: {} + } + +export type RealtimePostgresUpdatePayload = + RealtimePostgresChangesPayloadBase & { + eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}` + new: T + old: Partial + } + +export type RealtimePostgresDeletePayload = + RealtimePostgresChangesPayloadBase & { + eventType: `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}` + new: {} + old: Partial + } + +export type RealtimePostgresChangesPayload = + | RealtimePostgresInsertPayload + | RealtimePostgresUpdatePayload + | RealtimePostgresDeletePayload + +export type RealtimePostgresChangesFilter = { + /** + * The type of database change to listen to. + */ + event: T + /** + * The database schema to listen to. + */ + schema: string + /** + * The database table to listen to. + */ + table?: string + /** + * Receive database changes only when the filter is matched. + * + * A filter is a `column=operator.value` expression, e.g. `id=eq.1` or + * `title=like.%foo%`. See {@link RealtimePostgresChangesFilterOperator} for + * the available operators. + * + * Multiple filters can be combined with commas; they are applied as an `AND` + * condition: `filter: 'id=gt.0,id=lt.100'`. + * + * Any operator can be negated with the `not.` prefix: `filter: 'status=not.in.(draft,archived)'`. + * + * The server splits conditions on commas outside quotes/parentheses. To + * include a reserved character (`,`, `(`, `)`) in a value, wrap it in double + * quotes PostgREST-style: `name=eq."a,b"`. The {@link RealtimePostgresFilterBuilder} + * does this quoting for you. + * + * Instead of a raw string you can pass a {@link RealtimePostgresFilterBuilder} + * (via `postgresChangesFilter()`) for a type-checked, ergonomic way to compose filters; the + * SDK serializes it to a string automatically. + */ + filter?: string | RealtimePostgresFilterBuilder + /** + * Restrict the change payload to a subset of columns instead of receiving the + * full row. Reduces payload size (helpful for large `bytea`/`jsonb` columns) + * and the data transferred per event. + * + * The listed columns must be selectable by the subscribing role. + * + * @example + * channel.on('postgres_changes', { + * event: '*', + * schema: 'public', + * table: 'users', + * select: ['id', 'first_name'], + * }, (payload) => { + * // payload.new only contains { id, first_name } + * }) + */ + select?: string[] +} + +export type RealtimeChannelSendResponse = 'ok' | 'timed out' | 'error' | (string & {}) + +/** + * Payload of a `system` event emitted by the server. + * + * Most notably, when a channel is created with `config.broadcast.replication_ready: true`, + * the server sends one of these once the Postgres replication connection is ready + * (`status: 'ok'`) or fails to become ready in time (`status: 'error'`). + */ +export type RealtimeSystemPayload = { + /** The extension that produced the message, e.g. `'system'` or `'postgres_changes'`. */ + extension: 'system' | 'postgres_changes' | (string & {}) + /** `'ok'` on success, `'error'` on failure. */ + status: 'ok' | 'error' | (string & {}) + /** Human-readable description, e.g. `'Replication connection established'`. */ + message: string + /** The channel (sub)topic the message refers to. */ + channel: string +} + +export enum REALTIME_POSTGRES_CHANGES_LISTEN_EVENT { + ALL = '*', + INSERT = 'INSERT', + UPDATE = 'UPDATE', + DELETE = 'DELETE', +} + +export enum REALTIME_LISTEN_TYPES { + BROADCAST = 'broadcast', + PRESENCE = 'presence', + POSTGRES_CHANGES = 'postgres_changes', + SYSTEM = 'system', +} + +export enum REALTIME_SUBSCRIBE_STATES { + SUBSCRIBED = 'SUBSCRIBED', + TIMED_OUT = 'TIMED_OUT', + CLOSED = 'CLOSED', + CHANNEL_ERROR = 'CHANNEL_ERROR', +} + +export const REALTIME_CHANNEL_STATES = CHANNEL_STATES + +type PostgresChangesFilters = { + postgres_changes: { + id: string + event: string + schema?: string + table?: string + filter?: string + select?: string[] + }[] +} + +/** + * The `postgres_changes` filter fields that determine whether the server collapses two + * subscriptions into one. `filter` is always the serialized string form by the time it is compared. + */ +type PostgresChangesFilterShape = { + event?: string + schema?: string + table?: string + filter?: string + select?: string[] +} + +type Binding = { + type: string + filter: { [key: string]: any } + callback: ChannelBindingCallback + ref: number + id?: string +} + +/** A channel is the basic building block of Realtime + * and narrows the scope of data flow to subscribed clients. + * You can think of a channel as a chatroom where participants are able to see who's online + * and send and receive messages. + */ +export default class RealtimeChannel { + bindings: Record = {} + subTopic: string + broadcastEndpointURL: string + private: boolean + presence: RealtimePresence + /** @internal */ + channelAdapter: ChannelAdapter + + get state() { + return this.channelAdapter.state + } + + set state(state: ChannelState) { + this.channelAdapter.state = state + } + + get joinedOnce() { + return this.channelAdapter.joinedOnce + } + + get timeout() { + return this.socket.timeout + } + + get joinPush() { + return this.channelAdapter.joinPush + } + + get rejoinTimer(): Timer { + return this.channelAdapter.rejoinTimer + } + + /** + * Creates a channel that can broadcast messages, sync presence, and listen to Postgres changes. + * + * The topic determines which realtime stream you are subscribing to. Config options let you + * enable acknowledgement for broadcasts, presence tracking, or private channels. + * + * @category Realtime + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const channel = supabase.channel('room1') + * channel + * .on('broadcast', { event: 'cursor-pos' }, (payload) => console.log(payload)) + * .subscribe() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import RealtimeClient from '@supabase/realtime-js' + * + * const client = new RealtimeClient('https://xyzcompany.supabase.co/realtime/v1', { + * params: { apikey: 'your-publishable-key' }, + * }) + * const channel = new RealtimeChannel('realtime:public:messages', { config: {} }, client) + * ``` + */ + constructor( + /** Topic name can be any string. */ + public topic: string, + public params: RealtimeChannelOptions = { config: {} }, + public socket: RealtimeClient + ) { + this.subTopic = topic.replace(/^realtime:/i, '') + this.params.config = { + ...{ + broadcast: { ack: false, self: false }, + presence: { key: '', enabled: false }, + private: false, + }, + ...params.config, + } + + this.channelAdapter = new ChannelAdapter(this.socket.socketAdapter, topic, this.params) + this.presence = new RealtimePresence(this) + + this._onClose(() => { + this.socket._remove(this) + }) + + this._updateFilterTransform() + + this.broadcastEndpointURL = httpEndpointURL(this.socket.socketAdapter.endPointURL()) + this.private = this.params.config.private || false + + if (!this.private && this.params.config?.broadcast?.replay) { + throw new Error( + `tried to use replay on public channel '${this.topic}'. It must be a private channel.` + ) + } + } + + /** + * Subscribe registers your client with the server. + * + * The optional `callback` receives a `status` and, on failure, an `err` argument. + * Log the full `err` so its `cause`, `name`, and any structured fields aren't hidden + * behind `err.message`. + * + * @category Realtime + * + * @example Handling errors + * ```js + * supabase.channel('room1').subscribe((status, err) => { + * if (status === 'CHANNEL_ERROR' || status === 'TIMED_OUT') { + * // Log the full error: its `cause` often holds the underlying reason. + * console.error(status, err) + * } + * }) + * ``` + */ + subscribe( + callback?: (status: REALTIME_SUBSCRIBE_STATES, err?: Error) => void, + timeout = this.timeout + ): RealtimeChannel { + if (!this.socket.isConnected()) { + this.socket.connect() + } + if (this.channelAdapter.isClosed()) { + const { + config: { broadcast, presence, private: isPrivate }, + } = this.params + + const postgres_changes = this.bindings.postgres_changes?.map((r) => r.filter) ?? [] + + const presence_enabled = + (!!this.bindings[REALTIME_LISTEN_TYPES.PRESENCE] && + this.bindings[REALTIME_LISTEN_TYPES.PRESENCE].length > 0) || + this.params.config.presence?.enabled === true + const accessTokenPayload: { access_token?: string } = {} + const config = { + broadcast, + presence: { ...presence, enabled: presence_enabled }, + postgres_changes, + private: isPrivate, + } + + if (this.socket.accessTokenValue) { + accessTokenPayload.access_token = this.socket.accessTokenValue + } + + this._onError((reason: unknown) => { + callback?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, normalizeChannelError(reason)) + }) + + this._onClose(() => callback?.(REALTIME_SUBSCRIBE_STATES.CLOSED)) + + this.updateJoinPayload({ ...{ config }, ...accessTokenPayload }) + + this._updateFilterMessage() + + this.channelAdapter + .subscribe(timeout) + .receive('ok', async ({ postgres_changes }: PostgresChangesFilters) => { + // Only refresh auth if using callback-based tokens + if (!this.socket._isManualToken()) { + this.socket.setAuth() + } + if (postgres_changes === undefined) { + callback?.(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) + return + } + + this._updatePostgresBindings(postgres_changes, callback) + }) + .receive('error', (error: { [key: string]: any }) => { + this.state = CHANNEL_STATES.errored + const message = Object.values(error).join(', ') || 'error' + callback?.(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(message, { cause: error })) + }) + .receive('timeout', () => { + callback?.(REALTIME_SUBSCRIBE_STATES.TIMED_OUT) + }) + } + return this + } + + private _updatePostgresBindings( + postgres_changes: PostgresChangesFilters['postgres_changes'], + callback?: (status: REALTIME_SUBSCRIBE_STATES, err?: Error) => void + ) { + const clientPostgresBindings = this.bindings.postgres_changes + const bindingsLen = clientPostgresBindings?.length ?? 0 + const newPostgresBindings = [] + + for (let i = 0; i < bindingsLen; i++) { + const clientPostgresBinding = clientPostgresBindings[i] + const { + filter: { event, schema, table, filter }, + } = clientPostgresBinding + const serverPostgresFilter = postgres_changes && postgres_changes[i] + + if ( + serverPostgresFilter && + serverPostgresFilter.event === event && + RealtimeChannel.isFilterValueEqual(serverPostgresFilter.schema, schema) && + RealtimeChannel.isFilterValueEqual(serverPostgresFilter.table, table) && + RealtimeChannel.isFilterValueEqual(serverPostgresFilter.filter, filter) + ) { + newPostgresBindings.push({ + ...clientPostgresBinding, + id: serverPostgresFilter.id, + }) + } else { + this.unsubscribe() + this.state = CHANNEL_STATES.errored + + callback?.( + REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, + new Error('mismatch between server and client bindings for postgres changes') + ) + return + } + } + + this.bindings.postgres_changes = newPostgresBindings + + if (this.state != CHANNEL_STATES.errored && callback) { + callback(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) + } + } + + /** + * Returns the current presence state for this channel. + * + * The shape is a map keyed by presence key (for example a user id) where each entry contains the + * tracked metadata for that user. + * + * @category Realtime + */ + presenceState(): RealtimePresenceState { + return this.presence.state as RealtimePresenceState + } + + /** + * Sends the supplied payload to the presence tracker so other subscribers can see that this + * client is online. Use `untrack` to stop broadcasting presence for the same key. + * + * Tracking makes this client visible to other subscribers immediately, regardless of this + * channel's `config.presence.enabled` setting or whether it has a `presence` listener — that + * flag only affects whether *this* client receives presence updates from others (and, on + * RLS-protected channels, whether it's authorized to do so). + * + * @category Realtime + */ + async track( + payload: { [key: string]: any }, + opts: { [key: string]: any } = {} + ): Promise { + return await this.send( + { + type: 'presence', + event: 'track', + payload, + }, + opts + ) + } + + /** + * Removes the current presence state for this client. + * + * @category Realtime + */ + async untrack(opts: { [key: string]: any } = {}): Promise { + return await this.send( + { + type: 'presence', + event: 'untrack', + }, + opts + ) + } + + /** + * Listen for presence events on this channel — when peers join, leave, or + * sync presence state. + */ + on( + type: `${REALTIME_LISTEN_TYPES.PRESENCE}`, + filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.SYNC}` }, + callback: () => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.PRESENCE}`, + filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.JOIN}` }, + callback: (payload: RealtimePresenceJoinPayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.PRESENCE}`, + filter: { event: `${REALTIME_PRESENCE_LISTEN_EVENTS.LEAVE}` }, + callback: (payload: RealtimePresenceLeavePayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.PRESENCE}`, + filter: { event: '*' }, + callback: (payload?: RealtimePresenceJoinPayload | RealtimePresenceLeavePayload) => void + ): RealtimeChannel + /** + * Listen for Postgres database changes (insert / update / delete) streamed + * over this channel. + */ + on( + type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`, + filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL}`>, + callback: (payload: RealtimePostgresChangesPayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`, + filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`>, + callback: (payload: RealtimePostgresInsertPayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`, + filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`>, + callback: (payload: RealtimePostgresUpdatePayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`, + filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`>, + callback: (payload: RealtimePostgresDeletePayload) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.POSTGRES_CHANGES}`, + filter: RealtimePostgresChangesFilter<`${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}`>, + callback: (payload: RealtimePostgresChangesPayload) => void + ): RealtimeChannel + /** + * Listen for broadcast messages sent on this channel. + * + * @param type One of "broadcast", "presence", or "postgres_changes". + * @param filter Custom object specific to the Realtime feature detailing which payloads to receive. + * @param callback Function to be invoked when event handler is triggered. + */ + on( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: string }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: string + meta?: { + replayed?: boolean + id: string + } + [key: string]: any + }) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: string }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: string + meta?: { + replayed?: boolean + id: string + } + payload: T + }) => void + ): RealtimeChannel + on>( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.ALL + payload: RealtimeBroadcastPayload + }) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT + payload: RealtimeBroadcastInsertPayload + }) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE + payload: RealtimeBroadcastUpdatePayload + }) => void + ): RealtimeChannel + on( + type: `${REALTIME_LISTEN_TYPES.BROADCAST}`, + filter: { event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE }, + callback: (payload: { + type: `${REALTIME_LISTEN_TYPES.BROADCAST}` + event: REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE + payload: RealtimeBroadcastDeletePayload + }) => void + ): RealtimeChannel + /** + * Listen for `system` events on this channel. + * + * The payload follows the {@link RealtimeSystemPayload} shape. Opt in to the replication-ready + * notification with `config.broadcast.replication_ready: true` when creating the channel, then + * watch for `payload.status === 'ok'` to know the Postgres replication connection is ready. + * + * @example Know when the replication connection is ready + * ```js + * const channel = supabase.channel('room1', { + * config: { broadcast: { replication_ready: true } }, + * }) + * + * channel + * .on('postgres_changes', { event: '*', schema: 'public', table: 'messages' }, (payload) => { + * console.log('Change received!', payload) + * }) + * .on('system', {}, (payload) => { + * if (payload.extension === 'system' && payload.status === 'ok') { + * console.log('Replication connection is ready:', payload.message) + * } + * }) + * .subscribe() + * ``` + */ + on( + type: `${REALTIME_LISTEN_TYPES.SYSTEM}`, + filter: {}, + callback: (payload: any) => void + ): RealtimeChannel + /** + * Listen to realtime events on this channel. + * @category Realtime + * + * @remarks + * - By default, Broadcast and Presence are enabled for all projects. + * - By default, listening to database changes is disabled for new projects due to database performance and security concerns. You can turn it on by managing Realtime's [replication](/docs/guides/api#realtime-api-overview). + * - You can receive the "previous" data for updates and deletes by setting the table's `REPLICA IDENTITY` to `FULL` (e.g., `ALTER TABLE your_table REPLICA IDENTITY FULL;`). + * - Row level security is not applied to delete statements. When RLS is enabled and replica identity is set to full, only the primary key is sent to clients. + * + * @example Listen to broadcast messages + * ```js + * const channel = supabase.channel("room1") + * + * channel.on("broadcast", { event: "cursor-pos" }, (payload) => { + * console.log("Cursor position received!", payload); + * }).subscribe((status) => { + * if (status === "SUBSCRIBED") { + * channel.send({ + * type: "broadcast", + * event: "cursor-pos", + * payload: { x: Math.random(), y: Math.random() }, + * }); + * } + * }); + * ``` + * + * @example Listen to presence sync + * ```js + * const channel = supabase.channel('room1') + * channel + * .on('presence', { event: 'sync' }, () => { + * console.log('Synced presence state: ', channel.presenceState()) + * }) + * .subscribe(async (status) => { + * if (status === 'SUBSCRIBED') { + * await channel.track({ online_at: new Date().toISOString() }) + * } + * }) + * ``` + * + * @example Listen to presence join + * ```js + * const channel = supabase.channel('room1') + * channel + * .on('presence', { event: 'join' }, ({ newPresences }) => { + * console.log('Newly joined presences: ', newPresences) + * }) + * .subscribe(async (status) => { + * if (status === 'SUBSCRIBED') { + * await channel.track({ online_at: new Date().toISOString() }) + * } + * }) + * ``` + * + * @example Listen to presence leave + * ```js + * const channel = supabase.channel('room1') + * channel + * .on('presence', { event: 'leave' }, ({ leftPresences }) => { + * console.log('Newly left presences: ', leftPresences) + * }) + * .subscribe(async (status) => { + * if (status === 'SUBSCRIBED') { + * await channel.track({ online_at: new Date().toISOString() }) + * await channel.untrack() + * } + * }) + * ``` + * + * Registering the same `postgres_changes` filter more than once on a channel is a no-op: the + * duplicate is ignored and an error is logged, since the server only ever creates one + * subscription per distinct filter. + * + * @example Listen to all database changes + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: '*', schema: '*' }, payload => { + * console.log('Change received!', payload) + * }) + * .subscribe() + * ``` + * + * @example Listen to a specific table + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: '*', schema: 'public', table: 'countries' }, payload => { + * console.log('Change received!', payload) + * }) + * .subscribe() + * ``` + * + * @example Listen to inserts + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, payload => { + * console.log('Change received!', payload) + * }) + * .subscribe() + * ``` + * + * @exampleDescription Listen to updates + * By default, Supabase will send only the updated record. If you want to receive the previous values as well you can + * enable full replication for the table you are listening to: + * + * ```sql + * alter table "your_table" replica identity full; + * ``` + * + * @example Listen to updates + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries' }, payload => { + * console.log('Change received!', payload) + * }) + * .subscribe() + * ``` + * + * @exampleDescription Listen to deletes + * By default, Supabase does not send deleted records. If you want to receive the deleted record you can + * enable full replication for the table you are listening to: + * + * ```sql + * alter table "your_table" replica identity full; + * ``` + * + * @example Listen to deletes + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, payload => { + * console.log('Change received!', payload) + * }) + * .subscribe() + * ``` + * + * @exampleDescription Listen to multiple events + * You can chain listeners if you want to listen to multiple events for each table. + * + * @example Listen to multiple events + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, handleRecordInserted) + * .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, handleRecordDeleted) + * .subscribe() + * ``` + * + * @exampleDescription Listen to row level changes + * You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. + * + * @example Listen to row level changes + * ```js + * supabase + * .channel('room1') + * .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries', filter: 'id=eq.200' }, handleRecordUpdated) + * .subscribe() + * ``` + */ + on( + type: `${REALTIME_LISTEN_TYPES}`, + filter: { event: string; [key: string]: any }, + callback: (payload: any) => void + ): RealtimeChannel { + const stateCheck = this.channelAdapter.isJoined() || this.channelAdapter.isJoining() + const typeCheck = + type === REALTIME_LISTEN_TYPES.PRESENCE || type === REALTIME_LISTEN_TYPES.POSTGRES_CHANGES + + if (stateCheck && typeCheck) { + this.socket.log( + 'channel', + `cannot add \`${type}\` callbacks for ${this.topic} after \`subscribe()\`.` + ) + throw new Error(`cannot add \`${type}\` callbacks for ${this.topic} after \`subscribe()\`.`) + } + return this._on(type, filter, callback) + } + /** + * Sends a broadcast message explicitly via REST API. + * + * This method always uses the REST API endpoint regardless of WebSocket connection state. + * Useful when you want to guarantee REST delivery or when gradually migrating from implicit REST fallback. + * + * Payloads that are `ArrayBuffer` or `ArrayBufferView` (e.g. `Uint8Array`) are sent as + * `application/octet-stream`; all other payloads are JSON-encoded. + * + * @param event The name of the broadcast event + * @param payload Payload to be sent (required) + * @param opts Options including timeout + * @returns Promise resolving to object with success status, and error details if failed + * + * @category Realtime + */ + async httpSend( + event: string, + payload: any, + opts: { timeout?: number } = {} + ): Promise<{ success: true } | { success: false; status: number; error: string }> { + if (payload === undefined || payload === null) { + return Promise.reject(new Error('Payload is required for httpSend()')) + } + + const isBinary = payload instanceof ArrayBuffer || ArrayBuffer.isView(payload) + + const headers: Record = { + apikey: this.socket.apiKey ? this.socket.apiKey : '', + 'Content-Type': isBinary ? 'application/octet-stream' : 'application/json', + } + + if (this.socket.accessTokenValue) { + headers['Authorization'] = `Bearer ${this.socket.accessTokenValue}` + } + + const url = new URL(this.broadcastEndpointURL) + url.pathname += `/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(event)}` + if (this.private) { + url.searchParams.set('private', 'true') + } + + const options = { + method: 'POST', + headers, + body: isBinary ? (payload as ArrayBuffer | ArrayBufferView) : JSON.stringify(payload), + } + + const response = await this._fetchWithTimeout( + url.toString(), + options, + opts.timeout ?? this.timeout + ) + + if (response.status === 202) { + return { success: true } + } + + if (response.status === 404) { + return Promise.reject( + new Error( + 'httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. ' + + 'Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. ' + + 'See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md' + ) + ) + } + + let errorMessage = response.statusText + try { + const errorBody = await response.json() + errorMessage = errorBody.error || errorBody.message || errorMessage + } catch {} + + return Promise.reject(new Error(errorMessage)) + } + + /** + * Sends a message into the channel. + * + * @param args Arguments to send to channel + * @param args.type The type of event to send + * @param args.event The name of the event being sent + * @param args.payload Payload to be sent + * @param opts Options to be used during the send process + * + * @category Realtime + * + * @remarks + * - When using REST you don't need to subscribe to the channel + * - REST calls are only available from 2.37.0 onwards + * - If you create a channel only to send a REST broadcast, remove it from + * the client when the send completes + * + * @example Send a message via websocket + * ```js + * const channel = supabase.channel('room1') + * + * channel.subscribe((status) => { + * if (status === 'SUBSCRIBED') { + * channel.send({ + * type: 'broadcast', + * event: 'cursor-pos', + * payload: { x: Math.random(), y: Math.random() }, + * }) + * } + * }) + * ``` + * + * @exampleResponse Send a message via websocket + * ```js + * ok | timed out | error + * ``` + * + * @example Send a message via REST + * ```js + * const channel = supabase.channel('room1') + * + * try { + * await channel.httpSend('cursor-pos', { x: Math.random(), y: Math.random() }) + * } finally { + * await supabase.removeChannel(channel) + * } + * ``` + */ + async send( + args: { + type: 'broadcast' | 'presence' | 'postgres_changes' + event: string + payload?: any + [key: string]: any + }, + opts: { [key: string]: any } = {} + ): Promise { + if (!this.channelAdapter.canPush() && args.type === 'broadcast') { + console.warn( + 'Realtime send() is automatically falling back to REST API. ' + + 'This behavior will be deprecated in the future. ' + + 'Please use httpSend() explicitly for REST delivery.' + ) + + const { event, payload: endpoint_payload } = args + const headers: Record = { + apikey: this.socket.apiKey ? this.socket.apiKey : '', + 'Content-Type': 'application/json', + } + + if (this.socket.accessTokenValue) { + headers['Authorization'] = `Bearer ${this.socket.accessTokenValue}` + } + + const options = { + method: 'POST', + headers, + body: JSON.stringify({ + messages: [ + { + topic: this.subTopic, + event, + payload: endpoint_payload, + private: this.private, + }, + ], + }), + } + + try { + const response = await this._fetchWithTimeout( + this.broadcastEndpointURL, + options, + opts.timeout ?? this.timeout + ) + + await response.body?.cancel() + return response.ok ? 'ok' : 'error' + } catch (error) { + if (error instanceof Error && error.name === 'AbortError') { + return 'timed out' + } else { + return 'error' + } + } + } else { + return new Promise((resolve) => { + const push = this.channelAdapter.push(args.type, args, opts.timeout || this.timeout) + + if (args.type === 'broadcast' && !this.params?.config?.broadcast?.ack) { + resolve('ok') + } + + push.receive('ok', () => resolve('ok')) + push.receive('error', () => resolve('error')) + push.receive('timeout', () => resolve('timed out')) + }) + } + } + + /** + * Updates the payload that will be sent the next time the channel joins (reconnects). + * Useful for rotating access tokens or updating config without re-creating the channel. + * + * @category Realtime + */ + updateJoinPayload(payload: Record) { + this.channelAdapter.updateJoinPayload(payload) + } + + /** + * Leaves the channel. + * + * Unsubscribes from server events, and instructs channel to terminate on server. + * Triggers onClose() hooks. + * + * To receive leave acknowledgements, use the a `receive` hook to bind to the server ack, ie: + * channel.unsubscribe().receive("ok", () => alert("left!") ) + * + * @category Realtime + */ + async unsubscribe(timeout = this.timeout) { + return new Promise((resolve) => { + this.channelAdapter + .unsubscribe(timeout) + .receive('ok', () => resolve('ok')) + .receive('timeout', () => resolve('timed out')) + .receive('error', () => resolve('error')) + }) + } + + /** + * Destroys and stops related timers. + * + * @category Realtime + */ + teardown() { + this.channelAdapter.teardown() + } + + /** @internal */ + async _fetchWithTimeout(url: string, options: { [key: string]: any }, timeout: number) { + const controller = new AbortController() + const id = setTimeout(() => controller.abort(), timeout) + + const response = await this.socket.fetch(url, { + ...options, + signal: controller.signal, + }) + + clearTimeout(id) + + return response + } + + /** @internal */ + _on(type: string, filter: { [key: string]: any }, callback: ChannelBindingCallback) { + const typeLower = type.toLocaleLowerCase() + + // Serialize a postgres_changes filter builder into its string form so the + // rest of the pipeline (join payload, server binding match) sees a string. + // Duck-type `build()` in addition to `instanceof` so a builder constructed + // against a duplicate copy of the package (separate module realm) still works. + const filterValue = filter?.filter + if ( + filterValue instanceof RealtimePostgresFilterBuilder || + (typeof filterValue === 'object' && + filterValue !== null && + typeof (filterValue as { build?: unknown }).build === 'function') + ) { + filter = { ...filter, filter: (filterValue as RealtimePostgresFilterBuilder).build() } + } + + // The server collapses identical postgres_changes filters, so keeping a duplicate here would + // desync the client and server binding lists and make `subscribe()` fail with a mismatch. + if (typeLower === REALTIME_LISTEN_TYPES.POSTGRES_CHANGES) { + const duplicate = this.bindings[typeLower]?.find((bind) => + RealtimeChannel.isSamePostgresFilter(bind.filter, filter) + ) + + if (duplicate) { + this.socket.log( + 'error', + `duplicate \`postgres_changes\` binding for ${this.topic} ignored`, + filter + ) + return this + } + } + + const ref = this.channelAdapter.on(type, callback) + + const binding: Binding = { + type: typeLower, + filter: filter, + callback: callback, + ref: ref, + } + + if (this.bindings[typeLower]) { + this.bindings[typeLower].push(binding) + } else { + this.bindings[typeLower] = [binding] + } + + this._updateFilterMessage() + + return this + } + + /** + * Registers a callback that will be executed when the channel closes. + * + * @internal + */ + private _onClose(callback: ChannelBindingCallback) { + this.channelAdapter.onClose(callback) + } + + /** + * Registers a callback that will be executed when the channel encounteres an error. + * + * @internal + */ + private _onError(callback: ChannelOnErrorCallback) { + this.channelAdapter.onError(callback) + } + + /** @internal */ + private _updateFilterMessage() { + this.channelAdapter.updateFilterBindings((binding, payload: any, ref) => { + const typeLower = binding.event.toLocaleLowerCase() + + if (this._notThisChannelEvent(typeLower, ref)) { + return false + } + + const bind = this.bindings[typeLower]?.find((bind) => bind.ref === binding.ref) + + if (!bind) { + return true + } + + if (['broadcast', 'presence', 'postgres_changes'].includes(typeLower)) { + if ('id' in bind) { + const bindId = bind.id + const bindEvent = bind.filter?.event + return ( + bindId && + payload.ids?.includes(bindId) && + (bindEvent === '*' || + bindEvent?.toLocaleLowerCase() === payload.data?.type.toLocaleLowerCase()) + ) + } else { + const bindEvent = bind?.filter?.event?.toLocaleLowerCase() + return bindEvent === '*' || bindEvent === payload?.event?.toLocaleLowerCase() + } + } else { + return bind.type.toLocaleLowerCase() === typeLower + } + }) + } + + /** @internal */ + private _notThisChannelEvent(event: string, ref?: string | null) { + const { close, error, leave, join } = CHANNEL_EVENTS + const events: string[] = [close, error, leave, join] + return ref && events.includes(event) && ref !== this.joinPush.ref + } + + /** @internal */ + private _updateFilterTransform() { + this.channelAdapter.updatePayloadTransform((event, payload: any, ref) => { + if (typeof payload === 'object' && 'ids' in payload) { + const postgresChanges = payload.data + const { schema, table, commit_timestamp, type, errors } = postgresChanges + const enrichedPayload = { + schema: schema, + table: table, + commit_timestamp: commit_timestamp, + eventType: type, + new: {}, + old: {}, + errors: errors, + } + return { + ...enrichedPayload, + ...this._getPayloadRecords(postgresChanges), + } + } + + return payload + }) + } + + copyBindings(other: RealtimeChannel) { + if (this.joinedOnce) { + throw new Error('cannot copy bindings into joined channel') + } + for (const kind in other.bindings) { + for (const binding of other.bindings[kind]) { + this._on(binding.type, binding.filter, binding.callback) + } + } + } + + /** + * Compares two optional filter values for equality. + * Treats undefined, null, and empty string as equivalent empty values. + * @internal + */ + private static isFilterValueEqual( + serverValue: string | undefined | null, + clientValue: string | undefined + ): boolean { + const normalizedServer = serverValue ?? undefined + const normalizedClient = clientValue ?? undefined + return normalizedServer === normalizedClient + } + + /** + * Two `postgres_changes` filters are the same when the server would collapse them into a single + * subscription. + * @internal + */ + private static isSamePostgresFilter( + a: PostgresChangesFilterShape, + b: PostgresChangesFilterShape + ): boolean { + const selectA = a?.select?.join() ?? undefined + const selectB = b?.select?.join() ?? undefined + + return ( + a?.event === b?.event && + RealtimeChannel.isFilterValueEqual(a?.schema, b?.schema) && + RealtimeChannel.isFilterValueEqual(a?.table, b?.table) && + RealtimeChannel.isFilterValueEqual(a?.filter, b?.filter) && + selectA === selectB + ) + } + + /** @internal */ + private _getPayloadRecords(payload: any) { + const records = { + new: {}, + old: {}, + } + + if (payload.type === 'INSERT' || payload.type === 'UPDATE') { + records.new = Transformers.convertChangeData(payload.columns, payload.record) + } + + if (payload.type === 'UPDATE' || payload.type === 'DELETE') { + records.old = Transformers.convertChangeData(payload.columns, payload.old_record) + } + + return records + } +} diff --git a/node_modules/@supabase/realtime-js/src/RealtimeClient.ts b/node_modules/@supabase/realtime-js/src/RealtimeClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..73ffd9180c4640132abe3ee7998bb921e6a9eab3 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/RealtimeClient.ts @@ -0,0 +1,867 @@ +import WebSocketFactory, { WebSocketLike } from './lib/websocket-factory' + +import { + CHANNEL_EVENTS, + CONNECTION_STATE, + DEFAULT_VERSION, + DEFAULT_TIMEOUT, + DEFAULT_VSN, + VSN_1_0_0, + VSN_2_0_0, +} from './lib/constants' + +import Serializer from './lib/serializer' +import { httpEndpointURL } from './lib/transformers' +import RealtimeChannel from './RealtimeChannel' +import type { RealtimeChannelOptions } from './RealtimeChannel' +import SocketAdapter from './phoenix/socketAdapter' +import type { + Message, + SocketOptions, + HeartbeatCallback, + Encode, + Decode, + Timer, + Vsn, +} from './phoenix/types' + +type Fetch = typeof fetch + +export type LogLevel = 'info' | 'warn' | 'error' | (string & {}) + +export type RealtimeMessage = { + topic: string + event: string + payload: any + ref: string + join_ref?: string +} + +export type RealtimeRemoveChannelResponse = 'ok' | 'timed out' | 'error' | (string & {}) +export type HeartbeatStatus = 'sent' | 'ok' | 'error' | 'timeout' | 'disconnected' | (string & {}) +export type HeartbeatTimer = ReturnType | undefined + +// Connection-related constants +const CONNECTION_TIMEOUTS = { + HEARTBEAT_INTERVAL: 25000, + RECONNECT_DELAY: 10, + HEARTBEAT_TIMEOUT_FALLBACK: 100, +} as const + +const RECONNECT_INTERVALS = [1000, 2000, 5000, 10000] as const +const DEFAULT_RECONNECT_FALLBACK = 10000 + +/** + * Minimal WebSocket constructor interface that RealtimeClient can work with. + * Supply a compatible implementation (native WebSocket, `ws`, etc) when running outside the browser. + */ +export interface WebSocketLikeConstructor { + new (address: string | URL, subprotocols?: string | string[] | undefined): WebSocketLike + // Allow additional properties that may exist on WebSocket constructors + [key: string]: any +} + +export type RealtimeClientOptions = { + transport?: WebSocketLikeConstructor + timeout?: number + heartbeatIntervalMs?: number + heartbeatCallback?: (status: HeartbeatStatus, latency?: number) => void + vsn?: string + logger?: (kind: string, msg: string, data?: any) => void + encode?: Encode + decode?: Decode + reconnectAfterMs?: (tries: number) => number + headers?: { [key: string]: string } + params?: { [key: string]: any } + //Deprecated: Use it in favour of correct casing `logLevel` + log_level?: LogLevel + logLevel?: LogLevel + fetch?: Fetch + worker?: boolean + workerUrl?: string + accessToken?: () => Promise + disconnectOnEmptyChannelsAfterMs?: number + /** + * Storage compatible object used by the underlying socket for longpoll fallback history. + * Provide a custom implementation in environments where reading `globalThis.sessionStorage` + * throws (sandboxed iframes, in-app webviews, "block third-party storage" privacy modes). + * Defaults to `globalThis.sessionStorage` when accessible, otherwise an in-memory store. + */ + sessionStorage?: Storage +} + +function createMemorySessionStorage(): Storage { + const store = new Map() + return { + get length() { + return store.size + }, + clear() { + store.clear() + }, + getItem(key: string) { + return store.has(key) ? (store.get(key) as string) : null + }, + key(index: number) { + return Array.from(store.keys())[index] ?? null + }, + removeItem(key: string) { + store.delete(key) + }, + setItem(key: string, value: string) { + store.set(key, String(value)) + }, + } +} + +function resolveSessionStorage(): Storage { + try { + if (typeof globalThis !== 'undefined' && globalThis.sessionStorage) { + return globalThis.sessionStorage + } + } catch { + // Property access on `sessionStorage` itself throws in restricted-storage browsers. + } + return createMemorySessionStorage() +} + +const WORKER_SCRIPT = ` + addEventListener("message", (e) => { + if (e.data.event === "start") { + setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); + } + });` + +export default class RealtimeClient { + /** @internal */ + socketAdapter: SocketAdapter + channels: RealtimeChannel[] = new Array() + + accessTokenValue: string | null = null + accessToken: (() => Promise) | null = null + apiKey: string | null = null + + httpEndpoint: string = '' + /** @deprecated headers cannot be set on websocket connections */ + headers?: { [key: string]: string } = {} + params?: { [key: string]: string } = {} + + ref: number = 0 + + logLevel?: LogLevel + + fetch: Fetch + worker?: boolean + workerUrl?: string + workerRef?: Worker + + serializer: Serializer = new Serializer() + + get endPoint() { + return this.socketAdapter.endPoint + } + + get timeout() { + return this.socketAdapter.timeout + } + + get transport() { + return this.socketAdapter.transport + } + + get heartbeatCallback() { + return this.socketAdapter.heartbeatCallback + } + + get heartbeatIntervalMs() { + return this.socketAdapter.heartbeatIntervalMs + } + + get heartbeatTimer() { + if (this.worker) { + return this._workerHeartbeatTimer + } + return this.socketAdapter.heartbeatTimer + } + + get pendingHeartbeatRef() { + if (this.worker) { + return this._pendingWorkerHeartbeatRef + } + return this.socketAdapter.pendingHeartbeatRef + } + + get reconnectTimer(): Timer { + return this.socketAdapter.reconnectTimer + } + + get vsn(): Vsn { + return this.socketAdapter.vsn + } + + get encode() { + return this.socketAdapter.encode + } + + get decode() { + return this.socketAdapter.decode + } + + get reconnectAfterMs() { + return this.socketAdapter.reconnectAfterMs + } + + get sendBuffer() { + return this.socketAdapter.sendBuffer + } + + get stateChangeCallbacks(): { + open: [string, Function][] + close: [string, Function][] + error: [string, Function][] + message: [string, Function][] + } { + return this.socketAdapter.stateChangeCallbacks + } + + private _manuallySetToken: boolean = false + private _authPromise: Promise | null = null + private _authGeneration: number = 0 + private _workerHeartbeatTimer: HeartbeatTimer = undefined + private _pendingWorkerHeartbeatRef: string | null = null + private _pendingDisconnectTimer: ReturnType | null = null + private _disconnectOnEmptyChannelsAfterMs: number = 0 + + /** + * Initializes the Socket. + * + * @param endPoint The string WebSocket endpoint, ie, "ws://example.com/socket", "wss://example.com", "/socket" (inherited host & protocol) + * @param options.transport The Websocket Transport, for example WebSocket. This can be a custom implementation + * @param options.timeout The default timeout in milliseconds to trigger push timeouts. + * @param options.params The optional params to pass when connecting. + * @param options.headers Deprecated: headers cannot be set on websocket connections and this option will be removed in the future. + * @param options.heartbeatIntervalMs The millisec interval to send a heartbeat message. + * @param options.heartbeatCallback The optional function to handle heartbeat status and latency. + * @param options.logger The optional function for specialized logging, ie: logger: (kind, msg, data) => { console.log(`${kind}: ${msg}`, data) } + * @param options.logLevel Sets the log level for Realtime + * @param options.encode The function to encode outgoing messages. Defaults to JSON: (payload, callback) => callback(JSON.stringify(payload)) + * @param options.decode The function to decode incoming messages. Defaults to Serializer's decode. + * @param options.reconnectAfterMs he optional function that returns the millsec reconnect interval. Defaults to stepped backoff off. + * @param options.worker Use Web Worker to set a side flow. Defaults to false. + * @param options.workerUrl The URL of the worker script. Defaults to https://realtime.supabase.com/worker.js that includes a heartbeat event call to keep the connection alive. + * @param options.vsn The protocol version to use when connecting. Supported versions are "1.0.0" and "2.0.0". Defaults to "2.0.0". + * + * @category Realtime + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const channel = supabase.channel('room1') + * channel + * .on('broadcast', { event: 'cursor-pos' }, (payload) => console.log(payload)) + * .subscribe() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import RealtimeClient from '@supabase/realtime-js' + * + * const client = new RealtimeClient('https://xyzcompany.supabase.co/realtime/v1', { + * params: { apikey: 'your-publishable-key' }, + * }) + * client.connect() + * ``` + */ + constructor(endPoint: string, options?: RealtimeClientOptions) { + // Validate required parameters + if (!options?.params?.apikey) { + throw new Error('API key is required to connect to Realtime') + } + this.apiKey = options.params.apikey + + const socketAdapterOptions = this._initializeOptions(options) + + this.socketAdapter = new SocketAdapter(endPoint, socketAdapterOptions) + this.httpEndpoint = httpEndpointURL(endPoint) + + this.fetch = this._resolveFetch(options?.fetch) + } + + /** + * Connects the socket, unless already connected. + * + * @category Realtime + */ + connect(): void { + // Skip if already connecting, disconnecting, or connected + if (this.isConnecting() || this.isDisconnecting() || this.isConnected()) { + return + } + + // Trigger auth if needed and not already in progress + // This ensures auth is called for standalone RealtimeClient usage + // while avoiding race conditions with SupabaseClient's immediate setAuth call + if (this.accessToken && !this._authPromise) { + this._setAuthSafely('connect') + } + + this._setupConnectionHandlers() + + try { + this.socketAdapter.connect() + } catch (error) { + const errorMessage = (error as Error).message + throw new Error(`WebSocket not available: ${errorMessage}`) + } + + this._handleNodeJsRaceCondition() + } + + /** + * Returns the URL of the websocket. + * @returns string The URL of the websocket. + * + * @category Realtime + */ + endpointURL(): string { + return this.socketAdapter.endPointURL() + } + + /** + * Disconnects the socket. + * + * @param code A numeric status code to send on disconnect. + * @param reason A custom reason for the disconnect. + * + * @category Realtime + */ + async disconnect(code?: number, reason?: string) { + this._cancelPendingDisconnect() + if (this.isDisconnecting()) { + return 'ok' + } + return await this.socketAdapter.disconnect( + () => { + clearInterval(this._workerHeartbeatTimer) + this._terminateWorker() + }, + code, + reason + ) + } + + /** + * Returns all created channels + * + * @category Realtime + */ + getChannels(): RealtimeChannel[] { + return this.channels + } + + /** + * Unsubscribes, removes and tears down a single channel + * @param channel A RealtimeChannel instance + * + * @category Realtime + */ + async removeChannel(channel: RealtimeChannel): Promise { + const status = await channel.unsubscribe() + + if (status === 'ok') { + channel.teardown() + } + + return status + } + + /** + * Unsubscribes, removes and tears down all channels + * + * @category Realtime + */ + async removeAllChannels(): Promise { + const promises = this.channels.map(async (channel) => { + const result = await channel.unsubscribe() + channel.teardown() + return result + }) + + const result = await Promise.all(promises) + await this.disconnect() + return result + } + + /** + * Logs the message. + * + * For customized logging, `this.logger` can be overridden in Client constructor. + * + * @category Realtime + */ + log(kind: string, msg: string, data?: any) { + this.socketAdapter.log(kind, msg, data) + } + + /** + * Returns the current state of the socket. + * + * @category Realtime + */ + connectionState() { + return this.socketAdapter.connectionState() || CONNECTION_STATE.closed + } + + /** + * Returns `true` is the connection is open. + * + * @category Realtime + */ + isConnected(): boolean { + return this.socketAdapter.isConnected() + } + + /** + * Returns `true` if the connection is currently connecting. + * + * @category Realtime + */ + isConnecting(): boolean { + return this.socketAdapter.isConnecting() + } + + /** + * Returns `true` if the connection is currently disconnecting. + * + * @category Realtime + */ + isDisconnecting(): boolean { + return this.socketAdapter.isDisconnecting() + } + + /** + * Creates (or reuses) a {@link RealtimeChannel} for the provided topic. + * + * Topics are automatically prefixed with `realtime:` to match the Realtime service. + * If a channel with the same topic already exists it will be returned instead of creating + * a duplicate connection. + * + * @category Realtime + */ + channel(topic: string, params: RealtimeChannelOptions = { config: {} }): RealtimeChannel { + const realtimeTopic = `realtime:${topic}` + const exists = this.getChannels().find((c: RealtimeChannel) => c.topic === realtimeTopic) + + if (!exists) { + const chan = new RealtimeChannel(`realtime:${topic}`, params, this) + this._cancelPendingDisconnect() + this.channels.push(chan) + + return chan + } else { + return exists + } + } + + /** + * Push out a message if the socket is connected. + * + * If the socket is not connected, the message gets enqueued within a local buffer, and sent out when a connection is next established. + * + * @category Realtime + */ + push(data: RealtimeMessage): void { + this.socketAdapter.push(data) + } + + /** + * Sets the JWT access token used for channel subscription authorization and Realtime RLS. + * + * If param is null it will use the `accessToken` callback function or the token set on the client. + * + * On callback used, it will set the value of the token internal to the client. + * + * When a token is explicitly provided AND no `accessToken` callback is configured, + * it will be preserved across channel operations (including removeChannel and + * resubscribe) and the client stays in manual-token mode. + * + * When an `accessToken` callback IS configured, the callback is the source of truth: + * the client remains in callback mode and continues to refresh from it on heartbeat, + * even after a bootstrap/override `setAuth(token)` call. + * + * @param token A JWT string to override the token set on the client. + * + * @example Setting the authorization header + * // Use a manual token (preserved across resubscribes when no accessToken callback is set) + * client.realtime.setAuth('my-custom-jwt') + * + * // Switch back to using the accessToken callback + * client.realtime.setAuth() + * + * @category Realtime + */ + async setAuth(token: string | null = null): Promise { + const authGeneration = ++this._authGeneration + const authPromise = this._performAuth(token, authGeneration) + if (authGeneration === this._authGeneration) { + this._authPromise = authPromise + } + try { + await authPromise + } finally { + if (this._authPromise === authPromise) { + this._authPromise = null + } + } + } + + /** + * Returns true if the current access token was explicitly set via setAuth(token), + * false if it was obtained via the accessToken callback. + * @internal + */ + _isManualToken(): boolean { + return this._manuallySetToken + } + + /** + * Sends a heartbeat message if the socket is connected. + * + * @category Realtime + */ + async sendHeartbeat() { + this.socketAdapter.sendHeartbeat() + } + + /** + * Sets a callback that receives lifecycle events for internal heartbeat messages. + * Useful for instrumenting connection health (e.g. sent/ok/timeout). + * + * @category Realtime + */ + onHeartbeat(callback: HeartbeatCallback) { + this.socketAdapter.heartbeatCallback = this._wrapHeartbeatCallback(callback) + } + + /** + * Use either custom fetch, if provided, or default fetch to make HTTP requests + * + * @internal + */ + _resolveFetch = (customFetch?: Fetch): Fetch => { + if (customFetch) { + return (...args) => customFetch(...args) + } + return (...args) => fetch(...args) + } + + /** + * Return the next message ref, accounting for overflows + * + * @internal + */ + _makeRef(): string { + return this.socketAdapter.makeRef() + } + + /** + * Removes a channel from RealtimeClient + * + * @param channel An open subscription. + * + * @internal + */ + _remove(channel: RealtimeChannel) { + this.channels = this.channels.filter((c) => c.topic !== channel.topic) + if (this.channels.length === 0) { + this.log('transport', 'no channels remaining, scheduling disconnect') + this._schedulePendingDisconnect() + } + } + + /** @internal */ + private _schedulePendingDisconnect() { + this._cancelPendingDisconnect() + if (this._disconnectOnEmptyChannelsAfterMs === 0) { + this.log('transport', 'disconnecting immediately - no channels') + this.disconnect() + return + } + this._pendingDisconnectTimer = setTimeout(() => { + this._pendingDisconnectTimer = null + if (this.channels.length === 0) { + this.log('transport', 'deferred disconnect fired - no channels, disconnecting') + this.disconnect() + } + }, this._disconnectOnEmptyChannelsAfterMs) + this.log( + 'transport', + `deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms` + ) + } + + /** @internal */ + private _cancelPendingDisconnect() { + if (this._pendingDisconnectTimer !== null) { + this.log('transport', 'pending disconnect cancelled - channel activity detected') + clearTimeout(this._pendingDisconnectTimer) + this._pendingDisconnectTimer = null + } + } + + /** + * Perform the actual auth operation + * @internal + */ + private async _performAuth(token: string | null, authGeneration: number): Promise { + let tokenToSend: string | null + let isManualToken = false + + if (token) { + tokenToSend = token + // Track if this is a manually-provided token + isManualToken = true + } else if (this.accessToken) { + // Call the accessToken callback to get fresh token + try { + tokenToSend = await this.accessToken() + } catch (e) { + this.log('error', 'Error fetching access token from callback', e) + // Fall back to cached value if callback fails + tokenToSend = this.accessTokenValue + } + } else { + tokenToSend = this.accessTokenValue + } + + if (authGeneration !== this._authGeneration) { + return + } + + // Track whether this token was manually set or fetched via callback. + // The callback is the source of truth for token refresh + if (this.accessToken) { + this._manuallySetToken = false + } else if (isManualToken) { + this._manuallySetToken = true + } + + if (this.accessTokenValue != tokenToSend) { + this.accessTokenValue = tokenToSend + this.channels.forEach((channel) => { + const payload = { + access_token: tokenToSend, + version: DEFAULT_VERSION, + } + + channel.updateJoinPayload(payload) + + if (channel.joinedOnce && channel.channelAdapter.isJoined()) { + channel.channelAdapter.push(CHANNEL_EVENTS.access_token, { + access_token: tokenToSend, + }) + } + }) + } + } + + /** + * Wait for any in-flight auth operations to complete + * @internal + */ + private async _waitForAuthIfNeeded(): Promise { + if (this._authPromise) { + await this._authPromise + } + } + + /** + * Safely call setAuth with standardized error handling + * @internal + */ + private _setAuthSafely(context = 'general'): void { + // Only refresh auth if using callback-based tokens + if (!this._isManualToken()) { + this.setAuth().catch((e) => { + this.log('error', `Error setting auth in ${context}`, e) + }) + } + } + + /** @internal */ + private _setupConnectionHandlers(): void { + this.socketAdapter.onOpen(() => { + const authPromise = + this._authPromise || + (this.accessToken && !this.accessTokenValue ? this.setAuth() : Promise.resolve()) + + authPromise.catch((e) => { + this.log('error', 'error waiting for auth on connect', e) + }) + + if (this.worker && !this.workerRef) { + this._startWorkerHeartbeat() + } + }) + this.socketAdapter.onClose(() => { + if (this.worker && this.workerRef) { + this._terminateWorker() + } + }) + this.socketAdapter.onMessage((message: Message) => { + if (message.ref && message.ref === this._pendingWorkerHeartbeatRef) { + this._pendingWorkerHeartbeatRef = null + } + }) + } + + /** @internal */ + private _handleNodeJsRaceCondition() { + if (this.socketAdapter.isConnected()) { + // hack: ensure onConnOpen is called + this.socketAdapter.getSocket().onConnOpen() + } + } + + /** @internal */ + private _wrapHeartbeatCallback(heartbeatCallback?: HeartbeatCallback): HeartbeatCallback { + return (status, latency) => { + if (status === 'disconnected') return + if (status == 'sent') this._setAuthSafely() + if (heartbeatCallback) heartbeatCallback(status, latency) + } + } + + /** @internal */ + private _startWorkerHeartbeat() { + if (this.workerUrl) { + this.log('worker', `starting worker for from ${this.workerUrl}`) + } else { + this.log('worker', `starting default worker`) + } + const objectUrl = this._workerObjectUrl(this.workerUrl!) + this.workerRef = new Worker(objectUrl) + this.workerRef.onerror = (error) => { + this.log('worker', 'worker error', (error as ErrorEvent).message) + this._terminateWorker() + this.disconnect() + } + this.workerRef.onmessage = (event) => { + if (event.data.event === 'keepAlive') { + this.sendHeartbeat() + } + } + this.workerRef.postMessage({ + event: 'start', + interval: this.heartbeatIntervalMs, + }) + } + + /** + * Terminate the Web Worker and clear the reference + * @internal + */ + private _terminateWorker(): void { + if (this.workerRef) { + this.log('worker', 'terminating worker') + this.workerRef.terminate() + this.workerRef = undefined + } + } + + /** @internal */ + private _workerObjectUrl(url: string | undefined): string { + let result_url: string + if (url) { + result_url = url + } else { + const blob = new Blob([WORKER_SCRIPT], { type: 'application/javascript' }) + result_url = URL.createObjectURL(blob) + } + return result_url + } + + /** + * Initialize socket options with defaults + * @internal + */ + private _initializeOptions(options?: RealtimeClientOptions): SocketOptions { + this.worker = options?.worker ?? false + this.accessToken = options?.accessToken ?? null + + const result: SocketOptions = {} + result.timeout = options?.timeout ?? DEFAULT_TIMEOUT + result.heartbeatIntervalMs = + options?.heartbeatIntervalMs ?? CONNECTION_TIMEOUTS.HEARTBEAT_INTERVAL + + this._disconnectOnEmptyChannelsAfterMs = + options?.disconnectOnEmptyChannelsAfterMs ?? + 2 * (options?.heartbeatIntervalMs ?? CONNECTION_TIMEOUTS.HEARTBEAT_INTERVAL) + + // @ts-ignore - mismatch between phoenix and supabase + result.transport = options?.transport ?? WebSocketFactory.getWebSocketConstructor() + result.params = options?.params + result.logger = options?.logger + result.heartbeatCallback = this._wrapHeartbeatCallback(options?.heartbeatCallback) + result.sessionStorage = options?.sessionStorage ?? resolveSessionStorage() + result.reconnectAfterMs = + options?.reconnectAfterMs ?? + ((tries: number) => { + return RECONNECT_INTERVALS[tries - 1] || DEFAULT_RECONNECT_FALLBACK + }) + + let defaultEncode: Encode + let defaultDecode: Decode + + const vsn = options?.vsn ?? DEFAULT_VSN + + switch (vsn) { + case VSN_1_0_0: + defaultEncode = (payload, callback) => { + return callback(JSON.stringify(payload)) + } + defaultDecode = (payload, callback) => { + return callback(JSON.parse(payload as string)) + } + break + case VSN_2_0_0: + defaultEncode = this.serializer.encode.bind(this.serializer) + defaultDecode = this.serializer.decode.bind(this.serializer) + break + default: + throw new Error(`Unsupported serializer version: ${result.vsn}`) + } + + result.vsn = vsn + result.encode = options?.encode ?? defaultEncode + result.decode = options?.decode ?? defaultDecode + + result.beforeReconnect = this._reconnectAuth.bind(this) + + if (options?.logLevel || options?.log_level) { + this.logLevel = options.logLevel || options.log_level + result.params = { ...result.params, log_level: this.logLevel as string } + } + + // Handle worker setup + if (this.worker) { + if (typeof window !== 'undefined' && !window.Worker) { + throw new Error('Web Worker is not supported') + } + this.workerUrl = options?.workerUrl + result.autoSendHeartbeat = !this.worker + } + + return result + } + + /** @internal */ + private async _reconnectAuth() { + await this._waitForAuthIfNeeded() + if (!this.isConnected()) { + this.connect() + } + } +} diff --git a/node_modules/@supabase/realtime-js/src/RealtimePostgresFilterBuilder.ts b/node_modules/@supabase/realtime-js/src/RealtimePostgresFilterBuilder.ts new file mode 100644 index 0000000000000000000000000000000000000000..42facf73c408cfde252b2437b40ff746c2ea56c6 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/RealtimePostgresFilterBuilder.ts @@ -0,0 +1,253 @@ +/** + * Comparison operators accepted in a Postgres Changes `filter` string. + * + * These mirror the PostgREST operator surface and are evaluated server-side. + * Any operator can be negated via {@link RealtimePostgresFilterBuilder.not} + * (the `not.` prefix). + * + * This is the subset of PostgREST's `FilterOperator` (see `postgrest-js`) that + * Realtime Postgres Changes supports. Containment, range and full-text search + * operators (`cs`, `cd`, `ov`, range ops, `fts`, …) are intentionally not + * included because the Realtime server does not evaluate them. + * + * - `eq`, `neq`, `lt`, `lte`, `gt`, `gte` — comparison + * - `in` — membership: `status=in.(active,pending)` + * - `like`, `ilike` — pattern match (case-sensitive / insensitive): `title=like.%foo%` + * - `is` — `IS` check against `null` / `true` / `false` / `unknown`: `deleted_at=is.null` + * - `match`, `imatch` — POSIX regex match (`~` / `~*`) + * - `isdistinct` — NULL-safe inequality (`IS DISTINCT FROM`) + */ +export type RealtimePostgresChangesFilterOperator = + | 'eq' + | 'neq' + | 'lt' + | 'lte' + | 'gt' + | 'gte' + | 'in' + | 'like' + | 'ilike' + | 'is' + | 'match' + | 'imatch' + | 'isdistinct' + +/** Scalar value accepted by a single filter operator. */ +export type RealtimeFilterValue = string | number | boolean | null + +/** Value accepted by the `is` operator. */ +export type RealtimeIsFilterValue = null | boolean | 'null' | 'true' | 'false' | 'unknown' + +// Reserved characters that force PostgREST-style quoting: `[,()]` (which the +// server reads as condition/list delimiters) plus `"`/`\` (escaped inside quotes). +const PostgrestReservedCharsRegexp = /[,()"\\]/ + +const needsQuoting = (value: string): boolean => + PostgrestReservedCharsRegexp.test(value) || value !== value.trim() + +const quote = (value: string): string => `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"` + +const serializeScalar = (value: RealtimeFilterValue): string => { + const serialized = value === null ? 'null' : String(value) + return needsQuoting(serialized) ? quote(serialized) : serialized +} + +const serializeIsValue = (value: RealtimeIsFilterValue): string => + value === null ? 'null' : String(value) + +// Builds the `operator.value` portion of a filter (everything after `column=`). +const serialize = (operator: RealtimePostgresChangesFilterOperator, value: unknown): string => { + if (operator === 'in') { + const values = Array.isArray(value) ? value : [value] + if (values.length === 0) { + throw new Error('Realtime `in` filter requires at least one value.') + } + const items = Array.from(new Set(values)) + .map((v) => serializeScalar(v as RealtimeFilterValue)) + .join(',') + return `in.(${items})` + } + + if (operator === 'is') { + return `is.${serializeIsValue(value as RealtimeIsFilterValue)}` + } + + return `${operator}.${serializeScalar(value as RealtimeFilterValue)}` +} + +/** + * Fluent builder for Postgres Changes `filter` strings. + * + * Each method appends a single `column=operator.value` condition. Multiple + * conditions are combined with commas, which the Realtime server applies as an + * `AND`. Pass an instance straight to `channel.on('postgres_changes', …)` — the + * SDK serializes it to a string automatically — or call {@link build} to obtain + * the string yourself. + * + * The builder mirrors the `postgrest-js` filter API (`eq`, `neq`, `in`, `like`, + * `not`, …) for the operators that Realtime supports. Values containing reserved + * characters (`,`, `(`, `)`, `"`, `\`) — or surrounding whitespace — are + * automatically double-quoted and escaped the same way PostgREST does, so they + * survive the server's filter parser; all other values are sent verbatim. + * + * The filter is snapshotted when passed to `channel.on(...)`; mutating the + * builder afterwards does not affect an existing subscription. An empty builder + * serializes to `''`, which the server treats as "no filter". + * + * @example + * channel.on('postgres_changes', { + * event: '*', + * schema: 'public', + * table: 'users', + * filter: postgresChangesFilter().eq('id', 1).lt('age', 30), // → 'id=eq.1,age=lt.30' + * }, (payload) => { ... }) + */ +export class RealtimePostgresFilterBuilder { + private readonly filters: string[] = [] + + private add( + column: string, + operator: RealtimePostgresChangesFilterOperator, + value: unknown, + negate = false + ): this { + const prefix = negate ? 'not.' : '' + this.filters.push(`${column}=${prefix}${serialize(operator, value)}`) + return this + } + + /** Match rows where `column` equals `value` (`column=eq.value`). */ + eq(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'eq', value) + } + + /** Match rows where `column` does not equal `value` (`column=neq.value`). */ + neq(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'neq', value) + } + + /** Match rows where `column` is greater than `value` (`column=gt.value`). */ + gt(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'gt', value) + } + + /** Match rows where `column` is greater than or equal to `value` (`column=gte.value`). */ + gte(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'gte', value) + } + + /** Match rows where `column` is less than `value` (`column=lt.value`). */ + lt(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'lt', value) + } + + /** Match rows where `column` is less than or equal to `value` (`column=lte.value`). */ + lte(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'lte', value) + } + + /** + * Match rows where `column` is one of `values` (`column=in.(a,b,c)`). + * Requires at least one value; duplicates are removed. An element containing a + * reserved character is double-quoted (`in.("a,b",c)`), so commas inside an + * element are preserved. `null` is intentionally not accepted (`IN (null)` + * never matches in SQL) — use `is`/`not('col','is',null)` for null checks. + */ + in(column: string, values: ReadonlyArray): this { + return this.add(column, 'in', values) + } + + /** Match rows where `column` matches the case-sensitive `pattern` (`column=like.pattern`). */ + like(column: string, pattern: string): this { + return this.add(column, 'like', pattern) + } + + /** Match rows where `column` matches the case-insensitive `pattern` (`column=ilike.pattern`). */ + ilike(column: string, pattern: string): this { + return this.add(column, 'ilike', pattern) + } + + /** Match rows where `column` matches the POSIX regex `pattern` (`column=match.pattern`). */ + match(column: string, pattern: string): this { + return this.add(column, 'match', pattern) + } + + /** Match rows where `column` matches the case-insensitive POSIX regex `pattern` (`column=imatch.pattern`). */ + imatch(column: string, pattern: string): this { + return this.add(column, 'imatch', pattern) + } + + /** + * Match rows where `column` `IS` the given value (`column=is.null`). + * Accepts `null`, a boolean, or the keywords `'null' | 'true' | 'false' | 'unknown'`. + */ + is(column: string, value: RealtimeIsFilterValue): this { + return this.add(column, 'is', value) + } + + /** Match rows where `column` is distinct from `value` (`column=isdistinct.value`). NULL-safe inequality. */ + isDistinct(column: string, value: RealtimeFilterValue): this { + return this.add(column, 'isdistinct', value) + } + + /** + * Negate any operator with the `not.` prefix (`column=not.operator.value`). + * `in` takes an array, `is` takes an `IS` keyword/boolean/null, and every + * other operator takes a scalar value. + * + * @example + * postgresChangesFilter().not('status', 'in', ['draft', 'archived']) + * // → status=not.in.(draft,archived) + * postgresChangesFilter().not('deleted_at', 'is', null) + * // → deleted_at=not.is.null + */ + not(column: string, operator: 'in', value: ReadonlyArray): this + not(column: string, operator: 'is', value: RealtimeIsFilterValue): this + not( + column: string, + operator: Exclude, + value: RealtimeFilterValue + ): this + not( + column: string, + operator: RealtimePostgresChangesFilterOperator, + value: RealtimeFilterValue | ReadonlyArray + ): this { + return this.add(column, operator, value, true) + } + + /** + * Serialize all conditions into the comma-separated (AND) filter string. + * + * Conditions are joined by commas, which the server applies as `AND`. A scalar + * value (or single `in` element) that contains a reserved character — `,`, + * `(`, `)`, `"`, `\` — or surrounding whitespace is double-quoted and escaped + * the way PostgREST does, so commas inside a value are preserved rather than + * read as a condition boundary. + */ + build(): string { + return this.filters.join(',') + } + + /** Alias for {@link build}; lets the builder be used wherever a string is expected. */ + toString(): string { + return this.build() + } +} + +/** + * Create a {@link RealtimePostgresFilterBuilder} for composing a Postgres + * Changes `filter`. Conditions are combined with `AND`. + * + * @example + * import { postgresChangesFilter } from '@supabase/realtime-js' + * + * channel.on('postgres_changes', { + * event: 'UPDATE', + * schema: 'public', + * table: 'orders', + * filter: postgresChangesFilter().gt('amount', 100).eq('status', 'open'), + * }, (payload) => { ... }) + */ +export const postgresChangesFilter = (): RealtimePostgresFilterBuilder => + new RealtimePostgresFilterBuilder() diff --git a/node_modules/@supabase/realtime-js/src/RealtimePresence.ts b/node_modules/@supabase/realtime-js/src/RealtimePresence.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ced1282d1e5cab17e004f8b64605a5c58aaad11 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/RealtimePresence.ts @@ -0,0 +1,71 @@ +/* + This file draws heavily from https://github.com/phoenixframework/phoenix/blob/d344ec0a732ab4ee204215b31de69cf4be72e3bf/assets/js/phoenix/presence.js + License: https://github.com/phoenixframework/phoenix/blob/d344ec0a732ab4ee204215b31de69cf4be72e3bf/LICENSE.md +*/ + +import type RealtimeChannel from './RealtimeChannel' +import PresenceAdapter from './phoenix/presenceAdapter' + +export type Presence = { + presence_ref: string +} & T + +export type RealtimePresenceState = { + [key: string]: Presence[] +} + +export type RealtimePresenceJoinPayload = { + event: `${REALTIME_PRESENCE_LISTEN_EVENTS.JOIN}` + key: string + currentPresences: Presence[] + newPresences: Presence[] +} + +export type RealtimePresenceLeavePayload = { + event: `${REALTIME_PRESENCE_LISTEN_EVENTS.LEAVE}` + key: string + currentPresences: Presence[] + leftPresences: Presence[] +} + +export enum REALTIME_PRESENCE_LISTEN_EVENTS { + SYNC = 'sync', + JOIN = 'join', + LEAVE = 'leave', +} + +export type RealtimePresenceOptions = { + events?: { state: string; diff: string } +} + +export default class RealtimePresence { + get state() { + return this.presenceAdapter.state + } + + private presenceAdapter: PresenceAdapter + + /** + * Creates a Presence helper that keeps the local presence state in sync with the server. + * + * @param channel - The realtime channel to bind to. + * @param opts - Optional custom event names, e.g. `{ events: { state: 'state', diff: 'diff' } }`. + * + * @category Realtime + * + * @example Example for a presence channel + * ```ts + * const presence = new RealtimePresence(channel) + * + * channel.on('presence', ({ event, key }) => { + * console.log(`Presence ${event} on ${key}`) + * }) + * ``` + */ + constructor( + public channel: RealtimeChannel, + opts?: RealtimePresenceOptions + ) { + this.presenceAdapter = new PresenceAdapter(this.channel.channelAdapter, opts) + } +} diff --git a/node_modules/@supabase/realtime-js/src/index.ts b/node_modules/@supabase/realtime-js/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..9185d7e842b6dbc5d68ea6271f9f077e5e94d33c --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/index.ts @@ -0,0 +1,61 @@ +import RealtimeClient, { + RealtimeClientOptions, + RealtimeMessage, + RealtimeRemoveChannelResponse, + WebSocketLikeConstructor, +} from './RealtimeClient' +import RealtimeChannel, { + RealtimeChannelOptions, + RealtimeChannelSendResponse, + RealtimePostgresChangesFilter, + RealtimePostgresChangesFilterOperator, + RealtimePostgresFilterBuilder, + postgresChangesFilter, + RealtimePostgresChangesPayload, + RealtimePostgresInsertPayload, + RealtimePostgresUpdatePayload, + RealtimePostgresDeletePayload, + RealtimeSystemPayload, + REALTIME_LISTEN_TYPES, + REALTIME_POSTGRES_CHANGES_LISTEN_EVENT, + REALTIME_SUBSCRIBE_STATES, + REALTIME_CHANNEL_STATES, +} from './RealtimeChannel' +import RealtimePresence, { + RealtimePresenceState, + RealtimePresenceJoinPayload, + RealtimePresenceLeavePayload, + REALTIME_PRESENCE_LISTEN_EVENTS, +} from './RealtimePresence' +import WebSocketFactory, { WebSocketLike } from './lib/websocket-factory' + +export { + RealtimePresence, + RealtimeChannel, + RealtimeChannelOptions, + RealtimeChannelSendResponse, + RealtimeClient, + RealtimeClientOptions, + RealtimeMessage, + RealtimePostgresChangesFilter, + RealtimePostgresChangesFilterOperator, + RealtimePostgresFilterBuilder, + postgresChangesFilter, + RealtimePostgresChangesPayload, + RealtimePostgresInsertPayload, + RealtimePostgresUpdatePayload, + RealtimePostgresDeletePayload, + RealtimeSystemPayload, + RealtimePresenceJoinPayload, + RealtimePresenceLeavePayload, + RealtimePresenceState, + RealtimeRemoveChannelResponse, + REALTIME_LISTEN_TYPES, + REALTIME_POSTGRES_CHANGES_LISTEN_EVENT, + REALTIME_PRESENCE_LISTEN_EVENTS, + REALTIME_SUBSCRIBE_STATES, + REALTIME_CHANNEL_STATES, + WebSocketFactory, + WebSocketLike, + WebSocketLikeConstructor, +} diff --git a/node_modules/@supabase/realtime-js/src/lib/constants.ts b/node_modules/@supabase/realtime-js/src/lib/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..e907b020dbbe02cd6426e7e1e9017bdf077bdab0 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/constants.ts @@ -0,0 +1,62 @@ +import { version } from './version' +import type { + SocketState, + ChannelState, + ChannelEvent as PhoenixChannelEvent, + Transport, + Vsn, +} from '../phoenix/types' + +export type { SocketState, ChannelState, Transport } + +export const DEFAULT_VERSION = `realtime-js/${version}` + +export const VSN_1_0_0: Vsn = '1.0.0' +export const VSN_2_0_0: Vsn = '2.0.0' +export const DEFAULT_VSN: Vsn = VSN_2_0_0 + +export const VERSION = version + +export const DEFAULT_TIMEOUT = 10000 + +export const WS_CLOSE_NORMAL = 1000 +export const MAX_PUSH_BUFFER_SIZE = 100 + +export const SOCKET_STATES = { + connecting: 0, + open: 1, + closing: 2, + closed: 3, +} as const + +export const CHANNEL_STATES = { + closed: 'closed', + errored: 'errored', + joined: 'joined', + joining: 'joining', + leaving: 'leaving', +} as const + +export type ChannelEvent = PhoenixChannelEvent | 'access_token' + +export const CHANNEL_EVENTS = { + close: 'phx_close', + error: 'phx_error', + join: 'phx_join', + reply: 'phx_reply', + leave: 'phx_leave', + access_token: 'access_token', +} as const + +export const TRANSPORTS = { + websocket: 'websocket', +} as const + +export type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed' | (string & {}) + +export const CONNECTION_STATE = { + connecting: 'connecting', + open: 'open', + closing: 'closing', + closed: 'closed', +} as const diff --git a/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts b/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3954371e3eda124e038b8e241df81414eff51b6 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/normalizeChannelError.ts @@ -0,0 +1,30 @@ +/** + * Normalize the various shapes a channel error reason can take into a real `Error`. + * + * Transport-level channel errors arrive as a `CloseEvent`, a transport `Event`, an `Error`, + * a string, or `undefined` depending on which path in the underlying socket fired. Server-reply + * errors arrive as a payload object. This helper produces a consistent `Error` for every case + * and preserves the original via `cause` so callers can still inspect the raw event. + */ +export function normalizeChannelError(reason: unknown): Error { + if (reason instanceof Error) { + return reason + } + + if (typeof reason === 'string') { + return new Error(reason) + } + + if (reason && typeof reason === 'object') { + const obj = reason as Record + + if (typeof obj.code === 'number') { + const detail = typeof obj.reason === 'string' && obj.reason ? ` (${obj.reason})` : '' + return new Error(`socket closed: ${obj.code}${detail}`, { cause: reason }) + } + + return new Error('channel error: transport failure', { cause: reason }) + } + + return new Error('channel error: connection lost') +} diff --git a/node_modules/@supabase/realtime-js/src/lib/serializer.ts b/node_modules/@supabase/realtime-js/src/lib/serializer.ts new file mode 100644 index 0000000000000000000000000000000000000000..34520aa23c197d1bee1fa762f534bca3b6b06b88 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/serializer.ts @@ -0,0 +1,214 @@ +// This file draws heavily from https://github.com/phoenixframework/phoenix/commit/cf098e9cf7a44ee6479d31d911a97d3c7430c6fe +// License: https://github.com/phoenixframework/phoenix/blob/master/LICENSE.md +export type Msg = { + join_ref?: string | null + ref?: string | null + topic: string + event: string + payload: T +} + +export default class Serializer { + HEADER_LENGTH = 1 + USER_BROADCAST_PUSH_META_LENGTH = 6 + KINDS = { userBroadcastPush: 3, userBroadcast: 4 } + BINARY_ENCODING = 0 + JSON_ENCODING = 1 + BROADCAST_EVENT = 'broadcast' + + allowedMetadataKeys: string[] = [] + + constructor(allowedMetadataKeys?: string[] | null) { + this.allowedMetadataKeys = allowedMetadataKeys ?? [] + } + + encode(msg: Msg<{ [key: string]: any }>, callback: (result: ArrayBuffer | string) => any) { + if ( + msg.event === this.BROADCAST_EVENT && + !(msg.payload instanceof ArrayBuffer) && + typeof msg.payload.event === 'string' + ) { + return callback( + this._binaryEncodeUserBroadcastPush(msg as Msg<{ event: string } & { [key: string]: any }>) + ) + } + + let payload = [msg.join_ref, msg.ref, msg.topic, msg.event, msg.payload] + return callback(JSON.stringify(payload)) + } + + private _binaryEncodeUserBroadcastPush(message: Msg<{ event: string } & { [key: string]: any }>) { + if (this._isArrayBuffer(message.payload?.payload)) { + return this._encodeBinaryUserBroadcastPush(message) + } else { + return this._encodeJsonUserBroadcastPush(message) + } + } + + private _encodeBinaryUserBroadcastPush(message: Msg<{ event: string } & { [key: string]: any }>) { + const userPayload = message.payload?.payload ?? new ArrayBuffer(0) + return this._encodeUserBroadcastPush(message, this.BINARY_ENCODING, userPayload) + } + + private _encodeJsonUserBroadcastPush(message: Msg<{ event: string } & { [key: string]: any }>) { + const userPayload = message.payload?.payload ?? {} + const encoder = new TextEncoder() + const encodedUserPayload = encoder.encode(JSON.stringify(userPayload)).buffer + return this._encodeUserBroadcastPush(message, this.JSON_ENCODING, encodedUserPayload) + } + + private _encodeUserBroadcastPush( + message: Msg<{ event: string } & { [key: string]: any }>, + encodingType: number, + encodedPayload: ArrayBuffer + ) { + // Encode each header field as UTF-8. The length prefixes are byte counts and + // the decode side uses TextDecoder (UTF-8), so measuring with String.length + // and writing with charCodeAt would corrupt any multi-byte character (e.g. + // accents or emoji) and desynchronize the buffer. + const encoder = new TextEncoder() + const topic = encoder.encode(message.topic) + const ref = encoder.encode(message.ref ?? '') + const joinRef = encoder.encode(message.join_ref ?? '') + const userEvent = encoder.encode(message.payload.event) + + // Filter metadata based on allowed keys + const rest = this.allowedMetadataKeys + ? this._pick(message.payload, this.allowedMetadataKeys) + : {} + + const metadata = encoder.encode(Object.keys(rest).length === 0 ? '' : JSON.stringify(rest)) + + // Validate byte lengths don't exceed uint8 max value (255) + if (joinRef.length > 255) { + throw new Error(`joinRef length ${joinRef.length} exceeds maximum of 255`) + } + if (ref.length > 255) { + throw new Error(`ref length ${ref.length} exceeds maximum of 255`) + } + if (topic.length > 255) { + throw new Error(`topic length ${topic.length} exceeds maximum of 255`) + } + if (userEvent.length > 255) { + throw new Error(`userEvent length ${userEvent.length} exceeds maximum of 255`) + } + if (metadata.length > 255) { + throw new Error(`metadata length ${metadata.length} exceeds maximum of 255`) + } + + const metaLength = + this.USER_BROADCAST_PUSH_META_LENGTH + + joinRef.length + + ref.length + + topic.length + + userEvent.length + + metadata.length + + const header = new ArrayBuffer(this.HEADER_LENGTH + metaLength) + const view = new DataView(header) + const bytes = new Uint8Array(header) + let offset = 0 + + view.setUint8(offset++, this.KINDS.userBroadcastPush) // kind + view.setUint8(offset++, joinRef.length) + view.setUint8(offset++, ref.length) + view.setUint8(offset++, topic.length) + view.setUint8(offset++, userEvent.length) + view.setUint8(offset++, metadata.length) + view.setUint8(offset++, encodingType) + bytes.set(joinRef, offset) + offset += joinRef.length + bytes.set(ref, offset) + offset += ref.length + bytes.set(topic, offset) + offset += topic.length + bytes.set(userEvent, offset) + offset += userEvent.length + bytes.set(metadata, offset) + offset += metadata.length + + var combined = new Uint8Array(header.byteLength + encodedPayload.byteLength) + combined.set(new Uint8Array(header), 0) + combined.set(new Uint8Array(encodedPayload), header.byteLength) + + return combined.buffer + } + + decode(rawPayload: ArrayBuffer | string, callback: Function) { + if (this._isArrayBuffer(rawPayload)) { + let result = this._binaryDecode(rawPayload as ArrayBuffer) + return callback(result) + } + + if (typeof rawPayload === 'string') { + const jsonPayload = JSON.parse(rawPayload) + const [join_ref, ref, topic, event, payload] = jsonPayload + return callback({ join_ref, ref, topic, event, payload }) + } + + return callback({}) + } + + private _binaryDecode(buffer: ArrayBuffer) { + const view = new DataView(buffer) + const kind = view.getUint8(0) + const decoder = new TextDecoder() + switch (kind) { + case this.KINDS.userBroadcast: + return this._decodeUserBroadcast(buffer, view, decoder) + } + } + + private _decodeUserBroadcast( + buffer: ArrayBuffer, + view: DataView, + decoder: TextDecoder + ): { + join_ref: null + ref: null + topic: string + event: string + payload: { [key: string]: any } + } { + const topicSize = view.getUint8(1) + const userEventSize = view.getUint8(2) + const metadataSize = view.getUint8(3) + const payloadEncoding = view.getUint8(4) + + let offset = this.HEADER_LENGTH + 4 + const topic = decoder.decode(buffer.slice(offset, offset + topicSize)) + offset = offset + topicSize + const userEvent = decoder.decode(buffer.slice(offset, offset + userEventSize)) + offset = offset + userEventSize + const metadata = decoder.decode(buffer.slice(offset, offset + metadataSize)) + offset = offset + metadataSize + + const payload = buffer.slice(offset, buffer.byteLength) + const parsedPayload = + payloadEncoding === this.JSON_ENCODING ? JSON.parse(decoder.decode(payload)) : payload + + const data: { [key: string]: any } = { + type: this.BROADCAST_EVENT, + event: userEvent, + payload: parsedPayload, + } + + // Metadata is optional and always JSON encoded + if (metadataSize > 0) { + data['meta'] = JSON.parse(metadata) + } + + return { join_ref: null, ref: null, topic: topic, event: this.BROADCAST_EVENT, payload: data } + } + + private _isArrayBuffer(buffer: any): boolean { + return buffer instanceof ArrayBuffer || buffer?.constructor?.name === 'ArrayBuffer' + } + + private _pick(obj: Record | null | undefined, keys: string[]): Record { + if (!obj || typeof obj !== 'object') { + return {} + } + return Object.fromEntries(Object.entries(obj).filter(([key]) => keys.includes(key))) + } +} diff --git a/node_modules/@supabase/realtime-js/src/lib/transformers.ts b/node_modules/@supabase/realtime-js/src/lib/transformers.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9cade703db15e20d558b6b37c4ca010bdf5af2d --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/transformers.ts @@ -0,0 +1,270 @@ +/** + * Helpers to convert the change Payload into native JS types. + */ + +// Adapted from epgsql (src/epgsql_binary.erl), this module licensed under +// 3-clause BSD found here: https://raw.githubusercontent.com/epgsql/epgsql/devel/LICENSE + +export enum PostgresTypes { + abstime = 'abstime', + bool = 'bool', + date = 'date', + daterange = 'daterange', + float4 = 'float4', + float8 = 'float8', + int2 = 'int2', + int4 = 'int4', + int4range = 'int4range', + int8 = 'int8', + int8range = 'int8range', + json = 'json', + jsonb = 'jsonb', + money = 'money', + numeric = 'numeric', + oid = 'oid', + reltime = 'reltime', + text = 'text', + time = 'time', + timestamp = 'timestamp', + timestamptz = 'timestamptz', + timetz = 'timetz', + tsrange = 'tsrange', + tstzrange = 'tstzrange', +} + +type Columns = { + name: string // the column name. eg: "user_id" + type: string // the column type. eg: "uuid" + flags?: string[] // any special flags for the column. eg: ["key"] + type_modifier?: number // the type modifier. eg: 4294967295 +}[] + +type BaseValue = null | string | number | boolean +type RecordValue = BaseValue | BaseValue[] + +type Record = { + [key: string]: RecordValue +} + +/** + * Takes an array of columns and an object of string values then converts each string value + * to its mapped type. + * + * @param {{name: String, type: String}[]} columns + * @param {Object} record + * @param {Object} options The map of various options that can be applied to the mapper + * @param {Array} options.skipTypes The array of types that should not be converted + * + * @example convertChangeData([{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], {first_name: 'Paul', age:'33'}, {}) + * //=>{ first_name: 'Paul', age: 33 } + */ +export const convertChangeData = ( + columns: Columns, + record: Record | null, + options: { skipTypes?: string[] } = {} +): Record => { + const skipTypes = options.skipTypes ?? [] + + if (!record) { + return {} + } + + return Object.keys(record).reduce((acc, rec_key) => { + acc[rec_key] = convertColumn(rec_key, columns, record, skipTypes) + return acc + }, {} as Record) +} + +/** + * Converts the value of an individual column. + * + * @param {String} columnName The column that you want to convert + * @param {{name: String, type: String}[]} columns All of the columns + * @param {Object} record The map of string values + * @param {Array} skipTypes An array of types that should not be converted + * @return {object} Useless information + * + * @example convertColumn('age', [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], {first_name: 'Paul', age: '33'}, []) + * //=> 33 + * @example convertColumn('age', [{name: 'first_name', type: 'text'}, {name: 'age', type: 'int4'}], {first_name: 'Paul', age: '33'}, ['int4']) + * //=> "33" + */ +export const convertColumn = ( + columnName: string, + columns: Columns, + record: Record, + skipTypes: string[] +): RecordValue => { + const column = columns.find((x) => x.name === columnName) + const colType = column?.type + const value = record[columnName] + + if (colType && !skipTypes.includes(colType)) { + return convertCell(colType, value) + } + + return noop(value) +} + +/** + * If the value of the cell is `null`, returns null. + * Otherwise converts the string value to the correct type. + * @param {String} type A postgres column type + * @param {String} value The cell value + * + * @example convertCell('bool', 't') + * //=> true + * @example convertCell('int8', '10') + * //=> 10 + * @example convertCell('_int4', '{1,2,3,4}') + * //=> [1,2,3,4] + */ +export const convertCell = (type: string, value: RecordValue): RecordValue => { + // if data type is an array + if (type.charAt(0) === '_') { + const dataType = type.slice(1, type.length) + return toArray(value, dataType) + } + + // If not null, convert to correct type. + switch (type) { + case PostgresTypes.bool: + return toBoolean(value) + case PostgresTypes.float4: + case PostgresTypes.float8: + case PostgresTypes.int2: + case PostgresTypes.int4: + case PostgresTypes.int8: + case PostgresTypes.numeric: + case PostgresTypes.oid: + return toNumber(value) + case PostgresTypes.json: + case PostgresTypes.jsonb: + return toJson(value) + case PostgresTypes.timestamp: + return toTimestampString(value) // Format to be consistent with PostgREST + case PostgresTypes.abstime: // To allow users to cast it based on Timezone + case PostgresTypes.date: // To allow users to cast it based on Timezone + case PostgresTypes.daterange: + case PostgresTypes.int4range: + case PostgresTypes.int8range: + case PostgresTypes.money: + case PostgresTypes.reltime: // To allow users to cast it based on Timezone + case PostgresTypes.text: + case PostgresTypes.time: // To allow users to cast it based on Timezone + case PostgresTypes.timestamptz: // To allow users to cast it based on Timezone + case PostgresTypes.timetz: // To allow users to cast it based on Timezone + case PostgresTypes.tsrange: + case PostgresTypes.tstzrange: + return noop(value) + default: + // Return the value for remaining types + return noop(value) + } +} + +const noop = (value: RecordValue): RecordValue => { + return value +} +export const toBoolean = (value: RecordValue): RecordValue => { + switch (value) { + case 't': + return true + case 'f': + return false + default: + return value + } +} +export const toNumber = (value: RecordValue): RecordValue => { + if (typeof value === 'string') { + const parsedValue = parseFloat(value) + if (!Number.isNaN(parsedValue)) { + return parsedValue + } + } + return value +} +export const toJson = (value: RecordValue): RecordValue => { + if (typeof value === 'string') { + try { + return JSON.parse(value) + } catch { + return value + } + } + return value +} + +/** + * Converts a Postgres Array into a native JS array + * + * @example toArray('{}', 'int4') + * //=> [] + * @example toArray('{"[2021-01-01,2021-12-31)","(2021-01-01,2021-12-32]"}', 'daterange') + * //=> ['[2021-01-01,2021-12-31)', '(2021-01-01,2021-12-32]'] + * @example toArray([1,2,3,4], 'int4') + * //=> [1,2,3,4] + */ +export const toArray = (value: RecordValue, type: string): RecordValue => { + if (typeof value !== 'string') { + return value + } + + const lastIdx = value.length - 1 + const closeBrace = value[lastIdx] + const openBrace = value[0] + + // Confirm value is a Postgres array by checking curly brackets + if (openBrace === '{' && closeBrace === '}') { + let arr + const valTrim = value.slice(1, lastIdx) + + // TODO: find a better solution to separate Postgres array data + try { + arr = JSON.parse('[' + valTrim + ']') + } catch (_) { + // WARNING: splitting on comma does not cover all edge cases + arr = valTrim ? valTrim.split(',') : [] + } + + return arr.map((val: BaseValue) => convertCell(type, val)) + } + + return value +} + +/** + * Fixes timestamp to be ISO-8601. Swaps the space between the date and time for a 'T' + * See https://github.com/supabase/supabase/issues/18 + * + * @example toTimestampString('2019-09-10 00:00:00') + * //=> '2019-09-10T00:00:00' + */ +export const toTimestampString = (value: RecordValue): RecordValue => { + if (typeof value === 'string') { + return value.replace(' ', 'T') + } + + return value +} + +export const httpEndpointURL = (socketUrl: string): string => { + const wsUrl = new URL(socketUrl) + + wsUrl.protocol = wsUrl.protocol.replace(/^ws/i, 'http') + + wsUrl.pathname = wsUrl.pathname + .replace(/\/+$/, '') // remove all trailing slashes + .replace(/\/socket\/websocket$/i, '') // remove the socket/websocket path + .replace(/\/socket$/i, '') // remove the socket path + .replace(/\/websocket$/i, '') // remove the websocket path + + if (wsUrl.pathname === '' || wsUrl.pathname === '/') { + wsUrl.pathname = '/api/broadcast' + } else { + wsUrl.pathname = wsUrl.pathname + '/api/broadcast' + } + + return wsUrl.href +} diff --git a/node_modules/@supabase/realtime-js/src/lib/version.ts b/node_modules/@supabase/realtime-js/src/lib/version.ts new file mode 100644 index 0000000000000000000000000000000000000000..728b243d9860d462498beea4f7212d24b085dddf --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/version.ts @@ -0,0 +1,7 @@ +// Generated automatically during releases by scripts/update-version-files.ts +// This file provides runtime access to the package version for: +// - HTTP request headers (e.g., X-Client-Info header for API requests) +// - Debugging and support (identifying which version is running) +// - Telemetry and logging (version reporting in errors/analytics) +// - Ensuring build artifacts match the published package version +export const version = '2.112.3' diff --git a/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts b/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts new file mode 100644 index 0000000000000000000000000000000000000000..caf37f34659a97f7cbf8b62c5e99567ae992ba5e --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/lib/websocket-factory.ts @@ -0,0 +1,185 @@ +export interface WebSocketLike { + readonly CONNECTING: number + readonly OPEN: number + readonly CLOSING: number + readonly CLOSED: number + readonly readyState: number + readonly url: string + readonly protocol: string + + /** + * Closes the socket, optionally providing a close code and reason. + */ + close(code?: number, reason?: string): void + /** + * Sends data through the socket using the underlying implementation. + */ + send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void + + onopen: ((this: any, ev: Event) => any) | null + onmessage: ((this: any, ev: MessageEvent) => any) | null + onclose: ((this: any, ev: CloseEvent) => any) | null + onerror: ((this: any, ev: Event) => any) | null + + /** + * Registers an event listener on the socket (compatible with browser WebSocket API). + */ + addEventListener(type: string, listener: EventListener): void + /** + * Removes a previously registered event listener. + */ + removeEventListener(type: string, listener: EventListener): void + + // Add additional properties that may exist on WebSocket implementations + binaryType?: string + bufferedAmount?: number + extensions?: string + dispatchEvent?: (event: Event) => boolean +} + +export interface WebSocketEnvironment { + type: 'native' | 'cloudflare' | 'unsupported' + /** WebSocket constructor for this environment, if available. */ + wsConstructor?: typeof WebSocket + error?: string + workaround?: string +} + +/** + * Extended globalThis with optional runtime-specific properties + * that may or may not exist depending on the environment. + */ +interface RuntimeGlobals { + WebSocket?: { new (url: string, protocols?: string | string[]): WebSocketLike } + WebSocketPair?: unknown + EdgeRuntime?: unknown +} + +/** + * Utilities for creating WebSocket instances across runtimes. + */ +export class WebSocketFactory { + /** + * Static-only utility – prevent instantiation. + */ + private constructor() {} + private static detectEnvironment(): WebSocketEnvironment { + if (typeof WebSocket !== 'undefined') { + return { type: 'native', wsConstructor: WebSocket } + } + + const gt = globalThis as typeof globalThis & RuntimeGlobals + if (typeof globalThis !== 'undefined' && typeof gt.WebSocket !== 'undefined') { + return { type: 'native', wsConstructor: gt.WebSocket as typeof WebSocket } + } + + const gl = + typeof global !== 'undefined' ? (global as typeof global & RuntimeGlobals) : undefined + if (gl && typeof gl.WebSocket !== 'undefined') { + return { type: 'native', wsConstructor: gl.WebSocket as typeof WebSocket } + } + + if ( + typeof globalThis !== 'undefined' && + typeof gt.WebSocketPair !== 'undefined' && + typeof globalThis.WebSocket === 'undefined' + ) { + return { + type: 'cloudflare', + error: + 'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.', + workaround: + 'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.', + } + } + + if ( + (typeof globalThis !== 'undefined' && gt.EdgeRuntime) || + (typeof navigator !== 'undefined' && navigator.userAgent?.includes('Vercel-Edge')) + ) { + return { + type: 'unsupported', + error: + 'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.', + workaround: + 'Use serverless functions or a different deployment target for WebSocket functionality.', + } + } + + // Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings + const _process = (globalThis as Record)['process'] as + | { versions?: { node?: string } } + | undefined + if (_process) { + const processVersions = _process['versions'] + if (processVersions && processVersions['node']) { + // Reaching here means an earlier check did not find a native WebSocket, + // so this Node.js process is missing the global WebSocket (Node.js 22+). + return { + type: 'unsupported', + error: 'Node.js detected but native WebSocket not found.', + workaround: + 'Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option.', + } + } + } + + return { + type: 'unsupported', + error: 'Unknown JavaScript runtime without WebSocket support.', + workaround: + "Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation.", + } + } + + /** + * Returns the best available WebSocket constructor for the current runtime. + * + * @category Realtime + * + * @example Example with error handling + * ```ts + * try { + * const WS = WebSocketFactory.getWebSocketConstructor() + * const socket = new WS('wss://example.com/socket') + * } catch (error) { + * console.error('WebSocket not available in this environment.', error) + * } + * ``` + */ + public static getWebSocketConstructor(): typeof WebSocket { + const env = this.detectEnvironment() + if (env.wsConstructor) { + return env.wsConstructor + } + let errorMessage = env.error || 'WebSocket not supported in this environment.' + if (env.workaround) { + errorMessage += `\n\nSuggested solution: ${env.workaround}` + } + throw new Error(errorMessage) + } + + /** + * Detects whether the runtime can establish WebSocket connections. + * + * @category Realtime + * + * @example Example in a Node.js script + * ```ts + * if (!WebSocketFactory.isWebSocketSupported()) { + * console.error('WebSockets are required for this script.') + * process.exitCode = 1 + * } + * ``` + */ + public static isWebSocketSupported(): boolean { + try { + const env = this.detectEnvironment() + return env.type === 'native' + } catch { + return false + } + } +} + +export default WebSocketFactory diff --git a/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts b/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c9570e22a1e0efd6d81de3719a6cdbbe7812f80 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/phoenix/channelAdapter.ts @@ -0,0 +1,149 @@ +import { Channel } from '@supabase/phoenix' +import { CHANNEL_STATES, MAX_PUSH_BUFFER_SIZE } from '../lib/constants' +import type { RealtimeChannelOptions } from '../RealtimeChannel' +import SocketAdapter from './socketAdapter' +import type { + ChannelBindingCallback, + ChannelOnMessage, + ChannelOnErrorCallback, + ChannelFilterBindings, + Params, + ChannelState, + Push, + Timer, +} from './types' + +export default class ChannelAdapter { + private channel: Channel + private socket: SocketAdapter + + constructor(socket: SocketAdapter, topic: string, params: RealtimeChannelOptions) { + const phoenixParams = phoenixChannelParams(params) + this.channel = socket.getSocket().channel(topic, phoenixParams) + this.socket = socket + } + + get state(): ChannelState { + return this.channel.state + } + + set state(state: ChannelState) { + this.channel.state = state + } + + get joinedOnce(): boolean { + return this.channel.joinedOnce + } + + get joinPush(): Push { + return this.channel.joinPush + } + + get rejoinTimer(): Timer { + return this.channel.rejoinTimer + } + + on(event: string, callback: ChannelBindingCallback): number { + return this.channel.on(event, callback) + } + + off(event: string, refNumber?: number) { + this.channel.off(event, refNumber) + } + + subscribe(timeout?: number): Push { + return this.channel.join(timeout) + } + + unsubscribe(timeout?: number): Push { + return this.channel.leave(timeout) + } + + teardown() { + this.channel.teardown() + } + + onClose(callback: ChannelBindingCallback) { + this.channel.onClose(callback) + } + + onError(callback: ChannelOnErrorCallback): number { + return this.channel.onError(callback) + } + + push(event: string, payload: { [key: string]: any }, timeout?: number): Push { + let push: Push + + try { + push = this.channel.push(event, payload, timeout) + } catch (error) { + throw new Error( + `tried to push '${event}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events` + ) + } + + if (this.channel.pushBuffer.length > MAX_PUSH_BUFFER_SIZE) { + const removedPush = this.channel.pushBuffer.shift()! + removedPush.cancelTimeout() + this.socket.log( + 'channel', + `discarded push due to buffer overflow: ${removedPush.event}`, + removedPush.payload() + ) + } + return push + } + + updateJoinPayload(payload: Record) { + const oldPayload = this.channel.joinPush.payload() + this.channel.joinPush.payload = () => ({ ...oldPayload, ...payload }) + } + + canPush() { + return this.socket.isConnected() && this.state === CHANNEL_STATES.joined + } + + isJoined() { + return this.state === CHANNEL_STATES.joined + } + + isJoining() { + return this.state === CHANNEL_STATES.joining + } + + isClosed() { + return this.state === CHANNEL_STATES.closed + } + + isLeaving() { + return this.state === CHANNEL_STATES.leaving + } + + updateFilterBindings(filterBindings: ChannelFilterBindings) { + this.channel.filterBindings = filterBindings + } + + updatePayloadTransform(callback: ChannelOnMessage) { + this.channel.onMessage = callback + } + + /** + * @internal + */ + getChannel() { + return this.channel + } +} + +function phoenixChannelParams(options: RealtimeChannelOptions): Params { + return { + config: { + ...{ + broadcast: { ack: false, self: false }, + presence: { key: '', enabled: false }, + private: false, + }, + ...options.config, + }, + } +} diff --git a/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts b/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b69dcff68433538ce48d6d174ab492c7c864c30 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/phoenix/presenceAdapter.ts @@ -0,0 +1,119 @@ +import { Presence } from '@supabase/phoenix' +import type { PresenceState, PresenceStates } from './types' +import type { + RealtimePresenceOptions, + RealtimePresenceState, + Presence as RealtimePresenceType, +} from '../RealtimePresence' +import ChannelAdapter from './channelAdapter' + +export default class PresenceAdapter { + private presence: Presence + + constructor(channel: ChannelAdapter, opts?: RealtimePresenceOptions) { + const phoenixOptions = phoenixPresenceOptions(opts) + this.presence = new Presence(channel.getChannel(), phoenixOptions) + + this.presence.onJoin((key, currentPresence, newPresence) => { + const onJoinPayload = PresenceAdapter.onJoinPayload(key, currentPresence, newPresence) + channel.getChannel().trigger('presence', onJoinPayload) + }) + + this.presence.onLeave((key, currentPresence, leftPresence) => { + const onLeavePayload = PresenceAdapter.onLeavePayload(key, currentPresence, leftPresence) + channel.getChannel().trigger('presence', onLeavePayload) + }) + + this.presence.onSync(() => { + channel.getChannel().trigger('presence', { event: 'sync' }) + }) + } + + get state() { + return PresenceAdapter.transformState(this.presence.state) + } + + /** + * @private + * Remove 'metas' key + * Change 'phx_ref' to 'presence_ref' + * Remove 'phx_ref' and 'phx_ref_prev' + * + * @example Transform state + * // returns { + * abc123: [ + * { presence_ref: '2', user_id: 1 }, + * { presence_ref: '3', user_id: 2 } + * ] + * } + * RealtimePresence.transformState({ + * abc123: { + * metas: [ + * { phx_ref: '2', phx_ref_prev: '1' user_id: 1 }, + * { phx_ref: '3', user_id: 2 } + * ] + * } + * }) + * + */ + static transformState(state: PresenceStates): RealtimePresenceState { + state = cloneState(state) + + return Object.getOwnPropertyNames(state).reduce((newState, key) => { + const presences = state[key] + newState[key] = transformState(presences) + + return newState + }, {} as RealtimePresenceState) + } + + static onJoinPayload(key: string, currentPresence: PresenceState, newPresence: PresenceState) { + const currentPresences = parseCurrentPresences(currentPresence) + const newPresences = transformState(newPresence) + + return { + event: 'join', + key, + currentPresences, + newPresences, + } + } + + static onLeavePayload(key: string, currentPresence: PresenceState, leftPresence: PresenceState) { + const currentPresences = parseCurrentPresences(currentPresence) + const leftPresences = transformState(leftPresence) + + return { + event: 'leave', + key, + currentPresences, + leftPresences, + } + } +} + +function transformState(presences: PresenceState) { + return presences.metas.map((presence) => { + // Object spread compiles to Object.assign for ES2017, which treats __proto__ as a setter. + const descriptors = Object.getOwnPropertyDescriptors(presence) + const transformedPresence = Object.defineProperties({}, descriptors) as typeof presence + transformedPresence['presence_ref'] = transformedPresence['phx_ref'] + + delete transformedPresence['phx_ref'] + delete transformedPresence['phx_ref_prev'] + + return transformedPresence + }) as RealtimePresenceType[] +} + +function cloneState(state: PresenceStates): PresenceStates { + return JSON.parse(JSON.stringify(state)) +} + +function phoenixPresenceOptions(opts?: RealtimePresenceOptions) { + return opts?.events && { events: opts.events } +} + +function parseCurrentPresences(currentPresences?: PresenceState) { + return currentPresences?.metas ? transformState(currentPresences) : [] +} diff --git a/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts b/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts new file mode 100644 index 0000000000000000000000000000000000000000..38203323ca4958e5cb99ff88e2acd041b2a9f372 --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/phoenix/socketAdapter.ts @@ -0,0 +1,168 @@ +import { Socket } from '@supabase/phoenix' +import type { + Message, + SocketOnClose, + SocketOnMessage, + SocketOnOpen, + SocketOnError, + SocketOptions, + SocketStateChangeCallbacks, + Vsn, + Encode, + Decode, + HeartbeatCallback, + Timer, +} from './types' +import { CONNECTION_STATE, ConnectionState } from '../lib/constants' +import type { HeartbeatTimer, WebSocketLikeConstructor } from '../RealtimeClient' + +export default class SocketAdapter { + private socket: Socket + + constructor(endPoint: string, options: SocketOptions) { + this.socket = new Socket(endPoint, options) + } + + get timeout(): number { + return this.socket.timeout + } + + get endPoint(): string { + return this.socket.endPoint + } + + get transport(): WebSocketLikeConstructor { + return this.socket.transport as WebSocketLikeConstructor + } + + get heartbeatIntervalMs(): number { + return this.socket.heartbeatIntervalMs + } + + get heartbeatCallback(): HeartbeatCallback { + return this.socket.heartbeatCallback + } + + set heartbeatCallback(callback: HeartbeatCallback) { + this.socket.heartbeatCallback = callback + } + + get heartbeatTimer(): HeartbeatTimer { + return this.socket.heartbeatTimer + } + + get pendingHeartbeatRef(): string | null { + return this.socket.pendingHeartbeatRef + } + + get reconnectTimer(): Timer { + return this.socket.reconnectTimer + } + + get vsn(): Vsn { + return this.socket.vsn + } + + get encode(): Encode { + return this.socket.encode + } + + get decode(): Decode { + return this.socket.decode + } + + get reconnectAfterMs(): (tries: number) => number { + return this.socket.reconnectAfterMs + } + + get sendBuffer(): (() => void)[] { + return this.socket.sendBuffer + } + + get stateChangeCallbacks(): SocketStateChangeCallbacks { + return this.socket.stateChangeCallbacks + } + + connect() { + this.socket.connect() + } + + disconnect( + callback: () => void, + code?: number, + reason?: string, + timeout: number = 10000 + ): Promise<'ok' | 'timeout'> { + return new Promise((resolve) => { + setTimeout(() => resolve('timeout'), timeout) + this.socket.disconnect( + () => { + callback() + resolve('ok') + }, + code, + reason + ) + }) + } + + push(data: Message>) { + this.socket.push(data) + } + + log(kind: string, msg: string, data?: any) { + this.socket.log(kind, msg, data) + } + + makeRef(): string { + return this.socket.makeRef() + } + + onOpen(callback: SocketOnOpen) { + this.socket.onOpen(callback) + } + + onClose(callback: SocketOnClose) { + this.socket.onClose(callback) + } + + onError(callback: SocketOnError) { + this.socket.onError(callback) + } + + onMessage(callback: SocketOnMessage) { + this.socket.onMessage(callback) + } + + isConnected() { + return this.socket.isConnected() + } + + isConnecting() { + return this.socket.connectionState() == CONNECTION_STATE.connecting + } + + isDisconnecting() { + return this.socket.connectionState() == CONNECTION_STATE.closing + } + + connectionState(): ConnectionState { + // @ts-ignore - requires better typing and exposing type in phoenix + return this.socket.connectionState() + } + + endPointURL(): string { + return this.socket.endPointURL() + } + + sendHeartbeat() { + this.socket.sendHeartbeat() + } + + /** + * @internal + */ + getSocket() { + return this.socket + } +} diff --git a/node_modules/@supabase/realtime-js/src/phoenix/types.ts b/node_modules/@supabase/realtime-js/src/phoenix/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..917a471b6394f59abd2b2cb0d7e13d3efde7b78b --- /dev/null +++ b/node_modules/@supabase/realtime-js/src/phoenix/types.ts @@ -0,0 +1,32 @@ +export type { + Socket, + SocketOptions, + SocketState, + SocketOnOpen, + SocketOnError, + SocketOnMessage, + SocketOnClose, + SocketStateChangeCallbacks, + Channel, + ChannelState, + ChannelEvent, + ChannelBindingCallback, + ChannelFilterBindings, + ChannelOnMessage, + ChannelOnErrorCallback, + PresenceState, + Message, + Params, + Transport, + Timer, + Vsn, + Encode, + Decode, + HeartbeatCallback, + HeartbeatStatus, +} from '@supabase/phoenix' + +import type { Channel, PresenceState } from '@supabase/phoenix' + +export type Push = ReturnType +export type PresenceStates = Record diff --git a/node_modules/@supabase/storage-js/AGENTS.md b/node_modules/@supabase/storage-js/AGENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..6ec5e2b2db085eede7169747f23c3a8c9e558f28 --- /dev/null +++ b/node_modules/@supabase/storage-js/AGENTS.md @@ -0,0 +1,11 @@ +# Agent instructions for `@supabase/storage-js` + +Isomorphic storage client for Supabase. Handles bucket and object operations: upload, download, list, signed URLs, transformations. + +When helping a user work with this package: + +- **Usage and quick start**: [`README.md`](./README.md) +- **Full API reference**: [`src/`](./src/) — every public method and type has TSDoc with `@example` blocks. Read the source for the canonical, version-pinned answer. +- **Migration notes**: [`migrations/`](./migrations/) — per-theme markdown files for changes that need caller action. + +For broader Supabase guidance (docs site, MCP tools, schema and project workflows), use the centralized [Supabase agent skills](https://github.com/supabase/agent-skills): `npx skills add supabase/agent-skills`. Or pair with the Supabase MCP server via the [Supabase Plugin for AI Coding Agents](https://supabase.com/docs/guides/getting-started/plugins). diff --git a/node_modules/@supabase/storage-js/LICENSE b/node_modules/@supabase/storage-js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ddeba6a00ae5ec536d5429e040bc73ef2c6a07d6 --- /dev/null +++ b/node_modules/@supabase/storage-js/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Supabase + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@supabase/storage-js/README.md b/node_modules/@supabase/storage-js/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ea1e739764262b252e16c4e9d43db4af0aad3afc --- /dev/null +++ b/node_modules/@supabase/storage-js/README.md @@ -0,0 +1,1266 @@ +
+

+ + + + + Supabase Logo + + + +

Supabase Storage JS SDK

+ +

JavaScript SDK to interact with Supabase Storage, including file storage and vector embeddings.

+ +

+ Guides + · + Reference Docs + · + TypeDoc +

+

+ +
+ +[![Build](https://github.com/supabase/supabase-js/workflows/CI/badge.svg)](https://github.com/supabase/supabase-js/actions?query=branch%3Amaster) +[![Package](https://img.shields.io/npm/v/@supabase/storage-js)](https://www.npmjs.com/package/@supabase/storage-js) +[![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license) +[![pkg.pr.new](https://pkg.pr.new/badge/supabase/storage-js)](https://pkg.pr.new/~/supabase/storage-js) + +
+ +## Requirements + +- **Node.js 22 or later** (Node.js 20 support dropped in v2.110.0) +- For browser support, all modern browsers are supported + +> ⚠️ **Node.js 18 Deprecation Notice** +> +> Node.js 18 reached end-of-life on April 30, 2025. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/37217), support for Node.js 18 was dropped on October 31, 2025. + +> ⚠️ **Node.js 20 Deprecation Notice** +> +> Node.js 20 reached end-of-life on April 30, 2026. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/45715), support for Node.js 20 was dropped in v2.110.0. + +## Features + +- **File Storage**: Upload, download, list, move, and delete files +- **Access Control**: Public and private buckets with fine-grained permissions +- **Signed URLs**: Generate time-limited URLs for secure file access +- **Image Transformations**: On-the-fly image resizing and optimization +- **Vector Embeddings**: Store and query high-dimensional embeddings with similarity search +- **Analytics Buckets**: Iceberg table-based buckets optimized for analytical queries and data processing + +## Quick Start Guide + +### Installing the module + +```bash +npm install @supabase/storage-js +``` + +### Connecting to the storage backend + +There are two ways to use the Storage SDK: + +#### Option 1: Via Supabase Client (Recommended) + +If you're already using `@supabase/supabase-js`, access storage through the client: + +```js +import { createClient } from '@supabase/supabase-js' + +// Use publishable key for frontend applications +const supabase = createClient('https://.supabase.co', '') + +// Access storage +const storage = supabase.storage + +// Access different bucket types +const regularBucket = storage.from('my-bucket') +const vectorBucket = storage.vectors.from('embeddings-bucket') +const analyticsBucket = storage.analytics // Analytics API +``` + +#### Option 2: Standalone StorageClient + +For backend applications or when you need to bypass Row Level Security: + +```js +import { StorageClient } from '@supabase/storage-js' + +const STORAGE_URL = 'https://.supabase.co/storage/v1' +const SERVICE_KEY = '' // Use secret key for backend operations + +const storageClient = new StorageClient(STORAGE_URL, { + apikey: SERVICE_KEY, + Authorization: `Bearer ${SERVICE_KEY}`, +}) + +// Access different bucket types +const regularBucket = storageClient.from('my-bucket') +const vectorBucket = storageClient.vectors.from('embeddings-bucket') +const analyticsBucket = storageClient.analytics // Analytics API +``` + +> **When to use each approach:** +> +> - Use `supabase.storage` when working with other Supabase features (auth, database, etc.) in frontend applications +> - Use `new StorageClient()` for backend applications, Edge Functions, or when you need to bypass RLS policies + +> **Note:** Refer to the [Storage Access Control guide](https://supabase.com/docs/guides/storage/access-control) for detailed information on creating RLS policies. + +### Understanding Bucket Types + +Supabase Storage supports three types of buckets, each optimized for different use cases: + +#### 1. Regular Storage Buckets (File Storage) + +Standard buckets for storing files, images, videos, and other assets. + +```js +// Create regular storage bucket +const { data, error } = await storageClient.createBucket('my-files', { + public: false, +}) + +// Upload files +await storageClient.from('my-files').upload('avatar.png', file) +``` + +**Use cases:** User uploads, media assets, documents, backups + +#### 2. Vector Buckets (Embeddings Storage) + +Specialized buckets for storing and querying high-dimensional vector embeddings. + +```js +// Create vector bucket +await storageClient.vectors.createBucket('embeddings-prod') + +// Create index and insert vectors +const bucket = storageClient.vectors.from('embeddings-prod') +await bucket.createIndex({ + indexName: 'documents', + dimension: 1536, + distanceMetric: 'cosine', +}) +``` + +**Use cases:** Semantic search, AI-powered recommendations, similarity matching + +**[See full Vector Embeddings documentation below](#vector-embeddings)** + +#### 3. Analytics Buckets + +Specialized buckets using Apache Iceberg table format, optimized for analytical queries and large-scale data processing. + +```js +// Create analytics bucket +await storageClient.analytics.createBucket('analytics-data') + +// List analytics buckets +const { data, error } = await storageClient.analytics.listBuckets() + +// Delete analytics bucket +await storageClient.analytics.deleteBucket('analytics-data') +``` + +**Use cases:** Time-series data, analytical queries, data lakes, large-scale data processing, business intelligence + +**[See full Analytics Buckets documentation below](#analytics-buckets)** + +--- + +### Handling resources + +#### Handling Storage Buckets + +- Create a new Storage bucket: + + ```js + const { data, error } = await storageClient.createBucket( + 'test_bucket', // Bucket name (must be unique) + { public: false } // Bucket options + ) + ``` + +- Retrieve the details of an existing Storage bucket: + + ```js + const { data, error } = await storageClient.getBucket('test_bucket') + ``` + +- Update a new Storage bucket: + + ```js + const { data, error } = await storageClient.updateBucket( + 'test_bucket', // Bucket name + { public: false } // Bucket options + ) + ``` + +- Remove all objects inside a single bucket: + + ```js + const { data, error } = await storageClient.emptyBucket('test_bucket') + ``` + +- Delete an existing bucket (a bucket can't be deleted with existing objects inside it): + + ```js + const { data, error } = await storageClient.deleteBucket('test_bucket') + ``` + +- Retrieve the details of all Storage buckets within an existing project: + + ```js + // List all buckets + const { data, error } = await storageClient.listBuckets() + + // List buckets with options (pagination, sorting, search) + const { data, error } = await storageClient.listBuckets({ + limit: 10, + offset: 0, + sortColumn: 'created_at', + sortOrder: 'desc', + search: 'prod', + }) + ``` + +#### Handling Files + +- Upload a file to an existing bucket: + + ```js + const fileBody = ... // load your file here + + const { data, error } = await storageClient.from('bucket').upload('path/to/file', fileBody) + ``` + + > Note: + > The path in `data.Key` is prefixed by the bucket ID and is not the value which should be passed to the `download` method in order to fetch the file. + > To fetch the file via the `download` method, use `data.path` and `data.bucketId` as follows: + > + > ```javascript + > const { data, error } = await storageClient.from('bucket').upload('/folder/file.txt', fileBody) + > // check for errors + > const { data2, error2 } = await storageClient.from(data.bucketId).download(data.path) + > ``` + + > Note: The `upload` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-upload). + +- Download a file from an exisiting bucket: + + ```js + const { data, error } = await storageClient.from('bucket').download('path/to/file') + ``` + +- List all the files within a bucket: + + ```js + const { data, error } = await storageClient.from('bucket').list('folder') + ``` + + > Note: The `list` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-list). + +- Replace an existing file at the specified path with a new one: + + ```js + const fileBody = ... // load your file here + + const { data, error } = await storageClient + .from('bucket') + .update('path/to/file', fileBody) + ``` + + > Note: The `upload` method also accepts a map of optional parameters. For a complete list see the [Supabase API reference](https://supabase.com/docs/reference/javascript/storage-from-upload). + +- Move an existing file: + + ```js + const { data, error } = await storageClient + .from('bucket') + .move('old/path/to/file', 'new/path/to/file') + ``` + +- Delete files within the same bucket: + + ```js + const { data, error } = await storageClient.from('bucket').remove(['path/to/file']) + ``` + +- Create signed URL to download file without requiring permissions: + + ```js + const expireIn = 60 + + const { data, error } = await storageClient + .from('bucket') + .createSignedUrl('path/to/file', expireIn) + ``` + +- Retrieve URLs for assets in public buckets: + + ```js + const { data, error } = await storageClient.from('public-bucket').getPublicUrl('path/to/file') + ``` + +## Analytics Buckets + +Supabase Storage provides specialized analytics buckets using Apache Iceberg table format, optimized for analytical workloads and large-scale data processing. These buckets are designed for data lake architectures, time-series data, and business intelligence applications. + +### What are Analytics Buckets? + +Analytics buckets use the Apache Iceberg open table format, providing: + +- **ACID transactions** for data consistency +- **Schema evolution** without data rewrites +- **Time travel** to query historical data +- **Efficient metadata management** for large datasets +- **Optimized for analytical queries** rather than individual file operations + +### When to Use Analytics Buckets + +**Use analytics buckets for:** + +- Time-series data (logs, metrics, events) +- Data lake architectures +- Business intelligence and reporting +- Large-scale batch processing +- Analytical workloads requiring ACID guarantees + +**Use regular storage buckets for:** + +- User file uploads (images, documents, videos) +- Individual file management +- Content delivery +- Simple object storage needs + +### Quick Start + +You can access analytics functionality through the `analytics` property on your storage client: + +#### Via Supabase Client + +```typescript +import { createClient } from '@supabase/supabase-js' + +const supabase = createClient('https://your-project.supabase.co', 'your-publishable-key') + +// Access analytics operations +const analytics = supabase.storage.analytics + +// Create an analytics bucket +const { data, error } = await analytics.createBucket('analytics-data') +if (error) { + console.error('Failed to create analytics bucket:', error.message) +} else { + console.log('Created bucket:', data.name) +} +``` + +#### Via StorageClient + +```typescript +import { StorageClient } from '@supabase/storage-js' + +const storageClient = new StorageClient('https://your-project.supabase.co/storage/v1', { + apikey: 'YOUR_API_KEY', + Authorization: 'Bearer YOUR_TOKEN', +}) + +// Access analytics operations +const analytics = storageClient.analytics + +// Create an analytics bucket +await analytics.createBucket('analytics-data') +``` + +### API Reference + +#### Create Analytics Bucket + +Creates a new analytics bucket using Iceberg table format: + +```typescript +const { data, error } = await analytics.createBucket('my-analytics-bucket') + +if (error) { + console.error('Error:', error.message) +} else { + console.log('Created bucket:', data) +} +``` + +**Returns:** + +```typescript +{ + data: { + id: string + type: 'ANALYTICS' + format: string + created_at: string + updated_at: string + } | null + error: StorageError | null +} +``` + +#### List Analytics Buckets + +Retrieves all analytics buckets in your project with optional filtering and pagination: + +```typescript +const { data, error } = await analytics.listBuckets({ + limit: 10, + offset: 0, + sortColumn: 'created_at', + sortOrder: 'desc', + search: 'prod', +}) + +if (data) { + console.log(`Found ${data.length} analytics buckets`) + data.forEach((bucket) => { + console.log(`- ${bucket.id} (created: ${bucket.created_at})`) + }) +} +``` + +**Parameters:** + +- `limit?: number` - Maximum number of buckets to return +- `offset?: number` - Number of buckets to skip (for pagination) +- `sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'` - Column to sort by +- `sortOrder?: 'asc' | 'desc'` - Sort direction +- `search?: string` - Search term to filter bucket names + +**Returns:** + +```typescript +{ + data: AnalyticBucket[] | null + error: StorageError | null +} +``` + +**Example with Pagination:** + +```typescript +// Fetch first page +const firstPage = await analytics.listBuckets({ + limit: 100, + offset: 0, + sortColumn: 'created_at', + sortOrder: 'desc', +}) + +// Fetch second page +const secondPage = await analytics.listBuckets({ + limit: 100, + offset: 100, + sortColumn: 'created_at', + sortOrder: 'desc', +}) +``` + +#### Delete Analytics Bucket + +Deletes an analytics bucket. The bucket must be empty before deletion. + +```typescript +const { data, error } = await analytics.deleteBucket('old-analytics-bucket') + +if (error) { + console.error('Failed to delete:', error.message) +} else { + console.log('Bucket deleted:', data.message) +} +``` + +**Returns:** + +```typescript +{ + data: { message: string } | null + error: StorageError | null +} +``` + +> **Note:** A bucket cannot be deleted if it contains data. You must empty the bucket first. + +#### Get Iceberg Catalog for Advanced Operations + +For advanced operations like creating tables, namespaces, and querying Iceberg metadata, use the `from()` method to get a configured [iceberg-js](https://github.com/supabase/iceberg-js) client: + +```typescript +// Get an Iceberg REST Catalog client for your analytics bucket +const catalog = analytics.from('analytics-data') + +// Create a namespace +await catalog.createNamespace({ namespace: ['default'] }, { properties: { owner: 'data-team' } }) + +// Create a table with schema +await catalog.createTable( + { namespace: ['default'] }, + { + name: 'events', + schema: { + type: 'struct', + fields: [ + { id: 1, name: 'id', type: 'long', required: true }, + { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + { id: 3, name: 'user_id', type: 'string', required: false }, + ], + 'schema-id': 0, + 'identifier-field-ids': [1], + }, + 'partition-spec': { + 'spec-id': 0, + fields: [], + }, + 'write-order': { + 'order-id': 0, + fields: [], + }, + properties: { + 'write.format.default': 'parquet', + }, + } +) + +// List tables in namespace +const tables = await catalog.listTables({ namespace: ['default'] }) +console.log(tables) // [{ namespace: ['default'], name: 'events' }] + +// Load table metadata +const table = await catalog.loadTable({ namespace: ['default'], name: 'events' }) + +// Update table properties +await catalog.updateTable( + { namespace: ['default'], name: 'events' }, + { properties: { 'read.split.target-size': '134217728' } } +) + +// Drop table +await catalog.dropTable({ namespace: ['default'], name: 'events' }) + +// Drop namespace +await catalog.dropNamespace({ namespace: ['default'] }) +``` + +**Returns:** `IcebergRestCatalog` instance from [iceberg-js](https://github.com/supabase/iceberg-js) + +> **Note:** The `from()` method returns an Iceberg REST Catalog client that provides full access to the Apache Iceberg REST API. For complete documentation of available operations, see the [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + +### Error Handling + +Analytics buckets use the same error handling pattern as the rest of the Storage SDK: + +```typescript +const { data, error } = await analytics.createBucket('my-bucket') + +if (error) { + console.error('Error:', error.message) + console.error('Status:', error.status) + console.error('Status Code:', error.statusCode) + // Handle error appropriately +} +``` + +#### Throwing Errors + +You can configure the client to throw errors instead of returning them: + +```typescript +const analytics = storageClient.analytics +analytics.throwOnError() + +try { + const { data } = await analytics.createBucket('my-bucket') + // data is guaranteed to be present + console.log('Success:', data) +} catch (error) { + if (error instanceof StorageApiError) { + console.error('API Error:', error.statusCode, error.message) + } +} +``` + +### TypeScript Types + +The library exports TypeScript types for analytics buckets: + +```typescript +import type { AnalyticBucket, BucketType, StorageError } from '@supabase/storage-js' + +// AnalyticBucket type +interface AnalyticBucket { + id: string + type: 'ANALYTICS' + format: string + created_at: string + updated_at: string +} +``` + +### Common Patterns + +#### Checking if a Bucket Exists + +```typescript +async function bucketExists(bucketName: string): Promise { + const { data, error } = await analytics.listBuckets({ + search: bucketName, + }) + + if (error) { + console.error('Error checking bucket:', error.message) + return false + } + + return data?.some((bucket) => bucket.id === bucketName) ?? false +} +``` + +#### Creating Bucket with Error Handling + +```typescript +async function ensureAnalyticsBucket(bucketName: string) { + // Try to create the bucket + const { data, error } = await analytics.createBucket(bucketName) + + if (error) { + // Check if bucket already exists (conflict error) + if (error.statusCode === '409') { + console.log(`Bucket '${bucketName}' already exists`) + return { success: true, created: false } + } + + // Other error occurred + console.error('Failed to create bucket:', error.message) + return { success: false, error } + } + + console.log(`Created new bucket: '${bucketName}'`) + return { success: true, created: true, data } +} +``` + +#### Listing All Buckets with Pagination + +```typescript +async function getAllAnalyticsBuckets() { + const allBuckets: AnalyticBucket[] = [] + let offset = 0 + const limit = 100 + + while (true) { + const { data, error } = await analytics.listBuckets({ + limit, + offset, + sortColumn: 'created_at', + sortOrder: 'desc', + }) + + if (error) { + console.error('Error fetching buckets:', error.message) + break + } + + if (!data || data.length === 0) { + break + } + + allBuckets.push(...data) + + // If we got fewer results than the limit, we've reached the end + if (data.length < limit) { + break + } + + offset += limit + } + + return allBuckets +} +``` + +## Vector Embeddings + +Supabase Storage provides built-in support for storing and querying high-dimensional vector embeddings, powered by S3 Vectors. This enables semantic search, similarity matching, and AI-powered applications without needing a separate vector database. + +> **Note:** Vector embeddings functionality is available in `@supabase/storage-js` v2.76 and later. + +### Features + +- **Vector Buckets**: Organize vector indexes into logical containers +- **Vector Indexes**: Define schemas with configurable dimensions and distance metrics +- **Batch Operations**: Insert/update/delete up to 500 vectors per request +- **Similarity Search**: Query for nearest neighbors using cosine, euclidean, or dot product distance +- **Metadata Filtering**: Store and filter vectors by arbitrary JSON metadata +- **Pagination**: Efficiently scan large vector datasets +- **Parallel Scanning**: Distribute scans across multiple workers for high throughput +- **Cross-platform**: Works in Node.js, browsers, and edge runtimes + +### Quick Start + +You can access vector functionality in three ways, depending on your use case: + +#### Option 1: Via Supabase Client (Most Common) + +If you're using the full Supabase client: + +```typescript +import { createClient } from '@supabase/supabase-js' + +const supabase = createClient('https://your-project.supabase.co', 'your-publishable-key') + +// Access vector operations through storage +const vectors = supabase.storage.vectors + +// Create a vector bucket +await vectors.createBucket('embeddings-prod') + +// Create an index +const bucket = vectors.from('embeddings-prod') +await bucket.createIndex({ + indexName: 'documents-openai', + dataType: 'float32', + dimension: 1536, + distanceMetric: 'cosine', +}) + +// Insert vectors +const index = bucket.index('documents-openai') +await index.putVectors({ + vectors: [ + { + key: 'doc-1', + data: { float32: [0.1, 0.2, 0.3 /* ...1536 dimensions */] }, + metadata: { title: 'Introduction', category: 'docs' }, + }, + ], +}) + +// Query similar vectors +const { data, error } = await index.queryVectors({ + queryVector: { float32: [0.15, 0.25, 0.35 /* ...1536 dimensions */] }, + topK: 5, + returnDistance: true, + returnMetadata: true, +}) + +if (data) { + data.matches.forEach((match) => { + console.log(`${match.key}: distance=${match.distance}`) + console.log('Metadata:', match.metadata) + }) +} +``` + +#### Option 2: Via StorageClient + +If you're using the standalone `StorageClient` for storage operations, access vectors through the `vectors` property: + +```typescript +import { StorageClient } from '@supabase/storage-js' + +const storageClient = new StorageClient('https://your-project.supabase.co/storage/v1', { + apikey: 'YOUR_API_KEY', + Authorization: 'Bearer YOUR_TOKEN', +}) + +// Access vector operations +const vectors = storageClient.vectors + +// Use the same API as shown in Option 1 +await vectors.createBucket('embeddings-prod') +const bucket = vectors.from('embeddings-prod') +// ... rest of operations +``` + +#### Option 3: Standalone Vector Client + +For vector-only applications that don't need regular file storage operations: + +```typescript +import { StorageVectorsClient } from '@supabase/storage-js' + +// Initialize standalone vector client +const vectorClient = new StorageVectorsClient('https://your-project.supabase.co/storage/v1', { + headers: { Authorization: 'Bearer YOUR_TOKEN' }, +}) + +// Use the same API as shown in Option 1 +await vectorClient.createBucket('embeddings-prod') +const bucket = vectorClient.from('embeddings-prod') +// ... rest of operations +``` + +> **When to use each approach:** +> +> - **Option 1**: When using other Supabase features (auth, database, realtime) +> - **Option 2**: When working with both file storage and vectors +> - **Option 3**: For dedicated vector-only applications without file storage + +### API Reference + +#### Client Initialization + +```typescript +const vectorClient = new StorageVectorsClient(url, options?) +``` + +**Options:** + +- `headers?: Record` - Custom HTTP headers (e.g., Authorization) +- `fetch?: Fetch` - Custom fetch implementation + +#### Vector Buckets + +Vector buckets are top-level containers for organizing vector indexes. + +##### Create Bucket + +```typescript +const { data, error } = await vectorClient.createBucket('my-bucket') +``` + +##### Get Bucket + +```typescript +const { data, error } = await vectorClient.getBucket('my-bucket') +console.log('Created at:', new Date(data.vectorBucket.creationTime! * 1000)) +``` + +##### List Buckets + +```typescript +const { data, error } = await vectorClient.listBuckets({ + prefix: 'prod-', + maxResults: 100, +}) + +// Pagination +if (data?.nextToken) { + const next = await vectorClient.listBuckets({ nextToken: data.nextToken }) +} +``` + +##### Delete Bucket + +```typescript +// Bucket must be empty (all indexes deleted first) +const { error } = await vectorClient.deleteBucket('my-bucket') +``` + +#### Vector Indexes + +Vector indexes define the schema for embeddings including dimension and distance metric. + +##### Create Index + +```typescript +const bucket = vectorClient.from('my-bucket') + +await bucket.createIndex({ + indexName: 'my-index', + dataType: 'float32', + dimension: 1536, + distanceMetric: 'cosine', // 'cosine' | 'euclidean' | 'dotproduct' + metadataConfiguration: { + nonFilterableMetadataKeys: ['raw_text', 'internal_id'], + }, +}) +``` + +**Distance Metrics:** + +- `cosine` - Cosine similarity (normalized dot product) +- `euclidean` - Euclidean distance (L2 norm) +- `dotproduct` - Dot product similarity + +##### Get Index + +```typescript +const { data, error } = await bucket.getIndex('my-index') +console.log('Dimension:', data?.index.dimension) +console.log('Distance metric:', data?.index.distanceMetric) +``` + +##### List Indexes + +```typescript +const { data, error } = await bucket.listIndexes({ + prefix: 'documents-', + maxResults: 100, +}) +``` + +##### Delete Index + +```typescript +// Deletes index and all its vectors +await bucket.deleteIndex('my-index') +``` + +#### Vector Operations + +##### Insert/Update Vectors (Upsert) + +```typescript +const index = vectorClient.from('my-bucket').index('my-index') + +await index.putVectors({ + vectors: [ + { + key: 'unique-id-1', + data: { + float32: [ + /* 1536 numbers */ + ], + }, + metadata: { + title: 'Document Title', + category: 'technical', + page: 1, + }, + }, + // ... up to 500 vectors per request + ], +}) +``` + +**Limitations:** + +- 1-500 vectors per request +- Vectors must match index dimension +- Keys must be unique within index + +##### Get Vectors by Key + +```typescript +const { data, error } = await index.getVectors({ + keys: ['doc-1', 'doc-2', 'doc-3'], + returnData: true, // Include embeddings + returnMetadata: true, // Include metadata +}) + +data?.vectors.forEach((v) => { + console.log(v.key, v.metadata) +}) +``` + +##### Query Similar Vectors (ANN Search) + +```typescript +const { data, error } = await index.queryVectors({ + queryVector: { + float32: [ + /* 1536 numbers */ + ], + }, + topK: 10, + filter: { + category: 'technical', + published: true, + }, + returnDistance: true, + returnMetadata: true, +}) + +// Results ordered by similarity +data?.matches.forEach((match) => { + console.log(`${match.key}: distance=${match.distance}`) +}) +``` + +**Filter Syntax:** +The `filter` parameter accepts arbitrary JSON for metadata filtering. Non-filterable keys (configured at index creation) cannot be used in filters but can still be returned. + +##### List/Scan Vectors + +```typescript +// Simple pagination +let nextToken: string | undefined +do { + const { data } = await index.listVectors({ + maxResults: 500, + nextToken, + returnMetadata: true, + }) + + console.log('Batch:', data?.vectors.length) + nextToken = data?.nextToken +} while (nextToken) + +// Parallel scanning (4 workers) +const workers = [0, 1, 2, 3].map(async (segmentIndex) => { + const { data } = await index.listVectors({ + segmentCount: 4, + segmentIndex, + returnMetadata: true, + }) + return data?.vectors || [] +}) + +const results = await Promise.all(workers) +const allVectors = results.flat() +``` + +**Limitations:** + +- `maxResults`: 1-1000 (default: 500) +- `segmentCount`: 1-16 +- Response may be limited by 1MB size + +##### Delete Vectors + +```typescript +await index.deleteVectors({ + keys: ['doc-1', 'doc-2', 'doc-3'], + // ... up to 500 keys per request +}) +``` + +### Error Handling + +The library uses a consistent error handling pattern: + +```typescript +const { data, error } = await vectorClient.createBucket('my-bucket') + +if (error) { + console.error('Error:', error.message) + console.error('Status:', error.status) + console.error('Code:', error.statusCode) +} +``` + +#### Error Codes + +| Code | HTTP | Description | +| ---------------------------- | ---- | ----------------------- | +| `InternalError` | 500 | Internal server error | +| `S3VectorConflictException` | 409 | Resource already exists | +| `S3VectorNotFoundException` | 404 | Resource not found | +| `S3VectorBucketNotEmpty` | 400 | Bucket contains indexes | +| `S3VectorMaxBucketsExceeded` | 400 | Bucket quota exceeded | +| `S3VectorMaxIndexesExceeded` | 400 | Index quota exceeded | + +#### Throwing Errors + +You can configure the client to throw errors instead: + +```typescript +const vectorClient = new StorageVectorsClient(url, options) +vectorClient.throwOnError() + +try { + const { data } = await vectorClient.createBucket('my-bucket') + // data is guaranteed to be present +} catch (error) { + if (error instanceof StorageVectorsApiError) { + console.error('API Error:', error.statusCode) + } +} +``` + +### Advanced Usage + +#### Scoped Clients + +Create scoped clients for cleaner code: + +```typescript +// Bucket-scoped operations +const bucket = vectorClient.from('embeddings-prod') +await bucket.createIndex({ + /* ... */ +}) +await bucket.listIndexes() + +// Index-scoped operations +const index = bucket.index('documents-openai') +await index.putVectors({ + /* ... */ +}) +await index.queryVectors({ + /* ... */ +}) +``` + +#### Custom Fetch + +Provide a custom fetch implementation: + +```typescript +import { StorageVectorsClient } from '@supabase/storage-js' + +const vectorClient = new StorageVectorsClient(url, { + fetch: customFetch, + headers: { + /* ... */ + }, +}) +``` + +#### Batch Processing + +Process large datasets in batches: + +```typescript +async function insertLargeDataset(vectors: VectorObject[]) { + const batchSize = 500 + + for (let i = 0; i < vectors.length; i += batchSize) { + const batch = vectors.slice(i, i + batchSize) + await index.putVectors({ vectors: batch }) + console.log(`Inserted ${i + batch.length}/${vectors.length}`) + } +} +``` + +#### Float32 Validation + +Ensure vectors are properly normalized to float32: + +```typescript +import { normalizeToFloat32 } from '@supabase/storage-js' + +const vector = normalizeToFloat32([0.1, 0.2, 0.3 /* ... */]) +``` + +### Type Definitions + +The library exports comprehensive TypeScript types: + +```typescript +import type { + VectorBucket, + VectorIndex, + VectorData, + VectorObject, + VectorMatch, + VectorMetadata, + DistanceMetric, + ApiResponse, + StorageVectorsError, +} from '@supabase/storage-js' +``` + +## Development + +This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/supabase-js). To work on this package: + +### Building + +#### Build Scripts Overview + +```bash +# Build the package +pnpm nx build storage-js + +# Watch mode for development +pnpm nx build storage-js --watch + +# Generate documentation +pnpm nx docs storage-js +``` + +### Testing + +**Important:** The storage-js tests require a local Supabase stack running via the Supabase CLI. Docker must be running since the Supabase CLI uses it internally. + +#### Prerequisites + +1. **Docker** must be installed and running (used by Supabase CLI internally) +2. **Supabase CLI** — installed automatically via `pnpm exec supabase` + +#### Test Scripts Overview + +| Script | Description | What it does | +| ----------------- | --------------------------------- | ----------------------------------------------------------------- | +| `test:storage` | **Complete test workflow** | Runs the full test cycle: clean → start infra → run tests → clean | +| `test:suite` | **Jest tests only** | Runs Jest tests with coverage (requires infra to be running) | +| `test:infra` | **Start test infrastructure** | Starts Supabase CLI stack (PostgreSQL, Storage API, Kong, etc.) | +| `test:clean-post` | **Stop and clean infrastructure** | Stops the Supabase CLI stack | + +#### Running Tests + +##### Option 1: Complete Test Run (Recommended) + +This handles everything automatically - starting infrastructure, running tests, and cleaning up: + +```bash +# From monorepo root +pnpm nx test:storage storage-js +``` + +This command will: + +1. Stop any existing test containers +2. Build and start fresh test infrastructure +3. Wait for services to be ready +4. Run all Jest tests with coverage +5. Clean up all containers after tests complete + +##### Option 2: Manual Infrastructure Management + +Useful for development when you want to run tests multiple times without restarting Docker: + +```bash +# Step 1: Start the test infrastructure +# From root +pnpm nx test:infra storage-js +# This starts: PostgreSQL, Storage API, Kong Gateway, and imgproxy + +# Step 2: Run tests (can run multiple times) +pnpm nx test:suite storage-js + +# Step 3: When done, clean up the infrastructure +pnpm nx test:clean-post storage-js +``` + +##### Option 3: Development Mode + +For actively developing and debugging tests: + +```bash +# Start infrastructure once (from root) +pnpm nx test:infra storage-js + +# Run tests in watch mode +pnpm nx test:suite storage-js --watch + +# Clean up when done +pnpm nx test:clean-post storage-js +``` + +#### Test Infrastructure Details + +The test infrastructure is managed via the Supabase CLI (`pnpm exec supabase start --workdir test`), which starts a local Supabase stack defined by the config in `test/`. This includes PostgreSQL, the Storage API, Kong Gateway, and supporting services. + +#### Common Issues and Solutions + +| Issue | Solution | +| --------------------------------- | ------------------------------------------------------------------------------------------------- | +| Port conflicts | Another service is using a required port. Run `pnpm nx test:clean-post storage-js` then try again | +| "request failed, reason:" errors | Infrastructure isn't running. Run `pnpm nx test:infra storage-js` first | +| Tests fail with connection errors | Ensure Docker is running (Supabase CLI requires Docker) | +| Stack already running | Run `pnpm nx test:clean-post storage-js` to stop it before restarting | + +#### Understanding Test Failures + +- **StorageUnknownError with "request failed"**: Infrastructure not running +- **Snapshot failures**: Expected test data has changed — review and update snapshots if needed + +### Contributing + +We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started. + +For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. diff --git a/node_modules/@supabase/storage-js/dist/index.cjs b/node_modules/@supabase/storage-js/dist/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6656b512bed4f91f558adaf746721363be2760fa --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.cjs @@ -0,0 +1,3135 @@ +let iceberg_js = require("iceberg-js"); + +//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) { + return typeof o$1; + } : function(o$1) { + return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1; + }, _typeof(o); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r$1) { + return Object.getOwnPropertyDescriptor(e, r$1).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) { + _defineProperty(e, r$1, t[r$1]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) { + Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1)); + }); + } + return e; +} + +//#endregion +//#region src/lib/common/errors.ts +/** +* Base error class for all Storage errors +* Supports both 'storage' and 'vectors' namespaces +*/ +var StorageError = class extends Error { + constructor(message, namespace = "storage", status, statusCode) { + super(message); + this.__isStorageError = true; + this.namespace = namespace; + this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError"; + this.status = status; + this.statusCode = statusCode; + } + toJSON() { + return { + name: this.name, + message: this.message, + status: this.status, + statusCode: this.statusCode + }; + } +}; +/** +* Type guard to check if an error is a StorageError +* @param error - The error to check +* @returns True if the error is a StorageError +*/ +function isStorageError(error) { + return typeof error === "object" && error !== null && "__isStorageError" in error; +} +/** +* API error returned from Storage service +* Includes HTTP status code and service-specific error code +*/ +var StorageApiError = class extends StorageError { + constructor(message, status, statusCode, namespace = "storage", code) { + super(message, namespace, status, statusCode); + this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError"; + this.status = status; + this.statusCode = statusCode; + this.code = code; + } + toJSON() { + return _objectSpread2(_objectSpread2({}, super.toJSON()), {}, { code: this.code }); + } +}; +/** +* Unknown error that doesn't match expected error patterns +* Wraps the original error for debugging +*/ +var StorageUnknownError = class extends StorageError { + constructor(message, originalError, namespace = "storage") { + super(message, namespace); + this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError"; + this.originalError = originalError; + } +}; +/** +* @deprecated Use StorageError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsError = class extends StorageError { + constructor(message) { + super(message, "vectors"); + } +}; +/** +* Type guard to check if an error is a StorageVectorsError +* @param error - The error to check +* @returns True if the error is a StorageVectorsError +*/ +function isStorageVectorsError(error) { + return isStorageError(error) && error["namespace"] === "vectors"; +} +/** +* @deprecated Use StorageApiError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsApiError = class extends StorageApiError { + constructor(message, status, statusCode) { + super(message, status, statusCode, "vectors"); + } +}; +/** +* @deprecated Use StorageUnknownError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsUnknownError = class extends StorageUnknownError { + constructor(message, originalError) { + super(message, originalError, "vectors"); + } +}; +/** +* Error codes specific to S3 Vectors API +* Maps AWS service errors to application-friendly error codes +*/ +let StorageVectorsErrorCode = /* @__PURE__ */ function(StorageVectorsErrorCode$1) { + /** Internal server fault (HTTP 500) */ + StorageVectorsErrorCode$1["InternalError"] = "InternalError"; + /** Resource already exists / conflict (HTTP 409) */ + StorageVectorsErrorCode$1["S3VectorConflictException"] = "S3VectorConflictException"; + /** Resource not found (HTTP 404) */ + StorageVectorsErrorCode$1["S3VectorNotFoundException"] = "S3VectorNotFoundException"; + /** Delete bucket while not empty (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorBucketNotEmpty"] = "S3VectorBucketNotEmpty"; + /** Exceeds bucket quota/limit (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorMaxBucketsExceeded"] = "S3VectorMaxBucketsExceeded"; + /** Exceeds index quota/limit (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorMaxIndexesExceeded"] = "S3VectorMaxIndexesExceeded"; + return StorageVectorsErrorCode$1; +}({}); + +//#endregion +//#region src/lib/common/headers.ts +/** +* Sets a header with case-insensitive deduplication. +* Removes any existing headers whose name matches (case-insensitive), +* then sets the value under the lowercase key. Does not mutate the input object. +* +* @param headers - Existing headers object +* @param name - Header name to set (stored as lowercase) +* @param value - Header value +* @returns New headers object with the header set +*/ +function setHeader(headers, name, value) { + const result = _objectSpread2({}, headers); + const nameLower = name.toLowerCase(); + for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key]; + result[nameLower] = value; + return result; +} +/** +* Normalizes all header keys to lowercase with case-insensitive deduplication. +* When duplicate keys exist (differing only in case), the last value wins. +* Does not mutate the input object. +* +* @param headers - Headers object to normalize +* @returns New headers object with all keys lowercased +*/ +function normalizeHeaders(headers) { + const result = {}; + for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value; + return result; +} + +//#endregion +//#region src/lib/common/helpers.ts +/** +* Resolves the fetch implementation to use +* Uses custom fetch if provided, otherwise uses native fetch +* +* @param customFetch - Optional custom fetch implementation +* @returns Resolved fetch function +*/ +const resolveFetch = (customFetch) => { + if (customFetch) return (...args) => customFetch(...args); + return (...args) => fetch(...args); +}; +/** +* Determine if input is a plain object +* An object is plain if it's created by either {}, new Object(), or Object.create(null) +* +* @param value - Value to check +* @returns True if value is a plain object +* @source https://github.com/sindresorhus/is-plain-obj +*/ +const isPlainObject = (value) => { + if (typeof value !== "object" || value === null) return false; + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); +}; +/** +* Recursively converts object keys from snake_case to camelCase +* Used for normalizing API responses +* +* @param item - Object to convert +* @returns Converted object with camelCase keys +*/ +const recursiveToCamel = (item) => { + if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el)); + else if (typeof item === "function" || item !== Object(item)) return item; + const result = {}; + Object.entries(item).forEach(([key, value]) => { + const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, "")); + result[newKey] = recursiveToCamel(value); + }); + return result; +}; +/** +* Validates if a given bucket name is valid according to Supabase Storage API rules +* Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName() +* +* Rules: +* - Length: 1-100 characters +* - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters +* - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ? +* - Forbidden: path separators (/, \), path traversal (..), leading/trailing whitespace +* +* AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html +* +* @param bucketName - The bucket name to validate +* @returns true if valid, false otherwise +*/ +const isValidBucketName = (bucketName) => { + if (!bucketName || typeof bucketName !== "string") return false; + if (bucketName.length === 0 || bucketName.length > 100) return false; + if (bucketName.trim() !== bucketName) return false; + if (bucketName.includes("/") || bucketName.includes("\\")) return false; + return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName); +}; +/** +* Percent-encodes each segment of a storage path so URL delimiters within a +* key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start. +* +* Splits on `/` so real path separators stay literal — the storage server +* routes on them and decodes each segment back to the original key. +* +* @param path - A bucket id or `bucketId/objectKey` path +* @returns The path with each `/`-delimited segment percent-encoded +*/ +const encodeStoragePath = (path) => path.split("/").map(encodeURIComponent).join("/"); + +//#endregion +//#region src/lib/common/fetch.ts +/** +* Extracts error message from various error response formats +* @param err - Error object from API +* @returns Human-readable error message +*/ +const _getErrorMessage = (err) => { + if (typeof err === "object" && err !== null) { + const e = err; + if (typeof e.msg === "string") return e.msg; + if (typeof e.message === "string") return e.message; + if (typeof e.error_description === "string") return e.error_description; + if (typeof e.error === "string") return e.error; + if (typeof e.error === "object" && e.error !== null) { + const nested = e.error; + if (typeof nested.message === "string") return nested.message; + } + } + return JSON.stringify(err); +}; +/** +* Handles fetch errors and converts them to Storage error types +* @param error - The error caught from fetch +* @param reject - Promise rejection function +* @param options - Fetch options that may affect error handling +* @param namespace - Error namespace ('storage' or 'vectors') +*/ +const handleError = async (error, reject, options, namespace) => { + if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") { + const responseError = error; + let status = parseInt(String(responseError.status), 10); + if (!Number.isFinite(status)) status = 500; + responseError.json().then((err) => { + const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + ""; + reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace, err === null || err === void 0 ? void 0 : err.code)); + }).catch(() => { + const statusCode = status + ""; + reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace)); + }); + } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace)); +}; +/** +* Builds request parameters for fetch calls +* @param method - HTTP method +* @param options - Custom fetch options +* @param parameters - Additional fetch parameters like AbortSignal +* @param body - Request body (will be JSON stringified if plain object) +* @returns Complete fetch request parameters +*/ +const _getRequestParams = (method, options, parameters, body) => { + const params = { + method, + headers: (options === null || options === void 0 ? void 0 : options.headers) || {} + }; + if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters); + if (isPlainObject(body)) { + var _contentType; + const headers = (options === null || options === void 0 ? void 0 : options.headers) || {}; + let contentType; + for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value; + params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json"); + params.body = JSON.stringify(body); + } else params.body = body; + if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex; + return _objectSpread2(_objectSpread2({}, params), parameters); +}; +/** +* Internal request handler that wraps fetch with error handling +* @param fetcher - Fetch function to use +* @param method - HTTP method +* @param url - Request URL +* @param options - Custom fetch options +* @param parameters - Additional fetch parameters +* @param body - Request body +* @param namespace - Error namespace ('storage' or 'vectors') +* @returns Promise with parsed response or error +*/ +async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) { + return new Promise((resolve, reject) => { + fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => { + if (!result.ok) throw result; + if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result; + if (namespace === "vectors") { + const contentType = result.headers.get("content-type"); + if (result.headers.get("content-length") === "0" || result.status === 204) return {}; + if (!contentType || !contentType.includes("application/json")) return {}; + } + return result.json(); + }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace)); + }); +} +/** +* Creates a fetch API with the specified namespace +* @param namespace - Error namespace ('storage' or 'vectors') +* @returns Object with HTTP method functions +*/ +function createFetchApi(namespace = "storage") { + return { + get: async (fetcher, url, options, parameters) => { + return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace); + }, + post: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace); + }, + put: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace); + }, + head: async (fetcher, url, options, parameters) => { + return _handleRequest(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace); + }, + remove: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace); + } + }; +} +const defaultApi = createFetchApi("storage"); +const { get, post, put, head, remove } = defaultApi; +const vectorsApi = createFetchApi("vectors"); + +//#endregion +//#region src/lib/common/BaseApiClient.ts +/** +* @ignore +* Base API client class for all Storage API classes +* Provides common infrastructure for error handling and configuration +* +* @typeParam TError - The error type (StorageError or subclass) +*/ +var BaseApiClient = class { + /** + * Creates a new BaseApiClient instance + * @param url - Base URL for API requests + * @param headers - Default headers for API requests + * @param fetch - Optional custom fetch implementation + * @param namespace - Error namespace ('storage' or 'vectors') + */ + constructor(url, headers = {}, fetch$1, namespace = "storage") { + this.shouldThrowOnError = false; + this.url = url; + this.headers = normalizeHeaders(headers); + this.fetch = resolveFetch(fetch$1); + this.namespace = namespace; + } + /** + * Enable throwing errors instead of returning them. + * When enabled, errors are thrown instead of returned in { data, error } format. + * + * @returns this - For method chaining + */ + throwOnError() { + this.shouldThrowOnError = true; + return this; + } + /** + * Set an HTTP header for the request. + * Creates a shallow copy of headers to avoid mutating shared state. + * + * @param name - Header name + * @param value - Header value + * @returns this - For method chaining + */ + setHeader(name, value) { + this.headers = setHeader(this.headers, name, value); + return this; + } + /** + * Handles API operation with standardized error handling + * Eliminates repetitive try-catch blocks across all API methods + * + * This wrapper: + * 1. Executes the operation + * 2. Returns { data, error: null } on success + * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false) + * 4. Throws error on failure (if shouldThrowOnError is true) + * + * @typeParam T - The expected data type from the operation + * @param operation - Async function that performs the API call + * @returns Promise with { data, error } tuple + * + * @example Handling an operation + * ```typescript + * async listBuckets() { + * return this.handleOperation(async () => { + * return await get(this.fetch, `${this.url}/bucket`, { + * headers: this.headers, + * }) + * }) + * } + * ``` + */ + async handleOperation(operation) { + var _this = this; + try { + return { + data: await operation(), + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/StreamDownloadBuilder.ts +let _Symbol$toStringTag$1; +_Symbol$toStringTag$1 = Symbol.toStringTag; +var StreamDownloadBuilder = class { + constructor(downloadFn, shouldThrowOnError) { + this.downloadFn = downloadFn; + this.shouldThrowOnError = shouldThrowOnError; + this[_Symbol$toStringTag$1] = "StreamDownloadBuilder"; + this.promise = null; + } + then(onfulfilled, onrejected) { + return this.getPromise().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.getPromise().catch(onrejected); + } + finally(onfinally) { + return this.getPromise().finally(onfinally); + } + getPromise() { + if (!this.promise) this.promise = this.execute(); + return this.promise; + } + async execute() { + var _this = this; + try { + return { + data: (await _this.downloadFn()).body, + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/BlobDownloadBuilder.ts +let _Symbol$toStringTag; +_Symbol$toStringTag = Symbol.toStringTag; +var BlobDownloadBuilder = class { + constructor(downloadFn, shouldThrowOnError) { + this.downloadFn = downloadFn; + this.shouldThrowOnError = shouldThrowOnError; + this[_Symbol$toStringTag] = "BlobDownloadBuilder"; + this.promise = null; + } + asStream() { + return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError); + } + then(onfulfilled, onrejected) { + return this.getPromise().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.getPromise().catch(onrejected); + } + finally(onfinally) { + return this.getPromise().finally(onfinally); + } + getPromise() { + if (!this.promise) this.promise = this.execute(); + return this.promise; + } + async execute() { + var _this = this; + try { + return { + data: await (await _this.downloadFn()).blob(), + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/StorageFileApi.ts +const DEFAULT_SEARCH_OPTIONS = { + limit: 100, + offset: 0, + sortBy: { + column: "name", + order: "asc" + } +}; +const DEFAULT_FILE_OPTIONS = { + cacheControl: "3600", + contentType: "text/plain;charset=UTF-8", + upsert: false +}; +var StorageFileApi = class extends BaseApiClient { + constructor(url, headers = {}, bucketId, fetch$1) { + super(url, headers, fetch$1, "storage"); + this.bucketId = bucketId; + } + /** + * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one. + * + * @param method HTTP method. + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. + * @param fileBody The body of the file to be stored in the bucket. + */ + async uploadOrUpdate(method, path, fileBody, fileOptions) { + var _this = this; + return _this.handleOperation(async () => { + let body; + const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions); + let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) }); + const metadata = options.metadata; + if (typeof Blob !== "undefined" && fileBody instanceof Blob) { + body = new FormData(); + body.append("cacheControl", options.cacheControl); + if (metadata) body.append("metadata", _this.encodeMetadata(metadata)); + body.append("", fileBody); + } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) { + body = fileBody; + if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl); + if (metadata && !body.has("metadata")) body.append("metadata", _this.encodeMetadata(metadata)); + } else { + body = fileBody; + headers["cache-control"] = `max-age=${options.cacheControl}`; + headers["content-type"] = options.contentType; + if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata)); + if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half"; + } + if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value); + const cleanPath = _this._removeEmptyFolders(path); + const _path = _this._getFinalPath(cleanPath); + 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 } : {})); + return { + path: cleanPath, + id: data.Id, + fullPath: data.Key + }; + }); + } + /** + * Uploads a file to an existing bucket. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Upload file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile, { + * cacheControl: '3600', + * upsert: false + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Upload file using `ArrayBuffer` from base64 file data + * ```js + * import { decode } from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @example Handling errors + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile) + * + * if (error) { + * // Log the full error so fields like `statusCode` and `error` (the + * // Storage error name, e.g. "Duplicate") aren't hidden behind `error.message`. + * console.error(error) + * return + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async upload(path, fileBody, fileOptions) { + return this.uploadOrUpdate("POST", path, fileBody, fileOptions); + } + /** + * Upload a file with a token generated from `createSignedUploadUrl`. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param token The token generated from `createSignedUploadUrl` + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions HTTP headers (cacheControl, contentType, etc.). + * **Note:** The `upsert` option has no effect here. To enable upsert behavior, + * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead. + * @returns Promise with response containing file path and fullPath or error + * + * @example Upload to a signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "folder/cat.jpg", + * "fullPath": "avatars/folder/cat.jpg" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async uploadToSignedUrl(path, token, fileBody, fileOptions) { + var _this3 = this; + const cleanPath = _this3._removeEmptyFolders(path); + const _path = _this3._getFinalPath(cleanPath); + const url = new URL(_this3.url + `/object/upload/sign/${_path}`); + url.searchParams.set("token", token); + return _this3.handleOperation(async () => { + let body; + const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions); + let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) }); + const metadata = options.metadata; + if (typeof Blob !== "undefined" && fileBody instanceof Blob) { + body = new FormData(); + body.append("cacheControl", options.cacheControl); + if (metadata) body.append("metadata", _this3.encodeMetadata(metadata)); + body.append("", fileBody); + } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) { + body = fileBody; + if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl); + if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata)); + } else { + body = fileBody; + headers["cache-control"] = `max-age=${options.cacheControl}`; + headers["content-type"] = options.contentType; + if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata)); + if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half"; + } + if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value); + return { + path: cleanPath, + fullPath: (await put(_this3.fetch, url.toString(), body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}))).Key + }; + }); + } + /** + * Creates a signed upload URL. + * Signed upload URLs can be used to upload files to the bucket without further authentication. + * They are valid for 2 hours. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param options.upsert If set to true, allows the file to be overwritten if it already exists. + * @returns Promise with response containing signed upload URL, token, and path or error + * + * @example Create Signed Upload URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUploadUrl('folder/cat.jpg') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=", + * "path": "folder/cat.jpg", + * "token": "" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUploadUrl(path, options) { + var _this4 = this; + return _this4.handleOperation(async () => { + let _path = _this4._getFinalPath(path); + const headers = _objectSpread2({}, _this4.headers); + if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true"; + const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers }); + const url = new URL(_this4.url + data.url); + const token = url.searchParams.get("token"); + if (!token) throw new StorageError("No token returned by API"); + return { + signedUrl: url.toString(), + path, + token + }; + }); + } + /** + * Replaces an existing file at the specified path with a new one. + * + * @category Storage + * @subcategory File Buckets + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata. + * **Note:** The `upsert` option has no effect here. `update()` always replaces the + * file at the given path, so the `x-upsert` header is not sent. To control upsert + * behavior, use `upload()` instead. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Update file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', avatarFile, { + * cacheControl: '3600' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Update file using `ArrayBuffer` from base64 file data + * ```js + * import {decode} from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - `update()` always replaces the file at the given path regardless of the `upsert` option. + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async update(path, fileBody, fileOptions) { + return this.uploadOrUpdate("PUT", path, fileBody, fileOptions); + } + /** + * Moves an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-new.png`. + * @param options The destination options. + * @returns Promise with response containing success message or error + * + * @example Move file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .move('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully moved" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async move(fromPath, toPath, options) { + var _this6 = this; + return _this6.handleOperation(async () => { + return await post(_this6.fetch, `${_this6.url}/object/move`, { + bucketId: _this6.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket + }, { headers: _this6.headers }); + }); + } + /** + * Copies an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`. + * @param options The destination options. + * @returns Promise with response containing copied file path or error + * + * @example Copy file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .copy('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "avatars/private/avatar2.png" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async copy(fromPath, toPath, options) { + var _this7 = this; + return _this7.handleOperation(async () => { + return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, { + bucketId: _this7.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket + }, { headers: _this7.headers })).Key }; + }); + } + /** + * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing signed URL or error + * + * @example Create Signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * "error": null + * } + * ``` + * + * @example Create a signed URL for an asset with transformations + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Create a signed URL which triggers the download of the asset + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * download: true, + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrl(path, expiresIn, options) { + var _this8 = this; + return _this8.handleOperation(async () => { + let _path = _this8._getFinalPath(path); + const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0; + let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers }); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) }; + }); + } + /** + * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. + * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. + * @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. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing array of objects with signedUrl, path, and error or error + * + * @example Create Signed URLs + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "error": null, + * "path": "folder/avatar1.png", + * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * { + * "error": null, + * "path": "folder/avatar2.png", + * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrls(paths, expiresIn, options) { + var _this9 = this; + return _this9.handleOperation(async () => { + const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, { + expiresIn, + paths + }, { headers: _this9.headers }); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null })); + }); + } + /** + * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead. + * + * @category Storage + * @subcategory File Buckets + * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`. + * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache. + * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control. + * @returns BlobDownloadBuilder instance for downloading the file + * + * @example Download file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": , + * "error": null + * } + * ``` + * + * @example Download file with transformations + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * quality: 80 + * } + * }) + * ``` + * + * @example Download with cache control (useful in Edge Functions) + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { cache: 'no-store' }) + * ``` + * + * @example Download with abort signal + * ```js + * const controller = new AbortController() + * setTimeout(() => controller.abort(), 5000) + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { signal: controller.signal }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + download(path, options, parameters) { + 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"; + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + const _path = this._getFinalPath(path); + const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, { + headers: this.headers, + noResolveJson: true + }, parameters); + return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError); + } + /** + * Retrieves the details of an existing file. + * + * Returns detailed file metadata including size, content type, and timestamps. + * Note: The API returns `last_modified` field, not `updated_at`. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing file metadata or error + * + * @example Get file info + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .info('folder/avatar1.png') + * + * if (data) { + * console.log('Last modified:', data.lastModified) + * console.log('Size:', data.size) + * } + * ``` + */ + async info(path) { + var _this10 = this; + const _path = _this10._getFinalPath(path); + return _this10.handleOperation(async () => { + return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers })); + }); + } + /** + * Checks the existence of a file. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing boolean indicating file existence or error + * + * @example Check file existence + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .exists('folder/avatar1.png') + * ``` + */ + async exists(path) { + var _this11 = this; + const _path = _this11._getFinalPath(path); + try { + await head(_this11.fetch, `${_this11.url}/object/${_path}`, { headers: _this11.headers }); + return { + data: true, + error: null + }; + } catch (error) { + if (_this11.shouldThrowOnError) throw error; + if (isStorageError(error)) { + var _error$originalError; + 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; + if (status !== void 0 && [400, 404].includes(status)) return { + data: false, + error + }; + } + throw error; + } + } + /** + * 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. + * 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. + * + * @category Storage + * @subcategory File Buckets + * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Object with public URL + * + * @example Returns the URL for an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png" + * } + * } + * ``` + * + * @example Returns the URL for an asset in a public bucket with transformations + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Returns the URL which triggers the download of an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * download: true, + * }) + * ``` + * + * @remarks + * - 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" + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getPublicUrl(path, options) { + const _path = this._getFinalPath(path); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + 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"; + return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } }; + } + /** + * Deletes files within the same bucket + * + * Returns an array of FileObject entries for the deleted files. Note that deprecated + * fields like `bucket_id` may or may not be present in the response - do not rely on them. + * + * @category Storage + * @subcategory File Buckets + * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. + * @returns Promise with response containing array of deleted file objects or error + * + * @example Delete file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .remove(['folder/avatar1.png']) + * ``` + * + * Response: + * ```json + * { + * "data": [], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `delete` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async remove(paths) { + var _this12 = this; + return _this12.handleOperation(async () => { + return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers }); + }); + } + /** + * Purges the CDN cache for a single object in this bucket. + * + * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server + * issues a CDN invalidation for the object and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * Operates on a single object path. There is no wildcard or recursion: pass + * the exact path of the object you want invalidated. + * + * @category Storage + * @subcategory File Buckets + * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge a single cached object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png') + * ``` + * + * @example Purge only transformations for a single object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png', { transformations: true }) + * ``` + */ + async purgeCache(path, options, parameters) { + var _this13 = this; + return _this13.handleOperation(async () => { + const _path = encodeStoragePath(_this13._getFinalPath(path)); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true"); + const queryString = query.toString(); + return await remove(_this13.fetch, `${_this13.url}/cdn/${_path}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this13.headers }, parameters); + }); + } + /** + * Get file metadata + * @param id the file id to retrieve metadata + */ + /** + * Update file metadata + * @param id the file id to update metadata + * @param meta the new file metadata + */ + /** + * Lists all the files and folders within a path of the bucket. + * + * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`, + * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated. + * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned + * by this method. + * + * @category Storage + * @subcategory File Buckets + * @param path The folder path. + * @param options Search options including limit (defaults to 100), offset, sortBy, and search + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing array of files/folders or error + * + * @example List files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * }) + * + * // Handle files vs folders + * data?.forEach(item => { + * if (item.id !== null) { + * // It's a file + * console.log('File:', item.name, 'Size:', item.metadata?.size) + * } else { + * // It's a folder + * console.log('Folder:', item.name) + * } + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "avatar1.png", + * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2", + * "updated_at": "2024-05-22T23:06:05.580Z", + * "created_at": "2024-05-22T23:04:34.443Z", + * "last_accessed_at": "2024-05-22T23:04:34.443Z", + * "metadata": { + * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"", + * "size": 32175, + * "mimetype": "image/png", + * "cacheControl": "max-age=3600", + * "lastModified": "2024-05-22T23:06:05.574Z", + * "contentLength": 32175, + * "httpStatusCode": 200 + * } + * } + * ], + * "error": null + * } + * ``` + * + * @example Search files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * search: 'jon' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async list(path, options, parameters) { + var _this14 = this; + return _this14.handleOperation(async () => { + const sortBy = (options === null || options === void 0 ? void 0 : options.sortBy) ? _objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS.sortBy), options.sortBy) : DEFAULT_SEARCH_OPTIONS.sortBy; + const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { + sortBy, + prefix: path || "" + }); + return await post(_this14.fetch, `${_this14.url}/object/list/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters); + }); + } + /** + * Lists all the files and folders within a bucket using the V2 API with pagination support. + * + * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` — + * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available + * on entries in the `objects` array. + * + * @experimental this method signature might change in the future + * + * @category Storage + * @subcategory File Buckets + * @param options Search options including prefix, cursor for pagination, limit, with_delimiter + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing folders/objects arrays with pagination info or error + * + * @example List files with pagination + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * limit: 100, + * }) + * + * // Handle pagination + * if (data?.hasNext) { + * const nextPage = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * cursor: data.nextCursor, + * }) + * } + * + * // Handle files vs folders + * data?.objects.forEach(file => { + * if (file.id !== null) { + * console.log('File:', file.name, 'Size:', file.metadata?.size) + * } + * }) + * data?.folders.forEach(folder => { + * console.log('Folder:', folder.name) + * }) + * ``` + */ + async listV2(options, parameters) { + var _this15 = this; + return _this15.handleOperation(async () => { + const body = _objectSpread2({}, options); + return await post(_this15.fetch, `${_this15.url}/object/list-v2/${_this15.bucketId}`, body, { headers: _this15.headers }, parameters); + }); + } + encodeMetadata(metadata) { + return JSON.stringify(metadata); + } + toBase64(data) { + if (typeof Buffer !== "undefined") return Buffer.from(data).toString("base64"); + return btoa(data); + } + _getFinalPath(path) { + return `${this.bucketId}/${path.replace(/^\/+/, "")}`; + } + _removeEmptyFolders(path) { + return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/"); + } + /** Modifies the `query`, appending values the from `transform` */ + applyTransformOptsToQuery(query, transform) { + if (transform.width) query.set("width", transform.width.toString()); + if (transform.height) query.set("height", transform.height.toString()); + if (transform.resize) query.set("resize", transform.resize); + if (transform.format) query.set("format", transform.format); + if (transform.quality) query.set("quality", transform.quality.toString()); + return query; + } +}; + +//#endregion +//#region src/lib/version.ts +const version = "2.112.3"; + +//#endregion +//#region src/lib/constants.ts +const DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version}` }; + +//#endregion +//#region src/packages/StorageBucketApi.ts +var StorageBucketApi = class extends BaseApiClient { + constructor(url, headers = {}, fetch$1, opts) { + const baseUrl = new URL(url); + if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) { + if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase."); + } + const finalUrl = baseUrl.href.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers); + super(finalUrl, finalHeaders, fetch$1, "storage"); + } + /** + * Retrieves the details of all Storage buckets within an existing project. + * + * @category Storage + * @subcategory File Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of buckets or error + * + * @example List buckets + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets() + * ``` + * + * @example List buckets with options + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc', + * search: 'prod' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async listBuckets(options) { + var _this = this; + return _this.handleOperation(async () => { + const queryString = _this.listBucketOptionsToQueryString(options); + return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers }); + }); + } + /** + * Retrieves the details of an existing Storage bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to retrieve. + * @returns Promise with response containing bucket details or error + * + * @example Get bucket + * ```js + * const { data, error } = await supabase + * .storage + * .getBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "id": "avatars", + * "name": "avatars", + * "owner": "", + * "public": false, + * "file_size_limit": 1024, + * "allowed_mime_types": [ + * "image/png" + * ], + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async getBucket(id) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers }); + }); + } + /** + * Creates a new Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are creating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details. + * - default bucket type is `STANDARD` + * @returns Promise with response containing newly created bucket name or error + * + * @example Create bucket + * ```js + * const { data, error } = await supabase + * .storage + * .createBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "avatars" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `insert` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createBucket(id, options = { public: false }) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await post(_this3.fetch, `${_this3.url}/bucket`, { + id, + name: id, + type: options.type, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes + }, { headers: _this3.headers }); + }); + } + /** + * Updates a Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are updating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @returns Promise with response containing success message or error + * + * @example Update bucket + * ```js + * const { data, error } = await supabase + * .storage + * .updateBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully updated" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `update` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async updateBucket(id, options) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, { + id, + name: id, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes + }, { headers: _this4.headers }); + }); + } + /** + * Removes all objects inside a single bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to empty. + * @returns Promise with success message or error + * + * @example Empty bucket + * ```js + * const { data, error } = await supabase + * .storage + * .emptyBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully emptied" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: `select` and `delete` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async emptyBucket(id) { + var _this5 = this; + return _this5.handleOperation(async () => { + return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers }); + }); + } + /** + * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. + * You must first `empty()` the bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to delete. + * @returns Promise with success message or error + * + * @example Delete bucket + * ```js + * const { data, error } = await supabase + * .storage + * .deleteBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `delete` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async deleteBucket(id) { + var _this6 = this; + return _this6.handleOperation(async () => { + return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers }); + }); + } + /** + * Purges the CDN cache for an entire bucket. + * + * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server + * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to purge from cache. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge cache for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars') + * ``` + * + * @example Purge only transformations for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars', { transformations: true }) + * ``` + */ + async purgeBucketCache(id, options, parameters) { + var _this7 = this; + return _this7.handleOperation(async () => { + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true"); + const queryString = query.toString(); + return await remove(_this7.fetch, `${_this7.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters); + }); + } + listBucketOptionsToQueryString(options) { + const params = {}; + if (options) { + if ("limit" in options) params.limit = String(options.limit); + if ("offset" in options) params.offset = String(options.offset); + if (options.search) params.search = options.search; + if (options.sortColumn) params.sortColumn = options.sortColumn; + if (options.sortOrder) params.sortOrder = options.sortOrder; + } + return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : ""; + } +}; + +//#endregion +//#region src/packages/StorageAnalyticsClient.ts +/** +* Client class for managing Analytics Buckets using Iceberg tables +* Provides methods for creating, listing, and deleting analytics buckets +*/ +var StorageAnalyticsClient = class extends BaseApiClient { + /** + * @alpha + * + * Creates a new StorageAnalyticsClient instance + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param url - The base URL for the storage API + * @param headers - HTTP headers to include in requests + * @param fetch - Optional custom fetch implementation + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.storage.analytics.listBuckets() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageAnalyticsClient } from '@supabase/storage-js' + * + * const client = new StorageAnalyticsClient(url, headers) + * ``` + */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers); + super(finalUrl, finalHeaders, fetch$1, "storage"); + } + /** + * @alpha + * + * Creates a new analytics bucket using Iceberg tables + * Analytics buckets are optimized for analytical queries and data processing + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param name A unique name for the bucket you are creating + * @returns Promise with response containing newly created analytics bucket or error + * + * @example Create analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Creates a new analytics bucket using Iceberg tables + * - Analytics buckets are optimized for analytical queries and data processing + */ + async createBucket(name) { + var _this = this; + return _this.handleOperation(async () => { + return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers }); + }); + } + /** + * @alpha + * + * Retrieves the details of all Analytics Storage buckets within an existing project + * Only returns buckets of type 'ANALYTICS' + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of analytics buckets or error + * + * @example List analytics buckets + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - Retrieves the details of all Analytics Storage buckets within an existing project + * - Only returns buckets of type 'ANALYTICS' + */ + async listBuckets(options) { + var _this2 = this; + return _this2.handleOperation(async () => { + const queryParams = new URLSearchParams(); + if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString()); + if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString()); + if (options === null || options === void 0 ? void 0 : options.sortColumn) queryParams.set("sortColumn", options.sortColumn); + if (options === null || options === void 0 ? void 0 : options.sortOrder) queryParams.set("sortOrder", options.sortOrder); + if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search); + const queryString = queryParams.toString(); + const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`; + return await get(_this2.fetch, url, { headers: _this2.headers }); + }); + } + /** + * @alpha + * + * Deletes an existing analytics bucket + * A bucket can't be deleted with existing objects inside it + * You must first empty the bucket before deletion + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName The unique identifier of the bucket you would like to delete + * @returns Promise with response containing success message or error + * + * @example Delete analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .deleteBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Deletes an analytics bucket + */ + async deleteBucket(bucketName) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers }); + }); + } + /** + * @alpha + * + * Get an Iceberg REST Catalog client configured for a specific analytics bucket + * Use this to perform advanced table and namespace operations within the bucket + * The returned client provides full access to the Apache Iceberg REST Catalog API + * with the Supabase `{ data, error }` pattern for consistent error handling on all operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName - The name of the analytics bucket (warehouse) to connect to + * @returns The wrapped Iceberg catalog client + * @throws {StorageError} If the bucket name is invalid + * + * @example Get catalog and create table + * ```js + * // First, create an analytics bucket + * const { data: bucket, error: bucketError } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * + * // Get the Iceberg catalog for that bucket + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Create a namespace + * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] }) + * + * // Create a table with schema + * const { data: tableMetadata, error: tableError } = await catalog.createTable( + * { namespace: ['default'] }, + * { + * name: 'events', + * schema: { + * type: 'struct', + * fields: [ + * { id: 1, name: 'id', type: 'long', required: true }, + * { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + * { id: 3, name: 'user_id', type: 'string', required: false } + * ], + * 'schema-id': 0, + * 'identifier-field-ids': [1] + * }, + * 'partition-spec': { + * 'spec-id': 0, + * fields: [] + * }, + * 'write-order': { + * 'order-id': 0, + * fields: [] + * }, + * properties: { + * 'write.format.default': 'parquet' + * } + * } + * ) + * ``` + * + * @example List tables in namespace + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all tables in the default namespace + * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] }) + * if (listError) { + * if (listError.isNotFound()) { + * console.log('Namespace not found') + * } + * return + * } + * console.log(tables) // [{ namespace: ['default'], name: 'events' }] + * ``` + * + * @example Working with namespaces + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all namespaces + * const { data: namespaces } = await catalog.listNamespaces() + * + * // Create namespace with properties + * await catalog.createNamespace( + * { namespace: ['production'] }, + * { properties: { owner: 'data-team', env: 'prod' } } + * ) + * ``` + * + * @example Cleanup operations + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Drop table with purge option (removes all data) + * const { error: dropError } = await catalog.dropTable( + * { namespace: ['default'], name: 'events' }, + * { purge: true } + * ) + * + * if (dropError?.isNotFound()) { + * console.log('Table does not exist') + * } + * + * // Drop namespace (must be empty) + * await catalog.dropNamespace({ namespace: ['default'] }) + * ``` + * + * @remarks + * This method provides a bridge between Supabase's bucket management and the standard + * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter. + * All authentication and configuration is handled automatically using your Supabase credentials. + * + * **Error Handling**: Invalid bucket names throw immediately. All catalog + * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js. + * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling. + * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations. + * + * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently + * deletes all table data. Without it, the table is marked as deleted but data remains. + * + * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js. + * For complete API documentation and advanced usage, refer to the + * [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + */ + from(bucketName) { + var _this4 = this; + 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."); + const catalog = new iceberg_js.IcebergRestCatalog({ + baseUrl: this.url, + catalogName: bucketName, + auth: { + type: "custom", + getHeaders: async () => _this4.headers + }, + fetch: this.fetch + }); + const shouldThrowOnError = this.shouldThrowOnError; + return new Proxy(catalog, { get(target, prop) { + const value = target[prop]; + if (typeof value !== "function") return value; + return async (...args) => { + try { + return { + data: await value.apply(target, args), + error: null + }; + } catch (error) { + if (shouldThrowOnError) throw error; + return { + data: null, + error + }; + } + }; + } }); + } +}; + +//#endregion +//#region src/packages/VectorIndexApi.ts +/** +* @hidden +* Base implementation for vector index operations. +* Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead. +*/ +var VectorIndexApi = class extends BaseApiClient { + /** Creates a new VectorIndexApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Creates a new vector index within a bucket */ + async createIndex(options) { + var _this = this; + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {}; + }); + } + /** Retrieves metadata for a specific vector index */ + async getIndex(vectorBucketName, indexName) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, { + vectorBucketName, + indexName + }, { headers: _this2.headers }); + }); + } + /** Lists vector indexes within a bucket with optional filtering and pagination */ + async listIndexes(options) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers }); + }); + } + /** Deletes a vector index and all its data */ + async deleteIndex(vectorBucketName, indexName) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, { + vectorBucketName, + indexName + }, { headers: _this4.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/VectorDataApi.ts +/** +* @hidden +* Base implementation for vector data operations. +* Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead. +*/ +var VectorDataApi = class extends BaseApiClient { + /** Creates a new VectorDataApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Inserts or updates vectors in batch (1-500 per request) */ + async putVectors(options) { + var _this = this; + if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items"); + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {}; + }); + } + /** Retrieves vectors by their keys in batch */ + async getVectors(options) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers }); + }); + } + /** Lists vectors in an index with pagination */ + async listVectors(options) { + var _this3 = this; + if (options.segmentCount !== void 0) { + if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16"); + if (options.segmentIndex !== void 0) { + if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`); + } + } + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }); + }); + } + /** Queries for similar vectors using approximate nearest neighbor search */ + async queryVectors(options) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers }); + }); + } + /** Deletes vectors by their keys in batch (1-500 per request) */ + async deleteVectors(options) { + var _this5 = this; + if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items"); + return _this5.handleOperation(async () => { + return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/VectorBucketApi.ts +/** +* @hidden +* Base implementation for vector bucket operations. +* Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead. +*/ +var VectorBucketApi = class extends BaseApiClient { + /** Creates a new VectorBucketApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Creates a new vector bucket */ + async createBucket(vectorBucketName) { + var _this = this; + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {}; + }); + } + /** Retrieves metadata for a specific vector bucket */ + async getBucket(vectorBucketName) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers }); + }); + } + /** Lists vector buckets with optional filtering and pagination */ + async listBuckets(options = {}) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers }); + }); + } + /** Deletes a vector bucket (must be empty first) */ + async deleteBucket(vectorBucketName) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/StorageVectorsClient.ts +/** +* +* @alpha +* +* Main client for interacting with S3 Vectors API +* Provides access to bucket, index, and vector data operations +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +* +* **Usage Patterns:** +* +* ```typescript +* const { data, error } = await supabase +* .storage +* .vectors +* .createBucket('embeddings-prod') +* +* // Access index operations via buckets +* const bucket = supabase.storage.vectors.from('embeddings-prod') +* await bucket.createIndex({ +* indexName: 'documents', +* dataType: 'float32', +* dimension: 1536, +* distanceMetric: 'cosine' +* }) +* +* // Access vector operations via index +* const index = bucket.index('documents') +* await index.putVectors({ +* vectors: [ +* { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } +* ] +* }) +* +* // Query similar vectors +* const { data } = await index.queryVectors({ +* queryVector: { float32: [...] }, +* topK: 5, +* returnDistance: true +* }) +* ``` +*/ +var StorageVectorsClient = class extends VectorBucketApi { + /** + * @alpha + * + * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param url - Base URL of the Storage Vectors REST API. + * @param options.headers - Optional headers (for example `Authorization`) applied to every request. + * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes. + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageVectorsClient } from '@supabase/storage-js' + * + * const client = new StorageVectorsClient(url, options) + * ``` + */ + constructor(url, options = {}) { + super(url, options.headers || {}, options.fetch); + } + /** + * + * @alpha + * + * Access operations for a specific vector bucket + * Returns a scoped client for index and vector operations within the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Bucket-scoped client with index and vector operations + * + * @example Accessing a vector bucket + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + from(vectorBucketName) { + return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch); + } + /** + * + * @alpha + * + * Creates a new vector bucket + * Vector buckets are containers for vector indexes and their data + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Unique name for the vector bucket + * @returns Promise with empty response on success or error + * + * @example Creating a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * ``` + */ + async createBucket(vectorBucketName) { + var _superprop_getCreateBucket = () => super.createBucket, _this = this; + return _superprop_getCreateBucket().call(_this, vectorBucketName); + } + /** + * + * @alpha + * + * Retrieves metadata for a specific vector bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Promise with bucket metadata or error + * + * @example Get bucket metadata + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .getBucket('embeddings-prod') + * + * console.log('Bucket created:', data?.vectorBucket.creationTime) + * ``` + */ + async getBucket(vectorBucketName) { + var _superprop_getGetBucket = () => super.getBucket, _this2 = this; + return _superprop_getGetBucket().call(_this2, vectorBucketName); + } + /** + * + * @alpha + * + * Lists all vector buckets with optional filtering and pagination + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Optional filters (prefix, maxResults, nextToken) + * @returns Promise with list of buckets or error + * + * @example List vector buckets + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .listBuckets({ prefix: 'embeddings-' }) + * + * data?.vectorBuckets.forEach(bucket => { + * console.log(bucket.vectorBucketName) + * }) + * ``` + */ + async listBuckets(options = {}) { + var _superprop_getListBuckets = () => super.listBuckets, _this3 = this; + return _superprop_getListBuckets().call(_this3, options); + } + /** + * + * @alpha + * + * Deletes a vector bucket (bucket must be empty) + * All indexes must be deleted before deleting the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket to delete + * @returns Promise with empty response on success or error + * + * @example Delete a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .deleteBucket('embeddings-old') + * ``` + */ + async deleteBucket(vectorBucketName) { + var _superprop_getDeleteBucket = () => super.deleteBucket, _this4 = this; + return _superprop_getDeleteBucket().call(_this4, vectorBucketName); + } +}; +/** +* +* @alpha +* +* Scoped client for operations within a specific vector bucket +* Provides index management and access to vector operations +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +*/ +var VectorBucketScope = class extends VectorIndexApi { + /** + * @alpha + * + * Creates a helper that automatically scopes all index operations to the provided bucket. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector bucket scope + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + constructor(url, headers, vectorBucketName, fetch$1) { + super(url, headers, fetch$1); + this.vectorBucketName = vectorBucketName; + } + /** + * + * @alpha + * + * Creates a new vector index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Index configuration (vectorBucketName is automatically set) + * @returns Promise with empty response on success or error + * + * @example Creating a vector index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents-openai', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine', + * metadataConfiguration: { + * nonFilterableMetadataKeys: ['raw_text'] + * } + * }) + * ``` + */ + async createIndex(options) { + var _superprop_getCreateIndex = () => super.createIndex, _this5 = this; + return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName })); + } + /** + * + * @alpha + * + * Lists indexes in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (vectorBucketName is automatically set) + * @returns Promise with response containing indexes array and pagination token or error + * + * @example List indexes + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.listIndexes({ prefix: 'documents-' }) + * ``` + */ + async listIndexes(options = {}) { + var _superprop_getListIndexes = () => super.listIndexes, _this6 = this; + return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName })); + } + /** + * + * @alpha + * + * Retrieves metadata for a specific index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to retrieve + * @returns Promise with index metadata or error + * + * @example Get index metadata + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.getIndex('documents-openai') + * console.log('Dimension:', data?.index.dimension) + * ``` + */ + async getIndex(indexName) { + var _superprop_getGetIndex = () => super.getIndex, _this7 = this; + return _superprop_getGetIndex().call(_this7, _this7.vectorBucketName, indexName); + } + /** + * + * @alpha + * + * Deletes an index from this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to delete + * @returns Promise with empty response on success or error + * + * @example Delete an index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.deleteIndex('old-index') + * ``` + */ + async deleteIndex(indexName) { + var _superprop_getDeleteIndex = () => super.deleteIndex, _this8 = this; + return _superprop_getDeleteIndex().call(_this8, _this8.vectorBucketName, indexName); + } + /** + * + * @alpha + * + * Access operations for a specific index within this bucket + * Returns a scoped client for vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index + * @returns Index-scoped client with vector data operations + * + * @example Accessing an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * + * // Insert vectors + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5 + * }) + * ``` + */ + index(indexName) { + return new VectorIndexScope(this.url, this.headers, this.vectorBucketName, indexName, this.fetch); + } +}; +/** +* +* @alpha +* +* Scoped client for operations within a specific vector index +* Provides vector data operations (put, get, list, query, delete) +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +*/ +var VectorIndexScope = class extends VectorDataApi { + /** + * + * @alpha + * + * Creates a helper that automatically scopes all vector operations to the provided bucket/index names. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector index scope + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * ``` + */ + constructor(url, headers, vectorBucketName, indexName, fetch$1) { + super(url, headers, fetch$1); + this.vectorBucketName = vectorBucketName; + this.indexName = indexName; + } + /** + * + * @alpha + * + * Inserts or updates vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector insertion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Insert vectors into an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.putVectors({ + * vectors: [ + * { + * key: 'doc-1', + * data: { float32: [0.1, 0.2, ...] }, + * metadata: { title: 'Introduction', page: 1 } + * } + * ] + * }) + * ``` + */ + async putVectors(options) { + var _superprop_getPutVectors = () => super.putVectors, _this9 = this; + return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this9.vectorBucketName, + indexName: _this9.indexName + })); + } + /** + * + * @alpha + * + * Retrieves vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector retrieval options (bucket and index names automatically set) + * @returns Promise with response containing vectors array or error + * + * @example Get vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.getVectors({ + * keys: ['doc-1', 'doc-2'], + * returnMetadata: true + * }) + * ``` + */ + async getVectors(options) { + var _superprop_getGetVectors = () => super.getVectors, _this10 = this; + return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this10.vectorBucketName, + indexName: _this10.indexName + })); + } + /** + * + * @alpha + * + * Lists vectors in this index with pagination + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (bucket and index names automatically set) + * @returns Promise with response containing vectors array and pagination token or error + * + * @example List vectors with pagination + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.listVectors({ + * maxResults: 500, + * returnMetadata: true + * }) + * ``` + */ + async listVectors(options = {}) { + var _superprop_getListVectors = () => super.listVectors, _this11 = this; + return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this11.vectorBucketName, + indexName: _this11.indexName + })); + } + /** + * + * @alpha + * + * Queries for similar vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Query options (bucket and index names automatically set) + * @returns Promise with response containing matches array of similar vectors ordered by distance or error + * + * @example Query similar vectors + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.queryVectors({ + * queryVector: { float32: [0.1, 0.2, ...] }, + * topK: 5, + * filter: { category: 'technical' }, + * returnDistance: true, + * returnMetadata: true + * }) + * ``` + */ + async queryVectors(options) { + var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this; + return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this12.vectorBucketName, + indexName: _this12.indexName + })); + } + /** + * + * @alpha + * + * Deletes vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Deletion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Delete vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.deleteVectors({ + * keys: ['doc-1', 'doc-2', 'doc-3'] + * }) + * ``` + */ + async deleteVectors(options) { + var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this; + return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this13.vectorBucketName, + indexName: _this13.indexName + })); + } +}; + +//#endregion +//#region src/StorageClient.ts +var StorageClient = class extends StorageBucketApi { + /** + * Creates a client for Storage buckets, files, analytics, and vectors. + * + * @category Storage + * @subcategory File Buckets + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const avatars = supabase.storage.from('avatars') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import { StorageClient } from '@supabase/storage-js' + * + * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', { + * apikey: 'your-publishable-key', + * }) + * const avatars = storage.from('avatars') + * ``` + */ + constructor(url, headers = {}, fetch$1, opts) { + super(url, headers, fetch$1, opts); + } + /** + * Perform file operation in a bucket. + * + * @category Storage + * @subcategory File Buckets + * + * @param id The bucket id to operate on. + * + * @example Accessing a bucket + * ```typescript + * const avatars = supabase.storage.from('avatars') + * ``` + */ + from(id) { + return new StorageFileApi(this.url, this.headers, id, this.fetch); + } + /** + * + * @alpha + * + * Access vector storage operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * + * @returns A StorageVectorsClient instance configured with the current storage settings. + */ + get vectors() { + return new StorageVectorsClient(this.url + "/vector", { + headers: this.headers, + fetch: this.fetch + }); + } + /** + * + * @alpha + * + * Access analytics storage operations using Iceberg tables. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * + * @returns A StorageAnalyticsClient instance configured with the current storage settings. + */ + get analytics() { + return new StorageAnalyticsClient(this.url + "/iceberg", this.headers, this.fetch); + } +}; + +//#endregion +exports.StorageAnalyticsClient = StorageAnalyticsClient; +exports.StorageApiError = StorageApiError; +exports.StorageClient = StorageClient; +exports.StorageError = StorageError; +exports.StorageUnknownError = StorageUnknownError; +exports.StorageVectorsApiError = StorageVectorsApiError; +exports.StorageVectorsClient = StorageVectorsClient; +exports.StorageVectorsError = StorageVectorsError; +exports.StorageVectorsErrorCode = StorageVectorsErrorCode; +exports.StorageVectorsUnknownError = StorageVectorsUnknownError; +exports.VectorBucketApi = VectorBucketApi; +exports.VectorBucketScope = VectorBucketScope; +exports.VectorDataApi = VectorDataApi; +exports.VectorIndexApi = VectorIndexApi; +exports.VectorIndexScope = VectorIndexScope; +exports.isStorageError = isStorageError; +exports.isStorageVectorsError = isStorageVectorsError; +//# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.cjs.map b/node_modules/@supabase/storage-js/dist/index.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..3b3c2d97d702e9867f18dc8ea76b7469cb28bfdd --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs","names":["result: Record","result: Record","params: { [k: string]: any }","contentType: string | undefined","fetch","setHeaderUtil","this","downloadFn: () => Promise","shouldThrowOnError: boolean","this","downloadFn: () => Promise","shouldThrowOnError: boolean","this","DEFAULT_FILE_OPTIONS: FileOptions","fetch","this","headers: Record","fetch","this","params: Record","fetch","this","IcebergRestCatalog","fetch","this","fetch","this","fetch","this","fetch","this","fetch"],"sources":["../src/lib/common/errors.ts","../src/lib/common/headers.ts","../src/lib/common/helpers.ts","../src/lib/common/fetch.ts","../src/lib/common/BaseApiClient.ts","../src/packages/StreamDownloadBuilder.ts","../src/packages/BlobDownloadBuilder.ts","../src/packages/StorageFileApi.ts","../src/lib/version.ts","../src/lib/constants.ts","../src/packages/StorageBucketApi.ts","../src/packages/StorageAnalyticsClient.ts","../src/packages/VectorIndexApi.ts","../src/packages/VectorDataApi.ts","../src/packages/VectorBucketApi.ts","../src/packages/StorageVectorsClient.ts","../src/StorageClient.ts"],"sourcesContent":["/**\n * Namespace type for error classes\n * Determines the error class names and type guards\n */\nexport type ErrorNamespace = 'storage' | 'vectors'\n\n/**\n * Base error class for all Storage errors\n * Supports both 'storage' and 'vectors' namespaces\n */\nexport class StorageError extends Error {\n protected __isStorageError = true\n protected namespace: ErrorNamespace\n status: number | undefined\n statusCode: string | undefined\n\n constructor(\n message: string,\n namespace: ErrorNamespace = 'storage',\n status?: number,\n statusCode?: string\n ) {\n super(message)\n this.namespace = namespace\n this.name = namespace === 'vectors' ? 'StorageVectorsError' : 'StorageError'\n this.status = status\n this.statusCode = statusCode\n }\n\n toJSON(): {\n name: string\n message: string\n status: number | undefined\n statusCode: string | undefined\n } {\n return {\n name: this.name,\n message: this.message,\n status: this.status,\n statusCode: this.statusCode,\n }\n }\n}\n\n/**\n * Type guard to check if an error is a StorageError\n * @param error - The error to check\n * @returns True if the error is a StorageError\n */\nexport function isStorageError(error: unknown): error is StorageError {\n return typeof error === 'object' && error !== null && '__isStorageError' in error\n}\n\n/**\n * API error returned from Storage service\n * Includes HTTP status code and service-specific error code\n */\nexport class StorageApiError extends StorageError {\n override status: number\n override statusCode: string\n /**\n * Service-specific error code from the Storage API response body, such as\n * `NoSuchKey`, `AccessDenied` or `ResourceAlreadyExists`. Use this to branch\n * on the specific error rather than parsing the message.\n * @see https://supabase.com/docs/guides/storage/debugging/error-codes\n */\n code: string | undefined\n\n constructor(\n message: string,\n status: number,\n statusCode: string,\n namespace: ErrorNamespace = 'storage',\n code?: string\n ) {\n super(message, namespace, status, statusCode)\n this.name = namespace === 'vectors' ? 'StorageVectorsApiError' : 'StorageApiError'\n this.status = status\n this.statusCode = statusCode\n this.code = code\n }\n\n toJSON(): {\n name: string\n message: string\n status: number | undefined\n statusCode: string | undefined\n code: string | undefined\n } {\n return {\n ...super.toJSON(),\n code: this.code,\n }\n }\n}\n\n/**\n * Unknown error that doesn't match expected error patterns\n * Wraps the original error for debugging\n */\nexport class StorageUnknownError extends StorageError {\n originalError: unknown\n\n constructor(message: string, originalError: unknown, namespace: ErrorNamespace = 'storage') {\n super(message, namespace)\n this.name = namespace === 'vectors' ? 'StorageVectorsUnknownError' : 'StorageUnknownError'\n this.originalError = originalError\n }\n}\n\n// ============================================================================\n// Backward Compatibility Exports for Vectors\n// ============================================================================\n\n/**\n * @deprecated Use StorageError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsError extends StorageError {\n constructor(message: string) {\n super(message, 'vectors')\n }\n}\n\n/**\n * Type guard to check if an error is a StorageVectorsError\n * @param error - The error to check\n * @returns True if the error is a StorageVectorsError\n */\nexport function isStorageVectorsError(error: unknown): error is StorageVectorsError {\n return isStorageError(error) && (error as StorageError)['namespace'] === 'vectors'\n}\n\n/**\n * @deprecated Use StorageApiError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsApiError extends StorageApiError {\n constructor(message: string, status: number, statusCode: string) {\n super(message, status, statusCode, 'vectors')\n }\n}\n\n/**\n * @deprecated Use StorageUnknownError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsUnknownError extends StorageUnknownError {\n constructor(message: string, originalError: unknown) {\n super(message, originalError, 'vectors')\n }\n}\n\n/**\n * Error codes specific to S3 Vectors API\n * Maps AWS service errors to application-friendly error codes\n */\nexport enum StorageVectorsErrorCode {\n /** Internal server fault (HTTP 500) */\n InternalError = 'InternalError',\n /** Resource already exists / conflict (HTTP 409) */\n S3VectorConflictException = 'S3VectorConflictException',\n /** Resource not found (HTTP 404) */\n S3VectorNotFoundException = 'S3VectorNotFoundException',\n /** Delete bucket while not empty (HTTP 400) */\n S3VectorBucketNotEmpty = 'S3VectorBucketNotEmpty',\n /** Exceeds bucket quota/limit (HTTP 400) */\n S3VectorMaxBucketsExceeded = 'S3VectorMaxBucketsExceeded',\n /** Exceeds index quota/limit (HTTP 400) */\n S3VectorMaxIndexesExceeded = 'S3VectorMaxIndexesExceeded',\n}\n","/**\n * Sets a header with case-insensitive deduplication.\n * Removes any existing headers whose name matches (case-insensitive),\n * then sets the value under the lowercase key. Does not mutate the input object.\n *\n * @param headers - Existing headers object\n * @param name - Header name to set (stored as lowercase)\n * @param value - Header value\n * @returns New headers object with the header set\n */\nexport function setHeader(\n headers: Record,\n name: string,\n value: string\n): Record {\n const result = { ...headers }\n const nameLower = name.toLowerCase()\n\n for (const key of Object.keys(result)) {\n if (key.toLowerCase() === nameLower) {\n delete result[key]\n }\n }\n\n result[nameLower] = value\n return result\n}\n\n/**\n * Normalizes all header keys to lowercase with case-insensitive deduplication.\n * When duplicate keys exist (differing only in case), the last value wins.\n * Does not mutate the input object.\n *\n * @param headers - Headers object to normalize\n * @returns New headers object with all keys lowercased\n */\nexport function normalizeHeaders(headers: Record): Record {\n const result: Record = {}\n for (const [key, value] of Object.entries(headers)) {\n result[key.toLowerCase()] = value\n }\n return result\n}\n","type Fetch = typeof fetch\n\n/**\n * Resolves the fetch implementation to use\n * Uses custom fetch if provided, otherwise uses native fetch\n *\n * @param customFetch - Optional custom fetch implementation\n * @returns Resolved fetch function\n */\nexport const resolveFetch = (customFetch?: Fetch): Fetch => {\n if (customFetch) {\n return (...args) => customFetch(...args)\n }\n return (...args) => fetch(...args)\n}\n\n/**\n * Resolves the Response constructor to use\n * Returns native Response constructor\n *\n * @returns Response constructor\n */\nexport const resolveResponse = (): typeof Response => {\n return Response\n}\n\n/**\n * Determine if input is a plain object\n * An object is plain if it's created by either {}, new Object(), or Object.create(null)\n *\n * @param value - Value to check\n * @returns True if value is a plain object\n * @source https://github.com/sindresorhus/is-plain-obj\n */\nexport const isPlainObject = (value: object): boolean => {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const prototype = Object.getPrototypeOf(value)\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n )\n}\n\n/**\n * Recursively converts object keys from snake_case to camelCase\n * Used for normalizing API responses\n *\n * @param item - Object to convert\n * @returns Converted object with camelCase keys\n */\nexport const recursiveToCamel = (item: Record): unknown => {\n if (Array.isArray(item)) {\n return item.map((el) => recursiveToCamel(el))\n } else if (typeof item === 'function' || item !== Object(item)) {\n return item\n }\n\n const result: Record = {}\n Object.entries(item).forEach(([key, value]) => {\n const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, ''))\n result[newKey] = recursiveToCamel(value)\n })\n\n return result\n}\n\n/**\n * Validates if a given bucket name is valid according to Supabase Storage API rules\n * Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName()\n *\n * Rules:\n * - Length: 1-100 characters\n * - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters\n * - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ?\n * - Forbidden: path separators (/, \\), path traversal (..), leading/trailing whitespace\n *\n * AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html\n *\n * @param bucketName - The bucket name to validate\n * @returns true if valid, false otherwise\n */\nexport const isValidBucketName = (bucketName: string): boolean => {\n if (!bucketName || typeof bucketName !== 'string') {\n return false\n }\n\n // Check length constraints (1-100 characters)\n if (bucketName.length === 0 || bucketName.length > 100) {\n return false\n }\n\n // Check for leading/trailing whitespace\n if (bucketName.trim() !== bucketName) {\n return false\n }\n\n // Explicitly reject path separators (security)\n // Note: Consecutive periods (..) are allowed by backend - the AWS restriction\n // on relative paths applies to object keys, not bucket names\n if (bucketName.includes('/') || bucketName.includes('\\\\')) {\n return false\n }\n\n // Validate against allowed character set\n // Pattern matches backend regex: /^(\\w|!|-|\\.|\\*|'|\\(|\\)| |&|\\$|@|=|;|:|\\+|,|\\?)*$/\n // This explicitly excludes path separators (/, \\) and other problematic characters\n const bucketNameRegex = /^[\\w!.\\*'() &$@=;:+,?-]+$/\n return bucketNameRegex.test(bucketName)\n}\n\n/**\n * Normalizes a number array to float32 format\n * Ensures all vector values are valid 32-bit floats\n *\n * @param values - Array of numbers to normalize\n * @returns Normalized float32 array\n */\nexport const normalizeToFloat32 = (values: number[]): number[] => {\n // Use Float32Array to ensure proper precision\n return Array.from(new Float32Array(values))\n}\n\n/**\n * Validates vector dimensions match expected dimension\n * Throws error if dimensions don't match\n *\n * @param vector - Vector data to validate\n * @param expectedDimension - Expected vector dimension\n * @throws Error if dimensions don't match\n */\nexport const validateVectorDimension = (\n vector: { float32: number[] },\n expectedDimension?: number\n): void => {\n if (expectedDimension !== undefined && vector.float32.length !== expectedDimension) {\n throw new Error(\n `Vector dimension mismatch: expected ${expectedDimension}, got ${vector.float32.length}`\n )\n }\n}\n\n/**\n * Percent-encodes each segment of a storage path so URL delimiters within a\n * key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start.\n *\n * Splits on `/` so real path separators stay literal — the storage server\n * routes on them and decodes each segment back to the original key.\n *\n * @param path - A bucket id or `bucketId/objectKey` path\n * @returns The path with each `/`-delimited segment percent-encoded\n */\nexport const encodeStoragePath = (path: string): string =>\n path.split('/').map(encodeURIComponent).join('/')\n","import { StorageApiError, StorageError, StorageUnknownError, ErrorNamespace } from './errors'\nimport { setHeader } from './headers'\nimport { isPlainObject, resolveResponse } from './helpers'\nimport { FetchParameters } from '../types'\n\nexport type Fetch = typeof fetch\n\n/**\n * Options for fetch requests\n */\nexport interface FetchOptions {\n headers?: {\n [key: string]: string\n }\n duplex?: string\n noResolveJson?: boolean\n}\n\n/**\n * HTTP methods supported by the API\n */\nexport type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD'\n\n/**\n * Extracts error message from various error response formats\n * @param err - Error object from API\n * @returns Human-readable error message\n */\nconst _getErrorMessage = (err: unknown): string => {\n if (typeof err === 'object' && err !== null) {\n const e = err as Record\n if (typeof e.msg === 'string') return e.msg\n if (typeof e.message === 'string') return e.message\n if (typeof e.error_description === 'string') return e.error_description\n if (typeof e.error === 'string') return e.error\n if (typeof e.error === 'object' && e.error !== null) {\n const nested = e.error as Record\n if (typeof nested.message === 'string') return nested.message\n }\n }\n return JSON.stringify(err)\n}\n\n/**\n * Handles fetch errors and converts them to Storage error types\n * @param error - The error caught from fetch\n * @param reject - Promise rejection function\n * @param options - Fetch options that may affect error handling\n * @param namespace - Error namespace ('storage' or 'vectors')\n */\nconst handleError = async (\n error: unknown,\n reject: (reason: StorageError) => void,\n options: FetchOptions | undefined,\n namespace: ErrorNamespace\n) => {\n // Structural detection of json() method, present in all Response implementations\n // (native, node-fetch, cross-fetch, undici) and absent from standard Error objects.\n // Checking 'ok' or 'status' via `in` is unreliable across fetch polyfills/realms.\n const isResponseLike =\n error !== null &&\n typeof error === 'object' &&\n 'json' in error &&\n typeof (error as Record).json === 'function'\n\n if (isResponseLike) {\n const responseError = error as Response\n // Defensive coercion: some fetch polyfills have historically returned status as a string.\n let status = parseInt(String(responseError.status), 10)\n if (!Number.isFinite(status)) {\n status = 500\n }\n\n responseError\n .json()\n .then(\n (err: { statusCode?: string; code?: string; error?: string; message?: string } | null) => {\n const statusCode = err?.statusCode || err?.code || status + ''\n reject(\n new StorageApiError(_getErrorMessage(err), status, statusCode, namespace, err?.code)\n )\n }\n )\n .catch(() => {\n const statusCode = status + ''\n const message = responseError.statusText || `HTTP ${status} error`\n reject(new StorageApiError(message, status, statusCode, namespace))\n })\n } else {\n reject(new StorageUnknownError(_getErrorMessage(error), error, namespace))\n }\n}\n\n/**\n * Builds request parameters for fetch calls\n * @param method - HTTP method\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters like AbortSignal\n * @param body - Request body (will be JSON stringified if plain object)\n * @returns Complete fetch request parameters\n */\nconst _getRequestParams = (\n method: RequestMethodType,\n options?: FetchOptions,\n parameters?: FetchParameters,\n body?: object\n) => {\n const params: { [k: string]: any } = { method, headers: options?.headers || {} }\n\n if (method === 'GET' || method === 'HEAD' || !body) {\n return { ...params, ...parameters }\n }\n\n if (isPlainObject(body)) {\n const headers = options?.headers || {}\n let contentType: string | undefined\n\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === 'content-type') {\n contentType = value\n }\n }\n\n params.headers = setHeader(headers, 'Content-Type', contentType ?? 'application/json')\n params.body = JSON.stringify(body)\n } else {\n params.body = body\n }\n\n if (options?.duplex) {\n params.duplex = options.duplex\n }\n\n return { ...params, ...parameters }\n}\n\n/**\n * Internal request handler that wraps fetch with error handling\n * @param fetcher - Fetch function to use\n * @param method - HTTP method\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @param body - Request body\n * @param namespace - Error namespace ('storage' or 'vectors')\n * @returns Promise with parsed response or error\n */\nasync function _handleRequest(\n fetcher: Fetch,\n method: RequestMethodType,\n url: string,\n options: FetchOptions | undefined,\n parameters: FetchParameters | undefined,\n body: object | undefined,\n namespace: ErrorNamespace\n): Promise {\n return new Promise((resolve, reject) => {\n fetcher(url, _getRequestParams(method, options, parameters, body))\n .then((result) => {\n if (!result.ok) throw result\n if (options?.noResolveJson) return result\n\n // AWS S3 Vectors API returns 200 OK with content-length: 0 for successful mutations\n // (putVectors, deleteVectors) instead of 204 or JSON response. This is AWS's design choice\n // for performance optimization of bulk operations (up to 500 vectors per request).\n // We handle this to prevent \"Unexpected end of JSON input\" errors when calling result.json()\n if (namespace === 'vectors') {\n const contentType = result.headers.get('content-type')\n const contentLength = result.headers.get('content-length')\n\n // Return empty object for explicitly empty responses\n if (contentLength === '0' || result.status === 204) {\n return {}\n }\n\n // Return empty object if no JSON content type\n if (!contentType || !contentType.includes('application/json')) {\n return {}\n }\n }\n\n return result.json()\n })\n .then((data) => resolve(data))\n .catch((error) => handleError(error, reject, options, namespace))\n })\n}\n\n/**\n * Creates a fetch API with the specified namespace\n * @param namespace - Error namespace ('storage' or 'vectors')\n * @returns Object with HTTP method functions\n */\nexport function createFetchApi(namespace: ErrorNamespace = 'storage') {\n return {\n /**\n * Performs a GET request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n get: async (\n fetcher: Fetch,\n url: string,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'GET', url, options, parameters, undefined, namespace)\n },\n\n /**\n * Performs a POST request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n post: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'POST', url, options, parameters, body, namespace)\n },\n\n /**\n * Performs a PUT request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n put: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'PUT', url, options, parameters, body, namespace)\n },\n\n /**\n * Performs a HEAD request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with Response object (not JSON parsed)\n */\n head: async (\n fetcher: Fetch,\n url: string,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(\n fetcher,\n 'HEAD',\n url,\n {\n ...options,\n noResolveJson: true,\n },\n parameters,\n undefined,\n namespace\n )\n },\n\n /**\n * Performs a DELETE request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n remove: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'DELETE', url, options, parameters, body, namespace)\n },\n }\n}\n\n// Default exports for backward compatibility with 'storage' namespace\nconst defaultApi = createFetchApi('storage')\nexport const { get, post, put, head, remove } = defaultApi\n\n// Vectors API with 'vectors' namespace for proper error handling\nexport const vectorsApi = createFetchApi('vectors')\n","import { ErrorNamespace, isStorageError, StorageError } from './errors'\nimport { Fetch } from './fetch'\nimport { normalizeHeaders, setHeader as setHeaderUtil } from './headers'\nimport { resolveFetch } from './helpers'\n\n/**\n * @ignore\n * Base API client class for all Storage API classes\n * Provides common infrastructure for error handling and configuration\n *\n * @typeParam TError - The error type (StorageError or subclass)\n */\nexport default abstract class BaseApiClient {\n protected url: string\n protected headers: { [key: string]: string }\n protected fetch: Fetch\n protected shouldThrowOnError = false\n protected namespace: ErrorNamespace\n\n /**\n * Creates a new BaseApiClient instance\n * @param url - Base URL for API requests\n * @param headers - Default headers for API requests\n * @param fetch - Optional custom fetch implementation\n * @param namespace - Error namespace ('storage' or 'vectors')\n */\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n namespace: ErrorNamespace = 'storage'\n ) {\n this.url = url\n this.headers = normalizeHeaders(headers)\n this.fetch = resolveFetch(fetch)\n this.namespace = namespace\n }\n\n /**\n * Enable throwing errors instead of returning them.\n * When enabled, errors are thrown instead of returned in { data, error } format.\n *\n * @returns this - For method chaining\n */\n public throwOnError(): this {\n this.shouldThrowOnError = true\n return this\n }\n\n /**\n * Set an HTTP header for the request.\n * Creates a shallow copy of headers to avoid mutating shared state.\n *\n * @param name - Header name\n * @param value - Header value\n * @returns this - For method chaining\n */\n public setHeader(name: string, value: string): this {\n this.headers = setHeaderUtil(this.headers, name, value)\n return this\n }\n\n /**\n * Handles API operation with standardized error handling\n * Eliminates repetitive try-catch blocks across all API methods\n *\n * This wrapper:\n * 1. Executes the operation\n * 2. Returns { data, error: null } on success\n * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)\n * 4. Throws error on failure (if shouldThrowOnError is true)\n *\n * @typeParam T - The expected data type from the operation\n * @param operation - Async function that performs the API call\n * @returns Promise with { data, error } tuple\n *\n * @example Handling an operation\n * ```typescript\n * async listBuckets() {\n * return this.handleOperation(async () => {\n * return await get(this.fetch, `${this.url}/bucket`, {\n * headers: this.headers,\n * })\n * })\n * }\n * ```\n */\n protected async handleOperation(\n operation: () => Promise\n ): Promise<{ data: T; error: null } | { data: null; error: TError }> {\n try {\n const data = await operation()\n return { data, error: null }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n if (isStorageError(error)) {\n return { data: null, error: error as TError }\n }\n throw error\n }\n }\n}\n","import { isStorageError } from '../lib/common/errors'\nimport { DownloadResult } from '../lib/types'\n\nexport default class StreamDownloadBuilder implements Promise> {\n readonly [Symbol.toStringTag]: string = 'StreamDownloadBuilder'\n private promise: Promise> | null = null\n\n constructor(\n private downloadFn: () => Promise,\n private shouldThrowOnError: boolean\n ) {}\n\n then, TResult2 = never>(\n onfulfilled?:\n | ((value: DownloadResult) => TResult1 | PromiseLike)\n | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike) | null\n ): Promise {\n return this.getPromise().then(onfulfilled, onrejected)\n }\n\n catch(\n onrejected?: ((reason: any) => TResult | PromiseLike) | null\n ): Promise | TResult> {\n return this.getPromise().catch(onrejected)\n }\n\n finally(onfinally?: (() => void) | null): Promise> {\n return this.getPromise().finally(onfinally)\n }\n\n private getPromise(): Promise> {\n if (!this.promise) {\n this.promise = this.execute()\n }\n return this.promise\n }\n\n private async execute(): Promise> {\n try {\n const result = await this.downloadFn()\n\n return {\n data: result.body as ReadableStream,\n error: null,\n }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n\n if (isStorageError(error)) {\n return { data: null, error }\n }\n\n throw error\n }\n }\n}\n","import { isStorageError } from '../lib/common/errors'\nimport { DownloadResult } from '../lib/types'\nimport StreamDownloadBuilder from './StreamDownloadBuilder'\n\nexport default class BlobDownloadBuilder implements Promise> {\n readonly [Symbol.toStringTag]: string = 'BlobDownloadBuilder'\n private promise: Promise> | null = null\n\n constructor(\n private downloadFn: () => Promise,\n private shouldThrowOnError: boolean\n ) {}\n\n asStream(): StreamDownloadBuilder {\n return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError)\n }\n\n then, TResult2 = never>(\n onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike) | null\n ): Promise {\n return this.getPromise().then(onfulfilled, onrejected)\n }\n\n catch(\n onrejected?: ((reason: any) => TResult | PromiseLike) | null\n ): Promise | TResult> {\n return this.getPromise().catch(onrejected)\n }\n\n finally(onfinally?: (() => void) | null): Promise> {\n return this.getPromise().finally(onfinally)\n }\n\n private getPromise(): Promise> {\n if (!this.promise) {\n this.promise = this.execute()\n }\n return this.promise\n }\n\n private async execute(): Promise> {\n try {\n const result = await this.downloadFn()\n\n return {\n data: await result.blob(),\n error: null,\n }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n\n if (isStorageError(error)) {\n return { data: null, error }\n }\n\n throw error\n }\n }\n}\n","import {\n StorageApiError,\n StorageError,\n StorageUnknownError,\n isStorageError,\n} from '../lib/common/errors'\nimport { get, head, post, put, remove, Fetch } from '../lib/common/fetch'\nimport { setHeader } from '../lib/common/headers'\nimport { encodeStoragePath, recursiveToCamel } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n FileObject,\n FileOptions,\n SearchOptions,\n FetchParameters,\n TransformOptions,\n DestinationOptions,\n FileObjectV2,\n Camelize,\n SearchV2Options,\n SearchV2Result,\n PurgeCacheOptions,\n} from '../lib/types'\nimport BlobDownloadBuilder from './BlobDownloadBuilder'\n\nconst DEFAULT_SEARCH_OPTIONS = {\n limit: 100,\n offset: 0,\n sortBy: {\n column: 'name',\n order: 'asc',\n },\n}\n\nconst DEFAULT_FILE_OPTIONS: FileOptions = {\n cacheControl: '3600',\n contentType: 'text/plain;charset=UTF-8',\n upsert: false,\n}\n\ntype FileBody =\n | ArrayBuffer\n | ArrayBufferView\n | Blob\n | Buffer\n | File\n | FormData\n | NodeJS.ReadableStream\n | ReadableStream\n | URLSearchParams\n | string\n\nexport default class StorageFileApi extends BaseApiClient {\n protected bucketId: string | undefined\n\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n bucketId?: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch, 'storage')\n this.bucketId = bucketId\n }\n\n /**\n * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.\n *\n * @param method HTTP method.\n * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.\n * @param fileBody The body of the file to be stored in the bucket.\n */\n private async uploadOrUpdate(\n method: 'POST' | 'PUT',\n path: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let body\n const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions }\n let headers: Record = {\n ...this.headers,\n ...(method === 'POST' && { 'x-upsert': String(options.upsert as boolean) }),\n }\n\n const metadata = options.metadata\n\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData()\n body.append('cacheControl', options.cacheControl as string)\n if (metadata) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n body.append('', fileBody)\n } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody\n // Only append if not already present\n if (!body.has('cacheControl')) {\n body.append('cacheControl', options.cacheControl as string)\n }\n if (metadata && !body.has('metadata')) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n } else {\n body = fileBody\n headers['cache-control'] = `max-age=${options.cacheControl}`\n headers['content-type'] = options.contentType as string\n\n if (metadata) {\n headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata))\n }\n\n // Node.js streams require duplex option for fetch in Node 20+\n // Check for both web ReadableStream and Node.js streams\n const isStream =\n (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) ||\n (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function')\n\n if (isStream && !options.duplex) {\n options.duplex = 'half'\n }\n }\n\n if (fileOptions?.headers) {\n for (const [key, value] of Object.entries(fileOptions.headers)) {\n headers = setHeader(headers, key, value)\n }\n }\n\n const cleanPath = this._removeEmptyFolders(path)\n const _path = this._getFinalPath(cleanPath)\n const data = await (method == 'PUT' ? put : post)(\n this.fetch,\n `${this.url}/object/${_path}`,\n body as object,\n { headers, ...(options?.duplex ? { duplex: options.duplex } : {}) }\n )\n\n return { path: cleanPath, id: data.Id, fullPath: data.Key }\n })\n }\n\n /**\n * Uploads a file to an existing bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @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.\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.\n * @returns Promise with response containing file path, id, and fullPath or error\n *\n * @example Upload file\n * ```js\n * const avatarFile = event.target.files[0]\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', avatarFile, {\n * cacheControl: '3600',\n * upsert: false\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"public/avatar1.png\",\n * \"fullPath\": \"avatars/public/avatar1.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Upload file using `ArrayBuffer` from base64 file data\n * ```js\n * import { decode } from 'base64-arraybuffer'\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', decode('base64FileData'), {\n * contentType: 'image/png'\n * })\n * ```\n *\n * @example Handling errors\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', avatarFile)\n *\n * if (error) {\n * // Log the full error so fields like `statusCode` and `error` (the\n * // Storage error name, e.g. \"Duplicate\") aren't hidden behind `error.message`.\n * console.error(error)\n * return\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n * - 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.\n */\n async upload(\n path: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.uploadOrUpdate('POST', path, fileBody, fileOptions)\n }\n\n /**\n * Upload a file with a token generated from `createSignedUploadUrl`.\n *\n * @category Storage\n * @subcategory File Buckets\n * @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.\n * @param token The token generated from `createSignedUploadUrl`\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions HTTP headers (cacheControl, contentType, etc.).\n * **Note:** The `upsert` option has no effect here. To enable upsert behavior,\n * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead.\n * @returns Promise with response containing file path and fullPath or error\n *\n * @example Upload to a signed URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"folder/cat.jpg\",\n * \"fullPath\": \"avatars/folder/cat.jpg\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async uploadToSignedUrl(\n path: string,\n token: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ) {\n const cleanPath = this._removeEmptyFolders(path)\n const _path = this._getFinalPath(cleanPath)\n\n const url = new URL(this.url + `/object/upload/sign/${_path}`)\n url.searchParams.set('token', token)\n\n return this.handleOperation(async () => {\n let body\n const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions }\n let headers: Record = {\n ...this.headers,\n ...{ 'x-upsert': String(options.upsert as boolean) },\n }\n\n const metadata = options.metadata\n\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData()\n body.append('cacheControl', options.cacheControl as string)\n if (metadata) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n body.append('', fileBody)\n } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody\n if (!body.has('cacheControl')) {\n body.append('cacheControl', options.cacheControl as string)\n }\n if (metadata && !body.has('metadata')) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n } else {\n body = fileBody\n headers['cache-control'] = `max-age=${options.cacheControl}`\n headers['content-type'] = options.contentType as string\n if (metadata) {\n headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata))\n }\n\n const isStream =\n (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) ||\n (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function')\n\n if (isStream && !options.duplex) {\n options.duplex = 'half'\n }\n }\n\n if (fileOptions?.headers) {\n for (const [key, value] of Object.entries(fileOptions.headers)) {\n headers = setHeader(headers, key, value)\n }\n }\n\n const data = await put(this.fetch, url.toString(), body as object, {\n headers,\n ...(options?.duplex ? { duplex: options.duplex } : {}),\n })\n\n return { path: cleanPath, fullPath: data.Key }\n })\n }\n\n /**\n * Creates a signed upload URL.\n * Signed upload URLs can be used to upload files to the bucket without further authentication.\n * They are valid for 2 hours.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the current file name. For example `folder/image.png`.\n * @param options.upsert If set to true, allows the file to be overwritten if it already exists.\n * @returns Promise with response containing signed upload URL, token, and path or error\n *\n * @example Create Signed Upload URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUploadUrl('folder/cat.jpg')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=\",\n * \"path\": \"folder/cat.jpg\",\n * \"token\": \"\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `insert`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUploadUrl(\n path: string,\n options?: { upsert: boolean }\n ): Promise<\n | {\n data: { signedUrl: string; token: string; path: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let _path = this._getFinalPath(path)\n\n const headers = { ...this.headers }\n\n if (options?.upsert) {\n headers['x-upsert'] = 'true'\n }\n\n const data = await post(\n this.fetch,\n `${this.url}/object/upload/sign/${_path}`,\n {},\n { headers }\n )\n\n const url = new URL(this.url + data.url)\n\n const token = url.searchParams.get('token')\n\n if (!token) {\n throw new StorageError('No token returned by API')\n }\n\n return { signedUrl: url.toString(), path, token }\n })\n }\n\n /**\n * Replaces an existing file at the specified path with a new one.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.\n * **Note:** The `upsert` option has no effect here. `update()` always replaces the\n * file at the given path, so the `x-upsert` header is not sent. To control upsert\n * behavior, use `upload()` instead.\n * @returns Promise with response containing file path, id, and fullPath or error\n *\n * @example Update file\n * ```js\n * const avatarFile = event.target.files[0]\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .update('public/avatar1.png', avatarFile, {\n * cacheControl: '3600'\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"public/avatar1.png\",\n * \"fullPath\": \"avatars/public/avatar1.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Update file using `ArrayBuffer` from base64 file data\n * ```js\n * import {decode} from 'base64-arraybuffer'\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .update('public/avatar1.png', decode('base64FileData'), {\n * contentType: 'image/png'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `update` and `select`\n * - `update()` always replaces the file at the given path regardless of the `upsert` option.\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n * - 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.\n */\n async update(\n path: string,\n fileBody:\n | ArrayBuffer\n | ArrayBufferView\n | Blob\n | Buffer\n | File\n | FormData\n | NodeJS.ReadableStream\n | ReadableStream\n | URLSearchParams\n | string,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.uploadOrUpdate('PUT', path, fileBody, fileOptions)\n }\n\n /**\n * Moves an existing file to a new path in the same bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param fromPath The original file path, including the current file name. For example `folder/image.png`.\n * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.\n * @param options The destination options.\n * @returns Promise with response containing success message or error\n *\n * @example Move file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .move('public/avatar1.png', 'private/avatar2.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully moved\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `update` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async move(\n fromPath: string,\n toPath: string,\n options?: DestinationOptions\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(\n this.fetch,\n `${this.url}/object/move`,\n {\n bucketId: this.bucketId,\n sourceKey: fromPath,\n destinationKey: toPath,\n destinationBucket: options?.destinationBucket,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Copies an existing file to a new path in the same bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param fromPath The original file path, including the current file name. For example `folder/image.png`.\n * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.\n * @param options The destination options.\n * @returns Promise with response containing copied file path or error\n *\n * @example Copy file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .copy('public/avatar1.png', 'private/avatar2.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"avatars/private/avatar2.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `insert` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async copy(\n fromPath: string,\n toPath: string,\n options?: DestinationOptions\n ): Promise<\n | {\n data: { path: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const data = await post(\n this.fetch,\n `${this.url}/object/copy`,\n {\n bucketId: this.bucketId,\n sourceKey: fromPath,\n destinationKey: toPath,\n destinationBucket: options?.destinationBucket,\n },\n { headers: this.headers }\n )\n return { path: data.Key }\n })\n }\n\n /**\n * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the current file name. For example `folder/image.png`.\n * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.\n * @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.\n * @param options.transform Transform the asset before serving it to the client.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Promise with response containing signed URL or error\n *\n * @example Create Signed URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Create a signed URL for an asset with transformations\n * ```js\n * const { data } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60, {\n * transform: {\n * width: 100,\n * height: 100,\n * }\n * })\n * ```\n *\n * @example Create a signed URL which triggers the download of the asset\n * ```js\n * const { data } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60, {\n * download: true,\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUrl(\n path: string,\n expiresIn: number,\n options?: {\n download?: string | boolean\n transform?: TransformOptions\n cacheNonce?: string\n }\n ): Promise<\n | {\n data: { signedUrl: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let _path = this._getFinalPath(path)\n\n const hasTransform =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n\n let data = await post(\n this.fetch,\n `${this.url}/object/sign/${_path}`,\n { expiresIn, ...(hasTransform ? { transform: options!.transform } : {}) },\n { headers: this.headers }\n )\n\n const query = new URLSearchParams()\n if (options?.download)\n query.set('download', options.download === true ? '' : options.download)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n // `data.signedURL` contains a `token` query parameter, so append extra params with `&`\n // only when we actually have something to add.\n const signedUrl = encodeURI(\n `${this.url}${data.signedURL}${queryString ? `&${queryString}` : ''}`\n )\n\n return { signedUrl }\n })\n }\n\n /**\n * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.\n * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.\n * @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.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Promise with response containing array of objects with signedUrl, path, and error or error\n *\n * @example Create Signed URLs\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"error\": null,\n * \"path\": \"folder/avatar1.png\",\n * \"signedURL\": \"/object/sign/avatars/folder/avatar1.png?token=\",\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=\"\n * },\n * {\n * \"error\": null,\n * \"path\": \"folder/avatar2.png\",\n * \"signedURL\": \"/object/sign/avatars/folder/avatar2.png?token=\",\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=\"\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUrls(\n paths: string[],\n expiresIn: number,\n options?: { download?: string | boolean; cacheNonce?: string }\n ): Promise<\n | {\n data: {\n error: string | null\n path: string | null\n signedURL: string | null\n signedUrl: string | null\n }[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const data = await post(\n this.fetch,\n `${this.url}/object/sign/${this.bucketId}`,\n { expiresIn, paths },\n { headers: this.headers }\n )\n\n const query = new URLSearchParams()\n\n if (options?.download)\n query.set('download', options.download === true ? '' : options.download)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n\n const queryString = query.toString()\n\n return data.map(\n (datum: { error: string | null; path: string | null; signedURL: string | null }) => ({\n ...datum,\n signedUrl: datum.signedURL\n ? encodeURI(`${this.url}${datum.signedURL}${queryString ? `&${queryString}` : ''}`)\n : null,\n })\n )\n })\n }\n\n /**\n * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.\n * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache.\n * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.\n * @returns BlobDownloadBuilder instance for downloading the file\n *\n * @example Download file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": ,\n * \"error\": null\n * }\n * ```\n *\n * @example Download file with transformations\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {\n * transform: {\n * width: 100,\n * height: 100,\n * quality: 80\n * }\n * })\n * ```\n *\n * @example Download with cache control (useful in Edge Functions)\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {}, { cache: 'no-store' })\n * ```\n *\n * @example Download with abort signal\n * ```js\n * const controller = new AbortController()\n * setTimeout(() => controller.abort(), 5000)\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {}, { signal: controller.signal })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n download(\n path: string,\n options?: Options,\n parameters?: FetchParameters\n ): BlobDownloadBuilder {\n const wantsTransformation =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n const renderPath = wantsTransformation ? 'render/image/authenticated' : 'object'\n\n const query = new URLSearchParams()\n if (options?.transform) this.applyTransformOptsToQuery(query, options.transform)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n const _path = this._getFinalPath(path)\n const downloadFn = () =>\n get(\n this.fetch,\n `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ''}`,\n {\n headers: this.headers,\n noResolveJson: true,\n },\n parameters\n )\n return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError)\n }\n\n /**\n * Retrieves the details of an existing file.\n *\n * Returns detailed file metadata including size, content type, and timestamps.\n * Note: The API returns `last_modified` field, not `updated_at`.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the file name. For example `folder/image.png`.\n * @returns Promise with response containing file metadata or error\n *\n * @example Get file info\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .info('folder/avatar1.png')\n *\n * if (data) {\n * console.log('Last modified:', data.lastModified)\n * console.log('Size:', data.size)\n * }\n * ```\n */\n async info(path: string): Promise<\n | {\n data: Camelize\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n const _path = this._getFinalPath(path)\n\n return this.handleOperation(async () => {\n const data = await get(this.fetch, `${this.url}/object/info/${_path}`, {\n headers: this.headers,\n })\n\n return recursiveToCamel(data) as Camelize\n })\n }\n\n /**\n * Checks the existence of a file.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the file name. For example `folder/image.png`.\n * @returns Promise with response containing boolean indicating file existence or error\n *\n * @example Check file existence\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .exists('folder/avatar1.png')\n * ```\n */\n async exists(path: string): Promise<\n | {\n data: boolean\n error: null\n }\n | {\n data: boolean\n error: StorageError\n }\n > {\n const _path = this._getFinalPath(path)\n\n try {\n await head(this.fetch, `${this.url}/object/${_path}`, {\n headers: this.headers,\n })\n\n return { data: true, error: null }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n if (isStorageError(error)) {\n // HEAD requests produce StorageApiError (via handleError) or StorageUnknownError (legacy)\n const status =\n error instanceof StorageApiError\n ? error.status\n : error instanceof StorageUnknownError\n ? (error.originalError as { status: number })?.status\n : undefined\n\n if (status !== undefined && [400, 404].includes(status)) {\n return { data: false, error }\n }\n }\n\n throw error\n }\n }\n\n /**\n * 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.\n * 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.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.\n * @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.\n * @param options.transform Transform the asset before serving it to the client.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Object with public URL\n *\n * @example Returns the URL for an asset in a public bucket\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"publicUrl\": \"https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png\"\n * }\n * }\n * ```\n *\n * @example Returns the URL for an asset in a public bucket with transformations\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png', {\n * transform: {\n * width: 100,\n * height: 100,\n * }\n * })\n * ```\n *\n * @example Returns the URL which triggers the download of an asset in a public bucket\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png', {\n * download: true,\n * })\n * ```\n *\n * @remarks\n * - 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\"\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n getPublicUrl(\n path: string,\n options?: {\n download?: string | boolean\n transform?: TransformOptions\n cacheNonce?: string\n }\n ): { data: { publicUrl: string } } {\n const _path = this._getFinalPath(path)\n\n const query = new URLSearchParams()\n if (options?.download) query.set('download', options.download === true ? '' : options.download)\n if (options?.transform) this.applyTransformOptsToQuery(query, options.transform)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n const wantsTransformation =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n const renderPath = wantsTransformation ? 'render/image' : 'object'\n\n return {\n data: {\n publicUrl:\n encodeURI(`${this.url}/${renderPath}/public/${_path}`) +\n (queryString ? `?${queryString}` : ''),\n },\n }\n }\n\n /**\n * Deletes files within the same bucket\n *\n * Returns an array of FileObject entries for the deleted files. Note that deprecated\n * fields like `bucket_id` may or may not be present in the response - do not rely on them.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].\n * @returns Promise with response containing array of deleted file objects or error\n *\n * @example Delete file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .remove(['folder/avatar1.png'])\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `delete` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async remove(paths: string[]): Promise<\n | {\n data: FileObject[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(\n this.fetch,\n `${this.url}/object/${this.bucketId}`,\n { prefixes: paths },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Purges the CDN cache for a single object in this bucket.\n *\n * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server\n * issues a CDN invalidation for the object and returns `{ message: 'success' }`.\n *\n * **Requires the `service_role` key.** The underlying endpoint enforces\n * `service_role` JWT — calls made with the anon key or a user JWT will be\n * rejected by the server.\n *\n * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must\n * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant\n * feature enabled, otherwise the server returns an error.\n *\n * Operates on a single object path. There is no wildcard or recursion: pass\n * the exact path of the object you want invalidated.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`.\n * @param options Optional purge cache options.\n * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact.\n * @param parameters Optional fetch parameters such as an `AbortController` signal.\n * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.\n *\n * @example Purge a single cached object\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .purgeCache('folder/avatar1.png')\n * ```\n *\n * @example Purge only transformations for a single object\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .purgeCache('folder/avatar1.png', { transformations: true })\n * ```\n */\n async purgeCache(\n path: string,\n options?: PurgeCacheOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const _path = encodeStoragePath(this._getFinalPath(path))\n const query = new URLSearchParams()\n if (options?.transformations) {\n query.set('transformations', 'true')\n }\n const queryString = query.toString()\n\n return await remove(\n this.fetch,\n `${this.url}/cdn/${_path}${queryString ? `?${queryString}` : ''}`,\n {},\n { headers: this.headers },\n parameters\n )\n })\n }\n\n /**\n * Get file metadata\n * @param id the file id to retrieve metadata\n */\n // async getMetadata(\n // id: string\n // ): Promise<\n // | {\n // data: Metadata\n // error: null\n // }\n // | {\n // data: null\n // error: StorageError\n // }\n // > {\n // try {\n // const data = await get(this.fetch, `${this.url}/metadata/${id}`, { headers: this.headers })\n // return { data, error: null }\n // } catch (error) {\n // if (isStorageError(error)) {\n // return { data: null, error }\n // }\n\n // throw error\n // }\n // }\n\n /**\n * Update file metadata\n * @param id the file id to update metadata\n * @param meta the new file metadata\n */\n // async updateMetadata(\n // id: string,\n // meta: Metadata\n // ): Promise<\n // | {\n // data: Metadata\n // error: null\n // }\n // | {\n // data: null\n // error: StorageError\n // }\n // > {\n // try {\n // const data = await post(\n // this.fetch,\n // `${this.url}/metadata/${id}`,\n // { ...meta },\n // { headers: this.headers }\n // )\n // return { data, error: null }\n // } catch (error) {\n // if (isStorageError(error)) {\n // return { data: null, error }\n // }\n\n // throw error\n // }\n // }\n\n /**\n * Lists all the files and folders within a path of the bucket.\n *\n * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,\n * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.\n * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned\n * by this method.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The folder path.\n * @param options Search options including limit (defaults to 100), offset, sortBy, and search\n * @param parameters Optional fetch parameters including signal for cancellation\n * @returns Promise with response containing array of files/folders or error\n *\n * @example List files in a bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .list('folder', {\n * limit: 100,\n * offset: 0,\n * sortBy: { column: 'name', order: 'asc' },\n * })\n *\n * // Handle files vs folders\n * data?.forEach(item => {\n * if (item.id !== null) {\n * // It's a file\n * console.log('File:', item.name, 'Size:', item.metadata?.size)\n * } else {\n * // It's a folder\n * console.log('Folder:', item.name)\n * }\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"name\": \"avatar1.png\",\n * \"id\": \"e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2\",\n * \"updated_at\": \"2024-05-22T23:06:05.580Z\",\n * \"created_at\": \"2024-05-22T23:04:34.443Z\",\n * \"last_accessed_at\": \"2024-05-22T23:04:34.443Z\",\n * \"metadata\": {\n * \"eTag\": \"\\\"c5e8c553235d9af30ef4f6e280790b92\\\"\",\n * \"size\": 32175,\n * \"mimetype\": \"image/png\",\n * \"cacheControl\": \"max-age=3600\",\n * \"lastModified\": \"2024-05-22T23:06:05.574Z\",\n * \"contentLength\": 32175,\n * \"httpStatusCode\": 200\n * }\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @example Search files in a bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .list('folder', {\n * limit: 100,\n * offset: 0,\n * sortBy: { column: 'name', order: 'asc' },\n * search: 'jon'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async list(\n path?: string,\n options?: SearchOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: FileObject[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n // Deep-merge `sortBy` so overriding only one of its keys (e.g. `column`) keeps the\n // default for the other (e.g. `order`), matching how the top-level defaults behave.\n const sortBy = options?.sortBy\n ? { ...DEFAULT_SEARCH_OPTIONS.sortBy, ...options.sortBy }\n : DEFAULT_SEARCH_OPTIONS.sortBy\n const body = { ...DEFAULT_SEARCH_OPTIONS, ...options, sortBy, prefix: path || '' }\n return await post(\n this.fetch,\n `${this.url}/object/list/${this.bucketId}`,\n body,\n { headers: this.headers },\n parameters\n )\n })\n }\n\n /**\n * Lists all the files and folders within a bucket using the V2 API with pagination support.\n *\n * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —\n * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available\n * on entries in the `objects` array.\n *\n * @experimental this method signature might change in the future\n *\n * @category Storage\n * @subcategory File Buckets\n * @param options Search options including prefix, cursor for pagination, limit, with_delimiter\n * @param parameters Optional fetch parameters including signal for cancellation\n * @returns Promise with response containing folders/objects arrays with pagination info or error\n *\n * @example List files with pagination\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .listV2({\n * prefix: 'folder/',\n * limit: 100,\n * })\n *\n * // Handle pagination\n * if (data?.hasNext) {\n * const nextPage = await supabase\n * .storage\n * .from('avatars')\n * .listV2({\n * prefix: 'folder/',\n * cursor: data.nextCursor,\n * })\n * }\n *\n * // Handle files vs folders\n * data?.objects.forEach(file => {\n * if (file.id !== null) {\n * console.log('File:', file.name, 'Size:', file.metadata?.size)\n * }\n * })\n * data?.folders.forEach(folder => {\n * console.log('Folder:', folder.name)\n * })\n * ```\n */\n async listV2(\n options?: SearchV2Options,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: SearchV2Result\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const body = { ...options }\n return await post(\n this.fetch,\n `${this.url}/object/list-v2/${this.bucketId}`,\n body,\n { headers: this.headers },\n parameters\n )\n })\n }\n\n protected encodeMetadata(metadata: Record) {\n return JSON.stringify(metadata)\n }\n\n toBase64(data: string) {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(data).toString('base64')\n }\n return btoa(data)\n }\n\n private _getFinalPath(path: string) {\n return `${this.bucketId}/${path.replace(/^\\/+/, '')}`\n }\n\n private _removeEmptyFolders(path: string) {\n return path.replace(/^\\/|\\/$/g, '').replace(/\\/+/g, '/')\n }\n\n /** Modifies the `query`, appending values the from `transform` */\n private applyTransformOptsToQuery(\n query: URLSearchParams,\n transform: TransformOptions\n ): URLSearchParams {\n if (transform.width) query.set('width', transform.width.toString())\n if (transform.height) query.set('height', transform.height.toString())\n if (transform.resize) query.set('resize', transform.resize)\n if (transform.format) query.set('format', transform.format)\n if (transform.quality) query.set('quality', transform.quality.toString())\n\n return query\n }\n}\n","// Generated automatically during releases by scripts/update-version-files.ts\n// This file provides runtime access to the package version for:\n// - HTTP request headers (e.g., X-Client-Info header for API requests)\n// - Debugging and support (identifying which version is running)\n// - Telemetry and logging (version reporting in errors/analytics)\n// - Ensuring build artifacts match the published package version\nexport const version = '2.112.3'\n","import { version } from './version'\nexport const DEFAULT_HEADERS = {\n 'X-Client-Info': `storage-js/${version}`,\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, get, post, put, remove } from '../lib/common/fetch'\nimport { encodeStoragePath } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n Bucket,\n BucketType,\n FetchParameters,\n ListBucketOptions,\n PurgeCacheOptions,\n} from '../lib/types'\nimport { StorageClientOptions } from '../StorageClient'\n\nexport default class StorageBucketApi extends BaseApiClient {\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n opts?: StorageClientOptions\n ) {\n const baseUrl = new URL(url)\n\n // if legacy uri is used, replace with new storage host (disables request buffering to allow > 50GB uploads)\n // \"project-ref.supabase.co\" becomes \"project-ref.storage.supabase.co\"\n if (opts?.useNewHostname) {\n const isSupabaseHost = /supabase\\.(co|in|red)$/.test(baseUrl.hostname)\n if (isSupabaseHost && !baseUrl.hostname.includes('storage.supabase.')) {\n baseUrl.hostname = baseUrl.hostname.replace('supabase.', 'storage.supabase.')\n }\n }\n\n const finalUrl = baseUrl.href.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, ...headers }\n\n super(finalUrl, finalHeaders, fetch, 'storage')\n }\n\n /**\n * Retrieves the details of all Storage buckets within an existing project.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param options Query parameters for listing buckets\n * @param options.limit Maximum number of buckets to return\n * @param options.offset Number of buckets to skip\n * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')\n * @param options.sortOrder Sort order ('asc' or 'desc')\n * @param options.search Search term to filter bucket names\n * @returns Promise with response containing array of buckets or error\n *\n * @example List buckets\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .listBuckets()\n * ```\n *\n * @example List buckets with options\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .listBuckets({\n * limit: 10,\n * offset: 0,\n * sortColumn: 'created_at',\n * sortOrder: 'desc',\n * search: 'prod'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async listBuckets(options?: ListBucketOptions): Promise<\n | {\n data: Bucket[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const queryString = this.listBucketOptionsToQueryString(options)\n return await get(this.fetch, `${this.url}/bucket${queryString}`, {\n headers: this.headers,\n })\n })\n }\n\n /**\n * Retrieves the details of an existing Storage bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to retrieve.\n * @returns Promise with response containing bucket details or error\n *\n * @example Get bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .getBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"id\": \"avatars\",\n * \"name\": \"avatars\",\n * \"owner\": \"\",\n * \"public\": false,\n * \"file_size_limit\": 1024,\n * \"allowed_mime_types\": [\n * \"image/png\"\n * ],\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async getBucket(id: string): Promise<\n | {\n data: Bucket\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await get(this.fetch, `${this.url}/bucket/${id}`, { headers: this.headers })\n })\n }\n\n /**\n * Creates a new Storage bucket\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id A unique identifier for the bucket you are creating.\n * @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.\n * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.\n * The global file size limit takes precedence over this value.\n * The default value is null, which doesn't set a per bucket file size limit.\n * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.\n * The default value is null, which allows files with all mime types to be uploaded.\n * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.\n * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.\n * - default bucket type is `STANDARD`\n * @returns Promise with response containing newly created bucket name or error\n *\n * @example Create bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .createBucket('avatars', {\n * public: false,\n * allowedMimeTypes: ['image/png'],\n * fileSizeLimit: 1024\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"name\": \"avatars\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `insert`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createBucket(\n id: string,\n options: {\n public: boolean\n fileSizeLimit?: number | string | null\n allowedMimeTypes?: string[] | null\n type?: BucketType\n } = {\n public: false,\n }\n ): Promise<\n | {\n data: Pick\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(\n this.fetch,\n `${this.url}/bucket`,\n {\n id,\n name: id,\n type: options.type,\n public: options.public,\n file_size_limit: options.fileSizeLimit,\n allowed_mime_types: options.allowedMimeTypes,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Updates a Storage bucket\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id A unique identifier for the bucket you are updating.\n * @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.\n * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.\n * The global file size limit takes precedence over this value.\n * The default value is null, which doesn't set a per bucket file size limit.\n * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.\n * The default value is null, which allows files with all mime types to be uploaded.\n * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.\n * @returns Promise with response containing success message or error\n *\n * @example Update bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .updateBucket('avatars', {\n * public: false,\n * allowedMimeTypes: ['image/png'],\n * fileSizeLimit: 1024\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully updated\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select` and `update`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async updateBucket(\n id: string,\n options: {\n public: boolean\n fileSizeLimit?: number | string | null\n allowedMimeTypes?: string[] | null\n }\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await put(\n this.fetch,\n `${this.url}/bucket/${id}`,\n {\n id,\n name: id,\n public: options.public,\n file_size_limit: options.fileSizeLimit,\n allowed_mime_types: options.allowedMimeTypes,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Removes all objects inside a single bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to empty.\n * @returns Promise with success message or error\n *\n * @example Empty bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .emptyBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully emptied\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: `select` and `delete`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async emptyBucket(id: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(this.fetch, `${this.url}/bucket/${id}/empty`, {}, { headers: this.headers })\n })\n }\n\n /**\n * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.\n * You must first `empty()` the bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to delete.\n * @returns Promise with success message or error\n *\n * @example Delete bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .deleteBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully deleted\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select` and `delete`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async deleteBucket(id: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(this.fetch, `${this.url}/bucket/${id}`, {}, { headers: this.headers })\n })\n }\n\n /**\n * Purges the CDN cache for an entire bucket.\n *\n * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server\n * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`.\n *\n * **Requires the `service_role` key.** The underlying endpoint enforces\n * `service_role` JWT — calls made with the anon key or a user JWT will be\n * rejected by the server.\n *\n * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must\n * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant\n * feature enabled, otherwise the server returns an error.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to purge from cache.\n * @param options Optional purge cache options.\n * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact.\n * @param parameters Optional fetch parameters such as an `AbortController` signal.\n * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.\n *\n * @example Purge cache for an entire bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .purgeBucketCache('avatars')\n * ```\n *\n * @example Purge only transformations for an entire bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .purgeBucketCache('avatars', { transformations: true })\n * ```\n */\n async purgeBucketCache(\n id: string,\n options?: PurgeCacheOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const query = new URLSearchParams()\n if (options?.transformations) {\n query.set('transformations', 'true')\n }\n const queryString = query.toString()\n\n return await remove(\n this.fetch,\n `${this.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ''}`,\n {},\n { headers: this.headers },\n parameters\n )\n })\n }\n\n private listBucketOptionsToQueryString(options?: ListBucketOptions): string {\n const params: Record = {}\n if (options) {\n if ('limit' in options) {\n params.limit = String(options.limit)\n }\n if ('offset' in options) {\n params.offset = String(options.offset)\n }\n if (options.search) {\n params.search = options.search\n }\n if (options.sortColumn) {\n params.sortColumn = options.sortColumn\n }\n if (options.sortOrder) {\n params.sortOrder = options.sortOrder\n }\n }\n return Object.keys(params).length > 0 ? '?' + new URLSearchParams(params).toString() : ''\n }\n}\n","import { IcebergRestCatalog, IcebergError } from 'iceberg-js'\nimport { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, get, post, remove } from '../lib/common/fetch'\nimport { isValidBucketName } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport { AnalyticBucket } from '../lib/types'\n\ntype WrapAsyncMethod = T extends (...args: infer A) => Promise\n ? (...args: A) => Promise<{ data: R; error: null } | { data: null; error: IcebergError }>\n : T\n\nexport type WrappedIcebergRestCatalog = {\n [K in keyof IcebergRestCatalog]: WrapAsyncMethod\n}\n\n/**\n * Client class for managing Analytics Buckets using Iceberg tables\n * Provides methods for creating, listing, and deleting analytics buckets\n */\nexport default class StorageAnalyticsClient extends BaseApiClient {\n /**\n * @alpha\n *\n * Creates a new StorageAnalyticsClient instance\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param url - The base URL for the storage API\n * @param headers - HTTP headers to include in requests\n * @param fetch - Optional custom fetch implementation\n *\n * @example Using supabase-js (recommended)\n * ```typescript\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const { data, error } = await supabase.storage.analytics.listBuckets()\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```typescript\n * import { StorageAnalyticsClient } from '@supabase/storage-js'\n *\n * const client = new StorageAnalyticsClient(url, headers)\n * ```\n */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, ...headers }\n super(finalUrl, finalHeaders, fetch, 'storage')\n }\n\n /**\n * @alpha\n *\n * Creates a new analytics bucket using Iceberg tables\n * Analytics buckets are optimized for analytical queries and data processing\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param name A unique name for the bucket you are creating\n * @returns Promise with response containing newly created analytics bucket or error\n *\n * @example Create analytics bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .createBucket('analytics-data')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"name\": \"analytics-data\",\n * \"type\": \"ANALYTICS\",\n * \"format\": \"iceberg\",\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Creates a new analytics bucket using Iceberg tables\n * - Analytics buckets are optimized for analytical queries and data processing\n */\n async createBucket(name: string): Promise<\n | {\n data: AnalyticBucket\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(this.fetch, `${this.url}/bucket`, { name }, { headers: this.headers })\n })\n }\n\n /**\n * @alpha\n *\n * Retrieves the details of all Analytics Storage buckets within an existing project\n * Only returns buckets of type 'ANALYTICS'\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param options Query parameters for listing buckets\n * @param options.limit Maximum number of buckets to return\n * @param options.offset Number of buckets to skip\n * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')\n * @param options.sortOrder Sort order ('asc' or 'desc')\n * @param options.search Search term to filter bucket names\n * @returns Promise with response containing array of analytics buckets or error\n *\n * @example List analytics buckets\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .listBuckets({\n * limit: 10,\n * offset: 0,\n * sortColumn: 'created_at',\n * sortOrder: 'desc'\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"name\": \"analytics-data\",\n * \"type\": \"ANALYTICS\",\n * \"format\": \"iceberg\",\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Retrieves the details of all Analytics Storage buckets within an existing project\n * - Only returns buckets of type 'ANALYTICS'\n */\n async listBuckets(options?: {\n limit?: number\n offset?: number\n sortColumn?: 'name' | 'created_at' | 'updated_at'\n sortOrder?: 'asc' | 'desc'\n search?: string\n }): Promise<\n | {\n data: AnalyticBucket[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n // Build query string from options\n const queryParams = new URLSearchParams()\n if (options?.limit !== undefined) queryParams.set('limit', options.limit.toString())\n if (options?.offset !== undefined) queryParams.set('offset', options.offset.toString())\n if (options?.sortColumn) queryParams.set('sortColumn', options.sortColumn)\n if (options?.sortOrder) queryParams.set('sortOrder', options.sortOrder)\n if (options?.search) queryParams.set('search', options.search)\n\n const queryString = queryParams.toString()\n const url = queryString ? `${this.url}/bucket?${queryString}` : `${this.url}/bucket`\n\n return await get(this.fetch, url, { headers: this.headers })\n })\n }\n\n /**\n * @alpha\n *\n * Deletes an existing analytics bucket\n * A bucket can't be deleted with existing objects inside it\n * You must first empty the bucket before deletion\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param bucketName The unique identifier of the bucket you would like to delete\n * @returns Promise with response containing success message or error\n *\n * @example Delete analytics bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .deleteBucket('analytics-data')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully deleted\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Deletes an analytics bucket\n */\n async deleteBucket(bucketName: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(\n this.fetch,\n `${this.url}/bucket/${bucketName}`,\n {},\n { headers: this.headers }\n )\n })\n }\n\n /**\n * @alpha\n *\n * Get an Iceberg REST Catalog client configured for a specific analytics bucket\n * Use this to perform advanced table and namespace operations within the bucket\n * The returned client provides full access to the Apache Iceberg REST Catalog API\n * with the Supabase `{ data, error }` pattern for consistent error handling on all operations.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param bucketName - The name of the analytics bucket (warehouse) to connect to\n * @returns The wrapped Iceberg catalog client\n * @throws {StorageError} If the bucket name is invalid\n *\n * @example Get catalog and create table\n * ```js\n * // First, create an analytics bucket\n * const { data: bucket, error: bucketError } = await supabase\n * .storage\n * .analytics\n * .createBucket('analytics-data')\n *\n * // Get the Iceberg catalog for that bucket\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // Create a namespace\n * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })\n *\n * // Create a table with schema\n * const { data: tableMetadata, error: tableError } = await catalog.createTable(\n * { namespace: ['default'] },\n * {\n * name: 'events',\n * schema: {\n * type: 'struct',\n * fields: [\n * { id: 1, name: 'id', type: 'long', required: true },\n * { id: 2, name: 'timestamp', type: 'timestamp', required: true },\n * { id: 3, name: 'user_id', type: 'string', required: false }\n * ],\n * 'schema-id': 0,\n * 'identifier-field-ids': [1]\n * },\n * 'partition-spec': {\n * 'spec-id': 0,\n * fields: []\n * },\n * 'write-order': {\n * 'order-id': 0,\n * fields: []\n * },\n * properties: {\n * 'write.format.default': 'parquet'\n * }\n * }\n * )\n * ```\n *\n * @example List tables in namespace\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // List all tables in the default namespace\n * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })\n * if (listError) {\n * if (listError.isNotFound()) {\n * console.log('Namespace not found')\n * }\n * return\n * }\n * console.log(tables) // [{ namespace: ['default'], name: 'events' }]\n * ```\n *\n * @example Working with namespaces\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // List all namespaces\n * const { data: namespaces } = await catalog.listNamespaces()\n *\n * // Create namespace with properties\n * await catalog.createNamespace(\n * { namespace: ['production'] },\n * { properties: { owner: 'data-team', env: 'prod' } }\n * )\n * ```\n *\n * @example Cleanup operations\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // Drop table with purge option (removes all data)\n * const { error: dropError } = await catalog.dropTable(\n * { namespace: ['default'], name: 'events' },\n * { purge: true }\n * )\n *\n * if (dropError?.isNotFound()) {\n * console.log('Table does not exist')\n * }\n *\n * // Drop namespace (must be empty)\n * await catalog.dropNamespace({ namespace: ['default'] })\n * ```\n *\n * @remarks\n * This method provides a bridge between Supabase's bucket management and the standard\n * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.\n * All authentication and configuration is handled automatically using your Supabase credentials.\n *\n * **Error Handling**: Invalid bucket names throw immediately. All catalog\n * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.\n * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.\n * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.\n *\n * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently\n * deletes all table data. Without it, the table is marked as deleted but data remains.\n *\n * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.\n * For complete API documentation and advanced usage, refer to the\n * [iceberg-js documentation](https://supabase.github.io/iceberg-js/).\n */\n from(bucketName: string): WrappedIcebergRestCatalog {\n // Validate bucket name using same rules as Supabase Storage API backend\n if (!isValidBucketName(bucketName)) {\n throw new StorageError(\n 'Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines ' +\n 'and should avoid the use of any other characters.'\n )\n }\n\n // Construct the Iceberg REST Catalog URL\n // The base URL is /storage/v1/iceberg\n // Note: IcebergRestCatalog from iceberg-js automatically adds /v1/ prefix to API paths\n // so we should NOT append /v1 here (it would cause double /v1/v1/ in the URL)\n const catalog = new IcebergRestCatalog({\n baseUrl: this.url,\n catalogName: bucketName, // Maps to the warehouse parameter in Supabase's implementation\n auth: {\n type: 'custom',\n getHeaders: async () => this.headers,\n },\n fetch: this.fetch,\n })\n\n const shouldThrowOnError = this.shouldThrowOnError\n\n const wrappedCatalog = new Proxy(catalog, {\n get(target, prop: keyof IcebergRestCatalog) {\n const value = target[prop]\n if (typeof value !== 'function') {\n return value\n }\n\n return async (...args: unknown[]) => {\n try {\n const data = await (value as Function).apply(target, args)\n return { data, error: null }\n } catch (error) {\n if (shouldThrowOnError) {\n throw error\n }\n return { data: null, error: error as IcebergError }\n }\n }\n },\n }) as unknown as WrappedIcebergRestCatalog\n\n return wrappedCatalog\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n VectorIndex,\n ListIndexesOptions,\n ListIndexesResponse,\n VectorDataType,\n DistanceMetric,\n MetadataConfiguration,\n} from '../lib/types'\n\n/**\n * @alpha\n *\n * Options for creating a vector index\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport interface CreateIndexOptions {\n vectorBucketName: string\n indexName: string\n dataType: VectorDataType\n dimension: number\n distanceMetric: DistanceMetric\n metadataConfiguration?: MetadataConfiguration\n}\n\n/**\n * @hidden\n * Base implementation for vector index operations.\n * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.\n */\nexport default class VectorIndexApi extends BaseApiClient {\n /** Creates a new VectorIndexApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Creates a new vector index within a bucket */\n async createIndex(options: CreateIndexOptions): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/CreateIndex`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n\n /** Retrieves metadata for a specific vector index */\n async getIndex(\n vectorBucketName: string,\n indexName: string\n ): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(\n this.fetch,\n `${this.url}/GetIndex`,\n { vectorBucketName, indexName },\n { headers: this.headers }\n )\n })\n }\n\n /** Lists vector indexes within a bucket with optional filtering and pagination */\n async listIndexes(options: ListIndexesOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListIndexes`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes a vector index and all its data */\n async deleteIndex(vectorBucketName: string, indexName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/DeleteIndex`,\n { vectorBucketName, indexName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n PutVectorsOptions,\n GetVectorsOptions,\n GetVectorsResponse,\n DeleteVectorsOptions,\n ListVectorsOptions,\n ListVectorsResponse,\n QueryVectorsOptions,\n QueryVectorsResponse,\n} from '../lib/types'\n\n/**\n * @hidden\n * Base implementation for vector data operations.\n * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.\n */\nexport default class VectorDataApi extends BaseApiClient {\n /** Creates a new VectorDataApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Inserts or updates vectors in batch (1-500 per request) */\n async putVectors(options: PutVectorsOptions): Promise> {\n // Validate batch size\n if (options.vectors.length < 1 || options.vectors.length > 500) {\n throw new Error('Vector batch size must be between 1 and 500 items')\n }\n\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/PutVectors`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n\n /** Retrieves vectors by their keys in batch */\n async getVectors(options: GetVectorsOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/GetVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Lists vectors in an index with pagination */\n async listVectors(options: ListVectorsOptions): Promise> {\n // Validate segment configuration\n if (options.segmentCount !== undefined) {\n if (options.segmentCount < 1 || options.segmentCount > 16) {\n throw new Error('segmentCount must be between 1 and 16')\n }\n if (options.segmentIndex !== undefined) {\n if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) {\n throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`)\n }\n }\n }\n\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Queries for similar vectors using approximate nearest neighbor search */\n async queryVectors(options: QueryVectorsOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/QueryVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes vectors by their keys in batch (1-500 per request) */\n async deleteVectors(options: DeleteVectorsOptions): Promise> {\n // Validate batch size\n if (options.keys.length < 1 || options.keys.length > 500) {\n throw new Error('Keys batch size must be between 1 and 500 items')\n }\n\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/DeleteVectors`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n VectorBucket,\n ListVectorBucketsOptions,\n ListVectorBucketsResponse,\n} from '../lib/types'\n\n/**\n * @hidden\n * Base implementation for vector bucket operations.\n * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.\n */\nexport default class VectorBucketApi extends BaseApiClient {\n /** Creates a new VectorBucketApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Creates a new vector bucket */\n async createBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/CreateVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n\n /** Retrieves metadata for a specific vector bucket */\n async getBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(\n this.fetch,\n `${this.url}/GetVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n })\n }\n\n /** Lists vector buckets with optional filtering and pagination */\n async listBuckets(\n options: ListVectorBucketsOptions = {}\n ): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListVectorBuckets`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes a vector bucket (must be empty first) */\n async deleteBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/DeleteVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n}\n","import VectorIndexApi, { CreateIndexOptions } from './VectorIndexApi'\nimport VectorDataApi from './VectorDataApi'\nimport { Fetch } from '../lib/common/fetch'\nimport VectorBucketApi from './VectorBucketApi'\nimport {\n ApiResponse,\n DeleteVectorsOptions,\n GetVectorsOptions,\n ListIndexesOptions,\n ListVectorsOptions,\n ListVectorBucketsOptions,\n ListVectorBucketsResponse,\n PutVectorsOptions,\n QueryVectorsOptions,\n VectorBucket,\n} from '../lib/types'\n\n/**\n *\n * @alpha\n *\n * Configuration options for the Storage Vectors client\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport interface StorageVectorsClientOptions {\n /**\n * Custom headers to include in all requests\n */\n headers?: { [key: string]: string }\n /**\n * Custom fetch implementation (optional)\n * Useful for testing or custom request handling\n */\n fetch?: Fetch\n}\n\n/**\n *\n * @alpha\n *\n * Main client for interacting with S3 Vectors API\n * Provides access to bucket, index, and vector data operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * **Usage Patterns:**\n *\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .createBucket('embeddings-prod')\n *\n * // Access index operations via buckets\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.createIndex({\n * indexName: 'documents',\n * dataType: 'float32',\n * dimension: 1536,\n * distanceMetric: 'cosine'\n * })\n *\n * // Access vector operations via index\n * const index = bucket.index('documents')\n * await index.putVectors({\n * vectors: [\n * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }\n * ]\n * })\n *\n * // Query similar vectors\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [...] },\n * topK: 5,\n * returnDistance: true\n * })\n * ```\n */\nexport class StorageVectorsClient extends VectorBucketApi {\n /**\n * @alpha\n *\n * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param url - Base URL of the Storage Vectors REST API.\n * @param options.headers - Optional headers (for example `Authorization`) applied to every request.\n * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.\n *\n * @example Using supabase-js (recommended)\n * ```typescript\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```typescript\n * import { StorageVectorsClient } from '@supabase/storage-js'\n *\n * const client = new StorageVectorsClient(url, options)\n * ```\n */\n constructor(url: string, options: StorageVectorsClientOptions = {}) {\n super(url, options.headers || {}, options.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Access operations for a specific vector bucket\n * Returns a scoped client for index and vector operations within the bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket\n * @returns Bucket-scoped client with index and vector operations\n *\n * @example Accessing a vector bucket\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n */\n from(vectorBucketName: string): VectorBucketScope {\n return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Creates a new vector bucket\n * Vector buckets are containers for vector indexes and their data\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Unique name for the vector bucket\n * @returns Promise with empty response on success or error\n *\n * @example Creating a vector bucket\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .createBucket('embeddings-prod')\n * ```\n */\n async createBucket(vectorBucketName: string): Promise> {\n return super.createBucket(vectorBucketName)\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves metadata for a specific vector bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket\n * @returns Promise with bucket metadata or error\n *\n * @example Get bucket metadata\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .getBucket('embeddings-prod')\n *\n * console.log('Bucket created:', data?.vectorBucket.creationTime)\n * ```\n */\n async getBucket(vectorBucketName: string): Promise> {\n return super.getBucket(vectorBucketName)\n }\n\n /**\n *\n * @alpha\n *\n * Lists all vector buckets with optional filtering and pagination\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Optional filters (prefix, maxResults, nextToken)\n * @returns Promise with list of buckets or error\n *\n * @example List vector buckets\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .listBuckets({ prefix: 'embeddings-' })\n *\n * data?.vectorBuckets.forEach(bucket => {\n * console.log(bucket.vectorBucketName)\n * })\n * ```\n */\n async listBuckets(\n options: ListVectorBucketsOptions = {}\n ): Promise> {\n return super.listBuckets(options)\n }\n\n /**\n *\n * @alpha\n *\n * Deletes a vector bucket (bucket must be empty)\n * All indexes must be deleted before deleting the bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket to delete\n * @returns Promise with empty response on success or error\n *\n * @example Delete a vector bucket\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .deleteBucket('embeddings-old')\n * ```\n */\n async deleteBucket(vectorBucketName: string): Promise> {\n return super.deleteBucket(vectorBucketName)\n }\n}\n\n/**\n *\n * @alpha\n *\n * Scoped client for operations within a specific vector bucket\n * Provides index management and access to vector operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport class VectorBucketScope extends VectorIndexApi {\n private vectorBucketName: string\n\n /**\n * @alpha\n *\n * Creates a helper that automatically scopes all index operations to the provided bucket.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @example Creating a vector bucket scope\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string },\n vectorBucketName: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch)\n this.vectorBucketName = vectorBucketName\n }\n\n /**\n *\n * @alpha\n *\n * Creates a new vector index in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Index configuration (vectorBucketName is automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Creating a vector index\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.createIndex({\n * indexName: 'documents-openai',\n * dataType: 'float32',\n * dimension: 1536,\n * distanceMetric: 'cosine',\n * metadataConfiguration: {\n * nonFilterableMetadataKeys: ['raw_text']\n * }\n * })\n * ```\n */\n override async createIndex(options: Omit) {\n return super.createIndex({\n ...options,\n vectorBucketName: this.vectorBucketName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Lists indexes in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Listing options (vectorBucketName is automatically set)\n * @returns Promise with response containing indexes array and pagination token or error\n *\n * @example List indexes\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * const { data } = await bucket.listIndexes({ prefix: 'documents-' })\n * ```\n */\n override async listIndexes(options: Omit = {}) {\n return super.listIndexes({\n ...options,\n vectorBucketName: this.vectorBucketName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves metadata for a specific index in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index to retrieve\n * @returns Promise with index metadata or error\n *\n * @example Get index metadata\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * const { data } = await bucket.getIndex('documents-openai')\n * console.log('Dimension:', data?.index.dimension)\n * ```\n */\n override async getIndex(indexName: string) {\n return super.getIndex(this.vectorBucketName, indexName)\n }\n\n /**\n *\n * @alpha\n *\n * Deletes an index from this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index to delete\n * @returns Promise with empty response on success or error\n *\n * @example Delete an index\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.deleteIndex('old-index')\n * ```\n */\n override async deleteIndex(indexName: string) {\n return super.deleteIndex(this.vectorBucketName, indexName)\n }\n\n /**\n *\n * @alpha\n *\n * Access operations for a specific index within this bucket\n * Returns a scoped client for vector data operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index\n * @returns Index-scoped client with vector data operations\n *\n * @example Accessing an index\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n *\n * // Insert vectors\n * await index.putVectors({\n * vectors: [\n * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }\n * ]\n * })\n *\n * // Query similar vectors\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [...] },\n * topK: 5\n * })\n * ```\n */\n index(indexName: string): VectorIndexScope {\n return new VectorIndexScope(\n this.url,\n this.headers,\n this.vectorBucketName,\n indexName,\n this.fetch\n )\n }\n}\n\n/**\n *\n * @alpha\n *\n * Scoped client for operations within a specific vector index\n * Provides vector data operations (put, get, list, query, delete)\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport class VectorIndexScope extends VectorDataApi {\n private vectorBucketName: string\n private indexName: string\n\n /**\n *\n * @alpha\n *\n * Creates a helper that automatically scopes all vector operations to the provided bucket/index names.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @example Creating a vector index scope\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string },\n vectorBucketName: string,\n indexName: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch)\n this.vectorBucketName = vectorBucketName\n this.indexName = indexName\n }\n\n /**\n *\n * @alpha\n *\n * Inserts or updates vectors in this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Vector insertion options (bucket and index names automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Insert vectors into an index\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * await index.putVectors({\n * vectors: [\n * {\n * key: 'doc-1',\n * data: { float32: [0.1, 0.2, ...] },\n * metadata: { title: 'Introduction', page: 1 }\n * }\n * ]\n * })\n * ```\n */\n override async putVectors(options: Omit) {\n return super.putVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves vectors by keys from this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Vector retrieval options (bucket and index names automatically set)\n * @returns Promise with response containing vectors array or error\n *\n * @example Get vectors by keys\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.getVectors({\n * keys: ['doc-1', 'doc-2'],\n * returnMetadata: true\n * })\n * ```\n */\n override async getVectors(options: Omit) {\n return super.getVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Lists vectors in this index with pagination\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Listing options (bucket and index names automatically set)\n * @returns Promise with response containing vectors array and pagination token or error\n *\n * @example List vectors with pagination\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.listVectors({\n * maxResults: 500,\n * returnMetadata: true\n * })\n * ```\n */\n override async listVectors(\n options: Omit = {}\n ) {\n return super.listVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Queries for similar vectors in this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Query options (bucket and index names automatically set)\n * @returns Promise with response containing matches array of similar vectors ordered by distance or error\n *\n * @example Query similar vectors\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [0.1, 0.2, ...] },\n * topK: 5,\n * filter: { category: 'technical' },\n * returnDistance: true,\n * returnMetadata: true\n * })\n * ```\n */\n override async queryVectors(\n options: Omit\n ) {\n return super.queryVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Deletes vectors by keys from this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Deletion options (bucket and index names automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Delete vectors by keys\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * await index.deleteVectors({\n * keys: ['doc-1', 'doc-2', 'doc-3']\n * })\n * ```\n */\n override async deleteVectors(\n options: Omit\n ) {\n return super.deleteVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n}\n","import StorageFileApi from './packages/StorageFileApi'\nimport StorageBucketApi from './packages/StorageBucketApi'\nimport StorageAnalyticsClient from './packages/StorageAnalyticsClient'\nimport { Fetch } from './lib/common/fetch'\nimport { StorageVectorsClient } from './packages/StorageVectorsClient'\n\nexport interface StorageClientOptions {\n useNewHostname?: boolean\n}\n\nexport class StorageClient extends StorageBucketApi {\n /**\n * Creates a client for Storage buckets, files, analytics, and vectors.\n *\n * @category Storage\n * @subcategory File Buckets\n *\n * @example Using supabase-js (recommended)\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const avatars = supabase.storage.from('avatars')\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```ts\n * import { StorageClient } from '@supabase/storage-js'\n *\n * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {\n * apikey: 'your-publishable-key',\n * })\n * const avatars = storage.from('avatars')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n opts?: StorageClientOptions\n ) {\n super(url, headers, fetch, opts)\n }\n\n /**\n * Perform file operation in a bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n *\n * @param id The bucket id to operate on.\n *\n * @example Accessing a bucket\n * ```typescript\n * const avatars = supabase.storage.from('avatars')\n * ```\n */\n from(id: string): StorageFileApi {\n return new StorageFileApi(this.url, this.headers, id, this.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Access vector storage operations.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n *\n * @returns A StorageVectorsClient instance configured with the current storage settings.\n */\n get vectors(): StorageVectorsClient {\n return new StorageVectorsClient(this.url + '/vector', {\n headers: this.headers,\n fetch: this.fetch,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Access analytics storage operations using Iceberg tables.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n *\n * @returns A StorageAnalyticsClient instance configured with the current storage settings.\n */\n get analytics(): StorageAnalyticsClient {\n return new StorageAnalyticsClient(this.url + '/iceberg', this.headers, this.fetch)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAa,eAAb,cAAkC,MAAM;CAMtC,YACE,SACA,YAA4B,WAC5B,QACA,YACA;AACA,QAAM,QAAQ;OAXN,mBAAmB;AAY3B,OAAK,YAAY;AACjB,OAAK,OAAO,c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AmC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlD,YACE,KACA,UAAqC,EAAE,EACvC,SACA,MACA;AACA,QAAM,KAAK,SAASC,SAAO,KAAK;;;;;;;;;;;;;;;CAgBlC,KAAK,IAA4B;AAC/B,SAAO,IAAI,eAAe,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,MAAM;;;;;;;;;;;;;;;CAgBnE,IAAI,UAAgC;AAClC,SAAO,IAAI,qBAAqB,KAAK,MAAM,WAAW;GACpD,SAAS,KAAK;GACd,OAAO,KAAK;GACb,CAAC;;;;;;;;;;;;;;;CAgBJ,IAAI,YAAoC;AACtC,SAAO,IAAI,uBAAuB,KAAK,MAAM,YAAY,KAAK,SAAS,KAAK,MAAM"} \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.d.cts b/node_modules/@supabase/storage-js/dist/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..2d360b134f8ae1ccadd7e5251ad3fb59c14e36ba --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.d.cts @@ -0,0 +1,3086 @@ +import { IcebergError, IcebergRestCatalog } from "iceberg-js"; + +//#region src/lib/common/errors.d.ts + +/** + * Namespace type for error classes + * Determines the error class names and type guards + */ +type ErrorNamespace = 'storage' | 'vectors'; +/** + * Base error class for all Storage errors + * Supports both 'storage' and 'vectors' namespaces + */ +declare class StorageError extends Error { + protected __isStorageError: boolean; + protected namespace: ErrorNamespace; + status: number | undefined; + statusCode: string | undefined; + constructor(message: string, namespace?: ErrorNamespace, status?: number, statusCode?: string); + toJSON(): { + name: string; + message: string; + status: number | undefined; + statusCode: string | undefined; + }; +} +/** + * Type guard to check if an error is a StorageError + * @param error - The error to check + * @returns True if the error is a StorageError + */ +declare function isStorageError(error: unknown): error is StorageError; +/** + * API error returned from Storage service + * Includes HTTP status code and service-specific error code + */ +declare class StorageApiError extends StorageError { + status: number; + statusCode: string; + /** + * Service-specific error code from the Storage API response body, such as + * `NoSuchKey`, `AccessDenied` or `ResourceAlreadyExists`. Use this to branch + * on the specific error rather than parsing the message. + * @see https://supabase.com/docs/guides/storage/debugging/error-codes + */ + code: string | undefined; + constructor(message: string, status: number, statusCode: string, namespace?: ErrorNamespace, code?: string); + toJSON(): { + name: string; + message: string; + status: number | undefined; + statusCode: string | undefined; + code: string | undefined; + }; +} +/** + * Unknown error that doesn't match expected error patterns + * Wraps the original error for debugging + */ +declare class StorageUnknownError extends StorageError { + originalError: unknown; + constructor(message: string, originalError: unknown, namespace?: ErrorNamespace); +} +/** + * @deprecated Use StorageError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsError extends StorageError { + constructor(message: string); +} +/** + * Type guard to check if an error is a StorageVectorsError + * @param error - The error to check + * @returns True if the error is a StorageVectorsError + */ +declare function isStorageVectorsError(error: unknown): error is StorageVectorsError; +/** + * @deprecated Use StorageApiError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsApiError extends StorageApiError { + constructor(message: string, status: number, statusCode: string); +} +/** + * @deprecated Use StorageUnknownError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsUnknownError extends StorageUnknownError { + constructor(message: string, originalError: unknown); +} +/** + * Error codes specific to S3 Vectors API + * Maps AWS service errors to application-friendly error codes + */ +declare enum StorageVectorsErrorCode { + /** Internal server fault (HTTP 500) */ + InternalError = "InternalError", + /** Resource already exists / conflict (HTTP 409) */ + S3VectorConflictException = "S3VectorConflictException", + /** Resource not found (HTTP 404) */ + S3VectorNotFoundException = "S3VectorNotFoundException", + /** Delete bucket while not empty (HTTP 400) */ + S3VectorBucketNotEmpty = "S3VectorBucketNotEmpty", + /** Exceeds bucket quota/limit (HTTP 400) */ + S3VectorMaxBucketsExceeded = "S3VectorMaxBucketsExceeded", + /** Exceeds index quota/limit (HTTP 400) */ + S3VectorMaxIndexesExceeded = "S3VectorMaxIndexesExceeded", +} +//#endregion +//#region src/lib/types.d.ts +/** + * Type of storage bucket + * - STANDARD: Regular file storage buckets + * - ANALYTICS: Iceberg table-based buckets for analytical workloads + */ +type BucketType = 'STANDARD' | 'ANALYTICS' | (string & {}); +interface Bucket { + id: string; + type?: BucketType; + name: string; + owner: string; + file_size_limit?: number; + allowed_mime_types?: string[]; + created_at: string; + updated_at: string; + public: boolean; +} +interface ListBucketOptions { + limit?: number; + offset?: number; + sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'; + sortOrder?: 'asc' | 'desc'; + search?: string; +} +interface PurgeCacheOptions { + /** + * If true, purges only the transformations (resized/formatted variants) for the object or bucket, + * leaving the original cached file intact. If omitted, purges all cached versions. + */ + transformations?: true; +} +/** + * Represents an Analytics Bucket using Apache Iceberg table format. + * Analytics buckets are optimized for analytical queries and data processing. + */ +interface AnalyticBucket { + /** Unique identifier for the bucket */ + name: string; + /** Bucket type - always 'ANALYTICS' for analytics buckets */ + type: 'ANALYTICS'; + /** Storage format used (e.g., 'iceberg') */ + format: string; + /** ISO 8601 timestamp of bucket creation */ + created_at: string; + /** ISO 8601 timestamp of last update */ + updated_at: string; +} +/** + * Metadata object returned by the Storage API for files + * Contains information about file size, type, caching, and HTTP response details + */ +interface FileMetadata { + /** Entity tag for caching and conditional requests */ + eTag: string; + /** File size in bytes */ + size: number; + /** MIME type of the file */ + mimetype: string; + /** Cache control directive (e.g., "max-age=3600") */ + cacheControl: string; + /** Last modification timestamp (ISO 8601) */ + lastModified: string; + /** Content length in bytes (usually same as size) */ + contentLength: number; + /** HTTP status code from the storage backend */ + httpStatusCode: number; + /** Any additional custom metadata stored with the file */ + [key: string]: any; +} +/** + * File object returned by the List V1 API (list() method) + * Note: Folder entries will have null values for most fields except name + * + * Warning: Some fields may not be present in all API responses. Fields like + * bucket_id, owner, and buckets are not returned by list() operations. + */ +interface FileObject { + /** File or folder name (relative to the prefix) - always present */ + name: string; + /** Unique identifier for the file (null for folders) */ + id: string | null; + /** Last update timestamp (null for folders) */ + updated_at: string | null; + /** Creation timestamp (null for folders) */ + created_at: string | null; + /** @deprecated Last access timestamp (null for folders) */ + last_accessed_at: string | null; + /** File metadata including size, mimetype, etc. (null for folders) */ + metadata: FileMetadata | null; + /** + * @deprecated Bucket identifier - NOT returned by list() operations. + * May be present in remove() responses. Do not rely on this field. + */ + bucket_id?: string; + /** + * @deprecated Owner identifier - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + owner?: string; + /** + * @deprecated Bucket object - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + buckets?: Bucket; +} +/** + * File object returned by the Info endpoint (info() method) + * Contains detailed metadata for a specific file + */ +interface FileObjectV2 { + /** Unique identifier for the file */ + id: string; + /** File version identifier */ + version: string; + /** File name */ + name: string; + /** Bucket identifier */ + bucket_id: string; + /** Creation timestamp */ + created_at: string; + /** File size in bytes */ + size?: number; + /** Cache control header value */ + cache_control?: string; + /** MIME content type */ + content_type?: string; + /** Entity tag for caching */ + etag?: string; + /** Last modification timestamp (replaces updated_at) */ + last_modified?: string; + /** Custom file metadata */ + metadata?: FileMetadata; + /** + * @deprecated The API returns last_modified instead. + * This field may not be present in responses. + */ + updated_at?: string; +} +interface SortBy { + column?: string; + order?: string; +} +interface FileOptions { + /** + * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=` header. Defaults to 3600 seconds. + */ + cacheControl?: string; + /** + * the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. + */ + contentType?: string; + /** + * When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false. + */ + upsert?: boolean; + /** + * The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method. + */ + duplex?: string; + /** + * The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store. + */ + metadata?: Record; + /** + * Optionally add extra headers + */ + headers?: Record; +} +interface DestinationOptions { + destinationBucket?: string; +} +interface SearchOptions { + /** + * The number of files you want to be returned. + * @default 100 + */ + limit?: number; + /** + * The starting position. + */ + offset?: number; + /** + * The column to sort by. Can be any column inside a FileObject. + */ + sortBy?: SortBy; + /** + * The search string to filter files by. + */ + search?: string; +} +interface SortByV2 { + column: 'name' | 'updated_at' | 'created_at'; + order?: 'asc' | 'desc'; +} +interface SearchV2Options { + /** + * The number of files you want to be returned. + * @default 1000 + */ + limit?: number; + /** + * The prefix search string to filter files by. + */ + prefix?: string; + /** + * The cursor used for pagination. Pass the value received from nextCursor of the previous request. + */ + cursor?: string; + /** + * Whether to emulate a hierarchical listing of objects using delimiters. + * + * - When `false` (default), all objects are listed as flat key/value pairs. + * - When `true`, the response groups objects by delimiter, making it appear + * like a file/folder hierarchy. + * + * @default false + */ + with_delimiter?: boolean; + /** + * The column and order to sort by + * @default 'name asc' + */ + sortBy?: SortByV2; +} +/** + * File object returned by the List V2 API (listV2() method) + * Objects and folders are returned in separate arrays - this type represents + * actual files only. Use SearchV2Folder for folder entries. + */ +interface SearchV2Object { + /** File name */ + name: string; + /** Full object key/path */ + key?: string; + /** Unique identifier for the file */ + id: string; + /** Last update timestamp */ + updated_at: string; + /** Creation timestamp */ + created_at: string; + /** File metadata including size, mimetype, etc. (null if not yet set) */ + metadata: FileMetadata | null; + /** @deprecated Last access timestamp */ + last_accessed_at: string; +} +/** + * Folder entry returned by the List V2 API (listV2() method) when using with_delimiter: true + */ +interface SearchV2Folder { + /** Folder name/prefix */ + name: string; + /** Full folder key/path */ + key?: string; +} +interface SearchV2Result { + hasNext: boolean; + folders: SearchV2Folder[]; + objects: SearchV2Object[]; + nextCursor?: string; +} +interface FetchParameters { + /** + * Pass in an AbortController's signal to cancel the request. + */ + signal?: AbortSignal; + /** + * Controls how the request interacts with the browser's HTTP cache. + * - 'default': Use standard cache behavior + * - 'no-store': Bypass cache entirely (useful in Edge Functions) + * - 'reload': Bypass cache but update it with response + * - 'no-cache': Validate with server before using cached response + * - 'force-cache': Use cache even if stale + * - 'only-if-cached': Only use cache, fail if not cached + */ + cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; +} +interface Metadata { + name: string; +} +interface TransformOptions { + /** + * The width of the image in pixels. + */ + width?: number; + /** + * The height of the image in pixels. + */ + height?: number; + /** + * The resize mode can be cover, contain or fill. Defaults to cover. + * Cover resizes the image to maintain it's aspect ratio while filling the entire width and height. + * Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height. + * Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit. + */ + resize?: 'cover' | 'contain' | 'fill'; + /** + * Set the quality of the returned image. + * A number from 20 to 100, with 100 being the highest quality. + * Defaults to 80 + */ + quality?: number; + /** + * Specify the format of the image requested. + * + * When using 'origin' we force the format to be the same as the original image. + * When this option is not passed in, images are optimized to modern image formats like Webp. + */ + format?: 'origin'; +} +type CamelCase = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase}${Uppercase}${CamelCase}` : S; +type Camelize = { [K in keyof T as CamelCase>]: T[K] }; +type DownloadResult = { + data: T; + error: null; +} | { + data: null; + error: StorageError; +}; +/** + * Configuration for encryption at rest + * @property kmsKeyArn - ARN of the KMS key used for encryption + * @property sseType - Server-side encryption type (e.g., 'KMS') + */ +interface EncryptionConfiguration { + kmsKeyArn?: string; + sseType?: string; +} +/** + * Vector bucket metadata + * @property vectorBucketName - Unique name of the vector bucket + * @property creationTime - Unix timestamp of when the bucket was created + * @property encryptionConfiguration - Optional encryption settings + */ +interface VectorBucket { + vectorBucketName: string; + creationTime?: number; + encryptionConfiguration?: EncryptionConfiguration; +} +/** + * Metadata configuration for vector index + * Defines which metadata keys should not be indexed for filtering + * @property nonFilterableMetadataKeys - Array of metadata keys that cannot be used in filters + */ +interface MetadataConfiguration { + nonFilterableMetadataKeys?: string[]; +} +/** + * Supported data types for vectors + * Currently only float32 is supported + */ +type VectorDataType = 'float32' | (string & {}); +/** + * Distance metrics for vector similarity search + */ +type DistanceMetric = 'cosine' | 'euclidean' | 'dotproduct' | (string & {}); +/** + * Vector index configuration and metadata + * @property indexName - Unique name of the index within the bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property dataType - Data type of vector components (currently only 'float32') + * @property dimension - Dimensionality of vectors (e.g., 384, 768, 1536) + * @property distanceMetric - Similarity metric used for queries + * @property metadataConfiguration - Configuration for metadata filtering + * @property creationTime - Unix timestamp of when the index was created + */ +interface VectorIndex { + indexName: string; + vectorBucketName: string; + dataType: VectorDataType; + dimension: number; + distanceMetric: DistanceMetric; + metadataConfiguration?: MetadataConfiguration; + creationTime?: number; +} +/** + * Vector data representation + * Vectors must be float32 arrays with dimensions matching the index + * @property float32 - Array of 32-bit floating point numbers + */ +interface VectorData { + float32: number[]; +} +/** + * Arbitrary JSON metadata attached to vectors + * Keys configured as non-filterable in the index can be stored but not queried + */ +type VectorMetadata = Record; +/** + * Single vector object for insertion/update + * @property key - Unique identifier for the vector + * @property data - Vector embedding data + * @property metadata - Optional arbitrary metadata + */ +interface VectorObject { + key: string; + data: VectorData; + metadata?: VectorMetadata; +} +/** + * Vector object returned from queries with optional distance + * @property key - Unique identifier for the vector + * @property data - Vector embedding data (if requested) + * @property metadata - Arbitrary metadata (if requested) + * @property distance - Similarity distance from query vector (if requested) + */ +interface VectorMatch { + key: string; + data?: VectorData; + metadata?: VectorMetadata; + distance?: number; +} +/** + * Options for fetching vector buckets + * @property prefix - Filter buckets by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +interface ListVectorBucketsOptions { + prefix?: string; + maxResults?: number; + nextToken?: string; +} +/** + * Response from listing vector buckets + * @property vectorBuckets - Array of bucket names + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListVectorBucketsResponse { + vectorBuckets: { + vectorBucketName: string; + }[]; + nextToken?: string; +} +/** + * Options for listing indexes within a bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property prefix - Filter indexes by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +interface ListIndexesOptions { + vectorBucketName: string; + prefix?: string; + maxResults?: number; + nextToken?: string; +} +/** + * Response from listing indexes + * @property indexes - Array of index names + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListIndexesResponse { + indexes: { + indexName: string; + }[]; + nextToken?: string; +} +/** + * Options for batch reading vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to retrieve + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + */ +interface GetVectorsOptions { + vectorBucketName: string; + indexName: string; + keys: string[]; + returnData?: boolean; + returnMetadata?: boolean; +} +/** + * Response from getting vectors + * @property vectors - Array of retrieved vector objects + */ +interface GetVectorsResponse { + vectors: VectorMatch[]; +} +/** + * Options for batch inserting/updating vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property vectors - Array of vectors to insert/upsert (1-500 items) + */ +interface PutVectorsOptions { + vectorBucketName: string; + indexName: string; + vectors: VectorObject[]; +} +/** + * Options for batch deleting vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to delete (1-500 items) + */ +interface DeleteVectorsOptions { + vectorBucketName: string; + indexName: string; + keys: string[]; +} +/** + * Options for listing/scanning vectors in an index + * Supports parallel scanning via segment configuration + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property maxResults - Maximum number of results to return (default: 500, max: 1000) + * @property nextToken - Token for pagination from previous response + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + * @property segmentCount - Total number of parallel segments (1-16) + * @property segmentIndex - Zero-based index of this segment (0 to segmentCount-1) + */ +interface ListVectorsOptions { + vectorBucketName: string; + indexName: string; + maxResults?: number; + nextToken?: string; + returnData?: boolean; + returnMetadata?: boolean; + segmentCount?: number; + segmentIndex?: number; +} +/** + * Response from listing vectors + * @property vectors - Array of vector objects + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListVectorsResponse { + vectors: VectorMatch[]; + nextToken?: string; +} +/** + * JSON filter expression for metadata filtering + * Format and syntax depend on the S3 Vectors service implementation + */ +type VectorFilter = Record; +/** + * Options for querying similar vectors (ANN search) + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property queryVector - Query vector to find similar vectors + * @property topK - Number of nearest neighbors to return (default: 10) + * @property filter - Optional JSON filter for metadata + * @property returnDistance - Whether to include distance scores + * @property returnMetadata - Whether to include metadata in results + */ +interface QueryVectorsOptions { + vectorBucketName: string; + indexName: string; + queryVector: VectorData; + topK?: number; + filter?: VectorFilter; + returnDistance?: boolean; + returnMetadata?: boolean; +} +/** + * Response from vector similarity query + * @property vectors - Array of similar vectors ordered by distance + * @property distanceMetric - The distance metric used for the similarity search + */ +interface QueryVectorsResponse { + vectors: VectorMatch[]; + distanceMetric?: DistanceMetric; +} +/** + * Fetch-specific parameters like abort signals + * @property signal - AbortSignal for cancelling requests + */ +interface VectorFetchParameters { + signal?: AbortSignal; +} +/** + * Standard response wrapper for successful operations + * @property data - Response data of type T + * @property error - Null on success + */ +interface SuccessResponse { + data: T; + error: null; +} +/** + * Standard response wrapper for failed operations + * @property data - Null on error + * @property error - StorageError with details (named StorageVectorsError for vector operations) + */ +interface ErrorResponse { + data: null; + error: StorageError; +} +/** + * Union type for all API responses + * Follows the pattern: { data: T, error: null } | { data: null, error: Error } + */ +type ApiResponse = SuccessResponse | ErrorResponse; +//#endregion +//#region src/lib/common/fetch.d.ts +type Fetch = typeof fetch; +//#endregion +//#region src/lib/common/BaseApiClient.d.ts +/** + * @ignore + * Base API client class for all Storage API classes + * Provides common infrastructure for error handling and configuration + * + * @typeParam TError - The error type (StorageError or subclass) + */ +declare abstract class BaseApiClient { + protected url: string; + protected headers: { + [key: string]: string; + }; + protected fetch: Fetch; + protected shouldThrowOnError: boolean; + protected namespace: ErrorNamespace; + /** + * Creates a new BaseApiClient instance + * @param url - Base URL for API requests + * @param headers - Default headers for API requests + * @param fetch - Optional custom fetch implementation + * @param namespace - Error namespace ('storage' or 'vectors') + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, namespace?: ErrorNamespace); + /** + * Enable throwing errors instead of returning them. + * When enabled, errors are thrown instead of returned in { data, error } format. + * + * @returns this - For method chaining + */ + throwOnError(): this; + /** + * Set an HTTP header for the request. + * Creates a shallow copy of headers to avoid mutating shared state. + * + * @param name - Header name + * @param value - Header value + * @returns this - For method chaining + */ + setHeader(name: string, value: string): this; + /** + * Handles API operation with standardized error handling + * Eliminates repetitive try-catch blocks across all API methods + * + * This wrapper: + * 1. Executes the operation + * 2. Returns { data, error: null } on success + * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false) + * 4. Throws error on failure (if shouldThrowOnError is true) + * + * @typeParam T - The expected data type from the operation + * @param operation - Async function that performs the API call + * @returns Promise with { data, error } tuple + * + * @example Handling an operation + * ```typescript + * async listBuckets() { + * return this.handleOperation(async () => { + * return await get(this.fetch, `${this.url}/bucket`, { + * headers: this.headers, + * }) + * }) + * } + * ``` + */ + protected handleOperation(operation: () => Promise): Promise<{ + data: T; + error: null; + } | { + data: null; + error: TError; + }>; +} +//#endregion +//#region src/packages/StreamDownloadBuilder.d.ts +declare class StreamDownloadBuilder implements Promise> { + private downloadFn; + private shouldThrowOnError; + readonly [Symbol.toStringTag]: string; + private promise; + constructor(downloadFn: () => Promise, shouldThrowOnError: boolean); + then, TResult2 = never>(onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise | TResult>; + finally(onfinally?: (() => void) | null): Promise>; + private getPromise; + private execute; +} +//#endregion +//#region src/packages/BlobDownloadBuilder.d.ts +declare class BlobDownloadBuilder implements Promise> { + private downloadFn; + private shouldThrowOnError; + readonly [Symbol.toStringTag]: string; + private promise; + constructor(downloadFn: () => Promise, shouldThrowOnError: boolean); + asStream(): StreamDownloadBuilder; + then, TResult2 = never>(onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise | TResult>; + finally(onfinally?: (() => void) | null): Promise>; + private getPromise; + private execute; +} +//#endregion +//#region src/packages/StorageFileApi.d.ts +type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream | URLSearchParams | string; +declare class StorageFileApi extends BaseApiClient { + protected bucketId: string | undefined; + constructor(url: string, headers?: { + [key: string]: string; + }, bucketId?: string, fetch?: Fetch); + /** + * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one. + * + * @param method HTTP method. + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. + * @param fileBody The body of the file to be stored in the bucket. + */ + private uploadOrUpdate; + /** + * Uploads a file to an existing bucket. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Upload file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile, { + * cacheControl: '3600', + * upsert: false + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Upload file using `ArrayBuffer` from base64 file data + * ```js + * import { decode } from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @example Handling errors + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile) + * + * if (error) { + * // Log the full error so fields like `statusCode` and `error` (the + * // Storage error name, e.g. "Duplicate") aren't hidden behind `error.message`. + * console.error(error) + * return + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + upload(path: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{ + data: { + id: string; + path: string; + fullPath: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Upload a file with a token generated from `createSignedUploadUrl`. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param token The token generated from `createSignedUploadUrl` + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions HTTP headers (cacheControl, contentType, etc.). + * **Note:** The `upsert` option has no effect here. To enable upsert behavior, + * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead. + * @returns Promise with response containing file path and fullPath or error + * + * @example Upload to a signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "folder/cat.jpg", + * "fullPath": "avatars/folder/cat.jpg" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + uploadToSignedUrl(path: string, token: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{ + data: null; + error: StorageError; + } | { + data: { + path: string; + fullPath: any; + }; + error: null; + }>; + /** + * Creates a signed upload URL. + * Signed upload URLs can be used to upload files to the bucket without further authentication. + * They are valid for 2 hours. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param options.upsert If set to true, allows the file to be overwritten if it already exists. + * @returns Promise with response containing signed upload URL, token, and path or error + * + * @example Create Signed Upload URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUploadUrl('folder/cat.jpg') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=", + * "path": "folder/cat.jpg", + * "token": "" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUploadUrl(path: string, options?: { + upsert: boolean; + }): Promise<{ + data: { + signedUrl: string; + token: string; + path: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Replaces an existing file at the specified path with a new one. + * + * @category Storage + * @subcategory File Buckets + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata. + * **Note:** The `upsert` option has no effect here. `update()` always replaces the + * file at the given path, so the `x-upsert` header is not sent. To control upsert + * behavior, use `upload()` instead. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Update file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', avatarFile, { + * cacheControl: '3600' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Update file using `ArrayBuffer` from base64 file data + * ```js + * import {decode} from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - `update()` always replaces the file at the given path regardless of the `upsert` option. + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + update(path: string, fileBody: ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream | URLSearchParams | string, fileOptions?: FileOptions): Promise<{ + data: { + id: string; + path: string; + fullPath: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Moves an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-new.png`. + * @param options The destination options. + * @returns Promise with response containing success message or error + * + * @example Move file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .move('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully moved" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + move(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Copies an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`. + * @param options The destination options. + * @returns Promise with response containing copied file path or error + * + * @example Copy file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .copy('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "avatars/private/avatar2.png" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + copy(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{ + data: { + path: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing signed URL or error + * + * @example Create Signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * "error": null + * } + * ``` + * + * @example Create a signed URL for an asset with transformations + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Create a signed URL which triggers the download of the asset + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * download: true, + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUrl(path: string, expiresIn: number, options?: { + download?: string | boolean; + transform?: TransformOptions; + cacheNonce?: string; + }): Promise<{ + data: { + signedUrl: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. + * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. + * @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. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing array of objects with signedUrl, path, and error or error + * + * @example Create Signed URLs + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "error": null, + * "path": "folder/avatar1.png", + * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * { + * "error": null, + * "path": "folder/avatar2.png", + * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUrls(paths: string[], expiresIn: number, options?: { + download?: string | boolean; + cacheNonce?: string; + }): Promise<{ + data: { + error: string | null; + path: string | null; + signedURL: string | null; + signedUrl: string | null; + }[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead. + * + * @category Storage + * @subcategory File Buckets + * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`. + * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache. + * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control. + * @returns BlobDownloadBuilder instance for downloading the file + * + * @example Download file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": , + * "error": null + * } + * ``` + * + * @example Download file with transformations + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * quality: 80 + * } + * }) + * ``` + * + * @example Download with cache control (useful in Edge Functions) + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { cache: 'no-store' }) + * ``` + * + * @example Download with abort signal + * ```js + * const controller = new AbortController() + * setTimeout(() => controller.abort(), 5000) + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { signal: controller.signal }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + download(path: string, options?: Options, parameters?: FetchParameters): BlobDownloadBuilder; + /** + * Retrieves the details of an existing file. + * + * Returns detailed file metadata including size, content type, and timestamps. + * Note: The API returns `last_modified` field, not `updated_at`. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing file metadata or error + * + * @example Get file info + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .info('folder/avatar1.png') + * + * if (data) { + * console.log('Last modified:', data.lastModified) + * console.log('Size:', data.size) + * } + * ``` + */ + info(path: string): Promise<{ + data: Camelize; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Checks the existence of a file. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing boolean indicating file existence or error + * + * @example Check file existence + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .exists('folder/avatar1.png') + * ``` + */ + exists(path: string): Promise<{ + data: boolean; + error: null; + } | { + data: boolean; + error: StorageError; + }>; + /** + * 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. + * 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. + * + * @category Storage + * @subcategory File Buckets + * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Object with public URL + * + * @example Returns the URL for an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png" + * } + * } + * ``` + * + * @example Returns the URL for an asset in a public bucket with transformations + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Returns the URL which triggers the download of an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * download: true, + * }) + * ``` + * + * @remarks + * - 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" + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getPublicUrl(path: string, options?: { + download?: string | boolean; + transform?: TransformOptions; + cacheNonce?: string; + }): { + data: { + publicUrl: string; + }; + }; + /** + * Deletes files within the same bucket + * + * Returns an array of FileObject entries for the deleted files. Note that deprecated + * fields like `bucket_id` may or may not be present in the response - do not rely on them. + * + * @category Storage + * @subcategory File Buckets + * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. + * @returns Promise with response containing array of deleted file objects or error + * + * @example Delete file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .remove(['folder/avatar1.png']) + * ``` + * + * Response: + * ```json + * { + * "data": [], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `delete` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + remove(paths: string[]): Promise<{ + data: FileObject[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Purges the CDN cache for a single object in this bucket. + * + * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server + * issues a CDN invalidation for the object and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * Operates on a single object path. There is no wildcard or recursion: pass + * the exact path of the object you want invalidated. + * + * @category Storage + * @subcategory File Buckets + * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge a single cached object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png') + * ``` + * + * @example Purge only transformations for a single object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png', { transformations: true }) + * ``` + */ + purgeCache(path: string, options?: PurgeCacheOptions, parameters?: FetchParameters): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Get file metadata + * @param id the file id to retrieve metadata + */ + /** + * Update file metadata + * @param id the file id to update metadata + * @param meta the new file metadata + */ + /** + * Lists all the files and folders within a path of the bucket. + * + * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`, + * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated. + * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned + * by this method. + * + * @category Storage + * @subcategory File Buckets + * @param path The folder path. + * @param options Search options including limit (defaults to 100), offset, sortBy, and search + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing array of files/folders or error + * + * @example List files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * }) + * + * // Handle files vs folders + * data?.forEach(item => { + * if (item.id !== null) { + * // It's a file + * console.log('File:', item.name, 'Size:', item.metadata?.size) + * } else { + * // It's a folder + * console.log('Folder:', item.name) + * } + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "avatar1.png", + * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2", + * "updated_at": "2024-05-22T23:06:05.580Z", + * "created_at": "2024-05-22T23:04:34.443Z", + * "last_accessed_at": "2024-05-22T23:04:34.443Z", + * "metadata": { + * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"", + * "size": 32175, + * "mimetype": "image/png", + * "cacheControl": "max-age=3600", + * "lastModified": "2024-05-22T23:06:05.574Z", + * "contentLength": 32175, + * "httpStatusCode": 200 + * } + * } + * ], + * "error": null + * } + * ``` + * + * @example Search files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * search: 'jon' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + list(path?: string, options?: SearchOptions, parameters?: FetchParameters): Promise<{ + data: FileObject[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Lists all the files and folders within a bucket using the V2 API with pagination support. + * + * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` — + * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available + * on entries in the `objects` array. + * + * @experimental this method signature might change in the future + * + * @category Storage + * @subcategory File Buckets + * @param options Search options including prefix, cursor for pagination, limit, with_delimiter + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing folders/objects arrays with pagination info or error + * + * @example List files with pagination + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * limit: 100, + * }) + * + * // Handle pagination + * if (data?.hasNext) { + * const nextPage = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * cursor: data.nextCursor, + * }) + * } + * + * // Handle files vs folders + * data?.objects.forEach(file => { + * if (file.id !== null) { + * console.log('File:', file.name, 'Size:', file.metadata?.size) + * } + * }) + * data?.folders.forEach(folder => { + * console.log('Folder:', folder.name) + * }) + * ``` + */ + listV2(options?: SearchV2Options, parameters?: FetchParameters): Promise<{ + data: SearchV2Result; + error: null; + } | { + data: null; + error: StorageError; + }>; + protected encodeMetadata(metadata: Record): string; + toBase64(data: string): string; + private _getFinalPath; + private _removeEmptyFolders; + /** Modifies the `query`, appending values the from `transform` */ + private applyTransformOptsToQuery; +} +//#endregion +//#region src/packages/StorageBucketApi.d.ts +declare class StorageBucketApi extends BaseApiClient { + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, opts?: StorageClientOptions); + /** + * Retrieves the details of all Storage buckets within an existing project. + * + * @category Storage + * @subcategory File Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of buckets or error + * + * @example List buckets + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets() + * ``` + * + * @example List buckets with options + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc', + * search: 'prod' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + listBuckets(options?: ListBucketOptions): Promise<{ + data: Bucket[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Retrieves the details of an existing Storage bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to retrieve. + * @returns Promise with response containing bucket details or error + * + * @example Get bucket + * ```js + * const { data, error } = await supabase + * .storage + * .getBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "id": "avatars", + * "name": "avatars", + * "owner": "", + * "public": false, + * "file_size_limit": 1024, + * "allowed_mime_types": [ + * "image/png" + * ], + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getBucket(id: string): Promise<{ + data: Bucket; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates a new Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are creating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details. + * - default bucket type is `STANDARD` + * @returns Promise with response containing newly created bucket name or error + * + * @example Create bucket + * ```js + * const { data, error } = await supabase + * .storage + * .createBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "avatars" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `insert` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createBucket(id: string, options?: { + public: boolean; + fileSizeLimit?: number | string | null; + allowedMimeTypes?: string[] | null; + type?: BucketType; + }): Promise<{ + data: Pick; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Updates a Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are updating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @returns Promise with response containing success message or error + * + * @example Update bucket + * ```js + * const { data, error } = await supabase + * .storage + * .updateBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully updated" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `update` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + updateBucket(id: string, options: { + public: boolean; + fileSizeLimit?: number | string | null; + allowedMimeTypes?: string[] | null; + }): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Removes all objects inside a single bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to empty. + * @returns Promise with success message or error + * + * @example Empty bucket + * ```js + * const { data, error } = await supabase + * .storage + * .emptyBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully emptied" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: `select` and `delete` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + emptyBucket(id: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. + * You must first `empty()` the bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to delete. + * @returns Promise with success message or error + * + * @example Delete bucket + * ```js + * const { data, error } = await supabase + * .storage + * .deleteBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `delete` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + deleteBucket(id: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Purges the CDN cache for an entire bucket. + * + * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server + * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to purge from cache. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge cache for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars') + * ``` + * + * @example Purge only transformations for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars', { transformations: true }) + * ``` + */ + purgeBucketCache(id: string, options?: PurgeCacheOptions, parameters?: FetchParameters): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + private listBucketOptionsToQueryString; +} +//#endregion +//#region src/packages/StorageAnalyticsClient.d.ts +type WrapAsyncMethod = T extends ((...args: infer A) => Promise) ? (...args: A) => Promise<{ + data: R; + error: null; +} | { + data: null; + error: IcebergError; +}> : T; +type WrappedIcebergRestCatalog = { [K in keyof IcebergRestCatalog]: WrapAsyncMethod }; +/** + * Client class for managing Analytics Buckets using Iceberg tables + * Provides methods for creating, listing, and deleting analytics buckets + */ +declare class StorageAnalyticsClient extends BaseApiClient { + /** + * @alpha + * + * Creates a new StorageAnalyticsClient instance + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param url - The base URL for the storage API + * @param headers - HTTP headers to include in requests + * @param fetch - Optional custom fetch implementation + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.storage.analytics.listBuckets() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageAnalyticsClient } from '@supabase/storage-js' + * + * const client = new StorageAnalyticsClient(url, headers) + * ``` + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** + * @alpha + * + * Creates a new analytics bucket using Iceberg tables + * Analytics buckets are optimized for analytical queries and data processing + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param name A unique name for the bucket you are creating + * @returns Promise with response containing newly created analytics bucket or error + * + * @example Create analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Creates a new analytics bucket using Iceberg tables + * - Analytics buckets are optimized for analytical queries and data processing + */ + createBucket(name: string): Promise<{ + data: AnalyticBucket; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Retrieves the details of all Analytics Storage buckets within an existing project + * Only returns buckets of type 'ANALYTICS' + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of analytics buckets or error + * + * @example List analytics buckets + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - Retrieves the details of all Analytics Storage buckets within an existing project + * - Only returns buckets of type 'ANALYTICS' + */ + listBuckets(options?: { + limit?: number; + offset?: number; + sortColumn?: 'name' | 'created_at' | 'updated_at'; + sortOrder?: 'asc' | 'desc'; + search?: string; + }): Promise<{ + data: AnalyticBucket[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Deletes an existing analytics bucket + * A bucket can't be deleted with existing objects inside it + * You must first empty the bucket before deletion + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName The unique identifier of the bucket you would like to delete + * @returns Promise with response containing success message or error + * + * @example Delete analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .deleteBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Deletes an analytics bucket + */ + deleteBucket(bucketName: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Get an Iceberg REST Catalog client configured for a specific analytics bucket + * Use this to perform advanced table and namespace operations within the bucket + * The returned client provides full access to the Apache Iceberg REST Catalog API + * with the Supabase `{ data, error }` pattern for consistent error handling on all operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName - The name of the analytics bucket (warehouse) to connect to + * @returns The wrapped Iceberg catalog client + * @throws {StorageError} If the bucket name is invalid + * + * @example Get catalog and create table + * ```js + * // First, create an analytics bucket + * const { data: bucket, error: bucketError } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * + * // Get the Iceberg catalog for that bucket + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Create a namespace + * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] }) + * + * // Create a table with schema + * const { data: tableMetadata, error: tableError } = await catalog.createTable( + * { namespace: ['default'] }, + * { + * name: 'events', + * schema: { + * type: 'struct', + * fields: [ + * { id: 1, name: 'id', type: 'long', required: true }, + * { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + * { id: 3, name: 'user_id', type: 'string', required: false } + * ], + * 'schema-id': 0, + * 'identifier-field-ids': [1] + * }, + * 'partition-spec': { + * 'spec-id': 0, + * fields: [] + * }, + * 'write-order': { + * 'order-id': 0, + * fields: [] + * }, + * properties: { + * 'write.format.default': 'parquet' + * } + * } + * ) + * ``` + * + * @example List tables in namespace + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all tables in the default namespace + * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] }) + * if (listError) { + * if (listError.isNotFound()) { + * console.log('Namespace not found') + * } + * return + * } + * console.log(tables) // [{ namespace: ['default'], name: 'events' }] + * ``` + * + * @example Working with namespaces + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all namespaces + * const { data: namespaces } = await catalog.listNamespaces() + * + * // Create namespace with properties + * await catalog.createNamespace( + * { namespace: ['production'] }, + * { properties: { owner: 'data-team', env: 'prod' } } + * ) + * ``` + * + * @example Cleanup operations + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Drop table with purge option (removes all data) + * const { error: dropError } = await catalog.dropTable( + * { namespace: ['default'], name: 'events' }, + * { purge: true } + * ) + * + * if (dropError?.isNotFound()) { + * console.log('Table does not exist') + * } + * + * // Drop namespace (must be empty) + * await catalog.dropNamespace({ namespace: ['default'] }) + * ``` + * + * @remarks + * This method provides a bridge between Supabase's bucket management and the standard + * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter. + * All authentication and configuration is handled automatically using your Supabase credentials. + * + * **Error Handling**: Invalid bucket names throw immediately. All catalog + * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js. + * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling. + * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations. + * + * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently + * deletes all table data. Without it, the table is marked as deleted but data remains. + * + * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js. + * For complete API documentation and advanced usage, refer to the + * [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + */ + from(bucketName: string): WrappedIcebergRestCatalog; +} +//#endregion +//#region src/packages/VectorIndexApi.d.ts +/** + * @alpha + * + * Options for creating a vector index + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +interface CreateIndexOptions { + vectorBucketName: string; + indexName: string; + dataType: VectorDataType; + dimension: number; + distanceMetric: DistanceMetric; + metadataConfiguration?: MetadataConfiguration; +} +/** + * @hidden + * Base implementation for vector index operations. + * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead. + */ +declare class VectorIndexApi extends BaseApiClient { + /** Creates a new VectorIndexApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Creates a new vector index within a bucket */ + createIndex(options: CreateIndexOptions): Promise>; + /** Retrieves metadata for a specific vector index */ + getIndex(vectorBucketName: string, indexName: string): Promise>; + /** Lists vector indexes within a bucket with optional filtering and pagination */ + listIndexes(options: ListIndexesOptions): Promise>; + /** Deletes a vector index and all its data */ + deleteIndex(vectorBucketName: string, indexName: string): Promise>; +} +//#endregion +//#region src/packages/VectorDataApi.d.ts +/** + * @hidden + * Base implementation for vector data operations. + * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead. + */ +declare class VectorDataApi extends BaseApiClient { + /** Creates a new VectorDataApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Inserts or updates vectors in batch (1-500 per request) */ + putVectors(options: PutVectorsOptions): Promise>; + /** Retrieves vectors by their keys in batch */ + getVectors(options: GetVectorsOptions): Promise>; + /** Lists vectors in an index with pagination */ + listVectors(options: ListVectorsOptions): Promise>; + /** Queries for similar vectors using approximate nearest neighbor search */ + queryVectors(options: QueryVectorsOptions): Promise>; + /** Deletes vectors by their keys in batch (1-500 per request) */ + deleteVectors(options: DeleteVectorsOptions): Promise>; +} +//#endregion +//#region src/packages/VectorBucketApi.d.ts +/** + * @hidden + * Base implementation for vector bucket operations. + * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead. + */ +declare class VectorBucketApi extends BaseApiClient { + /** Creates a new VectorBucketApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Creates a new vector bucket */ + createBucket(vectorBucketName: string): Promise>; + /** Retrieves metadata for a specific vector bucket */ + getBucket(vectorBucketName: string): Promise>; + /** Lists vector buckets with optional filtering and pagination */ + listBuckets(options?: ListVectorBucketsOptions): Promise>; + /** Deletes a vector bucket (must be empty first) */ + deleteBucket(vectorBucketName: string): Promise>; +} +//#endregion +//#region src/packages/StorageVectorsClient.d.ts +/** + * + * @alpha + * + * Configuration options for the Storage Vectors client + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +interface StorageVectorsClientOptions { + /** + * Custom headers to include in all requests + */ + headers?: { + [key: string]: string; + }; + /** + * Custom fetch implementation (optional) + * Useful for testing or custom request handling + */ + fetch?: Fetch; +} +/** + * + * @alpha + * + * Main client for interacting with S3 Vectors API + * Provides access to bucket, index, and vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * **Usage Patterns:** + * + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * + * // Access index operations via buckets + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine' + * }) + * + * // Access vector operations via index + * const index = bucket.index('documents') + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5, + * returnDistance: true + * }) + * ``` + */ +declare class StorageVectorsClient extends VectorBucketApi { + /** + * @alpha + * + * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param url - Base URL of the Storage Vectors REST API. + * @param options.headers - Optional headers (for example `Authorization`) applied to every request. + * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes. + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageVectorsClient } from '@supabase/storage-js' + * + * const client = new StorageVectorsClient(url, options) + * ``` + */ + constructor(url: string, options?: StorageVectorsClientOptions); + /** + * + * @alpha + * + * Access operations for a specific vector bucket + * Returns a scoped client for index and vector operations within the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Bucket-scoped client with index and vector operations + * + * @example Accessing a vector bucket + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + from(vectorBucketName: string): VectorBucketScope; + /** + * + * @alpha + * + * Creates a new vector bucket + * Vector buckets are containers for vector indexes and their data + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Unique name for the vector bucket + * @returns Promise with empty response on success or error + * + * @example Creating a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * ``` + */ + createBucket(vectorBucketName: string): Promise>; + /** + * + * @alpha + * + * Retrieves metadata for a specific vector bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Promise with bucket metadata or error + * + * @example Get bucket metadata + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .getBucket('embeddings-prod') + * + * console.log('Bucket created:', data?.vectorBucket.creationTime) + * ``` + */ + getBucket(vectorBucketName: string): Promise>; + /** + * + * @alpha + * + * Lists all vector buckets with optional filtering and pagination + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Optional filters (prefix, maxResults, nextToken) + * @returns Promise with list of buckets or error + * + * @example List vector buckets + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .listBuckets({ prefix: 'embeddings-' }) + * + * data?.vectorBuckets.forEach(bucket => { + * console.log(bucket.vectorBucketName) + * }) + * ``` + */ + listBuckets(options?: ListVectorBucketsOptions): Promise>; + /** + * + * @alpha + * + * Deletes a vector bucket (bucket must be empty) + * All indexes must be deleted before deleting the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket to delete + * @returns Promise with empty response on success or error + * + * @example Delete a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .deleteBucket('embeddings-old') + * ``` + */ + deleteBucket(vectorBucketName: string): Promise>; +} +/** + * + * @alpha + * + * Scoped client for operations within a specific vector bucket + * Provides index management and access to vector operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +declare class VectorBucketScope extends VectorIndexApi { + private vectorBucketName; + /** + * @alpha + * + * Creates a helper that automatically scopes all index operations to the provided bucket. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector bucket scope + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + constructor(url: string, headers: { + [key: string]: string; + }, vectorBucketName: string, fetch?: Fetch); + /** + * + * @alpha + * + * Creates a new vector index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Index configuration (vectorBucketName is automatically set) + * @returns Promise with empty response on success or error + * + * @example Creating a vector index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents-openai', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine', + * metadataConfiguration: { + * nonFilterableMetadataKeys: ['raw_text'] + * } + * }) + * ``` + */ + createIndex(options: Omit): Promise>; + /** + * + * @alpha + * + * Lists indexes in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (vectorBucketName is automatically set) + * @returns Promise with response containing indexes array and pagination token or error + * + * @example List indexes + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.listIndexes({ prefix: 'documents-' }) + * ``` + */ + listIndexes(options?: Omit): Promise>; + /** + * + * @alpha + * + * Retrieves metadata for a specific index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to retrieve + * @returns Promise with index metadata or error + * + * @example Get index metadata + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.getIndex('documents-openai') + * console.log('Dimension:', data?.index.dimension) + * ``` + */ + getIndex(indexName: string): Promise>; + /** + * + * @alpha + * + * Deletes an index from this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to delete + * @returns Promise with empty response on success or error + * + * @example Delete an index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.deleteIndex('old-index') + * ``` + */ + deleteIndex(indexName: string): Promise>; + /** + * + * @alpha + * + * Access operations for a specific index within this bucket + * Returns a scoped client for vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index + * @returns Index-scoped client with vector data operations + * + * @example Accessing an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * + * // Insert vectors + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5 + * }) + * ``` + */ + index(indexName: string): VectorIndexScope; +} +/** + * + * @alpha + * + * Scoped client for operations within a specific vector index + * Provides vector data operations (put, get, list, query, delete) + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +declare class VectorIndexScope extends VectorDataApi { + private vectorBucketName; + private indexName; + /** + * + * @alpha + * + * Creates a helper that automatically scopes all vector operations to the provided bucket/index names. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector index scope + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * ``` + */ + constructor(url: string, headers: { + [key: string]: string; + }, vectorBucketName: string, indexName: string, fetch?: Fetch); + /** + * + * @alpha + * + * Inserts or updates vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector insertion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Insert vectors into an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.putVectors({ + * vectors: [ + * { + * key: 'doc-1', + * data: { float32: [0.1, 0.2, ...] }, + * metadata: { title: 'Introduction', page: 1 } + * } + * ] + * }) + * ``` + */ + putVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Retrieves vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector retrieval options (bucket and index names automatically set) + * @returns Promise with response containing vectors array or error + * + * @example Get vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.getVectors({ + * keys: ['doc-1', 'doc-2'], + * returnMetadata: true + * }) + * ``` + */ + getVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Lists vectors in this index with pagination + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (bucket and index names automatically set) + * @returns Promise with response containing vectors array and pagination token or error + * + * @example List vectors with pagination + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.listVectors({ + * maxResults: 500, + * returnMetadata: true + * }) + * ``` + */ + listVectors(options?: Omit): Promise>; + /** + * + * @alpha + * + * Queries for similar vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Query options (bucket and index names automatically set) + * @returns Promise with response containing matches array of similar vectors ordered by distance or error + * + * @example Query similar vectors + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.queryVectors({ + * queryVector: { float32: [0.1, 0.2, ...] }, + * topK: 5, + * filter: { category: 'technical' }, + * returnDistance: true, + * returnMetadata: true + * }) + * ``` + */ + queryVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Deletes vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Deletion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Delete vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.deleteVectors({ + * keys: ['doc-1', 'doc-2', 'doc-3'] + * }) + * ``` + */ + deleteVectors(options: Omit): Promise>; +} +//#endregion +//#region src/StorageClient.d.ts +interface StorageClientOptions { + useNewHostname?: boolean; +} +declare class StorageClient extends StorageBucketApi { + /** + * Creates a client for Storage buckets, files, analytics, and vectors. + * + * @category Storage + * @subcategory File Buckets + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const avatars = supabase.storage.from('avatars') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import { StorageClient } from '@supabase/storage-js' + * + * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', { + * apikey: 'your-publishable-key', + * }) + * const avatars = storage.from('avatars') + * ``` + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, opts?: StorageClientOptions); + /** + * Perform file operation in a bucket. + * + * @category Storage + * @subcategory File Buckets + * + * @param id The bucket id to operate on. + * + * @example Accessing a bucket + * ```typescript + * const avatars = supabase.storage.from('avatars') + * ``` + */ + from(id: string): StorageFileApi; + /** + * + * @alpha + * + * Access vector storage operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * + * @returns A StorageVectorsClient instance configured with the current storage settings. + */ + get vectors(): StorageVectorsClient; + /** + * + * @alpha + * + * Access analytics storage operations using Iceberg tables. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * + * @returns A StorageAnalyticsClient instance configured with the current storage settings. + */ + get analytics(): StorageAnalyticsClient; +} +//#endregion +export { AnalyticBucket, ApiResponse, Bucket, BucketType, Camelize, type CreateIndexOptions, DeleteVectorsOptions, DestinationOptions, DistanceMetric, DownloadResult, EncryptionConfiguration, ErrorNamespace, ErrorResponse, FetchParameters, FileMetadata, FileObject, FileObjectV2, FileOptions, GetVectorsOptions, GetVectorsResponse, ListBucketOptions, ListIndexesOptions, ListIndexesResponse, ListVectorBucketsOptions, ListVectorBucketsResponse, ListVectorsOptions, ListVectorsResponse, Metadata, MetadataConfiguration, PurgeCacheOptions, PutVectorsOptions, QueryVectorsOptions, QueryVectorsResponse, SearchOptions, SearchV2Folder, SearchV2Object, SearchV2Options, SearchV2Result, SortBy, SortByV2, StorageAnalyticsClient, StorageApiError, StorageClient, type StorageClientOptions, StorageError, StorageUnknownError, StorageVectorsApiError, StorageVectorsClient, type StorageVectorsClientOptions, StorageVectorsError, StorageVectorsErrorCode, StorageVectorsUnknownError, SuccessResponse, TransformOptions, VectorBucket, VectorBucketApi, VectorBucketScope, VectorData, VectorDataApi, VectorDataType, VectorFetchParameters, VectorFilter, VectorIndex, VectorIndexApi, VectorIndexScope, VectorMatch, VectorMetadata, VectorObject, isStorageError, isStorageVectorsError }; +//# sourceMappingURL=index.d.cts.map \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.d.cts.map b/node_modules/@supabase/storage-js/dist/index.d.cts.map new file mode 100644 index 0000000000000000000000000000000000000000..778ab489d1b2fa7cfc1e46a7509ee226fcbbf18d --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.d.cts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/common/errors.ts","../src/lib/types.ts","../src/lib/common/fetch.ts","../src/lib/common/BaseApiClient.ts","../src/packages/StreamDownloadBuilder.ts","../src/packages/BlobDownloadBuilder.ts","../src/packages/StorageFileApi.ts","../src/packages/StorageBucketApi.ts","../src/packages/StorageAnalyticsClient.ts","../src/packages/VectorIndexApi.ts","../src/packages/VectorDataApi.ts","../src/packages/VectorBucketApi.ts","../src/packages/StorageVectorsClient.ts","../src/StorageClient.ts"],"sourcesContent":[],"mappings":";;;;;;;AAIA;AAMa,KAND,cAAA,GAMc,SAAA,GAAA,SAAA;;;;;AAuCV,cAvCH,YAAA,SAAqB,KAAA,CAuCmC;EAQxD,UAAA,gBAAgB,EAAA,OAed;EA4BF,UAAA,SAAA,EAxFU,cA2F2C;EAerD,MAAA,EAAA,MAAA,GAAA,SAAoB;EAWjB,UAAA,EAAA,MAAA,GAAA,SAAqB;EAQxB,WAAA,CAAA,OAA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A,MAAe,EAAA,OA4Df,CA5BN,EAAA;IAQM,CAAA,GAAA,EAAA,MAAA,CAAc,EAAA,MAAA;EAoBd,CAAA,EAAA,KAAA,CAAA,EY5OL,KZ4OK,EAAc,IAAA,CAAA,EY3OpB,oBZ2OoB;EAOd;AAOjB;AAmBA;AAIA;AA6BC;;;;;;;;;EAII,IAAA,CAAA,EAAA,EAAA,MAAA,CAAA,EY/Re,cZ+Rf;EAEO;;;;;;;;AAIZ;AAkBA;AAWA;AAWA;AAQA;EAKY,IAAA,OAAA,CAAA,CAAA,EYzUK,oBZyUS;EAYT;;;;;AAejB;AAQA;AAQA;AAaA;AAaA;AAWA;AAYA;AAYA;EAaiB,IAAA,SAAA,CAAA,CAAA,EY1aE,sBZ0ae;AAYlC"} \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.d.mts b/node_modules/@supabase/storage-js/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..72e4fead27ddb9db211f693db15983aefc76d96d --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.d.mts @@ -0,0 +1,3086 @@ +import { IcebergError, IcebergRestCatalog } from "iceberg-js"; + +//#region src/lib/common/errors.d.ts + +/** + * Namespace type for error classes + * Determines the error class names and type guards + */ +type ErrorNamespace = 'storage' | 'vectors'; +/** + * Base error class for all Storage errors + * Supports both 'storage' and 'vectors' namespaces + */ +declare class StorageError extends Error { + protected __isStorageError: boolean; + protected namespace: ErrorNamespace; + status: number | undefined; + statusCode: string | undefined; + constructor(message: string, namespace?: ErrorNamespace, status?: number, statusCode?: string); + toJSON(): { + name: string; + message: string; + status: number | undefined; + statusCode: string | undefined; + }; +} +/** + * Type guard to check if an error is a StorageError + * @param error - The error to check + * @returns True if the error is a StorageError + */ +declare function isStorageError(error: unknown): error is StorageError; +/** + * API error returned from Storage service + * Includes HTTP status code and service-specific error code + */ +declare class StorageApiError extends StorageError { + status: number; + statusCode: string; + /** + * Service-specific error code from the Storage API response body, such as + * `NoSuchKey`, `AccessDenied` or `ResourceAlreadyExists`. Use this to branch + * on the specific error rather than parsing the message. + * @see https://supabase.com/docs/guides/storage/debugging/error-codes + */ + code: string | undefined; + constructor(message: string, status: number, statusCode: string, namespace?: ErrorNamespace, code?: string); + toJSON(): { + name: string; + message: string; + status: number | undefined; + statusCode: string | undefined; + code: string | undefined; + }; +} +/** + * Unknown error that doesn't match expected error patterns + * Wraps the original error for debugging + */ +declare class StorageUnknownError extends StorageError { + originalError: unknown; + constructor(message: string, originalError: unknown, namespace?: ErrorNamespace); +} +/** + * @deprecated Use StorageError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsError extends StorageError { + constructor(message: string); +} +/** + * Type guard to check if an error is a StorageVectorsError + * @param error - The error to check + * @returns True if the error is a StorageVectorsError + */ +declare function isStorageVectorsError(error: unknown): error is StorageVectorsError; +/** + * @deprecated Use StorageApiError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsApiError extends StorageApiError { + constructor(message: string, status: number, statusCode: string); +} +/** + * @deprecated Use StorageUnknownError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +declare class StorageVectorsUnknownError extends StorageUnknownError { + constructor(message: string, originalError: unknown); +} +/** + * Error codes specific to S3 Vectors API + * Maps AWS service errors to application-friendly error codes + */ +declare enum StorageVectorsErrorCode { + /** Internal server fault (HTTP 500) */ + InternalError = "InternalError", + /** Resource already exists / conflict (HTTP 409) */ + S3VectorConflictException = "S3VectorConflictException", + /** Resource not found (HTTP 404) */ + S3VectorNotFoundException = "S3VectorNotFoundException", + /** Delete bucket while not empty (HTTP 400) */ + S3VectorBucketNotEmpty = "S3VectorBucketNotEmpty", + /** Exceeds bucket quota/limit (HTTP 400) */ + S3VectorMaxBucketsExceeded = "S3VectorMaxBucketsExceeded", + /** Exceeds index quota/limit (HTTP 400) */ + S3VectorMaxIndexesExceeded = "S3VectorMaxIndexesExceeded", +} +//#endregion +//#region src/lib/types.d.ts +/** + * Type of storage bucket + * - STANDARD: Regular file storage buckets + * - ANALYTICS: Iceberg table-based buckets for analytical workloads + */ +type BucketType = 'STANDARD' | 'ANALYTICS' | (string & {}); +interface Bucket { + id: string; + type?: BucketType; + name: string; + owner: string; + file_size_limit?: number; + allowed_mime_types?: string[]; + created_at: string; + updated_at: string; + public: boolean; +} +interface ListBucketOptions { + limit?: number; + offset?: number; + sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at'; + sortOrder?: 'asc' | 'desc'; + search?: string; +} +interface PurgeCacheOptions { + /** + * If true, purges only the transformations (resized/formatted variants) for the object or bucket, + * leaving the original cached file intact. If omitted, purges all cached versions. + */ + transformations?: true; +} +/** + * Represents an Analytics Bucket using Apache Iceberg table format. + * Analytics buckets are optimized for analytical queries and data processing. + */ +interface AnalyticBucket { + /** Unique identifier for the bucket */ + name: string; + /** Bucket type - always 'ANALYTICS' for analytics buckets */ + type: 'ANALYTICS'; + /** Storage format used (e.g., 'iceberg') */ + format: string; + /** ISO 8601 timestamp of bucket creation */ + created_at: string; + /** ISO 8601 timestamp of last update */ + updated_at: string; +} +/** + * Metadata object returned by the Storage API for files + * Contains information about file size, type, caching, and HTTP response details + */ +interface FileMetadata { + /** Entity tag for caching and conditional requests */ + eTag: string; + /** File size in bytes */ + size: number; + /** MIME type of the file */ + mimetype: string; + /** Cache control directive (e.g., "max-age=3600") */ + cacheControl: string; + /** Last modification timestamp (ISO 8601) */ + lastModified: string; + /** Content length in bytes (usually same as size) */ + contentLength: number; + /** HTTP status code from the storage backend */ + httpStatusCode: number; + /** Any additional custom metadata stored with the file */ + [key: string]: any; +} +/** + * File object returned by the List V1 API (list() method) + * Note: Folder entries will have null values for most fields except name + * + * Warning: Some fields may not be present in all API responses. Fields like + * bucket_id, owner, and buckets are not returned by list() operations. + */ +interface FileObject { + /** File or folder name (relative to the prefix) - always present */ + name: string; + /** Unique identifier for the file (null for folders) */ + id: string | null; + /** Last update timestamp (null for folders) */ + updated_at: string | null; + /** Creation timestamp (null for folders) */ + created_at: string | null; + /** @deprecated Last access timestamp (null for folders) */ + last_accessed_at: string | null; + /** File metadata including size, mimetype, etc. (null for folders) */ + metadata: FileMetadata | null; + /** + * @deprecated Bucket identifier - NOT returned by list() operations. + * May be present in remove() responses. Do not rely on this field. + */ + bucket_id?: string; + /** + * @deprecated Owner identifier - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + owner?: string; + /** + * @deprecated Bucket object - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + buckets?: Bucket; +} +/** + * File object returned by the Info endpoint (info() method) + * Contains detailed metadata for a specific file + */ +interface FileObjectV2 { + /** Unique identifier for the file */ + id: string; + /** File version identifier */ + version: string; + /** File name */ + name: string; + /** Bucket identifier */ + bucket_id: string; + /** Creation timestamp */ + created_at: string; + /** File size in bytes */ + size?: number; + /** Cache control header value */ + cache_control?: string; + /** MIME content type */ + content_type?: string; + /** Entity tag for caching */ + etag?: string; + /** Last modification timestamp (replaces updated_at) */ + last_modified?: string; + /** Custom file metadata */ + metadata?: FileMetadata; + /** + * @deprecated The API returns last_modified instead. + * This field may not be present in responses. + */ + updated_at?: string; +} +interface SortBy { + column?: string; + order?: string; +} +interface FileOptions { + /** + * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=` header. Defaults to 3600 seconds. + */ + cacheControl?: string; + /** + * the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. + */ + contentType?: string; + /** + * When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false. + */ + upsert?: boolean; + /** + * The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method. + */ + duplex?: string; + /** + * The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store. + */ + metadata?: Record; + /** + * Optionally add extra headers + */ + headers?: Record; +} +interface DestinationOptions { + destinationBucket?: string; +} +interface SearchOptions { + /** + * The number of files you want to be returned. + * @default 100 + */ + limit?: number; + /** + * The starting position. + */ + offset?: number; + /** + * The column to sort by. Can be any column inside a FileObject. + */ + sortBy?: SortBy; + /** + * The search string to filter files by. + */ + search?: string; +} +interface SortByV2 { + column: 'name' | 'updated_at' | 'created_at'; + order?: 'asc' | 'desc'; +} +interface SearchV2Options { + /** + * The number of files you want to be returned. + * @default 1000 + */ + limit?: number; + /** + * The prefix search string to filter files by. + */ + prefix?: string; + /** + * The cursor used for pagination. Pass the value received from nextCursor of the previous request. + */ + cursor?: string; + /** + * Whether to emulate a hierarchical listing of objects using delimiters. + * + * - When `false` (default), all objects are listed as flat key/value pairs. + * - When `true`, the response groups objects by delimiter, making it appear + * like a file/folder hierarchy. + * + * @default false + */ + with_delimiter?: boolean; + /** + * The column and order to sort by + * @default 'name asc' + */ + sortBy?: SortByV2; +} +/** + * File object returned by the List V2 API (listV2() method) + * Objects and folders are returned in separate arrays - this type represents + * actual files only. Use SearchV2Folder for folder entries. + */ +interface SearchV2Object { + /** File name */ + name: string; + /** Full object key/path */ + key?: string; + /** Unique identifier for the file */ + id: string; + /** Last update timestamp */ + updated_at: string; + /** Creation timestamp */ + created_at: string; + /** File metadata including size, mimetype, etc. (null if not yet set) */ + metadata: FileMetadata | null; + /** @deprecated Last access timestamp */ + last_accessed_at: string; +} +/** + * Folder entry returned by the List V2 API (listV2() method) when using with_delimiter: true + */ +interface SearchV2Folder { + /** Folder name/prefix */ + name: string; + /** Full folder key/path */ + key?: string; +} +interface SearchV2Result { + hasNext: boolean; + folders: SearchV2Folder[]; + objects: SearchV2Object[]; + nextCursor?: string; +} +interface FetchParameters { + /** + * Pass in an AbortController's signal to cancel the request. + */ + signal?: AbortSignal; + /** + * Controls how the request interacts with the browser's HTTP cache. + * - 'default': Use standard cache behavior + * - 'no-store': Bypass cache entirely (useful in Edge Functions) + * - 'reload': Bypass cache but update it with response + * - 'no-cache': Validate with server before using cached response + * - 'force-cache': Use cache even if stale + * - 'only-if-cached': Only use cache, fail if not cached + */ + cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; +} +interface Metadata { + name: string; +} +interface TransformOptions { + /** + * The width of the image in pixels. + */ + width?: number; + /** + * The height of the image in pixels. + */ + height?: number; + /** + * The resize mode can be cover, contain or fill. Defaults to cover. + * Cover resizes the image to maintain it's aspect ratio while filling the entire width and height. + * Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height. + * Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit. + */ + resize?: 'cover' | 'contain' | 'fill'; + /** + * Set the quality of the returned image. + * A number from 20 to 100, with 100 being the highest quality. + * Defaults to 80 + */ + quality?: number; + /** + * Specify the format of the image requested. + * + * When using 'origin' we force the format to be the same as the original image. + * When this option is not passed in, images are optimized to modern image formats like Webp. + */ + format?: 'origin'; +} +type CamelCase = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase}${Uppercase}${CamelCase}` : S; +type Camelize = { [K in keyof T as CamelCase>]: T[K] }; +type DownloadResult = { + data: T; + error: null; +} | { + data: null; + error: StorageError; +}; +/** + * Configuration for encryption at rest + * @property kmsKeyArn - ARN of the KMS key used for encryption + * @property sseType - Server-side encryption type (e.g., 'KMS') + */ +interface EncryptionConfiguration { + kmsKeyArn?: string; + sseType?: string; +} +/** + * Vector bucket metadata + * @property vectorBucketName - Unique name of the vector bucket + * @property creationTime - Unix timestamp of when the bucket was created + * @property encryptionConfiguration - Optional encryption settings + */ +interface VectorBucket { + vectorBucketName: string; + creationTime?: number; + encryptionConfiguration?: EncryptionConfiguration; +} +/** + * Metadata configuration for vector index + * Defines which metadata keys should not be indexed for filtering + * @property nonFilterableMetadataKeys - Array of metadata keys that cannot be used in filters + */ +interface MetadataConfiguration { + nonFilterableMetadataKeys?: string[]; +} +/** + * Supported data types for vectors + * Currently only float32 is supported + */ +type VectorDataType = 'float32' | (string & {}); +/** + * Distance metrics for vector similarity search + */ +type DistanceMetric = 'cosine' | 'euclidean' | 'dotproduct' | (string & {}); +/** + * Vector index configuration and metadata + * @property indexName - Unique name of the index within the bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property dataType - Data type of vector components (currently only 'float32') + * @property dimension - Dimensionality of vectors (e.g., 384, 768, 1536) + * @property distanceMetric - Similarity metric used for queries + * @property metadataConfiguration - Configuration for metadata filtering + * @property creationTime - Unix timestamp of when the index was created + */ +interface VectorIndex { + indexName: string; + vectorBucketName: string; + dataType: VectorDataType; + dimension: number; + distanceMetric: DistanceMetric; + metadataConfiguration?: MetadataConfiguration; + creationTime?: number; +} +/** + * Vector data representation + * Vectors must be float32 arrays with dimensions matching the index + * @property float32 - Array of 32-bit floating point numbers + */ +interface VectorData { + float32: number[]; +} +/** + * Arbitrary JSON metadata attached to vectors + * Keys configured as non-filterable in the index can be stored but not queried + */ +type VectorMetadata = Record; +/** + * Single vector object for insertion/update + * @property key - Unique identifier for the vector + * @property data - Vector embedding data + * @property metadata - Optional arbitrary metadata + */ +interface VectorObject { + key: string; + data: VectorData; + metadata?: VectorMetadata; +} +/** + * Vector object returned from queries with optional distance + * @property key - Unique identifier for the vector + * @property data - Vector embedding data (if requested) + * @property metadata - Arbitrary metadata (if requested) + * @property distance - Similarity distance from query vector (if requested) + */ +interface VectorMatch { + key: string; + data?: VectorData; + metadata?: VectorMetadata; + distance?: number; +} +/** + * Options for fetching vector buckets + * @property prefix - Filter buckets by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +interface ListVectorBucketsOptions { + prefix?: string; + maxResults?: number; + nextToken?: string; +} +/** + * Response from listing vector buckets + * @property vectorBuckets - Array of bucket names + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListVectorBucketsResponse { + vectorBuckets: { + vectorBucketName: string; + }[]; + nextToken?: string; +} +/** + * Options for listing indexes within a bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property prefix - Filter indexes by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +interface ListIndexesOptions { + vectorBucketName: string; + prefix?: string; + maxResults?: number; + nextToken?: string; +} +/** + * Response from listing indexes + * @property indexes - Array of index names + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListIndexesResponse { + indexes: { + indexName: string; + }[]; + nextToken?: string; +} +/** + * Options for batch reading vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to retrieve + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + */ +interface GetVectorsOptions { + vectorBucketName: string; + indexName: string; + keys: string[]; + returnData?: boolean; + returnMetadata?: boolean; +} +/** + * Response from getting vectors + * @property vectors - Array of retrieved vector objects + */ +interface GetVectorsResponse { + vectors: VectorMatch[]; +} +/** + * Options for batch inserting/updating vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property vectors - Array of vectors to insert/upsert (1-500 items) + */ +interface PutVectorsOptions { + vectorBucketName: string; + indexName: string; + vectors: VectorObject[]; +} +/** + * Options for batch deleting vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to delete (1-500 items) + */ +interface DeleteVectorsOptions { + vectorBucketName: string; + indexName: string; + keys: string[]; +} +/** + * Options for listing/scanning vectors in an index + * Supports parallel scanning via segment configuration + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property maxResults - Maximum number of results to return (default: 500, max: 1000) + * @property nextToken - Token for pagination from previous response + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + * @property segmentCount - Total number of parallel segments (1-16) + * @property segmentIndex - Zero-based index of this segment (0 to segmentCount-1) + */ +interface ListVectorsOptions { + vectorBucketName: string; + indexName: string; + maxResults?: number; + nextToken?: string; + returnData?: boolean; + returnMetadata?: boolean; + segmentCount?: number; + segmentIndex?: number; +} +/** + * Response from listing vectors + * @property vectors - Array of vector objects + * @property nextToken - Token for fetching next page (if more results exist) + */ +interface ListVectorsResponse { + vectors: VectorMatch[]; + nextToken?: string; +} +/** + * JSON filter expression for metadata filtering + * Format and syntax depend on the S3 Vectors service implementation + */ +type VectorFilter = Record; +/** + * Options for querying similar vectors (ANN search) + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property queryVector - Query vector to find similar vectors + * @property topK - Number of nearest neighbors to return (default: 10) + * @property filter - Optional JSON filter for metadata + * @property returnDistance - Whether to include distance scores + * @property returnMetadata - Whether to include metadata in results + */ +interface QueryVectorsOptions { + vectorBucketName: string; + indexName: string; + queryVector: VectorData; + topK?: number; + filter?: VectorFilter; + returnDistance?: boolean; + returnMetadata?: boolean; +} +/** + * Response from vector similarity query + * @property vectors - Array of similar vectors ordered by distance + * @property distanceMetric - The distance metric used for the similarity search + */ +interface QueryVectorsResponse { + vectors: VectorMatch[]; + distanceMetric?: DistanceMetric; +} +/** + * Fetch-specific parameters like abort signals + * @property signal - AbortSignal for cancelling requests + */ +interface VectorFetchParameters { + signal?: AbortSignal; +} +/** + * Standard response wrapper for successful operations + * @property data - Response data of type T + * @property error - Null on success + */ +interface SuccessResponse { + data: T; + error: null; +} +/** + * Standard response wrapper for failed operations + * @property data - Null on error + * @property error - StorageError with details (named StorageVectorsError for vector operations) + */ +interface ErrorResponse { + data: null; + error: StorageError; +} +/** + * Union type for all API responses + * Follows the pattern: { data: T, error: null } | { data: null, error: Error } + */ +type ApiResponse = SuccessResponse | ErrorResponse; +//#endregion +//#region src/lib/common/fetch.d.ts +type Fetch = typeof fetch; +//#endregion +//#region src/lib/common/BaseApiClient.d.ts +/** + * @ignore + * Base API client class for all Storage API classes + * Provides common infrastructure for error handling and configuration + * + * @typeParam TError - The error type (StorageError or subclass) + */ +declare abstract class BaseApiClient { + protected url: string; + protected headers: { + [key: string]: string; + }; + protected fetch: Fetch; + protected shouldThrowOnError: boolean; + protected namespace: ErrorNamespace; + /** + * Creates a new BaseApiClient instance + * @param url - Base URL for API requests + * @param headers - Default headers for API requests + * @param fetch - Optional custom fetch implementation + * @param namespace - Error namespace ('storage' or 'vectors') + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, namespace?: ErrorNamespace); + /** + * Enable throwing errors instead of returning them. + * When enabled, errors are thrown instead of returned in { data, error } format. + * + * @returns this - For method chaining + */ + throwOnError(): this; + /** + * Set an HTTP header for the request. + * Creates a shallow copy of headers to avoid mutating shared state. + * + * @param name - Header name + * @param value - Header value + * @returns this - For method chaining + */ + setHeader(name: string, value: string): this; + /** + * Handles API operation with standardized error handling + * Eliminates repetitive try-catch blocks across all API methods + * + * This wrapper: + * 1. Executes the operation + * 2. Returns { data, error: null } on success + * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false) + * 4. Throws error on failure (if shouldThrowOnError is true) + * + * @typeParam T - The expected data type from the operation + * @param operation - Async function that performs the API call + * @returns Promise with { data, error } tuple + * + * @example Handling an operation + * ```typescript + * async listBuckets() { + * return this.handleOperation(async () => { + * return await get(this.fetch, `${this.url}/bucket`, { + * headers: this.headers, + * }) + * }) + * } + * ``` + */ + protected handleOperation(operation: () => Promise): Promise<{ + data: T; + error: null; + } | { + data: null; + error: TError; + }>; +} +//#endregion +//#region src/packages/StreamDownloadBuilder.d.ts +declare class StreamDownloadBuilder implements Promise> { + private downloadFn; + private shouldThrowOnError; + readonly [Symbol.toStringTag]: string; + private promise; + constructor(downloadFn: () => Promise, shouldThrowOnError: boolean); + then, TResult2 = never>(onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise | TResult>; + finally(onfinally?: (() => void) | null): Promise>; + private getPromise; + private execute; +} +//#endregion +//#region src/packages/BlobDownloadBuilder.d.ts +declare class BlobDownloadBuilder implements Promise> { + private downloadFn; + private shouldThrowOnError; + readonly [Symbol.toStringTag]: string; + private promise; + constructor(downloadFn: () => Promise, shouldThrowOnError: boolean); + asStream(): StreamDownloadBuilder; + then, TResult2 = never>(onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | null): Promise | TResult>; + finally(onfinally?: (() => void) | null): Promise>; + private getPromise; + private execute; +} +//#endregion +//#region src/packages/StorageFileApi.d.ts +type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream | URLSearchParams | string; +declare class StorageFileApi extends BaseApiClient { + protected bucketId: string | undefined; + constructor(url: string, headers?: { + [key: string]: string; + }, bucketId?: string, fetch?: Fetch); + /** + * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one. + * + * @param method HTTP method. + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. + * @param fileBody The body of the file to be stored in the bucket. + */ + private uploadOrUpdate; + /** + * Uploads a file to an existing bucket. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Upload file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile, { + * cacheControl: '3600', + * upsert: false + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Upload file using `ArrayBuffer` from base64 file data + * ```js + * import { decode } from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @example Handling errors + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile) + * + * if (error) { + * // Log the full error so fields like `statusCode` and `error` (the + * // Storage error name, e.g. "Duplicate") aren't hidden behind `error.message`. + * console.error(error) + * return + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + upload(path: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{ + data: { + id: string; + path: string; + fullPath: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Upload a file with a token generated from `createSignedUploadUrl`. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param token The token generated from `createSignedUploadUrl` + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions HTTP headers (cacheControl, contentType, etc.). + * **Note:** The `upsert` option has no effect here. To enable upsert behavior, + * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead. + * @returns Promise with response containing file path and fullPath or error + * + * @example Upload to a signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "folder/cat.jpg", + * "fullPath": "avatars/folder/cat.jpg" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + uploadToSignedUrl(path: string, token: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{ + data: null; + error: StorageError; + } | { + data: { + path: string; + fullPath: any; + }; + error: null; + }>; + /** + * Creates a signed upload URL. + * Signed upload URLs can be used to upload files to the bucket without further authentication. + * They are valid for 2 hours. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param options.upsert If set to true, allows the file to be overwritten if it already exists. + * @returns Promise with response containing signed upload URL, token, and path or error + * + * @example Create Signed Upload URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUploadUrl('folder/cat.jpg') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=", + * "path": "folder/cat.jpg", + * "token": "" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUploadUrl(path: string, options?: { + upsert: boolean; + }): Promise<{ + data: { + signedUrl: string; + token: string; + path: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Replaces an existing file at the specified path with a new one. + * + * @category Storage + * @subcategory File Buckets + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata. + * **Note:** The `upsert` option has no effect here. `update()` always replaces the + * file at the given path, so the `x-upsert` header is not sent. To control upsert + * behavior, use `upload()` instead. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Update file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', avatarFile, { + * cacheControl: '3600' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Update file using `ArrayBuffer` from base64 file data + * ```js + * import {decode} from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - `update()` always replaces the file at the given path regardless of the `upsert` option. + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + update(path: string, fileBody: ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream | URLSearchParams | string, fileOptions?: FileOptions): Promise<{ + data: { + id: string; + path: string; + fullPath: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Moves an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-new.png`. + * @param options The destination options. + * @returns Promise with response containing success message or error + * + * @example Move file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .move('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully moved" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + move(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Copies an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`. + * @param options The destination options. + * @returns Promise with response containing copied file path or error + * + * @example Copy file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .copy('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "avatars/private/avatar2.png" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + copy(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{ + data: { + path: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing signed URL or error + * + * @example Create Signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * "error": null + * } + * ``` + * + * @example Create a signed URL for an asset with transformations + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Create a signed URL which triggers the download of the asset + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * download: true, + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUrl(path: string, expiresIn: number, options?: { + download?: string | boolean; + transform?: TransformOptions; + cacheNonce?: string; + }): Promise<{ + data: { + signedUrl: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. + * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. + * @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. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing array of objects with signedUrl, path, and error or error + * + * @example Create Signed URLs + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "error": null, + * "path": "folder/avatar1.png", + * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * { + * "error": null, + * "path": "folder/avatar2.png", + * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createSignedUrls(paths: string[], expiresIn: number, options?: { + download?: string | boolean; + cacheNonce?: string; + }): Promise<{ + data: { + error: string | null; + path: string | null; + signedURL: string | null; + signedUrl: string | null; + }[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead. + * + * @category Storage + * @subcategory File Buckets + * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`. + * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache. + * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control. + * @returns BlobDownloadBuilder instance for downloading the file + * + * @example Download file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": , + * "error": null + * } + * ``` + * + * @example Download file with transformations + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * quality: 80 + * } + * }) + * ``` + * + * @example Download with cache control (useful in Edge Functions) + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { cache: 'no-store' }) + * ``` + * + * @example Download with abort signal + * ```js + * const controller = new AbortController() + * setTimeout(() => controller.abort(), 5000) + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { signal: controller.signal }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + download(path: string, options?: Options, parameters?: FetchParameters): BlobDownloadBuilder; + /** + * Retrieves the details of an existing file. + * + * Returns detailed file metadata including size, content type, and timestamps. + * Note: The API returns `last_modified` field, not `updated_at`. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing file metadata or error + * + * @example Get file info + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .info('folder/avatar1.png') + * + * if (data) { + * console.log('Last modified:', data.lastModified) + * console.log('Size:', data.size) + * } + * ``` + */ + info(path: string): Promise<{ + data: Camelize; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Checks the existence of a file. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing boolean indicating file existence or error + * + * @example Check file existence + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .exists('folder/avatar1.png') + * ``` + */ + exists(path: string): Promise<{ + data: boolean; + error: null; + } | { + data: boolean; + error: StorageError; + }>; + /** + * 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. + * 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. + * + * @category Storage + * @subcategory File Buckets + * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Object with public URL + * + * @example Returns the URL for an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png" + * } + * } + * ``` + * + * @example Returns the URL for an asset in a public bucket with transformations + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Returns the URL which triggers the download of an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * download: true, + * }) + * ``` + * + * @remarks + * - 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" + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getPublicUrl(path: string, options?: { + download?: string | boolean; + transform?: TransformOptions; + cacheNonce?: string; + }): { + data: { + publicUrl: string; + }; + }; + /** + * Deletes files within the same bucket + * + * Returns an array of FileObject entries for the deleted files. Note that deprecated + * fields like `bucket_id` may or may not be present in the response - do not rely on them. + * + * @category Storage + * @subcategory File Buckets + * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. + * @returns Promise with response containing array of deleted file objects or error + * + * @example Delete file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .remove(['folder/avatar1.png']) + * ``` + * + * Response: + * ```json + * { + * "data": [], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `delete` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + remove(paths: string[]): Promise<{ + data: FileObject[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Purges the CDN cache for a single object in this bucket. + * + * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server + * issues a CDN invalidation for the object and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * Operates on a single object path. There is no wildcard or recursion: pass + * the exact path of the object you want invalidated. + * + * @category Storage + * @subcategory File Buckets + * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge a single cached object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png') + * ``` + * + * @example Purge only transformations for a single object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png', { transformations: true }) + * ``` + */ + purgeCache(path: string, options?: PurgeCacheOptions, parameters?: FetchParameters): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Get file metadata + * @param id the file id to retrieve metadata + */ + /** + * Update file metadata + * @param id the file id to update metadata + * @param meta the new file metadata + */ + /** + * Lists all the files and folders within a path of the bucket. + * + * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`, + * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated. + * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned + * by this method. + * + * @category Storage + * @subcategory File Buckets + * @param path The folder path. + * @param options Search options including limit (defaults to 100), offset, sortBy, and search + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing array of files/folders or error + * + * @example List files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * }) + * + * // Handle files vs folders + * data?.forEach(item => { + * if (item.id !== null) { + * // It's a file + * console.log('File:', item.name, 'Size:', item.metadata?.size) + * } else { + * // It's a folder + * console.log('Folder:', item.name) + * } + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "avatar1.png", + * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2", + * "updated_at": "2024-05-22T23:06:05.580Z", + * "created_at": "2024-05-22T23:04:34.443Z", + * "last_accessed_at": "2024-05-22T23:04:34.443Z", + * "metadata": { + * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"", + * "size": 32175, + * "mimetype": "image/png", + * "cacheControl": "max-age=3600", + * "lastModified": "2024-05-22T23:06:05.574Z", + * "contentLength": 32175, + * "httpStatusCode": 200 + * } + * } + * ], + * "error": null + * } + * ``` + * + * @example Search files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * search: 'jon' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + list(path?: string, options?: SearchOptions, parameters?: FetchParameters): Promise<{ + data: FileObject[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Lists all the files and folders within a bucket using the V2 API with pagination support. + * + * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` — + * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available + * on entries in the `objects` array. + * + * @experimental this method signature might change in the future + * + * @category Storage + * @subcategory File Buckets + * @param options Search options including prefix, cursor for pagination, limit, with_delimiter + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing folders/objects arrays with pagination info or error + * + * @example List files with pagination + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * limit: 100, + * }) + * + * // Handle pagination + * if (data?.hasNext) { + * const nextPage = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * cursor: data.nextCursor, + * }) + * } + * + * // Handle files vs folders + * data?.objects.forEach(file => { + * if (file.id !== null) { + * console.log('File:', file.name, 'Size:', file.metadata?.size) + * } + * }) + * data?.folders.forEach(folder => { + * console.log('Folder:', folder.name) + * }) + * ``` + */ + listV2(options?: SearchV2Options, parameters?: FetchParameters): Promise<{ + data: SearchV2Result; + error: null; + } | { + data: null; + error: StorageError; + }>; + protected encodeMetadata(metadata: Record): string; + toBase64(data: string): string; + private _getFinalPath; + private _removeEmptyFolders; + /** Modifies the `query`, appending values the from `transform` */ + private applyTransformOptsToQuery; +} +//#endregion +//#region src/packages/StorageBucketApi.d.ts +declare class StorageBucketApi extends BaseApiClient { + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, opts?: StorageClientOptions); + /** + * Retrieves the details of all Storage buckets within an existing project. + * + * @category Storage + * @subcategory File Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of buckets or error + * + * @example List buckets + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets() + * ``` + * + * @example List buckets with options + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc', + * search: 'prod' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + listBuckets(options?: ListBucketOptions): Promise<{ + data: Bucket[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Retrieves the details of an existing Storage bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to retrieve. + * @returns Promise with response containing bucket details or error + * + * @example Get bucket + * ```js + * const { data, error } = await supabase + * .storage + * .getBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "id": "avatars", + * "name": "avatars", + * "owner": "", + * "public": false, + * "file_size_limit": 1024, + * "allowed_mime_types": [ + * "image/png" + * ], + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getBucket(id: string): Promise<{ + data: Bucket; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Creates a new Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are creating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details. + * - default bucket type is `STANDARD` + * @returns Promise with response containing newly created bucket name or error + * + * @example Create bucket + * ```js + * const { data, error } = await supabase + * .storage + * .createBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "avatars" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `insert` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + createBucket(id: string, options?: { + public: boolean; + fileSizeLimit?: number | string | null; + allowedMimeTypes?: string[] | null; + type?: BucketType; + }): Promise<{ + data: Pick; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Updates a Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are updating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @returns Promise with response containing success message or error + * + * @example Update bucket + * ```js + * const { data, error } = await supabase + * .storage + * .updateBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully updated" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `update` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + updateBucket(id: string, options: { + public: boolean; + fileSizeLimit?: number | string | null; + allowedMimeTypes?: string[] | null; + }): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Removes all objects inside a single bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to empty. + * @returns Promise with success message or error + * + * @example Empty bucket + * ```js + * const { data, error } = await supabase + * .storage + * .emptyBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully emptied" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: `select` and `delete` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + emptyBucket(id: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. + * You must first `empty()` the bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to delete. + * @returns Promise with success message or error + * + * @example Delete bucket + * ```js + * const { data, error } = await supabase + * .storage + * .deleteBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `delete` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + deleteBucket(id: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * Purges the CDN cache for an entire bucket. + * + * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server + * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to purge from cache. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge cache for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars') + * ``` + * + * @example Purge only transformations for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars', { transformations: true }) + * ``` + */ + purgeBucketCache(id: string, options?: PurgeCacheOptions, parameters?: FetchParameters): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + private listBucketOptionsToQueryString; +} +//#endregion +//#region src/packages/StorageAnalyticsClient.d.ts +type WrapAsyncMethod = T extends ((...args: infer A) => Promise) ? (...args: A) => Promise<{ + data: R; + error: null; +} | { + data: null; + error: IcebergError; +}> : T; +type WrappedIcebergRestCatalog = { [K in keyof IcebergRestCatalog]: WrapAsyncMethod }; +/** + * Client class for managing Analytics Buckets using Iceberg tables + * Provides methods for creating, listing, and deleting analytics buckets + */ +declare class StorageAnalyticsClient extends BaseApiClient { + /** + * @alpha + * + * Creates a new StorageAnalyticsClient instance + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param url - The base URL for the storage API + * @param headers - HTTP headers to include in requests + * @param fetch - Optional custom fetch implementation + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.storage.analytics.listBuckets() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageAnalyticsClient } from '@supabase/storage-js' + * + * const client = new StorageAnalyticsClient(url, headers) + * ``` + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** + * @alpha + * + * Creates a new analytics bucket using Iceberg tables + * Analytics buckets are optimized for analytical queries and data processing + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param name A unique name for the bucket you are creating + * @returns Promise with response containing newly created analytics bucket or error + * + * @example Create analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Creates a new analytics bucket using Iceberg tables + * - Analytics buckets are optimized for analytical queries and data processing + */ + createBucket(name: string): Promise<{ + data: AnalyticBucket; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Retrieves the details of all Analytics Storage buckets within an existing project + * Only returns buckets of type 'ANALYTICS' + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of analytics buckets or error + * + * @example List analytics buckets + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - Retrieves the details of all Analytics Storage buckets within an existing project + * - Only returns buckets of type 'ANALYTICS' + */ + listBuckets(options?: { + limit?: number; + offset?: number; + sortColumn?: 'name' | 'created_at' | 'updated_at'; + sortOrder?: 'asc' | 'desc'; + search?: string; + }): Promise<{ + data: AnalyticBucket[]; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Deletes an existing analytics bucket + * A bucket can't be deleted with existing objects inside it + * You must first empty the bucket before deletion + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName The unique identifier of the bucket you would like to delete + * @returns Promise with response containing success message or error + * + * @example Delete analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .deleteBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Deletes an analytics bucket + */ + deleteBucket(bucketName: string): Promise<{ + data: { + message: string; + }; + error: null; + } | { + data: null; + error: StorageError; + }>; + /** + * @alpha + * + * Get an Iceberg REST Catalog client configured for a specific analytics bucket + * Use this to perform advanced table and namespace operations within the bucket + * The returned client provides full access to the Apache Iceberg REST Catalog API + * with the Supabase `{ data, error }` pattern for consistent error handling on all operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName - The name of the analytics bucket (warehouse) to connect to + * @returns The wrapped Iceberg catalog client + * @throws {StorageError} If the bucket name is invalid + * + * @example Get catalog and create table + * ```js + * // First, create an analytics bucket + * const { data: bucket, error: bucketError } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * + * // Get the Iceberg catalog for that bucket + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Create a namespace + * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] }) + * + * // Create a table with schema + * const { data: tableMetadata, error: tableError } = await catalog.createTable( + * { namespace: ['default'] }, + * { + * name: 'events', + * schema: { + * type: 'struct', + * fields: [ + * { id: 1, name: 'id', type: 'long', required: true }, + * { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + * { id: 3, name: 'user_id', type: 'string', required: false } + * ], + * 'schema-id': 0, + * 'identifier-field-ids': [1] + * }, + * 'partition-spec': { + * 'spec-id': 0, + * fields: [] + * }, + * 'write-order': { + * 'order-id': 0, + * fields: [] + * }, + * properties: { + * 'write.format.default': 'parquet' + * } + * } + * ) + * ``` + * + * @example List tables in namespace + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all tables in the default namespace + * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] }) + * if (listError) { + * if (listError.isNotFound()) { + * console.log('Namespace not found') + * } + * return + * } + * console.log(tables) // [{ namespace: ['default'], name: 'events' }] + * ``` + * + * @example Working with namespaces + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all namespaces + * const { data: namespaces } = await catalog.listNamespaces() + * + * // Create namespace with properties + * await catalog.createNamespace( + * { namespace: ['production'] }, + * { properties: { owner: 'data-team', env: 'prod' } } + * ) + * ``` + * + * @example Cleanup operations + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Drop table with purge option (removes all data) + * const { error: dropError } = await catalog.dropTable( + * { namespace: ['default'], name: 'events' }, + * { purge: true } + * ) + * + * if (dropError?.isNotFound()) { + * console.log('Table does not exist') + * } + * + * // Drop namespace (must be empty) + * await catalog.dropNamespace({ namespace: ['default'] }) + * ``` + * + * @remarks + * This method provides a bridge between Supabase's bucket management and the standard + * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter. + * All authentication and configuration is handled automatically using your Supabase credentials. + * + * **Error Handling**: Invalid bucket names throw immediately. All catalog + * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js. + * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling. + * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations. + * + * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently + * deletes all table data. Without it, the table is marked as deleted but data remains. + * + * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js. + * For complete API documentation and advanced usage, refer to the + * [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + */ + from(bucketName: string): WrappedIcebergRestCatalog; +} +//#endregion +//#region src/packages/VectorIndexApi.d.ts +/** + * @alpha + * + * Options for creating a vector index + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +interface CreateIndexOptions { + vectorBucketName: string; + indexName: string; + dataType: VectorDataType; + dimension: number; + distanceMetric: DistanceMetric; + metadataConfiguration?: MetadataConfiguration; +} +/** + * @hidden + * Base implementation for vector index operations. + * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead. + */ +declare class VectorIndexApi extends BaseApiClient { + /** Creates a new VectorIndexApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Creates a new vector index within a bucket */ + createIndex(options: CreateIndexOptions): Promise>; + /** Retrieves metadata for a specific vector index */ + getIndex(vectorBucketName: string, indexName: string): Promise>; + /** Lists vector indexes within a bucket with optional filtering and pagination */ + listIndexes(options: ListIndexesOptions): Promise>; + /** Deletes a vector index and all its data */ + deleteIndex(vectorBucketName: string, indexName: string): Promise>; +} +//#endregion +//#region src/packages/VectorDataApi.d.ts +/** + * @hidden + * Base implementation for vector data operations. + * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead. + */ +declare class VectorDataApi extends BaseApiClient { + /** Creates a new VectorDataApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Inserts or updates vectors in batch (1-500 per request) */ + putVectors(options: PutVectorsOptions): Promise>; + /** Retrieves vectors by their keys in batch */ + getVectors(options: GetVectorsOptions): Promise>; + /** Lists vectors in an index with pagination */ + listVectors(options: ListVectorsOptions): Promise>; + /** Queries for similar vectors using approximate nearest neighbor search */ + queryVectors(options: QueryVectorsOptions): Promise>; + /** Deletes vectors by their keys in batch (1-500 per request) */ + deleteVectors(options: DeleteVectorsOptions): Promise>; +} +//#endregion +//#region src/packages/VectorBucketApi.d.ts +/** + * @hidden + * Base implementation for vector bucket operations. + * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead. + */ +declare class VectorBucketApi extends BaseApiClient { + /** Creates a new VectorBucketApi instance */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch); + /** Creates a new vector bucket */ + createBucket(vectorBucketName: string): Promise>; + /** Retrieves metadata for a specific vector bucket */ + getBucket(vectorBucketName: string): Promise>; + /** Lists vector buckets with optional filtering and pagination */ + listBuckets(options?: ListVectorBucketsOptions): Promise>; + /** Deletes a vector bucket (must be empty first) */ + deleteBucket(vectorBucketName: string): Promise>; +} +//#endregion +//#region src/packages/StorageVectorsClient.d.ts +/** + * + * @alpha + * + * Configuration options for the Storage Vectors client + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +interface StorageVectorsClientOptions { + /** + * Custom headers to include in all requests + */ + headers?: { + [key: string]: string; + }; + /** + * Custom fetch implementation (optional) + * Useful for testing or custom request handling + */ + fetch?: Fetch; +} +/** + * + * @alpha + * + * Main client for interacting with S3 Vectors API + * Provides access to bucket, index, and vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * **Usage Patterns:** + * + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * + * // Access index operations via buckets + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine' + * }) + * + * // Access vector operations via index + * const index = bucket.index('documents') + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5, + * returnDistance: true + * }) + * ``` + */ +declare class StorageVectorsClient extends VectorBucketApi { + /** + * @alpha + * + * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param url - Base URL of the Storage Vectors REST API. + * @param options.headers - Optional headers (for example `Authorization`) applied to every request. + * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes. + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageVectorsClient } from '@supabase/storage-js' + * + * const client = new StorageVectorsClient(url, options) + * ``` + */ + constructor(url: string, options?: StorageVectorsClientOptions); + /** + * + * @alpha + * + * Access operations for a specific vector bucket + * Returns a scoped client for index and vector operations within the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Bucket-scoped client with index and vector operations + * + * @example Accessing a vector bucket + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + from(vectorBucketName: string): VectorBucketScope; + /** + * + * @alpha + * + * Creates a new vector bucket + * Vector buckets are containers for vector indexes and their data + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Unique name for the vector bucket + * @returns Promise with empty response on success or error + * + * @example Creating a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * ``` + */ + createBucket(vectorBucketName: string): Promise>; + /** + * + * @alpha + * + * Retrieves metadata for a specific vector bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Promise with bucket metadata or error + * + * @example Get bucket metadata + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .getBucket('embeddings-prod') + * + * console.log('Bucket created:', data?.vectorBucket.creationTime) + * ``` + */ + getBucket(vectorBucketName: string): Promise>; + /** + * + * @alpha + * + * Lists all vector buckets with optional filtering and pagination + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Optional filters (prefix, maxResults, nextToken) + * @returns Promise with list of buckets or error + * + * @example List vector buckets + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .listBuckets({ prefix: 'embeddings-' }) + * + * data?.vectorBuckets.forEach(bucket => { + * console.log(bucket.vectorBucketName) + * }) + * ``` + */ + listBuckets(options?: ListVectorBucketsOptions): Promise>; + /** + * + * @alpha + * + * Deletes a vector bucket (bucket must be empty) + * All indexes must be deleted before deleting the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket to delete + * @returns Promise with empty response on success or error + * + * @example Delete a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .deleteBucket('embeddings-old') + * ``` + */ + deleteBucket(vectorBucketName: string): Promise>; +} +/** + * + * @alpha + * + * Scoped client for operations within a specific vector bucket + * Provides index management and access to vector operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +declare class VectorBucketScope extends VectorIndexApi { + private vectorBucketName; + /** + * @alpha + * + * Creates a helper that automatically scopes all index operations to the provided bucket. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector bucket scope + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + constructor(url: string, headers: { + [key: string]: string; + }, vectorBucketName: string, fetch?: Fetch); + /** + * + * @alpha + * + * Creates a new vector index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Index configuration (vectorBucketName is automatically set) + * @returns Promise with empty response on success or error + * + * @example Creating a vector index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents-openai', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine', + * metadataConfiguration: { + * nonFilterableMetadataKeys: ['raw_text'] + * } + * }) + * ``` + */ + createIndex(options: Omit): Promise>; + /** + * + * @alpha + * + * Lists indexes in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (vectorBucketName is automatically set) + * @returns Promise with response containing indexes array and pagination token or error + * + * @example List indexes + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.listIndexes({ prefix: 'documents-' }) + * ``` + */ + listIndexes(options?: Omit): Promise>; + /** + * + * @alpha + * + * Retrieves metadata for a specific index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to retrieve + * @returns Promise with index metadata or error + * + * @example Get index metadata + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.getIndex('documents-openai') + * console.log('Dimension:', data?.index.dimension) + * ``` + */ + getIndex(indexName: string): Promise>; + /** + * + * @alpha + * + * Deletes an index from this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to delete + * @returns Promise with empty response on success or error + * + * @example Delete an index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.deleteIndex('old-index') + * ``` + */ + deleteIndex(indexName: string): Promise>; + /** + * + * @alpha + * + * Access operations for a specific index within this bucket + * Returns a scoped client for vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index + * @returns Index-scoped client with vector data operations + * + * @example Accessing an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * + * // Insert vectors + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5 + * }) + * ``` + */ + index(indexName: string): VectorIndexScope; +} +/** + * + * @alpha + * + * Scoped client for operations within a specific vector index + * Provides vector data operations (put, get, list, query, delete) + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +declare class VectorIndexScope extends VectorDataApi { + private vectorBucketName; + private indexName; + /** + * + * @alpha + * + * Creates a helper that automatically scopes all vector operations to the provided bucket/index names. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector index scope + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * ``` + */ + constructor(url: string, headers: { + [key: string]: string; + }, vectorBucketName: string, indexName: string, fetch?: Fetch); + /** + * + * @alpha + * + * Inserts or updates vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector insertion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Insert vectors into an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.putVectors({ + * vectors: [ + * { + * key: 'doc-1', + * data: { float32: [0.1, 0.2, ...] }, + * metadata: { title: 'Introduction', page: 1 } + * } + * ] + * }) + * ``` + */ + putVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Retrieves vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector retrieval options (bucket and index names automatically set) + * @returns Promise with response containing vectors array or error + * + * @example Get vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.getVectors({ + * keys: ['doc-1', 'doc-2'], + * returnMetadata: true + * }) + * ``` + */ + getVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Lists vectors in this index with pagination + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (bucket and index names automatically set) + * @returns Promise with response containing vectors array and pagination token or error + * + * @example List vectors with pagination + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.listVectors({ + * maxResults: 500, + * returnMetadata: true + * }) + * ``` + */ + listVectors(options?: Omit): Promise>; + /** + * + * @alpha + * + * Queries for similar vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Query options (bucket and index names automatically set) + * @returns Promise with response containing matches array of similar vectors ordered by distance or error + * + * @example Query similar vectors + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.queryVectors({ + * queryVector: { float32: [0.1, 0.2, ...] }, + * topK: 5, + * filter: { category: 'technical' }, + * returnDistance: true, + * returnMetadata: true + * }) + * ``` + */ + queryVectors(options: Omit): Promise>; + /** + * + * @alpha + * + * Deletes vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Deletion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Delete vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.deleteVectors({ + * keys: ['doc-1', 'doc-2', 'doc-3'] + * }) + * ``` + */ + deleteVectors(options: Omit): Promise>; +} +//#endregion +//#region src/StorageClient.d.ts +interface StorageClientOptions { + useNewHostname?: boolean; +} +declare class StorageClient extends StorageBucketApi { + /** + * Creates a client for Storage buckets, files, analytics, and vectors. + * + * @category Storage + * @subcategory File Buckets + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const avatars = supabase.storage.from('avatars') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import { StorageClient } from '@supabase/storage-js' + * + * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', { + * apikey: 'your-publishable-key', + * }) + * const avatars = storage.from('avatars') + * ``` + */ + constructor(url: string, headers?: { + [key: string]: string; + }, fetch?: Fetch, opts?: StorageClientOptions); + /** + * Perform file operation in a bucket. + * + * @category Storage + * @subcategory File Buckets + * + * @param id The bucket id to operate on. + * + * @example Accessing a bucket + * ```typescript + * const avatars = supabase.storage.from('avatars') + * ``` + */ + from(id: string): StorageFileApi; + /** + * + * @alpha + * + * Access vector storage operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * + * @returns A StorageVectorsClient instance configured with the current storage settings. + */ + get vectors(): StorageVectorsClient; + /** + * + * @alpha + * + * Access analytics storage operations using Iceberg tables. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * + * @returns A StorageAnalyticsClient instance configured with the current storage settings. + */ + get analytics(): StorageAnalyticsClient; +} +//#endregion +export { AnalyticBucket, ApiResponse, Bucket, BucketType, Camelize, type CreateIndexOptions, DeleteVectorsOptions, DestinationOptions, DistanceMetric, DownloadResult, EncryptionConfiguration, ErrorNamespace, ErrorResponse, FetchParameters, FileMetadata, FileObject, FileObjectV2, FileOptions, GetVectorsOptions, GetVectorsResponse, ListBucketOptions, ListIndexesOptions, ListIndexesResponse, ListVectorBucketsOptions, ListVectorBucketsResponse, ListVectorsOptions, ListVectorsResponse, Metadata, MetadataConfiguration, PurgeCacheOptions, PutVectorsOptions, QueryVectorsOptions, QueryVectorsResponse, SearchOptions, SearchV2Folder, SearchV2Object, SearchV2Options, SearchV2Result, SortBy, SortByV2, StorageAnalyticsClient, StorageApiError, StorageClient, type StorageClientOptions, StorageError, StorageUnknownError, StorageVectorsApiError, StorageVectorsClient, type StorageVectorsClientOptions, StorageVectorsError, StorageVectorsErrorCode, StorageVectorsUnknownError, SuccessResponse, TransformOptions, VectorBucket, VectorBucketApi, VectorBucketScope, VectorData, VectorDataApi, VectorDataType, VectorFetchParameters, VectorFilter, VectorIndex, VectorIndexApi, VectorIndexScope, VectorMatch, VectorMetadata, VectorObject, isStorageError, isStorageVectorsError }; +//# sourceMappingURL=index.d.mts.map \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.d.mts.map b/node_modules/@supabase/storage-js/dist/index.d.mts.map new file mode 100644 index 0000000000000000000000000000000000000000..674de60ee7a5229114fcbe6148e6c18723ec43a4 --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/common/errors.ts","../src/lib/types.ts","../src/lib/common/fetch.ts","../src/lib/common/BaseApiClient.ts","../src/packages/StreamDownloadBuilder.ts","../src/packages/BlobDownloadBuilder.ts","../src/packages/StorageFileApi.ts","../src/packages/StorageBucketApi.ts","../src/packages/StorageAnalyticsClient.ts","../src/packages/VectorIndexApi.ts","../src/packages/VectorDataApi.ts","../src/packages/VectorBucketApi.ts","../src/packages/StorageVectorsClient.ts","../src/StorageClient.ts"],"sourcesContent":[],"mappings":";;;;;;;AAIA;AAMa,KAND,cAAA,GAMc,SAAA,GAAA,SAAA;;;;;AAuCV,cAvCH,YAAA,SAAqB,KAAA,CAuCmC;EAQxD,UAAA,gBAAgB,EAAA,OAed;EA4BF,UAAA,SAAA,EAxFU,cA2F2C;EAerD,MAAA,EAAA,MAAA,GAAA,SAAoB;EAWjB,UAAA,EAAA,MAAA,GAAA,SAAqB;EAQxB,WAAA,CAAA,OAAA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AAA,MAAe,EAAA,OA4Df,CA5BN,EAAA;IAQM,CAAA,GAAA,EAAA,MAAA,CAAc,EAAA,MAAA;EAoBd,CAAA,EAAA,KAAA,CAAA,EY5OL,KZ4OK,EAAc,IAAA,CAAA,EY3OpB,oBZ2OoB;EAOd;AAOjB;AAmBA;AAIA;AA6BC;;;;;;;;;EAII,IAAA,CAAA,EAAA,EAAA,MAAA,CAAA,EY/Re,cZ+Rf;EAEO;;;;;;;;AAIZ;AAkBA;AAWA;AAWA;AAQA;EAKY,IAAA,OAAA,CAAA,CAAA,EYzUK,oBZyUS;EAYT;;;;;AAejB;AAQA;AAQA;AAaA;AAaA;AAWA;AAYA;AAYA;EAaiB,IAAA,SAAA,CAAA,CAAA,EY1aE,sBZ0ae;AAYlC"} \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.mjs b/node_modules/@supabase/storage-js/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..de7ffaade21c3724f2209fd94b01684beeef93a5 --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.mjs @@ -0,0 +1,3119 @@ +import { IcebergRestCatalog } from "iceberg-js"; + +//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) { + return typeof o$1; + } : function(o$1) { + return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1; + }, _typeof(o); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r$1) { + return Object.getOwnPropertyDescriptor(e, r$1).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) { + _defineProperty(e, r$1, t[r$1]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) { + Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1)); + }); + } + return e; +} + +//#endregion +//#region src/lib/common/errors.ts +/** +* Base error class for all Storage errors +* Supports both 'storage' and 'vectors' namespaces +*/ +var StorageError = class extends Error { + constructor(message, namespace = "storage", status, statusCode) { + super(message); + this.__isStorageError = true; + this.namespace = namespace; + this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError"; + this.status = status; + this.statusCode = statusCode; + } + toJSON() { + return { + name: this.name, + message: this.message, + status: this.status, + statusCode: this.statusCode + }; + } +}; +/** +* Type guard to check if an error is a StorageError +* @param error - The error to check +* @returns True if the error is a StorageError +*/ +function isStorageError(error) { + return typeof error === "object" && error !== null && "__isStorageError" in error; +} +/** +* API error returned from Storage service +* Includes HTTP status code and service-specific error code +*/ +var StorageApiError = class extends StorageError { + constructor(message, status, statusCode, namespace = "storage", code) { + super(message, namespace, status, statusCode); + this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError"; + this.status = status; + this.statusCode = statusCode; + this.code = code; + } + toJSON() { + return _objectSpread2(_objectSpread2({}, super.toJSON()), {}, { code: this.code }); + } +}; +/** +* Unknown error that doesn't match expected error patterns +* Wraps the original error for debugging +*/ +var StorageUnknownError = class extends StorageError { + constructor(message, originalError, namespace = "storage") { + super(message, namespace); + this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError"; + this.originalError = originalError; + } +}; +/** +* @deprecated Use StorageError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsError = class extends StorageError { + constructor(message) { + super(message, "vectors"); + } +}; +/** +* Type guard to check if an error is a StorageVectorsError +* @param error - The error to check +* @returns True if the error is a StorageVectorsError +*/ +function isStorageVectorsError(error) { + return isStorageError(error) && error["namespace"] === "vectors"; +} +/** +* @deprecated Use StorageApiError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsApiError = class extends StorageApiError { + constructor(message, status, statusCode) { + super(message, status, statusCode, "vectors"); + } +}; +/** +* @deprecated Use StorageUnknownError with namespace='vectors' instead +* Alias for backward compatibility with existing vector storage code +*/ +var StorageVectorsUnknownError = class extends StorageUnknownError { + constructor(message, originalError) { + super(message, originalError, "vectors"); + } +}; +/** +* Error codes specific to S3 Vectors API +* Maps AWS service errors to application-friendly error codes +*/ +let StorageVectorsErrorCode = /* @__PURE__ */ function(StorageVectorsErrorCode$1) { + /** Internal server fault (HTTP 500) */ + StorageVectorsErrorCode$1["InternalError"] = "InternalError"; + /** Resource already exists / conflict (HTTP 409) */ + StorageVectorsErrorCode$1["S3VectorConflictException"] = "S3VectorConflictException"; + /** Resource not found (HTTP 404) */ + StorageVectorsErrorCode$1["S3VectorNotFoundException"] = "S3VectorNotFoundException"; + /** Delete bucket while not empty (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorBucketNotEmpty"] = "S3VectorBucketNotEmpty"; + /** Exceeds bucket quota/limit (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorMaxBucketsExceeded"] = "S3VectorMaxBucketsExceeded"; + /** Exceeds index quota/limit (HTTP 400) */ + StorageVectorsErrorCode$1["S3VectorMaxIndexesExceeded"] = "S3VectorMaxIndexesExceeded"; + return StorageVectorsErrorCode$1; +}({}); + +//#endregion +//#region src/lib/common/headers.ts +/** +* Sets a header with case-insensitive deduplication. +* Removes any existing headers whose name matches (case-insensitive), +* then sets the value under the lowercase key. Does not mutate the input object. +* +* @param headers - Existing headers object +* @param name - Header name to set (stored as lowercase) +* @param value - Header value +* @returns New headers object with the header set +*/ +function setHeader(headers, name, value) { + const result = _objectSpread2({}, headers); + const nameLower = name.toLowerCase(); + for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key]; + result[nameLower] = value; + return result; +} +/** +* Normalizes all header keys to lowercase with case-insensitive deduplication. +* When duplicate keys exist (differing only in case), the last value wins. +* Does not mutate the input object. +* +* @param headers - Headers object to normalize +* @returns New headers object with all keys lowercased +*/ +function normalizeHeaders(headers) { + const result = {}; + for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value; + return result; +} + +//#endregion +//#region src/lib/common/helpers.ts +/** +* Resolves the fetch implementation to use +* Uses custom fetch if provided, otherwise uses native fetch +* +* @param customFetch - Optional custom fetch implementation +* @returns Resolved fetch function +*/ +const resolveFetch = (customFetch) => { + if (customFetch) return (...args) => customFetch(...args); + return (...args) => fetch(...args); +}; +/** +* Determine if input is a plain object +* An object is plain if it's created by either {}, new Object(), or Object.create(null) +* +* @param value - Value to check +* @returns True if value is a plain object +* @source https://github.com/sindresorhus/is-plain-obj +*/ +const isPlainObject = (value) => { + if (typeof value !== "object" || value === null) return false; + const prototype = Object.getPrototypeOf(value); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); +}; +/** +* Recursively converts object keys from snake_case to camelCase +* Used for normalizing API responses +* +* @param item - Object to convert +* @returns Converted object with camelCase keys +*/ +const recursiveToCamel = (item) => { + if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el)); + else if (typeof item === "function" || item !== Object(item)) return item; + const result = {}; + Object.entries(item).forEach(([key, value]) => { + const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, "")); + result[newKey] = recursiveToCamel(value); + }); + return result; +}; +/** +* Validates if a given bucket name is valid according to Supabase Storage API rules +* Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName() +* +* Rules: +* - Length: 1-100 characters +* - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters +* - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ? +* - Forbidden: path separators (/, \), path traversal (..), leading/trailing whitespace +* +* AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html +* +* @param bucketName - The bucket name to validate +* @returns true if valid, false otherwise +*/ +const isValidBucketName = (bucketName) => { + if (!bucketName || typeof bucketName !== "string") return false; + if (bucketName.length === 0 || bucketName.length > 100) return false; + if (bucketName.trim() !== bucketName) return false; + if (bucketName.includes("/") || bucketName.includes("\\")) return false; + return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName); +}; +/** +* Percent-encodes each segment of a storage path so URL delimiters within a +* key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start. +* +* Splits on `/` so real path separators stay literal — the storage server +* routes on them and decodes each segment back to the original key. +* +* @param path - A bucket id or `bucketId/objectKey` path +* @returns The path with each `/`-delimited segment percent-encoded +*/ +const encodeStoragePath = (path) => path.split("/").map(encodeURIComponent).join("/"); + +//#endregion +//#region src/lib/common/fetch.ts +/** +* Extracts error message from various error response formats +* @param err - Error object from API +* @returns Human-readable error message +*/ +const _getErrorMessage = (err) => { + if (typeof err === "object" && err !== null) { + const e = err; + if (typeof e.msg === "string") return e.msg; + if (typeof e.message === "string") return e.message; + if (typeof e.error_description === "string") return e.error_description; + if (typeof e.error === "string") return e.error; + if (typeof e.error === "object" && e.error !== null) { + const nested = e.error; + if (typeof nested.message === "string") return nested.message; + } + } + return JSON.stringify(err); +}; +/** +* Handles fetch errors and converts them to Storage error types +* @param error - The error caught from fetch +* @param reject - Promise rejection function +* @param options - Fetch options that may affect error handling +* @param namespace - Error namespace ('storage' or 'vectors') +*/ +const handleError = async (error, reject, options, namespace) => { + if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") { + const responseError = error; + let status = parseInt(String(responseError.status), 10); + if (!Number.isFinite(status)) status = 500; + responseError.json().then((err) => { + const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + ""; + reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace, err === null || err === void 0 ? void 0 : err.code)); + }).catch(() => { + const statusCode = status + ""; + reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace)); + }); + } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace)); +}; +/** +* Builds request parameters for fetch calls +* @param method - HTTP method +* @param options - Custom fetch options +* @param parameters - Additional fetch parameters like AbortSignal +* @param body - Request body (will be JSON stringified if plain object) +* @returns Complete fetch request parameters +*/ +const _getRequestParams = (method, options, parameters, body) => { + const params = { + method, + headers: (options === null || options === void 0 ? void 0 : options.headers) || {} + }; + if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters); + if (isPlainObject(body)) { + var _contentType; + const headers = (options === null || options === void 0 ? void 0 : options.headers) || {}; + let contentType; + for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value; + params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json"); + params.body = JSON.stringify(body); + } else params.body = body; + if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex; + return _objectSpread2(_objectSpread2({}, params), parameters); +}; +/** +* Internal request handler that wraps fetch with error handling +* @param fetcher - Fetch function to use +* @param method - HTTP method +* @param url - Request URL +* @param options - Custom fetch options +* @param parameters - Additional fetch parameters +* @param body - Request body +* @param namespace - Error namespace ('storage' or 'vectors') +* @returns Promise with parsed response or error +*/ +async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) { + return new Promise((resolve, reject) => { + fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => { + if (!result.ok) throw result; + if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result; + if (namespace === "vectors") { + const contentType = result.headers.get("content-type"); + if (result.headers.get("content-length") === "0" || result.status === 204) return {}; + if (!contentType || !contentType.includes("application/json")) return {}; + } + return result.json(); + }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace)); + }); +} +/** +* Creates a fetch API with the specified namespace +* @param namespace - Error namespace ('storage' or 'vectors') +* @returns Object with HTTP method functions +*/ +function createFetchApi(namespace = "storage") { + return { + get: async (fetcher, url, options, parameters) => { + return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace); + }, + post: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace); + }, + put: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace); + }, + head: async (fetcher, url, options, parameters) => { + return _handleRequest(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace); + }, + remove: async (fetcher, url, body, options, parameters) => { + return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace); + } + }; +} +const defaultApi = createFetchApi("storage"); +const { get, post, put, head, remove } = defaultApi; +const vectorsApi = createFetchApi("vectors"); + +//#endregion +//#region src/lib/common/BaseApiClient.ts +/** +* @ignore +* Base API client class for all Storage API classes +* Provides common infrastructure for error handling and configuration +* +* @typeParam TError - The error type (StorageError or subclass) +*/ +var BaseApiClient = class { + /** + * Creates a new BaseApiClient instance + * @param url - Base URL for API requests + * @param headers - Default headers for API requests + * @param fetch - Optional custom fetch implementation + * @param namespace - Error namespace ('storage' or 'vectors') + */ + constructor(url, headers = {}, fetch$1, namespace = "storage") { + this.shouldThrowOnError = false; + this.url = url; + this.headers = normalizeHeaders(headers); + this.fetch = resolveFetch(fetch$1); + this.namespace = namespace; + } + /** + * Enable throwing errors instead of returning them. + * When enabled, errors are thrown instead of returned in { data, error } format. + * + * @returns this - For method chaining + */ + throwOnError() { + this.shouldThrowOnError = true; + return this; + } + /** + * Set an HTTP header for the request. + * Creates a shallow copy of headers to avoid mutating shared state. + * + * @param name - Header name + * @param value - Header value + * @returns this - For method chaining + */ + setHeader(name, value) { + this.headers = setHeader(this.headers, name, value); + return this; + } + /** + * Handles API operation with standardized error handling + * Eliminates repetitive try-catch blocks across all API methods + * + * This wrapper: + * 1. Executes the operation + * 2. Returns { data, error: null } on success + * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false) + * 4. Throws error on failure (if shouldThrowOnError is true) + * + * @typeParam T - The expected data type from the operation + * @param operation - Async function that performs the API call + * @returns Promise with { data, error } tuple + * + * @example Handling an operation + * ```typescript + * async listBuckets() { + * return this.handleOperation(async () => { + * return await get(this.fetch, `${this.url}/bucket`, { + * headers: this.headers, + * }) + * }) + * } + * ``` + */ + async handleOperation(operation) { + var _this = this; + try { + return { + data: await operation(), + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/StreamDownloadBuilder.ts +let _Symbol$toStringTag$1; +_Symbol$toStringTag$1 = Symbol.toStringTag; +var StreamDownloadBuilder = class { + constructor(downloadFn, shouldThrowOnError) { + this.downloadFn = downloadFn; + this.shouldThrowOnError = shouldThrowOnError; + this[_Symbol$toStringTag$1] = "StreamDownloadBuilder"; + this.promise = null; + } + then(onfulfilled, onrejected) { + return this.getPromise().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.getPromise().catch(onrejected); + } + finally(onfinally) { + return this.getPromise().finally(onfinally); + } + getPromise() { + if (!this.promise) this.promise = this.execute(); + return this.promise; + } + async execute() { + var _this = this; + try { + return { + data: (await _this.downloadFn()).body, + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/BlobDownloadBuilder.ts +let _Symbol$toStringTag; +_Symbol$toStringTag = Symbol.toStringTag; +var BlobDownloadBuilder = class { + constructor(downloadFn, shouldThrowOnError) { + this.downloadFn = downloadFn; + this.shouldThrowOnError = shouldThrowOnError; + this[_Symbol$toStringTag] = "BlobDownloadBuilder"; + this.promise = null; + } + asStream() { + return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError); + } + then(onfulfilled, onrejected) { + return this.getPromise().then(onfulfilled, onrejected); + } + catch(onrejected) { + return this.getPromise().catch(onrejected); + } + finally(onfinally) { + return this.getPromise().finally(onfinally); + } + getPromise() { + if (!this.promise) this.promise = this.execute(); + return this.promise; + } + async execute() { + var _this = this; + try { + return { + data: await (await _this.downloadFn()).blob(), + error: null + }; + } catch (error) { + if (_this.shouldThrowOnError) throw error; + if (isStorageError(error)) return { + data: null, + error + }; + throw error; + } + } +}; + +//#endregion +//#region src/packages/StorageFileApi.ts +const DEFAULT_SEARCH_OPTIONS = { + limit: 100, + offset: 0, + sortBy: { + column: "name", + order: "asc" + } +}; +const DEFAULT_FILE_OPTIONS = { + cacheControl: "3600", + contentType: "text/plain;charset=UTF-8", + upsert: false +}; +var StorageFileApi = class extends BaseApiClient { + constructor(url, headers = {}, bucketId, fetch$1) { + super(url, headers, fetch$1, "storage"); + this.bucketId = bucketId; + } + /** + * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one. + * + * @param method HTTP method. + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. + * @param fileBody The body of the file to be stored in the bucket. + */ + async uploadOrUpdate(method, path, fileBody, fileOptions) { + var _this = this; + return _this.handleOperation(async () => { + let body; + const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions); + let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) }); + const metadata = options.metadata; + if (typeof Blob !== "undefined" && fileBody instanceof Blob) { + body = new FormData(); + body.append("cacheControl", options.cacheControl); + if (metadata) body.append("metadata", _this.encodeMetadata(metadata)); + body.append("", fileBody); + } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) { + body = fileBody; + if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl); + if (metadata && !body.has("metadata")) body.append("metadata", _this.encodeMetadata(metadata)); + } else { + body = fileBody; + headers["cache-control"] = `max-age=${options.cacheControl}`; + headers["content-type"] = options.contentType; + if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata)); + if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half"; + } + if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value); + const cleanPath = _this._removeEmptyFolders(path); + const _path = _this._getFinalPath(cleanPath); + 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 } : {})); + return { + path: cleanPath, + id: data.Id, + fullPath: data.Key + }; + }); + } + /** + * Uploads a file to an existing bucket. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Upload file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile, { + * cacheControl: '3600', + * upsert: false + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Upload file using `ArrayBuffer` from base64 file data + * ```js + * import { decode } from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @example Handling errors + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile) + * + * if (error) { + * // Log the full error so fields like `statusCode` and `error` (the + * // Storage error name, e.g. "Duplicate") aren't hidden behind `error.message`. + * console.error(error) + * return + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async upload(path, fileBody, fileOptions) { + return this.uploadOrUpdate("POST", path, fileBody, fileOptions); + } + /** + * Upload a file with a token generated from `createSignedUploadUrl`. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param token The token generated from `createSignedUploadUrl` + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions HTTP headers (cacheControl, contentType, etc.). + * **Note:** The `upsert` option has no effect here. To enable upsert behavior, + * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead. + * @returns Promise with response containing file path and fullPath or error + * + * @example Upload to a signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "folder/cat.jpg", + * "fullPath": "avatars/folder/cat.jpg" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async uploadToSignedUrl(path, token, fileBody, fileOptions) { + var _this3 = this; + const cleanPath = _this3._removeEmptyFolders(path); + const _path = _this3._getFinalPath(cleanPath); + const url = new URL(_this3.url + `/object/upload/sign/${_path}`); + url.searchParams.set("token", token); + return _this3.handleOperation(async () => { + let body; + const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions); + let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) }); + const metadata = options.metadata; + if (typeof Blob !== "undefined" && fileBody instanceof Blob) { + body = new FormData(); + body.append("cacheControl", options.cacheControl); + if (metadata) body.append("metadata", _this3.encodeMetadata(metadata)); + body.append("", fileBody); + } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) { + body = fileBody; + if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl); + if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata)); + } else { + body = fileBody; + headers["cache-control"] = `max-age=${options.cacheControl}`; + headers["content-type"] = options.contentType; + if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata)); + if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half"; + } + if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value); + return { + path: cleanPath, + fullPath: (await put(_this3.fetch, url.toString(), body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}))).Key + }; + }); + } + /** + * Creates a signed upload URL. + * Signed upload URLs can be used to upload files to the bucket without further authentication. + * They are valid for 2 hours. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param options.upsert If set to true, allows the file to be overwritten if it already exists. + * @returns Promise with response containing signed upload URL, token, and path or error + * + * @example Create Signed Upload URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUploadUrl('folder/cat.jpg') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=", + * "path": "folder/cat.jpg", + * "token": "" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUploadUrl(path, options) { + var _this4 = this; + return _this4.handleOperation(async () => { + let _path = _this4._getFinalPath(path); + const headers = _objectSpread2({}, _this4.headers); + if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true"; + const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers }); + const url = new URL(_this4.url + data.url); + const token = url.searchParams.get("token"); + if (!token) throw new StorageError("No token returned by API"); + return { + signedUrl: url.toString(), + path, + token + }; + }); + } + /** + * Replaces an existing file at the specified path with a new one. + * + * @category Storage + * @subcategory File Buckets + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata. + * **Note:** The `upsert` option has no effect here. `update()` always replaces the + * file at the given path, so the `x-upsert` header is not sent. To control upsert + * behavior, use `upload()` instead. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Update file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', avatarFile, { + * cacheControl: '3600' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Update file using `ArrayBuffer` from base64 file data + * ```js + * import {decode} from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - `update()` always replaces the file at the given path regardless of the `upsert` option. + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async update(path, fileBody, fileOptions) { + return this.uploadOrUpdate("PUT", path, fileBody, fileOptions); + } + /** + * Moves an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-new.png`. + * @param options The destination options. + * @returns Promise with response containing success message or error + * + * @example Move file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .move('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully moved" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async move(fromPath, toPath, options) { + var _this6 = this; + return _this6.handleOperation(async () => { + return await post(_this6.fetch, `${_this6.url}/object/move`, { + bucketId: _this6.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket + }, { headers: _this6.headers }); + }); + } + /** + * Copies an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`. + * @param options The destination options. + * @returns Promise with response containing copied file path or error + * + * @example Copy file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .copy('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "avatars/private/avatar2.png" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async copy(fromPath, toPath, options) { + var _this7 = this; + return _this7.handleOperation(async () => { + return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, { + bucketId: _this7.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket + }, { headers: _this7.headers })).Key }; + }); + } + /** + * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing signed URL or error + * + * @example Create Signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * "error": null + * } + * ``` + * + * @example Create a signed URL for an asset with transformations + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Create a signed URL which triggers the download of the asset + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * download: true, + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrl(path, expiresIn, options) { + var _this8 = this; + return _this8.handleOperation(async () => { + let _path = _this8._getFinalPath(path); + const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0; + let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers }); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) }; + }); + } + /** + * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. + * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. + * @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. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing array of objects with signedUrl, path, and error or error + * + * @example Create Signed URLs + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "error": null, + * "path": "folder/avatar1.png", + * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * { + * "error": null, + * "path": "folder/avatar2.png", + * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrls(paths, expiresIn, options) { + var _this9 = this; + return _this9.handleOperation(async () => { + const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, { + expiresIn, + paths + }, { headers: _this9.headers }); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null })); + }); + } + /** + * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead. + * + * @category Storage + * @subcategory File Buckets + * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`. + * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache. + * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control. + * @returns BlobDownloadBuilder instance for downloading the file + * + * @example Download file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": , + * "error": null + * } + * ``` + * + * @example Download file with transformations + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * quality: 80 + * } + * }) + * ``` + * + * @example Download with cache control (useful in Edge Functions) + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { cache: 'no-store' }) + * ``` + * + * @example Download with abort signal + * ```js + * const controller = new AbortController() + * setTimeout(() => controller.abort(), 5000) + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { signal: controller.signal }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + download(path, options, parameters) { + 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"; + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + const _path = this._getFinalPath(path); + const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, { + headers: this.headers, + noResolveJson: true + }, parameters); + return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError); + } + /** + * Retrieves the details of an existing file. + * + * Returns detailed file metadata including size, content type, and timestamps. + * Note: The API returns `last_modified` field, not `updated_at`. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing file metadata or error + * + * @example Get file info + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .info('folder/avatar1.png') + * + * if (data) { + * console.log('Last modified:', data.lastModified) + * console.log('Size:', data.size) + * } + * ``` + */ + async info(path) { + var _this10 = this; + const _path = _this10._getFinalPath(path); + return _this10.handleOperation(async () => { + return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers })); + }); + } + /** + * Checks the existence of a file. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing boolean indicating file existence or error + * + * @example Check file existence + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .exists('folder/avatar1.png') + * ``` + */ + async exists(path) { + var _this11 = this; + const _path = _this11._getFinalPath(path); + try { + await head(_this11.fetch, `${_this11.url}/object/${_path}`, { headers: _this11.headers }); + return { + data: true, + error: null + }; + } catch (error) { + if (_this11.shouldThrowOnError) throw error; + if (isStorageError(error)) { + var _error$originalError; + 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; + if (status !== void 0 && [400, 404].includes(status)) return { + data: false, + error + }; + } + throw error; + } + } + /** + * 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. + * 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. + * + * @category Storage + * @subcategory File Buckets + * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Object with public URL + * + * @example Returns the URL for an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png" + * } + * } + * ``` + * + * @example Returns the URL for an asset in a public bucket with transformations + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Returns the URL which triggers the download of an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * download: true, + * }) + * ``` + * + * @remarks + * - 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" + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getPublicUrl(path, options) { + const _path = this._getFinalPath(path); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download); + if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform); + if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce)); + const queryString = query.toString(); + 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"; + return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } }; + } + /** + * Deletes files within the same bucket + * + * Returns an array of FileObject entries for the deleted files. Note that deprecated + * fields like `bucket_id` may or may not be present in the response - do not rely on them. + * + * @category Storage + * @subcategory File Buckets + * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. + * @returns Promise with response containing array of deleted file objects or error + * + * @example Delete file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .remove(['folder/avatar1.png']) + * ``` + * + * Response: + * ```json + * { + * "data": [], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `delete` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async remove(paths) { + var _this12 = this; + return _this12.handleOperation(async () => { + return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers }); + }); + } + /** + * Purges the CDN cache for a single object in this bucket. + * + * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server + * issues a CDN invalidation for the object and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * Operates on a single object path. There is no wildcard or recursion: pass + * the exact path of the object you want invalidated. + * + * @category Storage + * @subcategory File Buckets + * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge a single cached object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png') + * ``` + * + * @example Purge only transformations for a single object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png', { transformations: true }) + * ``` + */ + async purgeCache(path, options, parameters) { + var _this13 = this; + return _this13.handleOperation(async () => { + const _path = encodeStoragePath(_this13._getFinalPath(path)); + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true"); + const queryString = query.toString(); + return await remove(_this13.fetch, `${_this13.url}/cdn/${_path}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this13.headers }, parameters); + }); + } + /** + * Get file metadata + * @param id the file id to retrieve metadata + */ + /** + * Update file metadata + * @param id the file id to update metadata + * @param meta the new file metadata + */ + /** + * Lists all the files and folders within a path of the bucket. + * + * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`, + * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated. + * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned + * by this method. + * + * @category Storage + * @subcategory File Buckets + * @param path The folder path. + * @param options Search options including limit (defaults to 100), offset, sortBy, and search + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing array of files/folders or error + * + * @example List files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * }) + * + * // Handle files vs folders + * data?.forEach(item => { + * if (item.id !== null) { + * // It's a file + * console.log('File:', item.name, 'Size:', item.metadata?.size) + * } else { + * // It's a folder + * console.log('Folder:', item.name) + * } + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "avatar1.png", + * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2", + * "updated_at": "2024-05-22T23:06:05.580Z", + * "created_at": "2024-05-22T23:04:34.443Z", + * "last_accessed_at": "2024-05-22T23:04:34.443Z", + * "metadata": { + * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"", + * "size": 32175, + * "mimetype": "image/png", + * "cacheControl": "max-age=3600", + * "lastModified": "2024-05-22T23:06:05.574Z", + * "contentLength": 32175, + * "httpStatusCode": 200 + * } + * } + * ], + * "error": null + * } + * ``` + * + * @example Search files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * search: 'jon' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async list(path, options, parameters) { + var _this14 = this; + return _this14.handleOperation(async () => { + const sortBy = (options === null || options === void 0 ? void 0 : options.sortBy) ? _objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS.sortBy), options.sortBy) : DEFAULT_SEARCH_OPTIONS.sortBy; + const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { + sortBy, + prefix: path || "" + }); + return await post(_this14.fetch, `${_this14.url}/object/list/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters); + }); + } + /** + * Lists all the files and folders within a bucket using the V2 API with pagination support. + * + * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` — + * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available + * on entries in the `objects` array. + * + * @experimental this method signature might change in the future + * + * @category Storage + * @subcategory File Buckets + * @param options Search options including prefix, cursor for pagination, limit, with_delimiter + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing folders/objects arrays with pagination info or error + * + * @example List files with pagination + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * limit: 100, + * }) + * + * // Handle pagination + * if (data?.hasNext) { + * const nextPage = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * cursor: data.nextCursor, + * }) + * } + * + * // Handle files vs folders + * data?.objects.forEach(file => { + * if (file.id !== null) { + * console.log('File:', file.name, 'Size:', file.metadata?.size) + * } + * }) + * data?.folders.forEach(folder => { + * console.log('Folder:', folder.name) + * }) + * ``` + */ + async listV2(options, parameters) { + var _this15 = this; + return _this15.handleOperation(async () => { + const body = _objectSpread2({}, options); + return await post(_this15.fetch, `${_this15.url}/object/list-v2/${_this15.bucketId}`, body, { headers: _this15.headers }, parameters); + }); + } + encodeMetadata(metadata) { + return JSON.stringify(metadata); + } + toBase64(data) { + if (typeof Buffer !== "undefined") return Buffer.from(data).toString("base64"); + return btoa(data); + } + _getFinalPath(path) { + return `${this.bucketId}/${path.replace(/^\/+/, "")}`; + } + _removeEmptyFolders(path) { + return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/"); + } + /** Modifies the `query`, appending values the from `transform` */ + applyTransformOptsToQuery(query, transform) { + if (transform.width) query.set("width", transform.width.toString()); + if (transform.height) query.set("height", transform.height.toString()); + if (transform.resize) query.set("resize", transform.resize); + if (transform.format) query.set("format", transform.format); + if (transform.quality) query.set("quality", transform.quality.toString()); + return query; + } +}; + +//#endregion +//#region src/lib/version.ts +const version = "2.112.3"; + +//#endregion +//#region src/lib/constants.ts +const DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version}` }; + +//#endregion +//#region src/packages/StorageBucketApi.ts +var StorageBucketApi = class extends BaseApiClient { + constructor(url, headers = {}, fetch$1, opts) { + const baseUrl = new URL(url); + if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) { + if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase."); + } + const finalUrl = baseUrl.href.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers); + super(finalUrl, finalHeaders, fetch$1, "storage"); + } + /** + * Retrieves the details of all Storage buckets within an existing project. + * + * @category Storage + * @subcategory File Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of buckets or error + * + * @example List buckets + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets() + * ``` + * + * @example List buckets with options + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc', + * search: 'prod' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async listBuckets(options) { + var _this = this; + return _this.handleOperation(async () => { + const queryString = _this.listBucketOptionsToQueryString(options); + return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers }); + }); + } + /** + * Retrieves the details of an existing Storage bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to retrieve. + * @returns Promise with response containing bucket details or error + * + * @example Get bucket + * ```js + * const { data, error } = await supabase + * .storage + * .getBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "id": "avatars", + * "name": "avatars", + * "owner": "", + * "public": false, + * "file_size_limit": 1024, + * "allowed_mime_types": [ + * "image/png" + * ], + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async getBucket(id) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers }); + }); + } + /** + * Creates a new Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are creating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details. + * - default bucket type is `STANDARD` + * @returns Promise with response containing newly created bucket name or error + * + * @example Create bucket + * ```js + * const { data, error } = await supabase + * .storage + * .createBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "avatars" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `insert` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createBucket(id, options = { public: false }) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await post(_this3.fetch, `${_this3.url}/bucket`, { + id, + name: id, + type: options.type, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes + }, { headers: _this3.headers }); + }); + } + /** + * Updates a Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are updating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @returns Promise with response containing success message or error + * + * @example Update bucket + * ```js + * const { data, error } = await supabase + * .storage + * .updateBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully updated" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `update` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async updateBucket(id, options) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, { + id, + name: id, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes + }, { headers: _this4.headers }); + }); + } + /** + * Removes all objects inside a single bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to empty. + * @returns Promise with success message or error + * + * @example Empty bucket + * ```js + * const { data, error } = await supabase + * .storage + * .emptyBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully emptied" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: `select` and `delete` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async emptyBucket(id) { + var _this5 = this; + return _this5.handleOperation(async () => { + return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers }); + }); + } + /** + * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. + * You must first `empty()` the bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to delete. + * @returns Promise with success message or error + * + * @example Delete bucket + * ```js + * const { data, error } = await supabase + * .storage + * .deleteBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `delete` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async deleteBucket(id) { + var _this6 = this; + return _this6.handleOperation(async () => { + return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers }); + }); + } + /** + * Purges the CDN cache for an entire bucket. + * + * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server + * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to purge from cache. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge cache for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars') + * ``` + * + * @example Purge only transformations for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars', { transformations: true }) + * ``` + */ + async purgeBucketCache(id, options, parameters) { + var _this7 = this; + return _this7.handleOperation(async () => { + const query = new URLSearchParams(); + if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true"); + const queryString = query.toString(); + return await remove(_this7.fetch, `${_this7.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters); + }); + } + listBucketOptionsToQueryString(options) { + const params = {}; + if (options) { + if ("limit" in options) params.limit = String(options.limit); + if ("offset" in options) params.offset = String(options.offset); + if (options.search) params.search = options.search; + if (options.sortColumn) params.sortColumn = options.sortColumn; + if (options.sortOrder) params.sortOrder = options.sortOrder; + } + return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : ""; + } +}; + +//#endregion +//#region src/packages/StorageAnalyticsClient.ts +/** +* Client class for managing Analytics Buckets using Iceberg tables +* Provides methods for creating, listing, and deleting analytics buckets +*/ +var StorageAnalyticsClient = class extends BaseApiClient { + /** + * @alpha + * + * Creates a new StorageAnalyticsClient instance + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param url - The base URL for the storage API + * @param headers - HTTP headers to include in requests + * @param fetch - Optional custom fetch implementation + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.storage.analytics.listBuckets() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageAnalyticsClient } from '@supabase/storage-js' + * + * const client = new StorageAnalyticsClient(url, headers) + * ``` + */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers); + super(finalUrl, finalHeaders, fetch$1, "storage"); + } + /** + * @alpha + * + * Creates a new analytics bucket using Iceberg tables + * Analytics buckets are optimized for analytical queries and data processing + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param name A unique name for the bucket you are creating + * @returns Promise with response containing newly created analytics bucket or error + * + * @example Create analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Creates a new analytics bucket using Iceberg tables + * - Analytics buckets are optimized for analytical queries and data processing + */ + async createBucket(name) { + var _this = this; + return _this.handleOperation(async () => { + return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers }); + }); + } + /** + * @alpha + * + * Retrieves the details of all Analytics Storage buckets within an existing project + * Only returns buckets of type 'ANALYTICS' + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of analytics buckets or error + * + * @example List analytics buckets + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - Retrieves the details of all Analytics Storage buckets within an existing project + * - Only returns buckets of type 'ANALYTICS' + */ + async listBuckets(options) { + var _this2 = this; + return _this2.handleOperation(async () => { + const queryParams = new URLSearchParams(); + if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString()); + if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString()); + if (options === null || options === void 0 ? void 0 : options.sortColumn) queryParams.set("sortColumn", options.sortColumn); + if (options === null || options === void 0 ? void 0 : options.sortOrder) queryParams.set("sortOrder", options.sortOrder); + if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search); + const queryString = queryParams.toString(); + const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`; + return await get(_this2.fetch, url, { headers: _this2.headers }); + }); + } + /** + * @alpha + * + * Deletes an existing analytics bucket + * A bucket can't be deleted with existing objects inside it + * You must first empty the bucket before deletion + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName The unique identifier of the bucket you would like to delete + * @returns Promise with response containing success message or error + * + * @example Delete analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .deleteBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Deletes an analytics bucket + */ + async deleteBucket(bucketName) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers }); + }); + } + /** + * @alpha + * + * Get an Iceberg REST Catalog client configured for a specific analytics bucket + * Use this to perform advanced table and namespace operations within the bucket + * The returned client provides full access to the Apache Iceberg REST Catalog API + * with the Supabase `{ data, error }` pattern for consistent error handling on all operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName - The name of the analytics bucket (warehouse) to connect to + * @returns The wrapped Iceberg catalog client + * @throws {StorageError} If the bucket name is invalid + * + * @example Get catalog and create table + * ```js + * // First, create an analytics bucket + * const { data: bucket, error: bucketError } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * + * // Get the Iceberg catalog for that bucket + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Create a namespace + * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] }) + * + * // Create a table with schema + * const { data: tableMetadata, error: tableError } = await catalog.createTable( + * { namespace: ['default'] }, + * { + * name: 'events', + * schema: { + * type: 'struct', + * fields: [ + * { id: 1, name: 'id', type: 'long', required: true }, + * { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + * { id: 3, name: 'user_id', type: 'string', required: false } + * ], + * 'schema-id': 0, + * 'identifier-field-ids': [1] + * }, + * 'partition-spec': { + * 'spec-id': 0, + * fields: [] + * }, + * 'write-order': { + * 'order-id': 0, + * fields: [] + * }, + * properties: { + * 'write.format.default': 'parquet' + * } + * } + * ) + * ``` + * + * @example List tables in namespace + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all tables in the default namespace + * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] }) + * if (listError) { + * if (listError.isNotFound()) { + * console.log('Namespace not found') + * } + * return + * } + * console.log(tables) // [{ namespace: ['default'], name: 'events' }] + * ``` + * + * @example Working with namespaces + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all namespaces + * const { data: namespaces } = await catalog.listNamespaces() + * + * // Create namespace with properties + * await catalog.createNamespace( + * { namespace: ['production'] }, + * { properties: { owner: 'data-team', env: 'prod' } } + * ) + * ``` + * + * @example Cleanup operations + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Drop table with purge option (removes all data) + * const { error: dropError } = await catalog.dropTable( + * { namespace: ['default'], name: 'events' }, + * { purge: true } + * ) + * + * if (dropError?.isNotFound()) { + * console.log('Table does not exist') + * } + * + * // Drop namespace (must be empty) + * await catalog.dropNamespace({ namespace: ['default'] }) + * ``` + * + * @remarks + * This method provides a bridge between Supabase's bucket management and the standard + * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter. + * All authentication and configuration is handled automatically using your Supabase credentials. + * + * **Error Handling**: Invalid bucket names throw immediately. All catalog + * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js. + * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling. + * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations. + * + * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently + * deletes all table data. Without it, the table is marked as deleted but data remains. + * + * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js. + * For complete API documentation and advanced usage, refer to the + * [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + */ + from(bucketName) { + var _this4 = this; + 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."); + const catalog = new IcebergRestCatalog({ + baseUrl: this.url, + catalogName: bucketName, + auth: { + type: "custom", + getHeaders: async () => _this4.headers + }, + fetch: this.fetch + }); + const shouldThrowOnError = this.shouldThrowOnError; + return new Proxy(catalog, { get(target, prop) { + const value = target[prop]; + if (typeof value !== "function") return value; + return async (...args) => { + try { + return { + data: await value.apply(target, args), + error: null + }; + } catch (error) { + if (shouldThrowOnError) throw error; + return { + data: null, + error + }; + } + }; + } }); + } +}; + +//#endregion +//#region src/packages/VectorIndexApi.ts +/** +* @hidden +* Base implementation for vector index operations. +* Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead. +*/ +var VectorIndexApi = class extends BaseApiClient { + /** Creates a new VectorIndexApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Creates a new vector index within a bucket */ + async createIndex(options) { + var _this = this; + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {}; + }); + } + /** Retrieves metadata for a specific vector index */ + async getIndex(vectorBucketName, indexName) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, { + vectorBucketName, + indexName + }, { headers: _this2.headers }); + }); + } + /** Lists vector indexes within a bucket with optional filtering and pagination */ + async listIndexes(options) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers }); + }); + } + /** Deletes a vector index and all its data */ + async deleteIndex(vectorBucketName, indexName) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, { + vectorBucketName, + indexName + }, { headers: _this4.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/VectorDataApi.ts +/** +* @hidden +* Base implementation for vector data operations. +* Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead. +*/ +var VectorDataApi = class extends BaseApiClient { + /** Creates a new VectorDataApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Inserts or updates vectors in batch (1-500 per request) */ + async putVectors(options) { + var _this = this; + if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items"); + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {}; + }); + } + /** Retrieves vectors by their keys in batch */ + async getVectors(options) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers }); + }); + } + /** Lists vectors in an index with pagination */ + async listVectors(options) { + var _this3 = this; + if (options.segmentCount !== void 0) { + if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16"); + if (options.segmentIndex !== void 0) { + if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`); + } + } + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }); + }); + } + /** Queries for similar vectors using approximate nearest neighbor search */ + async queryVectors(options) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers }); + }); + } + /** Deletes vectors by their keys in batch (1-500 per request) */ + async deleteVectors(options) { + var _this5 = this; + if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items"); + return _this5.handleOperation(async () => { + return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/VectorBucketApi.ts +/** +* @hidden +* Base implementation for vector bucket operations. +* Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead. +*/ +var VectorBucketApi = class extends BaseApiClient { + /** Creates a new VectorBucketApi instance */ + constructor(url, headers = {}, fetch$1) { + const finalUrl = url.replace(/\/$/, ""); + const finalHeaders = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers); + super(finalUrl, finalHeaders, fetch$1, "vectors"); + } + /** Creates a new vector bucket */ + async createBucket(vectorBucketName) { + var _this = this; + return _this.handleOperation(async () => { + return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {}; + }); + } + /** Retrieves metadata for a specific vector bucket */ + async getBucket(vectorBucketName) { + var _this2 = this; + return _this2.handleOperation(async () => { + return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers }); + }); + } + /** Lists vector buckets with optional filtering and pagination */ + async listBuckets(options = {}) { + var _this3 = this; + return _this3.handleOperation(async () => { + return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers }); + }); + } + /** Deletes a vector bucket (must be empty first) */ + async deleteBucket(vectorBucketName) { + var _this4 = this; + return _this4.handleOperation(async () => { + return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {}; + }); + } +}; + +//#endregion +//#region src/packages/StorageVectorsClient.ts +/** +* +* @alpha +* +* Main client for interacting with S3 Vectors API +* Provides access to bucket, index, and vector data operations +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +* +* **Usage Patterns:** +* +* ```typescript +* const { data, error } = await supabase +* .storage +* .vectors +* .createBucket('embeddings-prod') +* +* // Access index operations via buckets +* const bucket = supabase.storage.vectors.from('embeddings-prod') +* await bucket.createIndex({ +* indexName: 'documents', +* dataType: 'float32', +* dimension: 1536, +* distanceMetric: 'cosine' +* }) +* +* // Access vector operations via index +* const index = bucket.index('documents') +* await index.putVectors({ +* vectors: [ +* { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } +* ] +* }) +* +* // Query similar vectors +* const { data } = await index.queryVectors({ +* queryVector: { float32: [...] }, +* topK: 5, +* returnDistance: true +* }) +* ``` +*/ +var StorageVectorsClient = class extends VectorBucketApi { + /** + * @alpha + * + * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param url - Base URL of the Storage Vectors REST API. + * @param options.headers - Optional headers (for example `Authorization`) applied to every request. + * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes. + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageVectorsClient } from '@supabase/storage-js' + * + * const client = new StorageVectorsClient(url, options) + * ``` + */ + constructor(url, options = {}) { + super(url, options.headers || {}, options.fetch); + } + /** + * + * @alpha + * + * Access operations for a specific vector bucket + * Returns a scoped client for index and vector operations within the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Bucket-scoped client with index and vector operations + * + * @example Accessing a vector bucket + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + from(vectorBucketName) { + return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch); + } + /** + * + * @alpha + * + * Creates a new vector bucket + * Vector buckets are containers for vector indexes and their data + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Unique name for the vector bucket + * @returns Promise with empty response on success or error + * + * @example Creating a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * ``` + */ + async createBucket(vectorBucketName) { + var _superprop_getCreateBucket = () => super.createBucket, _this = this; + return _superprop_getCreateBucket().call(_this, vectorBucketName); + } + /** + * + * @alpha + * + * Retrieves metadata for a specific vector bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Promise with bucket metadata or error + * + * @example Get bucket metadata + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .getBucket('embeddings-prod') + * + * console.log('Bucket created:', data?.vectorBucket.creationTime) + * ``` + */ + async getBucket(vectorBucketName) { + var _superprop_getGetBucket = () => super.getBucket, _this2 = this; + return _superprop_getGetBucket().call(_this2, vectorBucketName); + } + /** + * + * @alpha + * + * Lists all vector buckets with optional filtering and pagination + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Optional filters (prefix, maxResults, nextToken) + * @returns Promise with list of buckets or error + * + * @example List vector buckets + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .listBuckets({ prefix: 'embeddings-' }) + * + * data?.vectorBuckets.forEach(bucket => { + * console.log(bucket.vectorBucketName) + * }) + * ``` + */ + async listBuckets(options = {}) { + var _superprop_getListBuckets = () => super.listBuckets, _this3 = this; + return _superprop_getListBuckets().call(_this3, options); + } + /** + * + * @alpha + * + * Deletes a vector bucket (bucket must be empty) + * All indexes must be deleted before deleting the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket to delete + * @returns Promise with empty response on success or error + * + * @example Delete a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .deleteBucket('embeddings-old') + * ``` + */ + async deleteBucket(vectorBucketName) { + var _superprop_getDeleteBucket = () => super.deleteBucket, _this4 = this; + return _superprop_getDeleteBucket().call(_this4, vectorBucketName); + } +}; +/** +* +* @alpha +* +* Scoped client for operations within a specific vector bucket +* Provides index management and access to vector operations +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +*/ +var VectorBucketScope = class extends VectorIndexApi { + /** + * @alpha + * + * Creates a helper that automatically scopes all index operations to the provided bucket. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector bucket scope + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + constructor(url, headers, vectorBucketName, fetch$1) { + super(url, headers, fetch$1); + this.vectorBucketName = vectorBucketName; + } + /** + * + * @alpha + * + * Creates a new vector index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Index configuration (vectorBucketName is automatically set) + * @returns Promise with empty response on success or error + * + * @example Creating a vector index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents-openai', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine', + * metadataConfiguration: { + * nonFilterableMetadataKeys: ['raw_text'] + * } + * }) + * ``` + */ + async createIndex(options) { + var _superprop_getCreateIndex = () => super.createIndex, _this5 = this; + return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName })); + } + /** + * + * @alpha + * + * Lists indexes in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (vectorBucketName is automatically set) + * @returns Promise with response containing indexes array and pagination token or error + * + * @example List indexes + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.listIndexes({ prefix: 'documents-' }) + * ``` + */ + async listIndexes(options = {}) { + var _superprop_getListIndexes = () => super.listIndexes, _this6 = this; + return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName })); + } + /** + * + * @alpha + * + * Retrieves metadata for a specific index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to retrieve + * @returns Promise with index metadata or error + * + * @example Get index metadata + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.getIndex('documents-openai') + * console.log('Dimension:', data?.index.dimension) + * ``` + */ + async getIndex(indexName) { + var _superprop_getGetIndex = () => super.getIndex, _this7 = this; + return _superprop_getGetIndex().call(_this7, _this7.vectorBucketName, indexName); + } + /** + * + * @alpha + * + * Deletes an index from this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to delete + * @returns Promise with empty response on success or error + * + * @example Delete an index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.deleteIndex('old-index') + * ``` + */ + async deleteIndex(indexName) { + var _superprop_getDeleteIndex = () => super.deleteIndex, _this8 = this; + return _superprop_getDeleteIndex().call(_this8, _this8.vectorBucketName, indexName); + } + /** + * + * @alpha + * + * Access operations for a specific index within this bucket + * Returns a scoped client for vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index + * @returns Index-scoped client with vector data operations + * + * @example Accessing an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * + * // Insert vectors + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5 + * }) + * ``` + */ + index(indexName) { + return new VectorIndexScope(this.url, this.headers, this.vectorBucketName, indexName, this.fetch); + } +}; +/** +* +* @alpha +* +* Scoped client for operations within a specific vector index +* Provides vector data operations (put, get, list, query, delete) +* +* **Public alpha:** This API is part of a public alpha release and may not be available to your account type. +*/ +var VectorIndexScope = class extends VectorDataApi { + /** + * + * @alpha + * + * Creates a helper that automatically scopes all vector operations to the provided bucket/index names. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector index scope + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * ``` + */ + constructor(url, headers, vectorBucketName, indexName, fetch$1) { + super(url, headers, fetch$1); + this.vectorBucketName = vectorBucketName; + this.indexName = indexName; + } + /** + * + * @alpha + * + * Inserts or updates vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector insertion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Insert vectors into an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.putVectors({ + * vectors: [ + * { + * key: 'doc-1', + * data: { float32: [0.1, 0.2, ...] }, + * metadata: { title: 'Introduction', page: 1 } + * } + * ] + * }) + * ``` + */ + async putVectors(options) { + var _superprop_getPutVectors = () => super.putVectors, _this9 = this; + return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this9.vectorBucketName, + indexName: _this9.indexName + })); + } + /** + * + * @alpha + * + * Retrieves vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector retrieval options (bucket and index names automatically set) + * @returns Promise with response containing vectors array or error + * + * @example Get vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.getVectors({ + * keys: ['doc-1', 'doc-2'], + * returnMetadata: true + * }) + * ``` + */ + async getVectors(options) { + var _superprop_getGetVectors = () => super.getVectors, _this10 = this; + return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this10.vectorBucketName, + indexName: _this10.indexName + })); + } + /** + * + * @alpha + * + * Lists vectors in this index with pagination + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (bucket and index names automatically set) + * @returns Promise with response containing vectors array and pagination token or error + * + * @example List vectors with pagination + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.listVectors({ + * maxResults: 500, + * returnMetadata: true + * }) + * ``` + */ + async listVectors(options = {}) { + var _superprop_getListVectors = () => super.listVectors, _this11 = this; + return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this11.vectorBucketName, + indexName: _this11.indexName + })); + } + /** + * + * @alpha + * + * Queries for similar vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Query options (bucket and index names automatically set) + * @returns Promise with response containing matches array of similar vectors ordered by distance or error + * + * @example Query similar vectors + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.queryVectors({ + * queryVector: { float32: [0.1, 0.2, ...] }, + * topK: 5, + * filter: { category: 'technical' }, + * returnDistance: true, + * returnMetadata: true + * }) + * ``` + */ + async queryVectors(options) { + var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this; + return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this12.vectorBucketName, + indexName: _this12.indexName + })); + } + /** + * + * @alpha + * + * Deletes vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Deletion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Delete vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.deleteVectors({ + * keys: ['doc-1', 'doc-2', 'doc-3'] + * }) + * ``` + */ + async deleteVectors(options) { + var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this; + return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, { + vectorBucketName: _this13.vectorBucketName, + indexName: _this13.indexName + })); + } +}; + +//#endregion +//#region src/StorageClient.ts +var StorageClient = class extends StorageBucketApi { + /** + * Creates a client for Storage buckets, files, analytics, and vectors. + * + * @category Storage + * @subcategory File Buckets + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const avatars = supabase.storage.from('avatars') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import { StorageClient } from '@supabase/storage-js' + * + * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', { + * apikey: 'your-publishable-key', + * }) + * const avatars = storage.from('avatars') + * ``` + */ + constructor(url, headers = {}, fetch$1, opts) { + super(url, headers, fetch$1, opts); + } + /** + * Perform file operation in a bucket. + * + * @category Storage + * @subcategory File Buckets + * + * @param id The bucket id to operate on. + * + * @example Accessing a bucket + * ```typescript + * const avatars = supabase.storage.from('avatars') + * ``` + */ + from(id) { + return new StorageFileApi(this.url, this.headers, id, this.fetch); + } + /** + * + * @alpha + * + * Access vector storage operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * + * @returns A StorageVectorsClient instance configured with the current storage settings. + */ + get vectors() { + return new StorageVectorsClient(this.url + "/vector", { + headers: this.headers, + fetch: this.fetch + }); + } + /** + * + * @alpha + * + * Access analytics storage operations using Iceberg tables. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * + * @returns A StorageAnalyticsClient instance configured with the current storage settings. + */ + get analytics() { + return new StorageAnalyticsClient(this.url + "/iceberg", this.headers, this.fetch); + } +}; + +//#endregion +export { StorageAnalyticsClient, StorageApiError, StorageClient, StorageError, StorageUnknownError, StorageVectorsApiError, StorageVectorsClient, StorageVectorsError, StorageVectorsErrorCode, StorageVectorsUnknownError, VectorBucketApi, VectorBucketScope, VectorDataApi, VectorIndexApi, VectorIndexScope, isStorageError, isStorageVectorsError }; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/index.mjs.map b/node_modules/@supabase/storage-js/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..ea9105403068c8b910214edc750fc7a4c111b32b --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","names":["result: Record","result: Record","params: { [k: string]: any }","contentType: string | undefined","fetch","setHeaderUtil","this","downloadFn: () => Promise","shouldThrowOnError: boolean","this","downloadFn: () => Promise","shouldThrowOnError: boolean","this","DEFAULT_FILE_OPTIONS: FileOptions","fetch","this","headers: Record","fetch","this","params: Record","fetch","this","fetch","this","fetch","this","fetch","this","fetch","this","fetch"],"sources":["../src/lib/common/errors.ts","../src/lib/common/headers.ts","../src/lib/common/helpers.ts","../src/lib/common/fetch.ts","../src/lib/common/BaseApiClient.ts","../src/packages/StreamDownloadBuilder.ts","../src/packages/BlobDownloadBuilder.ts","../src/packages/StorageFileApi.ts","../src/lib/version.ts","../src/lib/constants.ts","../src/packages/StorageBucketApi.ts","../src/packages/StorageAnalyticsClient.ts","../src/packages/VectorIndexApi.ts","../src/packages/VectorDataApi.ts","../src/packages/VectorBucketApi.ts","../src/packages/StorageVectorsClient.ts","../src/StorageClient.ts"],"sourcesContent":["/**\n * Namespace type for error classes\n * Determines the error class names and type guards\n */\nexport type ErrorNamespace = 'storage' | 'vectors'\n\n/**\n * Base error class for all Storage errors\n * Supports both 'storage' and 'vectors' namespaces\n */\nexport class StorageError extends Error {\n protected __isStorageError = true\n protected namespace: ErrorNamespace\n status: number | undefined\n statusCode: string | undefined\n\n constructor(\n message: string,\n namespace: ErrorNamespace = 'storage',\n status?: number,\n statusCode?: string\n ) {\n super(message)\n this.namespace = namespace\n this.name = namespace === 'vectors' ? 'StorageVectorsError' : 'StorageError'\n this.status = status\n this.statusCode = statusCode\n }\n\n toJSON(): {\n name: string\n message: string\n status: number | undefined\n statusCode: string | undefined\n } {\n return {\n name: this.name,\n message: this.message,\n status: this.status,\n statusCode: this.statusCode,\n }\n }\n}\n\n/**\n * Type guard to check if an error is a StorageError\n * @param error - The error to check\n * @returns True if the error is a StorageError\n */\nexport function isStorageError(error: unknown): error is StorageError {\n return typeof error === 'object' && error !== null && '__isStorageError' in error\n}\n\n/**\n * API error returned from Storage service\n * Includes HTTP status code and service-specific error code\n */\nexport class StorageApiError extends StorageError {\n override status: number\n override statusCode: string\n /**\n * Service-specific error code from the Storage API response body, such as\n * `NoSuchKey`, `AccessDenied` or `ResourceAlreadyExists`. Use this to branch\n * on the specific error rather than parsing the message.\n * @see https://supabase.com/docs/guides/storage/debugging/error-codes\n */\n code: string | undefined\n\n constructor(\n message: string,\n status: number,\n statusCode: string,\n namespace: ErrorNamespace = 'storage',\n code?: string\n ) {\n super(message, namespace, status, statusCode)\n this.name = namespace === 'vectors' ? 'StorageVectorsApiError' : 'StorageApiError'\n this.status = status\n this.statusCode = statusCode\n this.code = code\n }\n\n toJSON(): {\n name: string\n message: string\n status: number | undefined\n statusCode: string | undefined\n code: string | undefined\n } {\n return {\n ...super.toJSON(),\n code: this.code,\n }\n }\n}\n\n/**\n * Unknown error that doesn't match expected error patterns\n * Wraps the original error for debugging\n */\nexport class StorageUnknownError extends StorageError {\n originalError: unknown\n\n constructor(message: string, originalError: unknown, namespace: ErrorNamespace = 'storage') {\n super(message, namespace)\n this.name = namespace === 'vectors' ? 'StorageVectorsUnknownError' : 'StorageUnknownError'\n this.originalError = originalError\n }\n}\n\n// ============================================================================\n// Backward Compatibility Exports for Vectors\n// ============================================================================\n\n/**\n * @deprecated Use StorageError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsError extends StorageError {\n constructor(message: string) {\n super(message, 'vectors')\n }\n}\n\n/**\n * Type guard to check if an error is a StorageVectorsError\n * @param error - The error to check\n * @returns True if the error is a StorageVectorsError\n */\nexport function isStorageVectorsError(error: unknown): error is StorageVectorsError {\n return isStorageError(error) && (error as StorageError)['namespace'] === 'vectors'\n}\n\n/**\n * @deprecated Use StorageApiError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsApiError extends StorageApiError {\n constructor(message: string, status: number, statusCode: string) {\n super(message, status, statusCode, 'vectors')\n }\n}\n\n/**\n * @deprecated Use StorageUnknownError with namespace='vectors' instead\n * Alias for backward compatibility with existing vector storage code\n */\nexport class StorageVectorsUnknownError extends StorageUnknownError {\n constructor(message: string, originalError: unknown) {\n super(message, originalError, 'vectors')\n }\n}\n\n/**\n * Error codes specific to S3 Vectors API\n * Maps AWS service errors to application-friendly error codes\n */\nexport enum StorageVectorsErrorCode {\n /** Internal server fault (HTTP 500) */\n InternalError = 'InternalError',\n /** Resource already exists / conflict (HTTP 409) */\n S3VectorConflictException = 'S3VectorConflictException',\n /** Resource not found (HTTP 404) */\n S3VectorNotFoundException = 'S3VectorNotFoundException',\n /** Delete bucket while not empty (HTTP 400) */\n S3VectorBucketNotEmpty = 'S3VectorBucketNotEmpty',\n /** Exceeds bucket quota/limit (HTTP 400) */\n S3VectorMaxBucketsExceeded = 'S3VectorMaxBucketsExceeded',\n /** Exceeds index quota/limit (HTTP 400) */\n S3VectorMaxIndexesExceeded = 'S3VectorMaxIndexesExceeded',\n}\n","/**\n * Sets a header with case-insensitive deduplication.\n * Removes any existing headers whose name matches (case-insensitive),\n * then sets the value under the lowercase key. Does not mutate the input object.\n *\n * @param headers - Existing headers object\n * @param name - Header name to set (stored as lowercase)\n * @param value - Header value\n * @returns New headers object with the header set\n */\nexport function setHeader(\n headers: Record,\n name: string,\n value: string\n): Record {\n const result = { ...headers }\n const nameLower = name.toLowerCase()\n\n for (const key of Object.keys(result)) {\n if (key.toLowerCase() === nameLower) {\n delete result[key]\n }\n }\n\n result[nameLower] = value\n return result\n}\n\n/**\n * Normalizes all header keys to lowercase with case-insensitive deduplication.\n * When duplicate keys exist (differing only in case), the last value wins.\n * Does not mutate the input object.\n *\n * @param headers - Headers object to normalize\n * @returns New headers object with all keys lowercased\n */\nexport function normalizeHeaders(headers: Record): Record {\n const result: Record = {}\n for (const [key, value] of Object.entries(headers)) {\n result[key.toLowerCase()] = value\n }\n return result\n}\n","type Fetch = typeof fetch\n\n/**\n * Resolves the fetch implementation to use\n * Uses custom fetch if provided, otherwise uses native fetch\n *\n * @param customFetch - Optional custom fetch implementation\n * @returns Resolved fetch function\n */\nexport const resolveFetch = (customFetch?: Fetch): Fetch => {\n if (customFetch) {\n return (...args) => customFetch(...args)\n }\n return (...args) => fetch(...args)\n}\n\n/**\n * Resolves the Response constructor to use\n * Returns native Response constructor\n *\n * @returns Response constructor\n */\nexport const resolveResponse = (): typeof Response => {\n return Response\n}\n\n/**\n * Determine if input is a plain object\n * An object is plain if it's created by either {}, new Object(), or Object.create(null)\n *\n * @param value - Value to check\n * @returns True if value is a plain object\n * @source https://github.com/sindresorhus/is-plain-obj\n */\nexport const isPlainObject = (value: object): boolean => {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const prototype = Object.getPrototypeOf(value)\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null) &&\n !(Symbol.toStringTag in value) &&\n !(Symbol.iterator in value)\n )\n}\n\n/**\n * Recursively converts object keys from snake_case to camelCase\n * Used for normalizing API responses\n *\n * @param item - Object to convert\n * @returns Converted object with camelCase keys\n */\nexport const recursiveToCamel = (item: Record): unknown => {\n if (Array.isArray(item)) {\n return item.map((el) => recursiveToCamel(el))\n } else if (typeof item === 'function' || item !== Object(item)) {\n return item\n }\n\n const result: Record = {}\n Object.entries(item).forEach(([key, value]) => {\n const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, ''))\n result[newKey] = recursiveToCamel(value)\n })\n\n return result\n}\n\n/**\n * Validates if a given bucket name is valid according to Supabase Storage API rules\n * Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName()\n *\n * Rules:\n * - Length: 1-100 characters\n * - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters\n * - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ?\n * - Forbidden: path separators (/, \\), path traversal (..), leading/trailing whitespace\n *\n * AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html\n *\n * @param bucketName - The bucket name to validate\n * @returns true if valid, false otherwise\n */\nexport const isValidBucketName = (bucketName: string): boolean => {\n if (!bucketName || typeof bucketName !== 'string') {\n return false\n }\n\n // Check length constraints (1-100 characters)\n if (bucketName.length === 0 || bucketName.length > 100) {\n return false\n }\n\n // Check for leading/trailing whitespace\n if (bucketName.trim() !== bucketName) {\n return false\n }\n\n // Explicitly reject path separators (security)\n // Note: Consecutive periods (..) are allowed by backend - the AWS restriction\n // on relative paths applies to object keys, not bucket names\n if (bucketName.includes('/') || bucketName.includes('\\\\')) {\n return false\n }\n\n // Validate against allowed character set\n // Pattern matches backend regex: /^(\\w|!|-|\\.|\\*|'|\\(|\\)| |&|\\$|@|=|;|:|\\+|,|\\?)*$/\n // This explicitly excludes path separators (/, \\) and other problematic characters\n const bucketNameRegex = /^[\\w!.\\*'() &$@=;:+,?-]+$/\n return bucketNameRegex.test(bucketName)\n}\n\n/**\n * Normalizes a number array to float32 format\n * Ensures all vector values are valid 32-bit floats\n *\n * @param values - Array of numbers to normalize\n * @returns Normalized float32 array\n */\nexport const normalizeToFloat32 = (values: number[]): number[] => {\n // Use Float32Array to ensure proper precision\n return Array.from(new Float32Array(values))\n}\n\n/**\n * Validates vector dimensions match expected dimension\n * Throws error if dimensions don't match\n *\n * @param vector - Vector data to validate\n * @param expectedDimension - Expected vector dimension\n * @throws Error if dimensions don't match\n */\nexport const validateVectorDimension = (\n vector: { float32: number[] },\n expectedDimension?: number\n): void => {\n if (expectedDimension !== undefined && vector.float32.length !== expectedDimension) {\n throw new Error(\n `Vector dimension mismatch: expected ${expectedDimension}, got ${vector.float32.length}`\n )\n }\n}\n\n/**\n * Percent-encodes each segment of a storage path so URL delimiters within a\n * key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start.\n *\n * Splits on `/` so real path separators stay literal — the storage server\n * routes on them and decodes each segment back to the original key.\n *\n * @param path - A bucket id or `bucketId/objectKey` path\n * @returns The path with each `/`-delimited segment percent-encoded\n */\nexport const encodeStoragePath = (path: string): string =>\n path.split('/').map(encodeURIComponent).join('/')\n","import { StorageApiError, StorageError, StorageUnknownError, ErrorNamespace } from './errors'\nimport { setHeader } from './headers'\nimport { isPlainObject, resolveResponse } from './helpers'\nimport { FetchParameters } from '../types'\n\nexport type Fetch = typeof fetch\n\n/**\n * Options for fetch requests\n */\nexport interface FetchOptions {\n headers?: {\n [key: string]: string\n }\n duplex?: string\n noResolveJson?: boolean\n}\n\n/**\n * HTTP methods supported by the API\n */\nexport type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD'\n\n/**\n * Extracts error message from various error response formats\n * @param err - Error object from API\n * @returns Human-readable error message\n */\nconst _getErrorMessage = (err: unknown): string => {\n if (typeof err === 'object' && err !== null) {\n const e = err as Record\n if (typeof e.msg === 'string') return e.msg\n if (typeof e.message === 'string') return e.message\n if (typeof e.error_description === 'string') return e.error_description\n if (typeof e.error === 'string') return e.error\n if (typeof e.error === 'object' && e.error !== null) {\n const nested = e.error as Record\n if (typeof nested.message === 'string') return nested.message\n }\n }\n return JSON.stringify(err)\n}\n\n/**\n * Handles fetch errors and converts them to Storage error types\n * @param error - The error caught from fetch\n * @param reject - Promise rejection function\n * @param options - Fetch options that may affect error handling\n * @param namespace - Error namespace ('storage' or 'vectors')\n */\nconst handleError = async (\n error: unknown,\n reject: (reason: StorageError) => void,\n options: FetchOptions | undefined,\n namespace: ErrorNamespace\n) => {\n // Structural detection of json() method, present in all Response implementations\n // (native, node-fetch, cross-fetch, undici) and absent from standard Error objects.\n // Checking 'ok' or 'status' via `in` is unreliable across fetch polyfills/realms.\n const isResponseLike =\n error !== null &&\n typeof error === 'object' &&\n 'json' in error &&\n typeof (error as Record).json === 'function'\n\n if (isResponseLike) {\n const responseError = error as Response\n // Defensive coercion: some fetch polyfills have historically returned status as a string.\n let status = parseInt(String(responseError.status), 10)\n if (!Number.isFinite(status)) {\n status = 500\n }\n\n responseError\n .json()\n .then(\n (err: { statusCode?: string; code?: string; error?: string; message?: string } | null) => {\n const statusCode = err?.statusCode || err?.code || status + ''\n reject(\n new StorageApiError(_getErrorMessage(err), status, statusCode, namespace, err?.code)\n )\n }\n )\n .catch(() => {\n const statusCode = status + ''\n const message = responseError.statusText || `HTTP ${status} error`\n reject(new StorageApiError(message, status, statusCode, namespace))\n })\n } else {\n reject(new StorageUnknownError(_getErrorMessage(error), error, namespace))\n }\n}\n\n/**\n * Builds request parameters for fetch calls\n * @param method - HTTP method\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters like AbortSignal\n * @param body - Request body (will be JSON stringified if plain object)\n * @returns Complete fetch request parameters\n */\nconst _getRequestParams = (\n method: RequestMethodType,\n options?: FetchOptions,\n parameters?: FetchParameters,\n body?: object\n) => {\n const params: { [k: string]: any } = { method, headers: options?.headers || {} }\n\n if (method === 'GET' || method === 'HEAD' || !body) {\n return { ...params, ...parameters }\n }\n\n if (isPlainObject(body)) {\n const headers = options?.headers || {}\n let contentType: string | undefined\n\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === 'content-type') {\n contentType = value\n }\n }\n\n params.headers = setHeader(headers, 'Content-Type', contentType ?? 'application/json')\n params.body = JSON.stringify(body)\n } else {\n params.body = body\n }\n\n if (options?.duplex) {\n params.duplex = options.duplex\n }\n\n return { ...params, ...parameters }\n}\n\n/**\n * Internal request handler that wraps fetch with error handling\n * @param fetcher - Fetch function to use\n * @param method - HTTP method\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @param body - Request body\n * @param namespace - Error namespace ('storage' or 'vectors')\n * @returns Promise with parsed response or error\n */\nasync function _handleRequest(\n fetcher: Fetch,\n method: RequestMethodType,\n url: string,\n options: FetchOptions | undefined,\n parameters: FetchParameters | undefined,\n body: object | undefined,\n namespace: ErrorNamespace\n): Promise {\n return new Promise((resolve, reject) => {\n fetcher(url, _getRequestParams(method, options, parameters, body))\n .then((result) => {\n if (!result.ok) throw result\n if (options?.noResolveJson) return result\n\n // AWS S3 Vectors API returns 200 OK with content-length: 0 for successful mutations\n // (putVectors, deleteVectors) instead of 204 or JSON response. This is AWS's design choice\n // for performance optimization of bulk operations (up to 500 vectors per request).\n // We handle this to prevent \"Unexpected end of JSON input\" errors when calling result.json()\n if (namespace === 'vectors') {\n const contentType = result.headers.get('content-type')\n const contentLength = result.headers.get('content-length')\n\n // Return empty object for explicitly empty responses\n if (contentLength === '0' || result.status === 204) {\n return {}\n }\n\n // Return empty object if no JSON content type\n if (!contentType || !contentType.includes('application/json')) {\n return {}\n }\n }\n\n return result.json()\n })\n .then((data) => resolve(data))\n .catch((error) => handleError(error, reject, options, namespace))\n })\n}\n\n/**\n * Creates a fetch API with the specified namespace\n * @param namespace - Error namespace ('storage' or 'vectors')\n * @returns Object with HTTP method functions\n */\nexport function createFetchApi(namespace: ErrorNamespace = 'storage') {\n return {\n /**\n * Performs a GET request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n get: async (\n fetcher: Fetch,\n url: string,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'GET', url, options, parameters, undefined, namespace)\n },\n\n /**\n * Performs a POST request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n post: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'POST', url, options, parameters, body, namespace)\n },\n\n /**\n * Performs a PUT request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n put: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'PUT', url, options, parameters, body, namespace)\n },\n\n /**\n * Performs a HEAD request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with Response object (not JSON parsed)\n */\n head: async (\n fetcher: Fetch,\n url: string,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(\n fetcher,\n 'HEAD',\n url,\n {\n ...options,\n noResolveJson: true,\n },\n parameters,\n undefined,\n namespace\n )\n },\n\n /**\n * Performs a DELETE request\n * @param fetcher - Fetch function to use\n * @param url - Request URL\n * @param body - Request body to be JSON stringified\n * @param options - Custom fetch options\n * @param parameters - Additional fetch parameters\n * @returns Promise with parsed response\n */\n remove: async (\n fetcher: Fetch,\n url: string,\n body: object,\n options?: FetchOptions,\n parameters?: FetchParameters\n ): Promise => {\n return _handleRequest(fetcher, 'DELETE', url, options, parameters, body, namespace)\n },\n }\n}\n\n// Default exports for backward compatibility with 'storage' namespace\nconst defaultApi = createFetchApi('storage')\nexport const { get, post, put, head, remove } = defaultApi\n\n// Vectors API with 'vectors' namespace for proper error handling\nexport const vectorsApi = createFetchApi('vectors')\n","import { ErrorNamespace, isStorageError, StorageError } from './errors'\nimport { Fetch } from './fetch'\nimport { normalizeHeaders, setHeader as setHeaderUtil } from './headers'\nimport { resolveFetch } from './helpers'\n\n/**\n * @ignore\n * Base API client class for all Storage API classes\n * Provides common infrastructure for error handling and configuration\n *\n * @typeParam TError - The error type (StorageError or subclass)\n */\nexport default abstract class BaseApiClient {\n protected url: string\n protected headers: { [key: string]: string }\n protected fetch: Fetch\n protected shouldThrowOnError = false\n protected namespace: ErrorNamespace\n\n /**\n * Creates a new BaseApiClient instance\n * @param url - Base URL for API requests\n * @param headers - Default headers for API requests\n * @param fetch - Optional custom fetch implementation\n * @param namespace - Error namespace ('storage' or 'vectors')\n */\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n namespace: ErrorNamespace = 'storage'\n ) {\n this.url = url\n this.headers = normalizeHeaders(headers)\n this.fetch = resolveFetch(fetch)\n this.namespace = namespace\n }\n\n /**\n * Enable throwing errors instead of returning them.\n * When enabled, errors are thrown instead of returned in { data, error } format.\n *\n * @returns this - For method chaining\n */\n public throwOnError(): this {\n this.shouldThrowOnError = true\n return this\n }\n\n /**\n * Set an HTTP header for the request.\n * Creates a shallow copy of headers to avoid mutating shared state.\n *\n * @param name - Header name\n * @param value - Header value\n * @returns this - For method chaining\n */\n public setHeader(name: string, value: string): this {\n this.headers = setHeaderUtil(this.headers, name, value)\n return this\n }\n\n /**\n * Handles API operation with standardized error handling\n * Eliminates repetitive try-catch blocks across all API methods\n *\n * This wrapper:\n * 1. Executes the operation\n * 2. Returns { data, error: null } on success\n * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)\n * 4. Throws error on failure (if shouldThrowOnError is true)\n *\n * @typeParam T - The expected data type from the operation\n * @param operation - Async function that performs the API call\n * @returns Promise with { data, error } tuple\n *\n * @example Handling an operation\n * ```typescript\n * async listBuckets() {\n * return this.handleOperation(async () => {\n * return await get(this.fetch, `${this.url}/bucket`, {\n * headers: this.headers,\n * })\n * })\n * }\n * ```\n */\n protected async handleOperation(\n operation: () => Promise\n ): Promise<{ data: T; error: null } | { data: null; error: TError }> {\n try {\n const data = await operation()\n return { data, error: null }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n if (isStorageError(error)) {\n return { data: null, error: error as TError }\n }\n throw error\n }\n }\n}\n","import { isStorageError } from '../lib/common/errors'\nimport { DownloadResult } from '../lib/types'\n\nexport default class StreamDownloadBuilder implements Promise> {\n readonly [Symbol.toStringTag]: string = 'StreamDownloadBuilder'\n private promise: Promise> | null = null\n\n constructor(\n private downloadFn: () => Promise,\n private shouldThrowOnError: boolean\n ) {}\n\n then, TResult2 = never>(\n onfulfilled?:\n | ((value: DownloadResult) => TResult1 | PromiseLike)\n | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike) | null\n ): Promise {\n return this.getPromise().then(onfulfilled, onrejected)\n }\n\n catch(\n onrejected?: ((reason: any) => TResult | PromiseLike) | null\n ): Promise | TResult> {\n return this.getPromise().catch(onrejected)\n }\n\n finally(onfinally?: (() => void) | null): Promise> {\n return this.getPromise().finally(onfinally)\n }\n\n private getPromise(): Promise> {\n if (!this.promise) {\n this.promise = this.execute()\n }\n return this.promise\n }\n\n private async execute(): Promise> {\n try {\n const result = await this.downloadFn()\n\n return {\n data: result.body as ReadableStream,\n error: null,\n }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n\n if (isStorageError(error)) {\n return { data: null, error }\n }\n\n throw error\n }\n }\n}\n","import { isStorageError } from '../lib/common/errors'\nimport { DownloadResult } from '../lib/types'\nimport StreamDownloadBuilder from './StreamDownloadBuilder'\n\nexport default class BlobDownloadBuilder implements Promise> {\n readonly [Symbol.toStringTag]: string = 'BlobDownloadBuilder'\n private promise: Promise> | null = null\n\n constructor(\n private downloadFn: () => Promise,\n private shouldThrowOnError: boolean\n ) {}\n\n asStream(): StreamDownloadBuilder {\n return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError)\n }\n\n then, TResult2 = never>(\n onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike) | null\n ): Promise {\n return this.getPromise().then(onfulfilled, onrejected)\n }\n\n catch(\n onrejected?: ((reason: any) => TResult | PromiseLike) | null\n ): Promise | TResult> {\n return this.getPromise().catch(onrejected)\n }\n\n finally(onfinally?: (() => void) | null): Promise> {\n return this.getPromise().finally(onfinally)\n }\n\n private getPromise(): Promise> {\n if (!this.promise) {\n this.promise = this.execute()\n }\n return this.promise\n }\n\n private async execute(): Promise> {\n try {\n const result = await this.downloadFn()\n\n return {\n data: await result.blob(),\n error: null,\n }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n\n if (isStorageError(error)) {\n return { data: null, error }\n }\n\n throw error\n }\n }\n}\n","import {\n StorageApiError,\n StorageError,\n StorageUnknownError,\n isStorageError,\n} from '../lib/common/errors'\nimport { get, head, post, put, remove, Fetch } from '../lib/common/fetch'\nimport { setHeader } from '../lib/common/headers'\nimport { encodeStoragePath, recursiveToCamel } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n FileObject,\n FileOptions,\n SearchOptions,\n FetchParameters,\n TransformOptions,\n DestinationOptions,\n FileObjectV2,\n Camelize,\n SearchV2Options,\n SearchV2Result,\n PurgeCacheOptions,\n} from '../lib/types'\nimport BlobDownloadBuilder from './BlobDownloadBuilder'\n\nconst DEFAULT_SEARCH_OPTIONS = {\n limit: 100,\n offset: 0,\n sortBy: {\n column: 'name',\n order: 'asc',\n },\n}\n\nconst DEFAULT_FILE_OPTIONS: FileOptions = {\n cacheControl: '3600',\n contentType: 'text/plain;charset=UTF-8',\n upsert: false,\n}\n\ntype FileBody =\n | ArrayBuffer\n | ArrayBufferView\n | Blob\n | Buffer\n | File\n | FormData\n | NodeJS.ReadableStream\n | ReadableStream\n | URLSearchParams\n | string\n\nexport default class StorageFileApi extends BaseApiClient {\n protected bucketId: string | undefined\n\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n bucketId?: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch, 'storage')\n this.bucketId = bucketId\n }\n\n /**\n * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.\n *\n * @param method HTTP method.\n * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.\n * @param fileBody The body of the file to be stored in the bucket.\n */\n private async uploadOrUpdate(\n method: 'POST' | 'PUT',\n path: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let body\n const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions }\n let headers: Record = {\n ...this.headers,\n ...(method === 'POST' && { 'x-upsert': String(options.upsert as boolean) }),\n }\n\n const metadata = options.metadata\n\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData()\n body.append('cacheControl', options.cacheControl as string)\n if (metadata) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n body.append('', fileBody)\n } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody\n // Only append if not already present\n if (!body.has('cacheControl')) {\n body.append('cacheControl', options.cacheControl as string)\n }\n if (metadata && !body.has('metadata')) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n } else {\n body = fileBody\n headers['cache-control'] = `max-age=${options.cacheControl}`\n headers['content-type'] = options.contentType as string\n\n if (metadata) {\n headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata))\n }\n\n // Node.js streams require duplex option for fetch in Node 20+\n // Check for both web ReadableStream and Node.js streams\n const isStream =\n (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) ||\n (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function')\n\n if (isStream && !options.duplex) {\n options.duplex = 'half'\n }\n }\n\n if (fileOptions?.headers) {\n for (const [key, value] of Object.entries(fileOptions.headers)) {\n headers = setHeader(headers, key, value)\n }\n }\n\n const cleanPath = this._removeEmptyFolders(path)\n const _path = this._getFinalPath(cleanPath)\n const data = await (method == 'PUT' ? put : post)(\n this.fetch,\n `${this.url}/object/${_path}`,\n body as object,\n { headers, ...(options?.duplex ? { duplex: options.duplex } : {}) }\n )\n\n return { path: cleanPath, id: data.Id, fullPath: data.Key }\n })\n }\n\n /**\n * Uploads a file to an existing bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @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.\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.\n * @returns Promise with response containing file path, id, and fullPath or error\n *\n * @example Upload file\n * ```js\n * const avatarFile = event.target.files[0]\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', avatarFile, {\n * cacheControl: '3600',\n * upsert: false\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"public/avatar1.png\",\n * \"fullPath\": \"avatars/public/avatar1.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Upload file using `ArrayBuffer` from base64 file data\n * ```js\n * import { decode } from 'base64-arraybuffer'\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', decode('base64FileData'), {\n * contentType: 'image/png'\n * })\n * ```\n *\n * @example Handling errors\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .upload('public/avatar1.png', avatarFile)\n *\n * if (error) {\n * // Log the full error so fields like `statusCode` and `error` (the\n * // Storage error name, e.g. \"Duplicate\") aren't hidden behind `error.message`.\n * console.error(error)\n * return\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n * - 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.\n */\n async upload(\n path: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.uploadOrUpdate('POST', path, fileBody, fileOptions)\n }\n\n /**\n * Upload a file with a token generated from `createSignedUploadUrl`.\n *\n * @category Storage\n * @subcategory File Buckets\n * @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.\n * @param token The token generated from `createSignedUploadUrl`\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions HTTP headers (cacheControl, contentType, etc.).\n * **Note:** The `upsert` option has no effect here. To enable upsert behavior,\n * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead.\n * @returns Promise with response containing file path and fullPath or error\n *\n * @example Upload to a signed URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"folder/cat.jpg\",\n * \"fullPath\": \"avatars/folder/cat.jpg\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async uploadToSignedUrl(\n path: string,\n token: string,\n fileBody: FileBody,\n fileOptions?: FileOptions\n ) {\n const cleanPath = this._removeEmptyFolders(path)\n const _path = this._getFinalPath(cleanPath)\n\n const url = new URL(this.url + `/object/upload/sign/${_path}`)\n url.searchParams.set('token', token)\n\n return this.handleOperation(async () => {\n let body\n const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions }\n let headers: Record = {\n ...this.headers,\n ...{ 'x-upsert': String(options.upsert as boolean) },\n }\n\n const metadata = options.metadata\n\n if (typeof Blob !== 'undefined' && fileBody instanceof Blob) {\n body = new FormData()\n body.append('cacheControl', options.cacheControl as string)\n if (metadata) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n body.append('', fileBody)\n } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) {\n body = fileBody\n if (!body.has('cacheControl')) {\n body.append('cacheControl', options.cacheControl as string)\n }\n if (metadata && !body.has('metadata')) {\n body.append('metadata', this.encodeMetadata(metadata))\n }\n } else {\n body = fileBody\n headers['cache-control'] = `max-age=${options.cacheControl}`\n headers['content-type'] = options.contentType as string\n if (metadata) {\n headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata))\n }\n\n const isStream =\n (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) ||\n (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function')\n\n if (isStream && !options.duplex) {\n options.duplex = 'half'\n }\n }\n\n if (fileOptions?.headers) {\n for (const [key, value] of Object.entries(fileOptions.headers)) {\n headers = setHeader(headers, key, value)\n }\n }\n\n const data = await put(this.fetch, url.toString(), body as object, {\n headers,\n ...(options?.duplex ? { duplex: options.duplex } : {}),\n })\n\n return { path: cleanPath, fullPath: data.Key }\n })\n }\n\n /**\n * Creates a signed upload URL.\n * Signed upload URLs can be used to upload files to the bucket without further authentication.\n * They are valid for 2 hours.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the current file name. For example `folder/image.png`.\n * @param options.upsert If set to true, allows the file to be overwritten if it already exists.\n * @returns Promise with response containing signed upload URL, token, and path or error\n *\n * @example Create Signed Upload URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUploadUrl('folder/cat.jpg')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=\",\n * \"path\": \"folder/cat.jpg\",\n * \"token\": \"\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `insert`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUploadUrl(\n path: string,\n options?: { upsert: boolean }\n ): Promise<\n | {\n data: { signedUrl: string; token: string; path: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let _path = this._getFinalPath(path)\n\n const headers = { ...this.headers }\n\n if (options?.upsert) {\n headers['x-upsert'] = 'true'\n }\n\n const data = await post(\n this.fetch,\n `${this.url}/object/upload/sign/${_path}`,\n {},\n { headers }\n )\n\n const url = new URL(this.url + data.url)\n\n const token = url.searchParams.get('token')\n\n if (!token) {\n throw new StorageError('No token returned by API')\n }\n\n return { signedUrl: url.toString(), path, token }\n })\n }\n\n /**\n * Replaces an existing file at the specified path with a new one.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.\n * @param fileBody The body of the file to be stored in the bucket.\n * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.\n * **Note:** The `upsert` option has no effect here. `update()` always replaces the\n * file at the given path, so the `x-upsert` header is not sent. To control upsert\n * behavior, use `upload()` instead.\n * @returns Promise with response containing file path, id, and fullPath or error\n *\n * @example Update file\n * ```js\n * const avatarFile = event.target.files[0]\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .update('public/avatar1.png', avatarFile, {\n * cacheControl: '3600'\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"public/avatar1.png\",\n * \"fullPath\": \"avatars/public/avatar1.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Update file using `ArrayBuffer` from base64 file data\n * ```js\n * import {decode} from 'base64-arraybuffer'\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .update('public/avatar1.png', decode('base64FileData'), {\n * contentType: 'image/png'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `update` and `select`\n * - `update()` always replaces the file at the given path regardless of the `upsert` option.\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n * - 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.\n */\n async update(\n path: string,\n fileBody:\n | ArrayBuffer\n | ArrayBufferView\n | Blob\n | Buffer\n | File\n | FormData\n | NodeJS.ReadableStream\n | ReadableStream\n | URLSearchParams\n | string,\n fileOptions?: FileOptions\n ): Promise<\n | {\n data: { id: string; path: string; fullPath: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.uploadOrUpdate('PUT', path, fileBody, fileOptions)\n }\n\n /**\n * Moves an existing file to a new path in the same bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param fromPath The original file path, including the current file name. For example `folder/image.png`.\n * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.\n * @param options The destination options.\n * @returns Promise with response containing success message or error\n *\n * @example Move file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .move('public/avatar1.png', 'private/avatar2.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully moved\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `update` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async move(\n fromPath: string,\n toPath: string,\n options?: DestinationOptions\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(\n this.fetch,\n `${this.url}/object/move`,\n {\n bucketId: this.bucketId,\n sourceKey: fromPath,\n destinationKey: toPath,\n destinationBucket: options?.destinationBucket,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Copies an existing file to a new path in the same bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param fromPath The original file path, including the current file name. For example `folder/image.png`.\n * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.\n * @param options The destination options.\n * @returns Promise with response containing copied file path or error\n *\n * @example Copy file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .copy('public/avatar1.png', 'private/avatar2.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"path\": \"avatars/private/avatar2.png\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `insert` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async copy(\n fromPath: string,\n toPath: string,\n options?: DestinationOptions\n ): Promise<\n | {\n data: { path: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const data = await post(\n this.fetch,\n `${this.url}/object/copy`,\n {\n bucketId: this.bucketId,\n sourceKey: fromPath,\n destinationKey: toPath,\n destinationBucket: options?.destinationBucket,\n },\n { headers: this.headers }\n )\n return { path: data.Key }\n })\n }\n\n /**\n * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the current file name. For example `folder/image.png`.\n * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.\n * @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.\n * @param options.transform Transform the asset before serving it to the client.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Promise with response containing signed URL or error\n *\n * @example Create Signed URL\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @example Create a signed URL for an asset with transformations\n * ```js\n * const { data } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60, {\n * transform: {\n * width: 100,\n * height: 100,\n * }\n * })\n * ```\n *\n * @example Create a signed URL which triggers the download of the asset\n * ```js\n * const { data } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrl('folder/avatar1.png', 60, {\n * download: true,\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUrl(\n path: string,\n expiresIn: number,\n options?: {\n download?: string | boolean\n transform?: TransformOptions\n cacheNonce?: string\n }\n ): Promise<\n | {\n data: { signedUrl: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n let _path = this._getFinalPath(path)\n\n const hasTransform =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n\n let data = await post(\n this.fetch,\n `${this.url}/object/sign/${_path}`,\n { expiresIn, ...(hasTransform ? { transform: options!.transform } : {}) },\n { headers: this.headers }\n )\n\n const query = new URLSearchParams()\n if (options?.download)\n query.set('download', options.download === true ? '' : options.download)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n // `data.signedURL` contains a `token` query parameter, so append extra params with `&`\n // only when we actually have something to add.\n const signedUrl = encodeURI(\n `${this.url}${data.signedURL}${queryString ? `&${queryString}` : ''}`\n )\n\n return { signedUrl }\n })\n }\n\n /**\n * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.\n * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.\n * @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.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Promise with response containing array of objects with signedUrl, path, and error or error\n *\n * @example Create Signed URLs\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"error\": null,\n * \"path\": \"folder/avatar1.png\",\n * \"signedURL\": \"/object/sign/avatars/folder/avatar1.png?token=\",\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=\"\n * },\n * {\n * \"error\": null,\n * \"path\": \"folder/avatar2.png\",\n * \"signedURL\": \"/object/sign/avatars/folder/avatar2.png?token=\",\n * \"signedUrl\": \"https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=\"\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createSignedUrls(\n paths: string[],\n expiresIn: number,\n options?: { download?: string | boolean; cacheNonce?: string }\n ): Promise<\n | {\n data: {\n error: string | null\n path: string | null\n signedURL: string | null\n signedUrl: string | null\n }[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const data = await post(\n this.fetch,\n `${this.url}/object/sign/${this.bucketId}`,\n { expiresIn, paths },\n { headers: this.headers }\n )\n\n const query = new URLSearchParams()\n\n if (options?.download)\n query.set('download', options.download === true ? '' : options.download)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n\n const queryString = query.toString()\n\n return data.map(\n (datum: { error: string | null; path: string | null; signedURL: string | null }) => ({\n ...datum,\n signedUrl: datum.signedURL\n ? encodeURI(`${this.url}${datum.signedURL}${queryString ? `&${queryString}` : ''}`)\n : null,\n })\n )\n })\n }\n\n /**\n * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.\n * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache.\n * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.\n * @returns BlobDownloadBuilder instance for downloading the file\n *\n * @example Download file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": ,\n * \"error\": null\n * }\n * ```\n *\n * @example Download file with transformations\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {\n * transform: {\n * width: 100,\n * height: 100,\n * quality: 80\n * }\n * })\n * ```\n *\n * @example Download with cache control (useful in Edge Functions)\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {}, { cache: 'no-store' })\n * ```\n *\n * @example Download with abort signal\n * ```js\n * const controller = new AbortController()\n * setTimeout(() => controller.abort(), 5000)\n *\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .download('folder/avatar1.png', {}, { signal: controller.signal })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n download(\n path: string,\n options?: Options,\n parameters?: FetchParameters\n ): BlobDownloadBuilder {\n const wantsTransformation =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n const renderPath = wantsTransformation ? 'render/image/authenticated' : 'object'\n\n const query = new URLSearchParams()\n if (options?.transform) this.applyTransformOptsToQuery(query, options.transform)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n const _path = this._getFinalPath(path)\n const downloadFn = () =>\n get(\n this.fetch,\n `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ''}`,\n {\n headers: this.headers,\n noResolveJson: true,\n },\n parameters\n )\n return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError)\n }\n\n /**\n * Retrieves the details of an existing file.\n *\n * Returns detailed file metadata including size, content type, and timestamps.\n * Note: The API returns `last_modified` field, not `updated_at`.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the file name. For example `folder/image.png`.\n * @returns Promise with response containing file metadata or error\n *\n * @example Get file info\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .info('folder/avatar1.png')\n *\n * if (data) {\n * console.log('Last modified:', data.lastModified)\n * console.log('Size:', data.size)\n * }\n * ```\n */\n async info(path: string): Promise<\n | {\n data: Camelize\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n const _path = this._getFinalPath(path)\n\n return this.handleOperation(async () => {\n const data = await get(this.fetch, `${this.url}/object/info/${_path}`, {\n headers: this.headers,\n })\n\n return recursiveToCamel(data) as Camelize\n })\n }\n\n /**\n * Checks the existence of a file.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The file path, including the file name. For example `folder/image.png`.\n * @returns Promise with response containing boolean indicating file existence or error\n *\n * @example Check file existence\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .exists('folder/avatar1.png')\n * ```\n */\n async exists(path: string): Promise<\n | {\n data: boolean\n error: null\n }\n | {\n data: boolean\n error: StorageError\n }\n > {\n const _path = this._getFinalPath(path)\n\n try {\n await head(this.fetch, `${this.url}/object/${_path}`, {\n headers: this.headers,\n })\n\n return { data: true, error: null }\n } catch (error) {\n if (this.shouldThrowOnError) {\n throw error\n }\n if (isStorageError(error)) {\n // HEAD requests produce StorageApiError (via handleError) or StorageUnknownError (legacy)\n const status =\n error instanceof StorageApiError\n ? error.status\n : error instanceof StorageUnknownError\n ? (error.originalError as { status: number })?.status\n : undefined\n\n if (status !== undefined && [400, 404].includes(status)) {\n return { data: false, error }\n }\n }\n\n throw error\n }\n }\n\n /**\n * 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.\n * 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.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.\n * @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.\n * @param options.transform Transform the asset before serving it to the client.\n * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.\n * @returns Object with public URL\n *\n * @example Returns the URL for an asset in a public bucket\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"publicUrl\": \"https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png\"\n * }\n * }\n * ```\n *\n * @example Returns the URL for an asset in a public bucket with transformations\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png', {\n * transform: {\n * width: 100,\n * height: 100,\n * }\n * })\n * ```\n *\n * @example Returns the URL which triggers the download of an asset in a public bucket\n * ```js\n * const { data } = supabase\n * .storage\n * .from('public-bucket')\n * .getPublicUrl('folder/avatar1.png', {\n * download: true,\n * })\n * ```\n *\n * @remarks\n * - 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\"\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n getPublicUrl(\n path: string,\n options?: {\n download?: string | boolean\n transform?: TransformOptions\n cacheNonce?: string\n }\n ): { data: { publicUrl: string } } {\n const _path = this._getFinalPath(path)\n\n const query = new URLSearchParams()\n if (options?.download) query.set('download', options.download === true ? '' : options.download)\n if (options?.transform) this.applyTransformOptsToQuery(query, options.transform)\n if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce))\n const queryString = query.toString()\n\n const wantsTransformation =\n typeof options?.transform === 'object' &&\n options.transform !== null &&\n Object.keys(options.transform).length > 0\n const renderPath = wantsTransformation ? 'render/image' : 'object'\n\n return {\n data: {\n publicUrl:\n encodeURI(`${this.url}/${renderPath}/public/${_path}`) +\n (queryString ? `?${queryString}` : ''),\n },\n }\n }\n\n /**\n * Deletes files within the same bucket\n *\n * Returns an array of FileObject entries for the deleted files. Note that deprecated\n * fields like `bucket_id` may or may not be present in the response - do not rely on them.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].\n * @returns Promise with response containing array of deleted file objects or error\n *\n * @example Delete file\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .remove(['folder/avatar1.png'])\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `delete` and `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async remove(paths: string[]): Promise<\n | {\n data: FileObject[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(\n this.fetch,\n `${this.url}/object/${this.bucketId}`,\n { prefixes: paths },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Purges the CDN cache for a single object in this bucket.\n *\n * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server\n * issues a CDN invalidation for the object and returns `{ message: 'success' }`.\n *\n * **Requires the `service_role` key.** The underlying endpoint enforces\n * `service_role` JWT — calls made with the anon key or a user JWT will be\n * rejected by the server.\n *\n * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must\n * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant\n * feature enabled, otherwise the server returns an error.\n *\n * Operates on a single object path. There is no wildcard or recursion: pass\n * the exact path of the object you want invalidated.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`.\n * @param options Optional purge cache options.\n * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact.\n * @param parameters Optional fetch parameters such as an `AbortController` signal.\n * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.\n *\n * @example Purge a single cached object\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .purgeCache('folder/avatar1.png')\n * ```\n *\n * @example Purge only transformations for a single object\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .purgeCache('folder/avatar1.png', { transformations: true })\n * ```\n */\n async purgeCache(\n path: string,\n options?: PurgeCacheOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const _path = encodeStoragePath(this._getFinalPath(path))\n const query = new URLSearchParams()\n if (options?.transformations) {\n query.set('transformations', 'true')\n }\n const queryString = query.toString()\n\n return await remove(\n this.fetch,\n `${this.url}/cdn/${_path}${queryString ? `?${queryString}` : ''}`,\n {},\n { headers: this.headers },\n parameters\n )\n })\n }\n\n /**\n * Get file metadata\n * @param id the file id to retrieve metadata\n */\n // async getMetadata(\n // id: string\n // ): Promise<\n // | {\n // data: Metadata\n // error: null\n // }\n // | {\n // data: null\n // error: StorageError\n // }\n // > {\n // try {\n // const data = await get(this.fetch, `${this.url}/metadata/${id}`, { headers: this.headers })\n // return { data, error: null }\n // } catch (error) {\n // if (isStorageError(error)) {\n // return { data: null, error }\n // }\n\n // throw error\n // }\n // }\n\n /**\n * Update file metadata\n * @param id the file id to update metadata\n * @param meta the new file metadata\n */\n // async updateMetadata(\n // id: string,\n // meta: Metadata\n // ): Promise<\n // | {\n // data: Metadata\n // error: null\n // }\n // | {\n // data: null\n // error: StorageError\n // }\n // > {\n // try {\n // const data = await post(\n // this.fetch,\n // `${this.url}/metadata/${id}`,\n // { ...meta },\n // { headers: this.headers }\n // )\n // return { data, error: null }\n // } catch (error) {\n // if (isStorageError(error)) {\n // return { data: null, error }\n // }\n\n // throw error\n // }\n // }\n\n /**\n * Lists all the files and folders within a path of the bucket.\n *\n * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,\n * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.\n * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned\n * by this method.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param path The folder path.\n * @param options Search options including limit (defaults to 100), offset, sortBy, and search\n * @param parameters Optional fetch parameters including signal for cancellation\n * @returns Promise with response containing array of files/folders or error\n *\n * @example List files in a bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .list('folder', {\n * limit: 100,\n * offset: 0,\n * sortBy: { column: 'name', order: 'asc' },\n * })\n *\n * // Handle files vs folders\n * data?.forEach(item => {\n * if (item.id !== null) {\n * // It's a file\n * console.log('File:', item.name, 'Size:', item.metadata?.size)\n * } else {\n * // It's a folder\n * console.log('Folder:', item.name)\n * }\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"name\": \"avatar1.png\",\n * \"id\": \"e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2\",\n * \"updated_at\": \"2024-05-22T23:06:05.580Z\",\n * \"created_at\": \"2024-05-22T23:04:34.443Z\",\n * \"last_accessed_at\": \"2024-05-22T23:04:34.443Z\",\n * \"metadata\": {\n * \"eTag\": \"\\\"c5e8c553235d9af30ef4f6e280790b92\\\"\",\n * \"size\": 32175,\n * \"mimetype\": \"image/png\",\n * \"cacheControl\": \"max-age=3600\",\n * \"lastModified\": \"2024-05-22T23:06:05.574Z\",\n * \"contentLength\": 32175,\n * \"httpStatusCode\": 200\n * }\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @example Search files in a bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .list('folder', {\n * limit: 100,\n * offset: 0,\n * sortBy: { column: 'name', order: 'asc' },\n * search: 'jon'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: none\n * - `objects` table permissions: `select`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async list(\n path?: string,\n options?: SearchOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: FileObject[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n // Deep-merge `sortBy` so overriding only one of its keys (e.g. `column`) keeps the\n // default for the other (e.g. `order`), matching how the top-level defaults behave.\n const sortBy = options?.sortBy\n ? { ...DEFAULT_SEARCH_OPTIONS.sortBy, ...options.sortBy }\n : DEFAULT_SEARCH_OPTIONS.sortBy\n const body = { ...DEFAULT_SEARCH_OPTIONS, ...options, sortBy, prefix: path || '' }\n return await post(\n this.fetch,\n `${this.url}/object/list/${this.bucketId}`,\n body,\n { headers: this.headers },\n parameters\n )\n })\n }\n\n /**\n * Lists all the files and folders within a bucket using the V2 API with pagination support.\n *\n * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —\n * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available\n * on entries in the `objects` array.\n *\n * @experimental this method signature might change in the future\n *\n * @category Storage\n * @subcategory File Buckets\n * @param options Search options including prefix, cursor for pagination, limit, with_delimiter\n * @param parameters Optional fetch parameters including signal for cancellation\n * @returns Promise with response containing folders/objects arrays with pagination info or error\n *\n * @example List files with pagination\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .from('avatars')\n * .listV2({\n * prefix: 'folder/',\n * limit: 100,\n * })\n *\n * // Handle pagination\n * if (data?.hasNext) {\n * const nextPage = await supabase\n * .storage\n * .from('avatars')\n * .listV2({\n * prefix: 'folder/',\n * cursor: data.nextCursor,\n * })\n * }\n *\n * // Handle files vs folders\n * data?.objects.forEach(file => {\n * if (file.id !== null) {\n * console.log('File:', file.name, 'Size:', file.metadata?.size)\n * }\n * })\n * data?.folders.forEach(folder => {\n * console.log('Folder:', folder.name)\n * })\n * ```\n */\n async listV2(\n options?: SearchV2Options,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: SearchV2Result\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const body = { ...options }\n return await post(\n this.fetch,\n `${this.url}/object/list-v2/${this.bucketId}`,\n body,\n { headers: this.headers },\n parameters\n )\n })\n }\n\n protected encodeMetadata(metadata: Record) {\n return JSON.stringify(metadata)\n }\n\n toBase64(data: string) {\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(data).toString('base64')\n }\n return btoa(data)\n }\n\n private _getFinalPath(path: string) {\n return `${this.bucketId}/${path.replace(/^\\/+/, '')}`\n }\n\n private _removeEmptyFolders(path: string) {\n return path.replace(/^\\/|\\/$/g, '').replace(/\\/+/g, '/')\n }\n\n /** Modifies the `query`, appending values the from `transform` */\n private applyTransformOptsToQuery(\n query: URLSearchParams,\n transform: TransformOptions\n ): URLSearchParams {\n if (transform.width) query.set('width', transform.width.toString())\n if (transform.height) query.set('height', transform.height.toString())\n if (transform.resize) query.set('resize', transform.resize)\n if (transform.format) query.set('format', transform.format)\n if (transform.quality) query.set('quality', transform.quality.toString())\n\n return query\n }\n}\n","// Generated automatically during releases by scripts/update-version-files.ts\n// This file provides runtime access to the package version for:\n// - HTTP request headers (e.g., X-Client-Info header for API requests)\n// - Debugging and support (identifying which version is running)\n// - Telemetry and logging (version reporting in errors/analytics)\n// - Ensuring build artifacts match the published package version\nexport const version = '2.112.3'\n","import { version } from './version'\nexport const DEFAULT_HEADERS = {\n 'X-Client-Info': `storage-js/${version}`,\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, get, post, put, remove } from '../lib/common/fetch'\nimport { encodeStoragePath } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n Bucket,\n BucketType,\n FetchParameters,\n ListBucketOptions,\n PurgeCacheOptions,\n} from '../lib/types'\nimport { StorageClientOptions } from '../StorageClient'\n\nexport default class StorageBucketApi extends BaseApiClient {\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n opts?: StorageClientOptions\n ) {\n const baseUrl = new URL(url)\n\n // if legacy uri is used, replace with new storage host (disables request buffering to allow > 50GB uploads)\n // \"project-ref.supabase.co\" becomes \"project-ref.storage.supabase.co\"\n if (opts?.useNewHostname) {\n const isSupabaseHost = /supabase\\.(co|in|red)$/.test(baseUrl.hostname)\n if (isSupabaseHost && !baseUrl.hostname.includes('storage.supabase.')) {\n baseUrl.hostname = baseUrl.hostname.replace('supabase.', 'storage.supabase.')\n }\n }\n\n const finalUrl = baseUrl.href.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, ...headers }\n\n super(finalUrl, finalHeaders, fetch, 'storage')\n }\n\n /**\n * Retrieves the details of all Storage buckets within an existing project.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param options Query parameters for listing buckets\n * @param options.limit Maximum number of buckets to return\n * @param options.offset Number of buckets to skip\n * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')\n * @param options.sortOrder Sort order ('asc' or 'desc')\n * @param options.search Search term to filter bucket names\n * @returns Promise with response containing array of buckets or error\n *\n * @example List buckets\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .listBuckets()\n * ```\n *\n * @example List buckets with options\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .listBuckets({\n * limit: 10,\n * offset: 0,\n * sortColumn: 'created_at',\n * sortOrder: 'desc',\n * search: 'prod'\n * })\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async listBuckets(options?: ListBucketOptions): Promise<\n | {\n data: Bucket[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const queryString = this.listBucketOptionsToQueryString(options)\n return await get(this.fetch, `${this.url}/bucket${queryString}`, {\n headers: this.headers,\n })\n })\n }\n\n /**\n * Retrieves the details of an existing Storage bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to retrieve.\n * @returns Promise with response containing bucket details or error\n *\n * @example Get bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .getBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"id\": \"avatars\",\n * \"name\": \"avatars\",\n * \"owner\": \"\",\n * \"public\": false,\n * \"file_size_limit\": 1024,\n * \"allowed_mime_types\": [\n * \"image/png\"\n * ],\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async getBucket(id: string): Promise<\n | {\n data: Bucket\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await get(this.fetch, `${this.url}/bucket/${id}`, { headers: this.headers })\n })\n }\n\n /**\n * Creates a new Storage bucket\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id A unique identifier for the bucket you are creating.\n * @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.\n * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.\n * The global file size limit takes precedence over this value.\n * The default value is null, which doesn't set a per bucket file size limit.\n * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.\n * The default value is null, which allows files with all mime types to be uploaded.\n * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.\n * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.\n * - default bucket type is `STANDARD`\n * @returns Promise with response containing newly created bucket name or error\n *\n * @example Create bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .createBucket('avatars', {\n * public: false,\n * allowedMimeTypes: ['image/png'],\n * fileSizeLimit: 1024\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"name\": \"avatars\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `insert`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async createBucket(\n id: string,\n options: {\n public: boolean\n fileSizeLimit?: number | string | null\n allowedMimeTypes?: string[] | null\n type?: BucketType\n } = {\n public: false,\n }\n ): Promise<\n | {\n data: Pick\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(\n this.fetch,\n `${this.url}/bucket`,\n {\n id,\n name: id,\n type: options.type,\n public: options.public,\n file_size_limit: options.fileSizeLimit,\n allowed_mime_types: options.allowedMimeTypes,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Updates a Storage bucket\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id A unique identifier for the bucket you are updating.\n * @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.\n * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.\n * The global file size limit takes precedence over this value.\n * The default value is null, which doesn't set a per bucket file size limit.\n * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.\n * The default value is null, which allows files with all mime types to be uploaded.\n * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.\n * @returns Promise with response containing success message or error\n *\n * @example Update bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .updateBucket('avatars', {\n * public: false,\n * allowedMimeTypes: ['image/png'],\n * fileSizeLimit: 1024\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully updated\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select` and `update`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async updateBucket(\n id: string,\n options: {\n public: boolean\n fileSizeLimit?: number | string | null\n allowedMimeTypes?: string[] | null\n }\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await put(\n this.fetch,\n `${this.url}/bucket/${id}`,\n {\n id,\n name: id,\n public: options.public,\n file_size_limit: options.fileSizeLimit,\n allowed_mime_types: options.allowedMimeTypes,\n },\n { headers: this.headers }\n )\n })\n }\n\n /**\n * Removes all objects inside a single bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to empty.\n * @returns Promise with success message or error\n *\n * @example Empty bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .emptyBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully emptied\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select`\n * - `objects` table permissions: `select` and `delete`\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async emptyBucket(id: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(this.fetch, `${this.url}/bucket/${id}/empty`, {}, { headers: this.headers })\n })\n }\n\n /**\n * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.\n * You must first `empty()` the bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to delete.\n * @returns Promise with success message or error\n *\n * @example Delete bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .deleteBucket('avatars')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully deleted\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - RLS policy permissions required:\n * - `buckets` table permissions: `select` and `delete`\n * - `objects` table permissions: none\n * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works\n */\n async deleteBucket(id: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(this.fetch, `${this.url}/bucket/${id}`, {}, { headers: this.headers })\n })\n }\n\n /**\n * Purges the CDN cache for an entire bucket.\n *\n * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server\n * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`.\n *\n * **Requires the `service_role` key.** The underlying endpoint enforces\n * `service_role` JWT — calls made with the anon key or a user JWT will be\n * rejected by the server.\n *\n * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must\n * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant\n * feature enabled, otherwise the server returns an error.\n *\n * @category Storage\n * @subcategory File Buckets\n * @param id The unique identifier of the bucket you would like to purge from cache.\n * @param options Optional purge cache options.\n * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact.\n * @param parameters Optional fetch parameters such as an `AbortController` signal.\n * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure.\n *\n * @example Purge cache for an entire bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .purgeBucketCache('avatars')\n * ```\n *\n * @example Purge only transformations for an entire bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .purgeBucketCache('avatars', { transformations: true })\n * ```\n */\n async purgeBucketCache(\n id: string,\n options?: PurgeCacheOptions,\n parameters?: FetchParameters\n ): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n const query = new URLSearchParams()\n if (options?.transformations) {\n query.set('transformations', 'true')\n }\n const queryString = query.toString()\n\n return await remove(\n this.fetch,\n `${this.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ''}`,\n {},\n { headers: this.headers },\n parameters\n )\n })\n }\n\n private listBucketOptionsToQueryString(options?: ListBucketOptions): string {\n const params: Record = {}\n if (options) {\n if ('limit' in options) {\n params.limit = String(options.limit)\n }\n if ('offset' in options) {\n params.offset = String(options.offset)\n }\n if (options.search) {\n params.search = options.search\n }\n if (options.sortColumn) {\n params.sortColumn = options.sortColumn\n }\n if (options.sortOrder) {\n params.sortOrder = options.sortOrder\n }\n }\n return Object.keys(params).length > 0 ? '?' + new URLSearchParams(params).toString() : ''\n }\n}\n","import { IcebergRestCatalog, IcebergError } from 'iceberg-js'\nimport { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, get, post, remove } from '../lib/common/fetch'\nimport { isValidBucketName } from '../lib/common/helpers'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport { AnalyticBucket } from '../lib/types'\n\ntype WrapAsyncMethod = T extends (...args: infer A) => Promise\n ? (...args: A) => Promise<{ data: R; error: null } | { data: null; error: IcebergError }>\n : T\n\nexport type WrappedIcebergRestCatalog = {\n [K in keyof IcebergRestCatalog]: WrapAsyncMethod\n}\n\n/**\n * Client class for managing Analytics Buckets using Iceberg tables\n * Provides methods for creating, listing, and deleting analytics buckets\n */\nexport default class StorageAnalyticsClient extends BaseApiClient {\n /**\n * @alpha\n *\n * Creates a new StorageAnalyticsClient instance\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param url - The base URL for the storage API\n * @param headers - HTTP headers to include in requests\n * @param fetch - Optional custom fetch implementation\n *\n * @example Using supabase-js (recommended)\n * ```typescript\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const { data, error } = await supabase.storage.analytics.listBuckets()\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```typescript\n * import { StorageAnalyticsClient } from '@supabase/storage-js'\n *\n * const client = new StorageAnalyticsClient(url, headers)\n * ```\n */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, ...headers }\n super(finalUrl, finalHeaders, fetch, 'storage')\n }\n\n /**\n * @alpha\n *\n * Creates a new analytics bucket using Iceberg tables\n * Analytics buckets are optimized for analytical queries and data processing\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param name A unique name for the bucket you are creating\n * @returns Promise with response containing newly created analytics bucket or error\n *\n * @example Create analytics bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .createBucket('analytics-data')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"name\": \"analytics-data\",\n * \"type\": \"ANALYTICS\",\n * \"format\": \"iceberg\",\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Creates a new analytics bucket using Iceberg tables\n * - Analytics buckets are optimized for analytical queries and data processing\n */\n async createBucket(name: string): Promise<\n | {\n data: AnalyticBucket\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await post(this.fetch, `${this.url}/bucket`, { name }, { headers: this.headers })\n })\n }\n\n /**\n * @alpha\n *\n * Retrieves the details of all Analytics Storage buckets within an existing project\n * Only returns buckets of type 'ANALYTICS'\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param options Query parameters for listing buckets\n * @param options.limit Maximum number of buckets to return\n * @param options.offset Number of buckets to skip\n * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')\n * @param options.sortOrder Sort order ('asc' or 'desc')\n * @param options.search Search term to filter bucket names\n * @returns Promise with response containing array of analytics buckets or error\n *\n * @example List analytics buckets\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .listBuckets({\n * limit: 10,\n * offset: 0,\n * sortColumn: 'created_at',\n * sortOrder: 'desc'\n * })\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": [\n * {\n * \"name\": \"analytics-data\",\n * \"type\": \"ANALYTICS\",\n * \"format\": \"iceberg\",\n * \"created_at\": \"2024-05-22T22:26:05.100Z\",\n * \"updated_at\": \"2024-05-22T22:26:05.100Z\"\n * }\n * ],\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Retrieves the details of all Analytics Storage buckets within an existing project\n * - Only returns buckets of type 'ANALYTICS'\n */\n async listBuckets(options?: {\n limit?: number\n offset?: number\n sortColumn?: 'name' | 'created_at' | 'updated_at'\n sortOrder?: 'asc' | 'desc'\n search?: string\n }): Promise<\n | {\n data: AnalyticBucket[]\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n // Build query string from options\n const queryParams = new URLSearchParams()\n if (options?.limit !== undefined) queryParams.set('limit', options.limit.toString())\n if (options?.offset !== undefined) queryParams.set('offset', options.offset.toString())\n if (options?.sortColumn) queryParams.set('sortColumn', options.sortColumn)\n if (options?.sortOrder) queryParams.set('sortOrder', options.sortOrder)\n if (options?.search) queryParams.set('search', options.search)\n\n const queryString = queryParams.toString()\n const url = queryString ? `${this.url}/bucket?${queryString}` : `${this.url}/bucket`\n\n return await get(this.fetch, url, { headers: this.headers })\n })\n }\n\n /**\n * @alpha\n *\n * Deletes an existing analytics bucket\n * A bucket can't be deleted with existing objects inside it\n * You must first empty the bucket before deletion\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param bucketName The unique identifier of the bucket you would like to delete\n * @returns Promise with response containing success message or error\n *\n * @example Delete analytics bucket\n * ```js\n * const { data, error } = await supabase\n * .storage\n * .analytics\n * .deleteBucket('analytics-data')\n * ```\n *\n * Response:\n * ```json\n * {\n * \"data\": {\n * \"message\": \"Successfully deleted\"\n * },\n * \"error\": null\n * }\n * ```\n *\n * @remarks\n * - Deletes an analytics bucket\n */\n async deleteBucket(bucketName: string): Promise<\n | {\n data: { message: string }\n error: null\n }\n | {\n data: null\n error: StorageError\n }\n > {\n return this.handleOperation(async () => {\n return await remove(\n this.fetch,\n `${this.url}/bucket/${bucketName}`,\n {},\n { headers: this.headers }\n )\n })\n }\n\n /**\n * @alpha\n *\n * Get an Iceberg REST Catalog client configured for a specific analytics bucket\n * Use this to perform advanced table and namespace operations within the bucket\n * The returned client provides full access to the Apache Iceberg REST Catalog API\n * with the Supabase `{ data, error }` pattern for consistent error handling on all operations.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n * @param bucketName - The name of the analytics bucket (warehouse) to connect to\n * @returns The wrapped Iceberg catalog client\n * @throws {StorageError} If the bucket name is invalid\n *\n * @example Get catalog and create table\n * ```js\n * // First, create an analytics bucket\n * const { data: bucket, error: bucketError } = await supabase\n * .storage\n * .analytics\n * .createBucket('analytics-data')\n *\n * // Get the Iceberg catalog for that bucket\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // Create a namespace\n * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })\n *\n * // Create a table with schema\n * const { data: tableMetadata, error: tableError } = await catalog.createTable(\n * { namespace: ['default'] },\n * {\n * name: 'events',\n * schema: {\n * type: 'struct',\n * fields: [\n * { id: 1, name: 'id', type: 'long', required: true },\n * { id: 2, name: 'timestamp', type: 'timestamp', required: true },\n * { id: 3, name: 'user_id', type: 'string', required: false }\n * ],\n * 'schema-id': 0,\n * 'identifier-field-ids': [1]\n * },\n * 'partition-spec': {\n * 'spec-id': 0,\n * fields: []\n * },\n * 'write-order': {\n * 'order-id': 0,\n * fields: []\n * },\n * properties: {\n * 'write.format.default': 'parquet'\n * }\n * }\n * )\n * ```\n *\n * @example List tables in namespace\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // List all tables in the default namespace\n * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })\n * if (listError) {\n * if (listError.isNotFound()) {\n * console.log('Namespace not found')\n * }\n * return\n * }\n * console.log(tables) // [{ namespace: ['default'], name: 'events' }]\n * ```\n *\n * @example Working with namespaces\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // List all namespaces\n * const { data: namespaces } = await catalog.listNamespaces()\n *\n * // Create namespace with properties\n * await catalog.createNamespace(\n * { namespace: ['production'] },\n * { properties: { owner: 'data-team', env: 'prod' } }\n * )\n * ```\n *\n * @example Cleanup operations\n * ```js\n * const catalog = supabase.storage.analytics.from('analytics-data')\n *\n * // Drop table with purge option (removes all data)\n * const { error: dropError } = await catalog.dropTable(\n * { namespace: ['default'], name: 'events' },\n * { purge: true }\n * )\n *\n * if (dropError?.isNotFound()) {\n * console.log('Table does not exist')\n * }\n *\n * // Drop namespace (must be empty)\n * await catalog.dropNamespace({ namespace: ['default'] })\n * ```\n *\n * @remarks\n * This method provides a bridge between Supabase's bucket management and the standard\n * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.\n * All authentication and configuration is handled automatically using your Supabase credentials.\n *\n * **Error Handling**: Invalid bucket names throw immediately. All catalog\n * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.\n * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.\n * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.\n *\n * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently\n * deletes all table data. Without it, the table is marked as deleted but data remains.\n *\n * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.\n * For complete API documentation and advanced usage, refer to the\n * [iceberg-js documentation](https://supabase.github.io/iceberg-js/).\n */\n from(bucketName: string): WrappedIcebergRestCatalog {\n // Validate bucket name using same rules as Supabase Storage API backend\n if (!isValidBucketName(bucketName)) {\n throw new StorageError(\n 'Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines ' +\n 'and should avoid the use of any other characters.'\n )\n }\n\n // Construct the Iceberg REST Catalog URL\n // The base URL is /storage/v1/iceberg\n // Note: IcebergRestCatalog from iceberg-js automatically adds /v1/ prefix to API paths\n // so we should NOT append /v1 here (it would cause double /v1/v1/ in the URL)\n const catalog = new IcebergRestCatalog({\n baseUrl: this.url,\n catalogName: bucketName, // Maps to the warehouse parameter in Supabase's implementation\n auth: {\n type: 'custom',\n getHeaders: async () => this.headers,\n },\n fetch: this.fetch,\n })\n\n const shouldThrowOnError = this.shouldThrowOnError\n\n const wrappedCatalog = new Proxy(catalog, {\n get(target, prop: keyof IcebergRestCatalog) {\n const value = target[prop]\n if (typeof value !== 'function') {\n return value\n }\n\n return async (...args: unknown[]) => {\n try {\n const data = await (value as Function).apply(target, args)\n return { data, error: null }\n } catch (error) {\n if (shouldThrowOnError) {\n throw error\n }\n return { data: null, error: error as IcebergError }\n }\n }\n },\n }) as unknown as WrappedIcebergRestCatalog\n\n return wrappedCatalog\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n VectorIndex,\n ListIndexesOptions,\n ListIndexesResponse,\n VectorDataType,\n DistanceMetric,\n MetadataConfiguration,\n} from '../lib/types'\n\n/**\n * @alpha\n *\n * Options for creating a vector index\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport interface CreateIndexOptions {\n vectorBucketName: string\n indexName: string\n dataType: VectorDataType\n dimension: number\n distanceMetric: DistanceMetric\n metadataConfiguration?: MetadataConfiguration\n}\n\n/**\n * @hidden\n * Base implementation for vector index operations.\n * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.\n */\nexport default class VectorIndexApi extends BaseApiClient {\n /** Creates a new VectorIndexApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Creates a new vector index within a bucket */\n async createIndex(options: CreateIndexOptions): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/CreateIndex`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n\n /** Retrieves metadata for a specific vector index */\n async getIndex(\n vectorBucketName: string,\n indexName: string\n ): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(\n this.fetch,\n `${this.url}/GetIndex`,\n { vectorBucketName, indexName },\n { headers: this.headers }\n )\n })\n }\n\n /** Lists vector indexes within a bucket with optional filtering and pagination */\n async listIndexes(options: ListIndexesOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListIndexes`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes a vector index and all its data */\n async deleteIndex(vectorBucketName: string, indexName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/DeleteIndex`,\n { vectorBucketName, indexName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n PutVectorsOptions,\n GetVectorsOptions,\n GetVectorsResponse,\n DeleteVectorsOptions,\n ListVectorsOptions,\n ListVectorsResponse,\n QueryVectorsOptions,\n QueryVectorsResponse,\n} from '../lib/types'\n\n/**\n * @hidden\n * Base implementation for vector data operations.\n * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.\n */\nexport default class VectorDataApi extends BaseApiClient {\n /** Creates a new VectorDataApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Inserts or updates vectors in batch (1-500 per request) */\n async putVectors(options: PutVectorsOptions): Promise> {\n // Validate batch size\n if (options.vectors.length < 1 || options.vectors.length > 500) {\n throw new Error('Vector batch size must be between 1 and 500 items')\n }\n\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/PutVectors`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n\n /** Retrieves vectors by their keys in batch */\n async getVectors(options: GetVectorsOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/GetVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Lists vectors in an index with pagination */\n async listVectors(options: ListVectorsOptions): Promise> {\n // Validate segment configuration\n if (options.segmentCount !== undefined) {\n if (options.segmentCount < 1 || options.segmentCount > 16) {\n throw new Error('segmentCount must be between 1 and 16')\n }\n if (options.segmentIndex !== undefined) {\n if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) {\n throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`)\n }\n }\n }\n\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Queries for similar vectors using approximate nearest neighbor search */\n async queryVectors(options: QueryVectorsOptions): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/QueryVectors`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes vectors by their keys in batch (1-500 per request) */\n async deleteVectors(options: DeleteVectorsOptions): Promise> {\n // Validate batch size\n if (options.keys.length < 1 || options.keys.length > 500) {\n throw new Error('Keys batch size must be between 1 and 500 items')\n }\n\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(this.fetch, `${this.url}/DeleteVectors`, options, {\n headers: this.headers,\n })\n return data || {}\n })\n }\n}\n","import { DEFAULT_HEADERS } from '../lib/constants'\nimport { StorageError } from '../lib/common/errors'\nimport { Fetch, vectorsApi } from '../lib/common/fetch'\nimport BaseApiClient from '../lib/common/BaseApiClient'\nimport {\n ApiResponse,\n VectorBucket,\n ListVectorBucketsOptions,\n ListVectorBucketsResponse,\n} from '../lib/types'\n\n/**\n * @hidden\n * Base implementation for vector bucket operations.\n * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.\n */\nexport default class VectorBucketApi extends BaseApiClient {\n /** Creates a new VectorBucketApi instance */\n constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {\n const finalUrl = url.replace(/\\/$/, '')\n const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers }\n super(finalUrl, finalHeaders, fetch, 'vectors')\n }\n\n /** Creates a new vector bucket */\n async createBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/CreateVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n\n /** Retrieves metadata for a specific vector bucket */\n async getBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(\n this.fetch,\n `${this.url}/GetVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n })\n }\n\n /** Lists vector buckets with optional filtering and pagination */\n async listBuckets(\n options: ListVectorBucketsOptions = {}\n ): Promise> {\n return this.handleOperation(async () => {\n return await vectorsApi.post(this.fetch, `${this.url}/ListVectorBuckets`, options, {\n headers: this.headers,\n })\n })\n }\n\n /** Deletes a vector bucket (must be empty first) */\n async deleteBucket(vectorBucketName: string): Promise> {\n return this.handleOperation(async () => {\n const data = await vectorsApi.post(\n this.fetch,\n `${this.url}/DeleteVectorBucket`,\n { vectorBucketName },\n { headers: this.headers }\n )\n return data || {}\n })\n }\n}\n","import VectorIndexApi, { CreateIndexOptions } from './VectorIndexApi'\nimport VectorDataApi from './VectorDataApi'\nimport { Fetch } from '../lib/common/fetch'\nimport VectorBucketApi from './VectorBucketApi'\nimport {\n ApiResponse,\n DeleteVectorsOptions,\n GetVectorsOptions,\n ListIndexesOptions,\n ListVectorsOptions,\n ListVectorBucketsOptions,\n ListVectorBucketsResponse,\n PutVectorsOptions,\n QueryVectorsOptions,\n VectorBucket,\n} from '../lib/types'\n\n/**\n *\n * @alpha\n *\n * Configuration options for the Storage Vectors client\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport interface StorageVectorsClientOptions {\n /**\n * Custom headers to include in all requests\n */\n headers?: { [key: string]: string }\n /**\n * Custom fetch implementation (optional)\n * Useful for testing or custom request handling\n */\n fetch?: Fetch\n}\n\n/**\n *\n * @alpha\n *\n * Main client for interacting with S3 Vectors API\n * Provides access to bucket, index, and vector data operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * **Usage Patterns:**\n *\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .createBucket('embeddings-prod')\n *\n * // Access index operations via buckets\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.createIndex({\n * indexName: 'documents',\n * dataType: 'float32',\n * dimension: 1536,\n * distanceMetric: 'cosine'\n * })\n *\n * // Access vector operations via index\n * const index = bucket.index('documents')\n * await index.putVectors({\n * vectors: [\n * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }\n * ]\n * })\n *\n * // Query similar vectors\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [...] },\n * topK: 5,\n * returnDistance: true\n * })\n * ```\n */\nexport class StorageVectorsClient extends VectorBucketApi {\n /**\n * @alpha\n *\n * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param url - Base URL of the Storage Vectors REST API.\n * @param options.headers - Optional headers (for example `Authorization`) applied to every request.\n * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.\n *\n * @example Using supabase-js (recommended)\n * ```typescript\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```typescript\n * import { StorageVectorsClient } from '@supabase/storage-js'\n *\n * const client = new StorageVectorsClient(url, options)\n * ```\n */\n constructor(url: string, options: StorageVectorsClientOptions = {}) {\n super(url, options.headers || {}, options.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Access operations for a specific vector bucket\n * Returns a scoped client for index and vector operations within the bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket\n * @returns Bucket-scoped client with index and vector operations\n *\n * @example Accessing a vector bucket\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n */\n from(vectorBucketName: string): VectorBucketScope {\n return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Creates a new vector bucket\n * Vector buckets are containers for vector indexes and their data\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Unique name for the vector bucket\n * @returns Promise with empty response on success or error\n *\n * @example Creating a vector bucket\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .createBucket('embeddings-prod')\n * ```\n */\n async createBucket(vectorBucketName: string): Promise> {\n return super.createBucket(vectorBucketName)\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves metadata for a specific vector bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket\n * @returns Promise with bucket metadata or error\n *\n * @example Get bucket metadata\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .getBucket('embeddings-prod')\n *\n * console.log('Bucket created:', data?.vectorBucket.creationTime)\n * ```\n */\n async getBucket(vectorBucketName: string): Promise> {\n return super.getBucket(vectorBucketName)\n }\n\n /**\n *\n * @alpha\n *\n * Lists all vector buckets with optional filtering and pagination\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Optional filters (prefix, maxResults, nextToken)\n * @returns Promise with list of buckets or error\n *\n * @example List vector buckets\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .listBuckets({ prefix: 'embeddings-' })\n *\n * data?.vectorBuckets.forEach(bucket => {\n * console.log(bucket.vectorBucketName)\n * })\n * ```\n */\n async listBuckets(\n options: ListVectorBucketsOptions = {}\n ): Promise> {\n return super.listBuckets(options)\n }\n\n /**\n *\n * @alpha\n *\n * Deletes a vector bucket (bucket must be empty)\n * All indexes must be deleted before deleting the bucket\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param vectorBucketName - Name of the vector bucket to delete\n * @returns Promise with empty response on success or error\n *\n * @example Delete a vector bucket\n * ```typescript\n * const { data, error } = await supabase\n * .storage\n * .vectors\n * .deleteBucket('embeddings-old')\n * ```\n */\n async deleteBucket(vectorBucketName: string): Promise> {\n return super.deleteBucket(vectorBucketName)\n }\n}\n\n/**\n *\n * @alpha\n *\n * Scoped client for operations within a specific vector bucket\n * Provides index management and access to vector operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport class VectorBucketScope extends VectorIndexApi {\n private vectorBucketName: string\n\n /**\n * @alpha\n *\n * Creates a helper that automatically scopes all index operations to the provided bucket.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @example Creating a vector bucket scope\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string },\n vectorBucketName: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch)\n this.vectorBucketName = vectorBucketName\n }\n\n /**\n *\n * @alpha\n *\n * Creates a new vector index in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Index configuration (vectorBucketName is automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Creating a vector index\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.createIndex({\n * indexName: 'documents-openai',\n * dataType: 'float32',\n * dimension: 1536,\n * distanceMetric: 'cosine',\n * metadataConfiguration: {\n * nonFilterableMetadataKeys: ['raw_text']\n * }\n * })\n * ```\n */\n override async createIndex(options: Omit) {\n return super.createIndex({\n ...options,\n vectorBucketName: this.vectorBucketName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Lists indexes in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Listing options (vectorBucketName is automatically set)\n * @returns Promise with response containing indexes array and pagination token or error\n *\n * @example List indexes\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * const { data } = await bucket.listIndexes({ prefix: 'documents-' })\n * ```\n */\n override async listIndexes(options: Omit = {}) {\n return super.listIndexes({\n ...options,\n vectorBucketName: this.vectorBucketName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves metadata for a specific index in this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index to retrieve\n * @returns Promise with index metadata or error\n *\n * @example Get index metadata\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * const { data } = await bucket.getIndex('documents-openai')\n * console.log('Dimension:', data?.index.dimension)\n * ```\n */\n override async getIndex(indexName: string) {\n return super.getIndex(this.vectorBucketName, indexName)\n }\n\n /**\n *\n * @alpha\n *\n * Deletes an index from this bucket\n * Convenience method that automatically includes the bucket name\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index to delete\n * @returns Promise with empty response on success or error\n *\n * @example Delete an index\n * ```typescript\n * const bucket = supabase.storage.vectors.from('embeddings-prod')\n * await bucket.deleteIndex('old-index')\n * ```\n */\n override async deleteIndex(indexName: string) {\n return super.deleteIndex(this.vectorBucketName, indexName)\n }\n\n /**\n *\n * @alpha\n *\n * Access operations for a specific index within this bucket\n * Returns a scoped client for vector data operations\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param indexName - Name of the index\n * @returns Index-scoped client with vector data operations\n *\n * @example Accessing an index\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n *\n * // Insert vectors\n * await index.putVectors({\n * vectors: [\n * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }\n * ]\n * })\n *\n * // Query similar vectors\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [...] },\n * topK: 5\n * })\n * ```\n */\n index(indexName: string): VectorIndexScope {\n return new VectorIndexScope(\n this.url,\n this.headers,\n this.vectorBucketName,\n indexName,\n this.fetch\n )\n }\n}\n\n/**\n *\n * @alpha\n *\n * Scoped client for operations within a specific vector index\n * Provides vector data operations (put, get, list, query, delete)\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n */\nexport class VectorIndexScope extends VectorDataApi {\n private vectorBucketName: string\n private indexName: string\n\n /**\n *\n * @alpha\n *\n * Creates a helper that automatically scopes all vector operations to the provided bucket/index names.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @example Creating a vector index scope\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string },\n vectorBucketName: string,\n indexName: string,\n fetch?: Fetch\n ) {\n super(url, headers, fetch)\n this.vectorBucketName = vectorBucketName\n this.indexName = indexName\n }\n\n /**\n *\n * @alpha\n *\n * Inserts or updates vectors in this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Vector insertion options (bucket and index names automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Insert vectors into an index\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * await index.putVectors({\n * vectors: [\n * {\n * key: 'doc-1',\n * data: { float32: [0.1, 0.2, ...] },\n * metadata: { title: 'Introduction', page: 1 }\n * }\n * ]\n * })\n * ```\n */\n override async putVectors(options: Omit) {\n return super.putVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Retrieves vectors by keys from this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Vector retrieval options (bucket and index names automatically set)\n * @returns Promise with response containing vectors array or error\n *\n * @example Get vectors by keys\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.getVectors({\n * keys: ['doc-1', 'doc-2'],\n * returnMetadata: true\n * })\n * ```\n */\n override async getVectors(options: Omit) {\n return super.getVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Lists vectors in this index with pagination\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Listing options (bucket and index names automatically set)\n * @returns Promise with response containing vectors array and pagination token or error\n *\n * @example List vectors with pagination\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.listVectors({\n * maxResults: 500,\n * returnMetadata: true\n * })\n * ```\n */\n override async listVectors(\n options: Omit = {}\n ) {\n return super.listVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Queries for similar vectors in this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Query options (bucket and index names automatically set)\n * @returns Promise with response containing matches array of similar vectors ordered by distance or error\n *\n * @example Query similar vectors\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * const { data } = await index.queryVectors({\n * queryVector: { float32: [0.1, 0.2, ...] },\n * topK: 5,\n * filter: { category: 'technical' },\n * returnDistance: true,\n * returnMetadata: true\n * })\n * ```\n */\n override async queryVectors(\n options: Omit\n ) {\n return super.queryVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Deletes vectors by keys from this index\n * Convenience method that automatically includes bucket and index names\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n * @param options - Deletion options (bucket and index names automatically set)\n * @returns Promise with empty response on success or error\n *\n * @example Delete vectors by keys\n * ```typescript\n * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')\n * await index.deleteVectors({\n * keys: ['doc-1', 'doc-2', 'doc-3']\n * })\n * ```\n */\n override async deleteVectors(\n options: Omit\n ) {\n return super.deleteVectors({\n ...options,\n vectorBucketName: this.vectorBucketName,\n indexName: this.indexName,\n })\n }\n}\n","import StorageFileApi from './packages/StorageFileApi'\nimport StorageBucketApi from './packages/StorageBucketApi'\nimport StorageAnalyticsClient from './packages/StorageAnalyticsClient'\nimport { Fetch } from './lib/common/fetch'\nimport { StorageVectorsClient } from './packages/StorageVectorsClient'\n\nexport interface StorageClientOptions {\n useNewHostname?: boolean\n}\n\nexport class StorageClient extends StorageBucketApi {\n /**\n * Creates a client for Storage buckets, files, analytics, and vectors.\n *\n * @category Storage\n * @subcategory File Buckets\n *\n * @example Using supabase-js (recommended)\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const avatars = supabase.storage.from('avatars')\n * ```\n *\n * @example Standalone import for bundle-sensitive environments\n * ```ts\n * import { StorageClient } from '@supabase/storage-js'\n *\n * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {\n * apikey: 'your-publishable-key',\n * })\n * const avatars = storage.from('avatars')\n * ```\n */\n constructor(\n url: string,\n headers: { [key: string]: string } = {},\n fetch?: Fetch,\n opts?: StorageClientOptions\n ) {\n super(url, headers, fetch, opts)\n }\n\n /**\n * Perform file operation in a bucket.\n *\n * @category Storage\n * @subcategory File Buckets\n *\n * @param id The bucket id to operate on.\n *\n * @example Accessing a bucket\n * ```typescript\n * const avatars = supabase.storage.from('avatars')\n * ```\n */\n from(id: string): StorageFileApi {\n return new StorageFileApi(this.url, this.headers, id, this.fetch)\n }\n\n /**\n *\n * @alpha\n *\n * Access vector storage operations.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Vector Buckets\n *\n * @returns A StorageVectorsClient instance configured with the current storage settings.\n */\n get vectors(): StorageVectorsClient {\n return new StorageVectorsClient(this.url + '/vector', {\n headers: this.headers,\n fetch: this.fetch,\n })\n }\n\n /**\n *\n * @alpha\n *\n * Access analytics storage operations using Iceberg tables.\n *\n * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.\n *\n * @category Storage\n * @subcategory Analytics Buckets\n *\n * @returns A StorageAnalyticsClient instance configured with the current storage settings.\n */\n get analytics(): StorageAnalyticsClient {\n return new StorageAnalyticsClient(this.url + '/iceberg', this.headers, this.fetch)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAa,eAAb,cAAkC,MA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B,MAAe,cACb,SACA;0CACO,MAAM;AAAb,uFACK;GACH,kBAAkBA,QAAK;GACvB,WAAWA,QAAK;;;;;;;ACtnBtB,IAAa,gBAAb,cAAmC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlD,YACE,KACA,UAAqC,EAAE,EACvC,SACA,MACA;AACA,QAAM,KAAK,SAASC,SAAO,KAAK;;;;;;;;;;;;;;;CAgBlC,KAAK,IAA4B;AAC/B,SAAO,IAAI,eAAe,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,MAAM;;;;;;;;;;;;;;;CAgBnE,IAAI,UAAgC;AAClC,SAAO,IAAI,qBAAqB,KAAK,MAAM,WAAW;GACpD,SAAS,KAAK;GACd,OAAO,KAAK;GACb,CAAC;;;;;;;;;;;;;;;CAgBJ,IAAI,YAAoC;AACtC,SAAO,IAAI,uBAAuB,KAAK,MAAM,YAAY,KAAK,SAAS,KAAK,MAAM"} \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/dist/umd/supabase.js b/node_modules/@supabase/storage-js/dist/umd/supabase.js new file mode 100644 index 0000000000000000000000000000000000000000..e8ba58ed81e3e61b55658643a0c4094f3f5a7860 --- /dev/null +++ b/node_modules/@supabase/storage-js/dist/umd/supabase.js @@ -0,0 +1 @@ +var supabase=(function(e){var t=class extends Error{constructor(e,t=`storage`,n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t===`vectors`?`StorageVectorsError`:`StorageError`,this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function n(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var r=class extends t{constructor(e,t,n,r=`storage`,i){super(e,r,t,n),this.name=r===`vectors`?`StorageVectorsApiError`:`StorageApiError`,this.status=t,this.statusCode=n,this.code=i}toJSON(){return{...super.toJSON(),code:this.code}}},i=class extends t{constructor(e,t,n=`storage`){super(e,n),this.name=n===`vectors`?`StorageVectorsUnknownError`:`StorageUnknownError`,this.originalError=t}},a=class extends t{constructor(e){super(e,`vectors`)}};function o(e){return n(e)&&e.namespace===`vectors`}var s=class extends r{constructor(e,t,n){super(e,t,n,`vectors`)}},c=class extends i{constructor(e,t){super(e,t,`vectors`)}};let l=function(e){return e.InternalError=`InternalError`,e.S3VectorConflictException=`S3VectorConflictException`,e.S3VectorNotFoundException=`S3VectorNotFoundException`,e.S3VectorBucketNotEmpty=`S3VectorBucketNotEmpty`,e.S3VectorMaxBucketsExceeded=`S3VectorMaxBucketsExceeded`,e.S3VectorMaxIndexesExceeded=`S3VectorMaxIndexesExceeded`,e}({});function u(e,t,n){let r={...e},i=t.toLowerCase();for(let e of Object.keys(r))e.toLowerCase()===i&&delete r[e];return r[i]=n,r}function d(e){let t={};for(let[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}let f=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),p=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},m=e=>{if(Array.isArray(e))return e.map(e=>m(e));if(typeof e==`function`||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,n])=>{let r=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,``));t[r]=m(n)}),t},h=e=>!e||typeof e!=`string`||e.length===0||e.length>100||e.trim()!==e||e.includes(`/`)||e.includes(`\\`)?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),g=e=>e.split(`/`).map(encodeURIComponent).join(`/`),_=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error;if(typeof t.error==`object`&&t.error!==null){let e=t.error;if(typeof e.message==`string`)return e.message}}return JSON.stringify(e)},v=async(e,t,n,a)=>{if(typeof e==`object`&&e&&`json`in e&&typeof e.json==`function`){let n=e,i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(e=>{let n=e?.statusCode||e?.code||i+``;t(new r(_(e),i,n,a,e?.code))}).catch(()=>{let e=i+``;t(new r(n.statusText||`HTTP ${i} error`,i,e,a))})}else t(new i(_(e),e,a))},y=(e,t,n,r)=>{let i={method:e,headers:t?.headers||{}};if(e===`GET`||e===`HEAD`||!r)return{...i,...n};if(p(r)){let e=t?.headers||{},n;for(let[t,r]of Object.entries(e))t.toLowerCase()===`content-type`&&(n=r);i.headers=u(e,`Content-Type`,n??`application/json`),i.body=JSON.stringify(r)}else i.body=r;return t?.duplex&&(i.duplex=t.duplex),{...i,...n}};async function b(e,t,n,r,i,a,o){return new Promise((s,c)=>{e(n,y(t,r,i,a)).then(e=>{if(!e.ok)throw e;if(r?.noResolveJson)return e;if(o===`vectors`){let t=e.headers.get(`content-type`);if(e.headers.get(`content-length`)===`0`||e.status===204||!t||!t.includes(`application/json`))return{}}return e.json()}).then(e=>s(e)).catch(e=>v(e,c,r,o))})}function x(e=`storage`){return{get:async(t,n,r,i)=>b(t,`GET`,n,r,i,void 0,e),post:async(t,n,r,i,a)=>b(t,`POST`,n,i,a,r,e),put:async(t,n,r,i,a)=>b(t,`PUT`,n,i,a,r,e),head:async(t,n,r,i)=>b(t,`HEAD`,n,{...r,noResolveJson:!0},i,void 0,e),remove:async(t,n,r,i,a)=>b(t,`DELETE`,n,i,a,r,e)}}let{get:S,post:C,put:w,head:T,remove:E}=x(`storage`),D=x(`vectors`);var O=class{constructor(e,t={},n,r=`storage`){this.shouldThrowOnError=!1,this.url=e,this.headers=d(t),this.fetch=f(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=u(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let k;var A=class{static{k=Symbol.toStringTag}constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[k]=`StreamDownloadBuilder`,this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let j;var M=class{static{j=Symbol.toStringTag}constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[j]=`BlobDownloadBuilder`,this.promise=null}asStream(){return new A(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e))return{data:null,error:e};throw e}}};let N={limit:100,offset:0,sortBy:{column:`name`,order:`asc`}},P={cacheControl:`3600`,contentType:`text/plain;charset=UTF-8`,upsert:!1};var F=class extends O{constructor(e,t={},n,r){super(e,t,r,`storage`),this.bucketId=n}async uploadOrUpdate(e,t,n,r){return this.handleOperation(async()=>{let i,a={...P,...r},o={...this.headers,...e===`POST`&&{"x-upsert":String(a.upsert)}},s=a.metadata;if(typeof Blob<`u`&&n instanceof Blob?(i=new FormData,i.append(`cacheControl`,a.cacheControl),s&&i.append(`metadata`,this.encodeMetadata(s)),i.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(i=n,i.has(`cacheControl`)||i.append(`cacheControl`,a.cacheControl),s&&!i.has(`metadata`)&&i.append(`metadata`,this.encodeMetadata(s))):(i=n,o[`cache-control`]=`max-age=${a.cacheControl}`,o[`content-type`]=a.contentType,s&&(o[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&i instanceof ReadableStream||i&&typeof i==`object`&&`pipe`in i&&typeof i.pipe==`function`)&&!a.duplex&&(a.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))o=u(o,e,t);let c=this._removeEmptyFolders(t),l=this._getFinalPath(c),d=await(e==`PUT`?w:C)(this.fetch,`${this.url}/object/${l}`,i,{headers:o,...a?.duplex?{duplex:a.duplex}:{}});return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate(`POST`,e,t,n)}async uploadToSignedUrl(e,t,n,r){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${a}`);return o.searchParams.set(`token`,t),this.handleOperation(async()=>{let e,t={...P,...r},a={...this.headers,"x-upsert":String(t.upsert)},s=t.metadata;if(typeof Blob<`u`&&n instanceof Blob?(e=new FormData,e.append(`cacheControl`,t.cacheControl),s&&e.append(`metadata`,this.encodeMetadata(s)),e.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(e=n,e.has(`cacheControl`)||e.append(`cacheControl`,t.cacheControl),s&&!e.has(`metadata`)&&e.append(`metadata`,this.encodeMetadata(s))):(e=n,a[`cache-control`]=`max-age=${t.cacheControl}`,a[`content-type`]=t.contentType,s&&(a[`x-metadata`]=this.toBase64(this.encodeMetadata(s))),(typeof ReadableStream<`u`&&e instanceof ReadableStream||e&&typeof e==`object`&&`pipe`in e&&typeof e.pipe==`function`)&&!t.duplex&&(t.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))a=u(a,e,t);return{path:i,fullPath:(await w(this.fetch,o.toString(),e,{headers:a,...t?.duplex?{duplex:t.duplex}:{}})).Key}})}async createSignedUploadUrl(e,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i={...this.headers};n?.upsert&&(i[`x-upsert`]=`true`);let a=await C(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(this.url+a.url),s=o.searchParams.get(`token`);if(!s)throw new t(`No token returned by API`);return{signedUrl:o.toString(),path:e,token:s}})}async update(e,t,n){return this.uploadOrUpdate(`PUT`,e,t,n)}async move(e,t,n){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers}))}async copy(e,t,n){return this.handleOperation(async()=>({path:(await C(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key}))}async createSignedUrl(e,t,n){return this.handleOperation(async()=>{let r=this._getFinalPath(e),i=typeof n?.transform==`object`&&n.transform!==null&&Object.keys(n.transform).length>0,a=await C(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t,...i?{transform:n.transform}:{}},{headers:this.headers}),o=new URLSearchParams;n?.download&&o.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&o.set(`cacheNonce`,String(n.cacheNonce));let s=o.toString();return{signedUrl:encodeURI(`${this.url}${a.signedURL}${s?`&${s}`:``}`)}})}async createSignedUrls(e,t,n){return this.handleOperation(async()=>{let r=await C(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=new URLSearchParams;n?.download&&i.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&i.set(`cacheNonce`,String(n.cacheNonce));let a=i.toString();return r.map(e=>({...e,signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${a?`&${a}`:``}`):null}))})}download(e,t,n){let r=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image/authenticated`:`object`,i=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(i,t.transform),t?.cacheNonce!=null&&i.set(`cacheNonce`,String(t.cacheNonce));let a=i.toString(),o=this._getFinalPath(e);return new M(()=>S(this.fetch,`${this.url}/${r}/${o}${a?`?${a}`:``}`,{headers:this.headers,noResolveJson:!0},n),this.shouldThrowOnError)}async info(e){let t=this._getFinalPath(e);return this.handleOperation(async()=>m(await S(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers})))}async exists(e){let t=this._getFinalPath(e);try{return await T(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(n(e)){let t=e instanceof r?e.status:e instanceof i?e.originalError?.status:void 0;if(t!==void 0&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){let n=this._getFinalPath(e),r=new URLSearchParams;t?.download&&r.set(`download`,t.download===!0?``:t.download),t?.transform&&this.applyTransformOptsToQuery(r,t.transform),t?.cacheNonce!=null&&r.set(`cacheNonce`,String(t.cacheNonce));let i=r.toString(),a=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image`:`object`;return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}`)+(i?`?${i}`:``)}}}async remove(e){return this.handleOperation(async()=>await E(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}))}async purgeCache(e,t,n){return this.handleOperation(async()=>{let r=g(this._getFinalPath(e)),i=new URLSearchParams;t?.transformations&&i.set(`transformations`,`true`);let a=i.toString();return await E(this.fetch,`${this.url}/cdn/${r}${a?`?${a}`:``}`,{},{headers:this.headers},n)})}async list(e,t,n){return this.handleOperation(async()=>{let r=t?.sortBy?{...N.sortBy,...t.sortBy}:N.sortBy,i={...N,...t,sortBy:r,prefix:e||``};return await C(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n)})}async listV2(e,t){return this.handleOperation(async()=>{let n={...e};return await C(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,``)}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)}applyTransformOptsToQuery(e,t){return t.width&&e.set(`width`,t.width.toString()),t.height&&e.set(`height`,t.height.toString()),t.resize&&e.set(`resize`,t.resize),t.format&&e.set(`format`,t.format),t.quality&&e.set(`quality`,t.quality.toString()),e}};let I={"X-Client-Info":`storage-js/2.112.3`};var L=class extends O{constructor(e,t={},n,r){let i=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes(`storage.supabase.`)&&(i.hostname=i.hostname.replace(`supabase.`,`storage.supabase.`));let a=i.href.replace(/\/$/,``),o={...I,...t};super(a,o,n,`storage`)}async listBuckets(e){return this.handleOperation(async()=>{let t=this.listBucketOptionsToQueryString(e);return await S(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers})})}async getBucket(e){return this.handleOperation(async()=>await S(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}))}async createBucket(e,t={public:!1}){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async updateBucket(e,t){return this.handleOperation(async()=>await w(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}))}async emptyBucket(e){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await E(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}async purgeBucketCache(e,t,n){return this.handleOperation(async()=>{let r=new URLSearchParams;t?.transformations&&r.set(`transformations`,`true`);let i=r.toString();return await E(this.fetch,`${this.url}/cdn/${g(e)}${i?`?${i}`:``}`,{},{headers:this.headers},n)})}listBucketOptionsToQueryString(e){let t={};return e&&(`limit`in e&&(t.limit=String(e.limit)),`offset`in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?`?`+new URLSearchParams(t).toString():``}},R=class extends Error{constructor(e,t){super(e),this.name=`IcebergError`,this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType===`CommitStateUnknownException`||[500,502,504].includes(t.status)&&t.icebergType?.includes(`CommitState`)===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function z(e,t,n){let r=new URL(t,e);if(n)for(let[e,t]of Object.entries(n))t!==void 0&&r.searchParams.set(e,t);return r.toString()}async function B(e){return!e||e.type===`none`?{}:e.type===`bearer`?{Authorization:`Bearer ${e.token}`}:e.type===`header`?{[e.name]:e.value}:e.type===`custom`?await e.getHeaders():{}}function V(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:a,headers:o}){let s=z(e.baseUrl,r,i),c=await B(e.auth),l=await t(s,{method:n,headers:{...a?{"Content-Type":`application/json`}:{},...c,...o},body:a?JSON.stringify(a):void 0}),u=await l.text(),d=(l.headers.get(`content-type`)||``).includes(`application/json`),f=d&&u?JSON.parse(u):u;if(!l.ok){let e=d?f:void 0,t=e?.error;throw new R(t?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:l.status,headers:l.headers,data:f}}}}function H(e){return e.join(``)}var U=class{constructor(e,t=``){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:H(e.namespace)}:void 0;return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${H(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${H(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${H(e.namespace)}`}),!0}catch(e){if(e instanceof R&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof R&&e.status===409)return;throw e}}};function W(e){return e.join(``)}var G=class{constructor(e,t=``,n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let n={};return this.accessDelegation&&(n[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){let n=await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data[`metadata-location`],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation);try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${W(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof R&&e.status===404)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof R&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},K=class{constructor(e){let t=`v1`;e.catalogName&&(t+=`/${e.catalogName}`),this.client=V({baseUrl:e.baseUrl.endsWith(`/`)?e.baseUrl:`${e.baseUrl}/`,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(`,`),this.namespaceOps=new U(this.client,t),this.tableOps=new G(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},q=class extends O{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...I,...t};super(r,i,n,`storage`)}async createBucket(e){return this.handleOperation(async()=>await C(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}))}async listBuckets(e){return this.handleOperation(async()=>{let t=new URLSearchParams;e?.limit!==void 0&&t.set(`limit`,e.limit.toString()),e?.offset!==void 0&&t.set(`offset`,e.offset.toString()),e?.sortColumn&&t.set(`sortColumn`,e.sortColumn),e?.sortOrder&&t.set(`sortOrder`,e.sortOrder),e?.search&&t.set(`search`,e.search);let n=t.toString(),r=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return await S(this.fetch,r,{headers:this.headers})})}async deleteBucket(e){return this.handleOperation(async()=>await E(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}))}from(e){if(!h(e))throw new t(`Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.`);let n=new K({baseUrl:this.url,catalogName:e,auth:{type:`custom`,getHeaders:async()=>this.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(e,t){let n=e[t];return typeof n==`function`?async(...t)=>{try{return{data:await n.apply(e,t),error:null}}catch(e){if(r)throw e;return{data:null,error:e}}}:n}})}},J=class extends O{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...I,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createIndex(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers})||{})}async getIndex(e,t){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))}async listIndexes(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}))}async deleteIndex(e,t){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers})||{})}},Y=class extends O{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...I,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async putVectors(e){if(e.vectors.length<1||e.vectors.length>500)throw Error(`Vector batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers})||{})}async getVectors(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}))}async listVectors(e){if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw Error(`segmentCount must be between 1 and 16`);if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}))}async queryVectors(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}))}async deleteVectors(e){if(e.keys.length<1||e.keys.length>500)throw Error(`Keys batch size must be between 1 and 500 items`);return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers})||{})}},X=class extends O{constructor(e,t={},n){let r=e.replace(/\/$/,``),i={...I,"Content-Type":`application/json`,...t};super(r,i,n,`vectors`)}async createBucket(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}async getBucket(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}))}async listBuckets(e={}){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}))}async deleteBucket(e){return this.handleOperation(async()=>await D.post(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{})}},Z=class extends X{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Q(this.url,this.headers,e,this.fetch)}async createBucket(e){return super.createBucket(e)}async getBucket(e){return super.getBucket(e)}async listBuckets(e={}){return super.listBuckets(e)}async deleteBucket(e){return super.deleteBucket(e)}},Q=class extends J{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){return super.createIndex({...e,vectorBucketName:this.vectorBucketName})}async listIndexes(e={}){return super.listIndexes({...e,vectorBucketName:this.vectorBucketName})}async getIndex(e){return super.getIndex(this.vectorBucketName,e)}async deleteIndex(e){return super.deleteIndex(this.vectorBucketName,e)}index(e){return new $(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},$=class extends Y{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){return super.putVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async getVectors(e){return super.getVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async listVectors(e={}){return super.listVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async queryVectors(e){return super.queryVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}async deleteVectors(e){return super.deleteVectors({...e,vectorBucketName:this.vectorBucketName,indexName:this.indexName})}},ee=class extends L{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new F(this.url,this.headers,e,this.fetch)}get vectors(){return new Z(this.url+`/vector`,{headers:this.headers,fetch:this.fetch})}get analytics(){return new q(this.url+`/iceberg`,this.headers,this.fetch)}};return e.StorageAnalyticsClient=q,e.StorageApiError=r,e.StorageClient=ee,e.StorageError=t,e.StorageUnknownError=i,e.StorageVectorsApiError=s,e.StorageVectorsClient=Z,e.StorageVectorsError=a,e.StorageVectorsErrorCode=l,e.StorageVectorsUnknownError=c,e.VectorBucketApi=X,e.VectorBucketScope=Q,e.VectorDataApi=Y,e.VectorIndexApi=J,e.VectorIndexScope=$,e.isStorageError=n,e.isStorageVectorsError=o,e})({}); \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/migrations/README.md b/node_modules/@supabase/storage-js/migrations/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e20f6f5dbff3d205623f120857e1e0d909f7a31c --- /dev/null +++ b/node_modules/@supabase/storage-js/migrations/README.md @@ -0,0 +1,25 @@ +# Migration notes for `@supabase/storage-js` + +Each file in this directory describes one migration theme — what changed in `@supabase/storage-js`, who is affected, and what callers need to do. + +Files are shipped with the npm package, so the migration notes you see here are pinned to the version of `@supabase/storage-js` you have installed. Upgrading the package brings the relevant migration notes along with it. + +## How agents should use this directory + +When helping a developer upgrade `@supabase/storage-js`: + +1. Read the migration files in `node_modules/@supabase/storage-js/migrations/` for the version they have installed. +2. Cross-reference against the version they are upgrading to. +3. Apply the migration steps described in each relevant file. + +## How humans should use this directory + +Browse the files for the migration theme you care about. Each file is self-contained and explains its own scope, audience, and steps. + +## File naming + +One file per migration theme, named by topic rather than version (e.g. `.md`, kebab-case). A single version can ship multiple theme files; a single theme can span multiple versions. Each file documents its own `Since` / `Will require action by` version range internally. + +## Cross-cutting migration notes + +Migrations that span multiple Supabase packages (e.g. Node.js version drops, monorepo restructures) live in [`docs/MIGRATION.md`](../../../../docs/MIGRATION.md) at the repository root, not here. This directory is scoped to `@supabase/storage-js` only. diff --git a/node_modules/@supabase/storage-js/package.json b/node_modules/@supabase/storage-js/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c8f661bca20dddeb13c17cd3e894d5d758dd9643 --- /dev/null +++ b/node_modules/@supabase/storage-js/package.json @@ -0,0 +1,70 @@ +{ + "name": "@supabase/storage-js", + "version": "2.112.3", + "description": "Isomorphic storage client for Supabase.", + "keywords": [ + "javascript", + "typescript", + "supabase" + ], + "homepage": "https://github.com/supabase/supabase-js/tree/master/packages/core/storage-js", + "bugs": "https://github.com/supabase/supabase-js/issues", + "license": "MIT", + "author": "Supabase", + "files": [ + "dist", + "src", + "migrations", + "AGENTS.md" + ], + "main": "dist/index.cjs", + "module": "dist/index.mjs", + "types": "dist/index.d.cts", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + }, + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, + "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/supabase/supabase-js.git", + "directory": "packages/core/storage-js" + }, + "dependencies": { + "iceberg-js": "^0.8.1", + "tslib": "2.8.1" + }, + "devDependencies": { + "@types/jest": "30.0.0", + "@types/node": "20.19.9", + "jest": "30.4.2", + "ts-jest": "^29.4.9", + "tsdown": "^0.18.0", + "typedoc": "^0.27.9", + "typescript": "~5.8.3" + }, + "jsdelivr": "dist/umd/supabase.js", + "unpkg": "dist/umd/supabase.js", + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=22.0.0" + }, + "scripts": { + "build": "tsdown", + "build:watch": "tsdown --watch", + "docs": "typedoc --options ../../../typedoc.base.mjs --entryPoints src/index.ts --out docs/v2 --entryPoints src/packages/* --excludePrivate --excludeProtected", + "docs:json": "typedoc --options ../../../typedoc.base.mjs --json docs/v2/spec.json --entryPoints src/index.ts --entryPoints src/packages/* --excludePrivate --excludeExternals --excludeProtected" + } +} \ No newline at end of file diff --git a/node_modules/@supabase/storage-js/src/StorageClient.ts b/node_modules/@supabase/storage-js/src/StorageClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a264bcfbef966bc5fd8bca18949752da8929851 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/StorageClient.ts @@ -0,0 +1,98 @@ +import StorageFileApi from './packages/StorageFileApi' +import StorageBucketApi from './packages/StorageBucketApi' +import StorageAnalyticsClient from './packages/StorageAnalyticsClient' +import { Fetch } from './lib/common/fetch' +import { StorageVectorsClient } from './packages/StorageVectorsClient' + +export interface StorageClientOptions { + useNewHostname?: boolean +} + +export class StorageClient extends StorageBucketApi { + /** + * Creates a client for Storage buckets, files, analytics, and vectors. + * + * @category Storage + * @subcategory File Buckets + * + * @example Using supabase-js (recommended) + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const avatars = supabase.storage.from('avatars') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```ts + * import { StorageClient } from '@supabase/storage-js' + * + * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', { + * apikey: 'your-publishable-key', + * }) + * const avatars = storage.from('avatars') + * ``` + */ + constructor( + url: string, + headers: { [key: string]: string } = {}, + fetch?: Fetch, + opts?: StorageClientOptions + ) { + super(url, headers, fetch, opts) + } + + /** + * Perform file operation in a bucket. + * + * @category Storage + * @subcategory File Buckets + * + * @param id The bucket id to operate on. + * + * @example Accessing a bucket + * ```typescript + * const avatars = supabase.storage.from('avatars') + * ``` + */ + from(id: string): StorageFileApi { + return new StorageFileApi(this.url, this.headers, id, this.fetch) + } + + /** + * + * @alpha + * + * Access vector storage operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * + * @returns A StorageVectorsClient instance configured with the current storage settings. + */ + get vectors(): StorageVectorsClient { + return new StorageVectorsClient(this.url + '/vector', { + headers: this.headers, + fetch: this.fetch, + }) + } + + /** + * + * @alpha + * + * Access analytics storage operations using Iceberg tables. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * + * @returns A StorageAnalyticsClient instance configured with the current storage settings. + */ + get analytics(): StorageAnalyticsClient { + return new StorageAnalyticsClient(this.url + '/iceberg', this.headers, this.fetch) + } +} diff --git a/node_modules/@supabase/storage-js/src/index.ts b/node_modules/@supabase/storage-js/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab85d29740cd6f9e2d007fee080fccfdc413d38d --- /dev/null +++ b/node_modules/@supabase/storage-js/src/index.ts @@ -0,0 +1,19 @@ +export { StorageClient } from './StorageClient' +export type { StorageClientOptions } from './StorageClient' +export { default as StorageAnalyticsClient } from './packages/StorageAnalyticsClient' + +// Vector Storage +export { + StorageVectorsClient, + VectorBucketScope, + VectorIndexScope, +} from './packages/StorageVectorsClient' +export type { StorageVectorsClientOptions } from './packages/StorageVectorsClient' +export { default as VectorBucketApi } from './packages/VectorBucketApi' +export { default as VectorDataApi } from './packages/VectorDataApi' +export { default as VectorIndexApi } from './packages/VectorIndexApi' +export type { CreateIndexOptions } from './packages/VectorIndexApi' + +// Types and Errors +export * from './lib/types' +export * from './lib/common/errors' diff --git a/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts b/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbe9e38e49e589f79a88ce7af3924faa85ab6555 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/common/BaseApiClient.ts @@ -0,0 +1,104 @@ +import { ErrorNamespace, isStorageError, StorageError } from './errors' +import { Fetch } from './fetch' +import { normalizeHeaders, setHeader as setHeaderUtil } from './headers' +import { resolveFetch } from './helpers' + +/** + * @ignore + * Base API client class for all Storage API classes + * Provides common infrastructure for error handling and configuration + * + * @typeParam TError - The error type (StorageError or subclass) + */ +export default abstract class BaseApiClient { + protected url: string + protected headers: { [key: string]: string } + protected fetch: Fetch + protected shouldThrowOnError = false + protected namespace: ErrorNamespace + + /** + * Creates a new BaseApiClient instance + * @param url - Base URL for API requests + * @param headers - Default headers for API requests + * @param fetch - Optional custom fetch implementation + * @param namespace - Error namespace ('storage' or 'vectors') + */ + constructor( + url: string, + headers: { [key: string]: string } = {}, + fetch?: Fetch, + namespace: ErrorNamespace = 'storage' + ) { + this.url = url + this.headers = normalizeHeaders(headers) + this.fetch = resolveFetch(fetch) + this.namespace = namespace + } + + /** + * Enable throwing errors instead of returning them. + * When enabled, errors are thrown instead of returned in { data, error } format. + * + * @returns this - For method chaining + */ + public throwOnError(): this { + this.shouldThrowOnError = true + return this + } + + /** + * Set an HTTP header for the request. + * Creates a shallow copy of headers to avoid mutating shared state. + * + * @param name - Header name + * @param value - Header value + * @returns this - For method chaining + */ + public setHeader(name: string, value: string): this { + this.headers = setHeaderUtil(this.headers, name, value) + return this + } + + /** + * Handles API operation with standardized error handling + * Eliminates repetitive try-catch blocks across all API methods + * + * This wrapper: + * 1. Executes the operation + * 2. Returns { data, error: null } on success + * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false) + * 4. Throws error on failure (if shouldThrowOnError is true) + * + * @typeParam T - The expected data type from the operation + * @param operation - Async function that performs the API call + * @returns Promise with { data, error } tuple + * + * @example Handling an operation + * ```typescript + * async listBuckets() { + * return this.handleOperation(async () => { + * return await get(this.fetch, `${this.url}/bucket`, { + * headers: this.headers, + * }) + * }) + * } + * ``` + */ + protected async handleOperation( + operation: () => Promise + ): Promise<{ data: T; error: null } | { data: null; error: TError }> { + try { + const data = await operation() + return { data, error: null } + } catch (error) { + if (this.shouldThrowOnError) { + throw error + } + if (isStorageError(error)) { + return { data: null, error: error as TError } + } + throw error + } + } +} diff --git a/node_modules/@supabase/storage-js/src/lib/common/errors.ts b/node_modules/@supabase/storage-js/src/lib/common/errors.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd323e1c97ab041cf2e4287f6ed7ab69d8d64db7 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/common/errors.ts @@ -0,0 +1,171 @@ +/** + * Namespace type for error classes + * Determines the error class names and type guards + */ +export type ErrorNamespace = 'storage' | 'vectors' + +/** + * Base error class for all Storage errors + * Supports both 'storage' and 'vectors' namespaces + */ +export class StorageError extends Error { + protected __isStorageError = true + protected namespace: ErrorNamespace + status: number | undefined + statusCode: string | undefined + + constructor( + message: string, + namespace: ErrorNamespace = 'storage', + status?: number, + statusCode?: string + ) { + super(message) + this.namespace = namespace + this.name = namespace === 'vectors' ? 'StorageVectorsError' : 'StorageError' + this.status = status + this.statusCode = statusCode + } + + toJSON(): { + name: string + message: string + status: number | undefined + statusCode: string | undefined + } { + return { + name: this.name, + message: this.message, + status: this.status, + statusCode: this.statusCode, + } + } +} + +/** + * Type guard to check if an error is a StorageError + * @param error - The error to check + * @returns True if the error is a StorageError + */ +export function isStorageError(error: unknown): error is StorageError { + return typeof error === 'object' && error !== null && '__isStorageError' in error +} + +/** + * API error returned from Storage service + * Includes HTTP status code and service-specific error code + */ +export class StorageApiError extends StorageError { + override status: number + override statusCode: string + /** + * Service-specific error code from the Storage API response body, such as + * `NoSuchKey`, `AccessDenied` or `ResourceAlreadyExists`. Use this to branch + * on the specific error rather than parsing the message. + * @see https://supabase.com/docs/guides/storage/debugging/error-codes + */ + code: string | undefined + + constructor( + message: string, + status: number, + statusCode: string, + namespace: ErrorNamespace = 'storage', + code?: string + ) { + super(message, namespace, status, statusCode) + this.name = namespace === 'vectors' ? 'StorageVectorsApiError' : 'StorageApiError' + this.status = status + this.statusCode = statusCode + this.code = code + } + + toJSON(): { + name: string + message: string + status: number | undefined + statusCode: string | undefined + code: string | undefined + } { + return { + ...super.toJSON(), + code: this.code, + } + } +} + +/** + * Unknown error that doesn't match expected error patterns + * Wraps the original error for debugging + */ +export class StorageUnknownError extends StorageError { + originalError: unknown + + constructor(message: string, originalError: unknown, namespace: ErrorNamespace = 'storage') { + super(message, namespace) + this.name = namespace === 'vectors' ? 'StorageVectorsUnknownError' : 'StorageUnknownError' + this.originalError = originalError + } +} + +// ============================================================================ +// Backward Compatibility Exports for Vectors +// ============================================================================ + +/** + * @deprecated Use StorageError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +export class StorageVectorsError extends StorageError { + constructor(message: string) { + super(message, 'vectors') + } +} + +/** + * Type guard to check if an error is a StorageVectorsError + * @param error - The error to check + * @returns True if the error is a StorageVectorsError + */ +export function isStorageVectorsError(error: unknown): error is StorageVectorsError { + return isStorageError(error) && (error as StorageError)['namespace'] === 'vectors' +} + +/** + * @deprecated Use StorageApiError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +export class StorageVectorsApiError extends StorageApiError { + constructor(message: string, status: number, statusCode: string) { + super(message, status, statusCode, 'vectors') + } +} + +/** + * @deprecated Use StorageUnknownError with namespace='vectors' instead + * Alias for backward compatibility with existing vector storage code + */ +export class StorageVectorsUnknownError extends StorageUnknownError { + constructor(message: string, originalError: unknown) { + super(message, originalError, 'vectors') + } +} + +/** + * Error codes specific to S3 Vectors API + * Maps AWS service errors to application-friendly error codes + */ +export enum StorageVectorsErrorCode { + /** Internal server fault (HTTP 500) */ + InternalError = 'InternalError', + /** Resource already exists / conflict (HTTP 409) */ + S3VectorConflictException = 'S3VectorConflictException', + /** Resource not found (HTTP 404) */ + S3VectorNotFoundException = 'S3VectorNotFoundException', + /** Delete bucket while not empty (HTTP 400) */ + S3VectorBucketNotEmpty = 'S3VectorBucketNotEmpty', + /** Exceeds bucket quota/limit (HTTP 400) */ + S3VectorMaxBucketsExceeded = 'S3VectorMaxBucketsExceeded', + /** Exceeds index quota/limit (HTTP 400) */ + S3VectorMaxIndexesExceeded = 'S3VectorMaxIndexesExceeded', +} diff --git a/node_modules/@supabase/storage-js/src/lib/common/fetch.ts b/node_modules/@supabase/storage-js/src/lib/common/fetch.ts new file mode 100644 index 0000000000000000000000000000000000000000..8128ea05d8172f8deca6e5d5e5f82cf721809b8b --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/common/fetch.ts @@ -0,0 +1,305 @@ +import { StorageApiError, StorageError, StorageUnknownError, ErrorNamespace } from './errors' +import { setHeader } from './headers' +import { isPlainObject, resolveResponse } from './helpers' +import { FetchParameters } from '../types' + +export type Fetch = typeof fetch + +/** + * Options for fetch requests + */ +export interface FetchOptions { + headers?: { + [key: string]: string + } + duplex?: string + noResolveJson?: boolean +} + +/** + * HTTP methods supported by the API + */ +export type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' + +/** + * Extracts error message from various error response formats + * @param err - Error object from API + * @returns Human-readable error message + */ +const _getErrorMessage = (err: unknown): string => { + if (typeof err === 'object' && err !== null) { + const e = err as Record + if (typeof e.msg === 'string') return e.msg + if (typeof e.message === 'string') return e.message + if (typeof e.error_description === 'string') return e.error_description + if (typeof e.error === 'string') return e.error + if (typeof e.error === 'object' && e.error !== null) { + const nested = e.error as Record + if (typeof nested.message === 'string') return nested.message + } + } + return JSON.stringify(err) +} + +/** + * Handles fetch errors and converts them to Storage error types + * @param error - The error caught from fetch + * @param reject - Promise rejection function + * @param options - Fetch options that may affect error handling + * @param namespace - Error namespace ('storage' or 'vectors') + */ +const handleError = async ( + error: unknown, + reject: (reason: StorageError) => void, + options: FetchOptions | undefined, + namespace: ErrorNamespace +) => { + // Structural detection of json() method, present in all Response implementations + // (native, node-fetch, cross-fetch, undici) and absent from standard Error objects. + // Checking 'ok' or 'status' via `in` is unreliable across fetch polyfills/realms. + const isResponseLike = + error !== null && + typeof error === 'object' && + 'json' in error && + typeof (error as Record).json === 'function' + + if (isResponseLike) { + const responseError = error as Response + // Defensive coercion: some fetch polyfills have historically returned status as a string. + let status = parseInt(String(responseError.status), 10) + if (!Number.isFinite(status)) { + status = 500 + } + + responseError + .json() + .then( + (err: { statusCode?: string; code?: string; error?: string; message?: string } | null) => { + const statusCode = err?.statusCode || err?.code || status + '' + reject( + new StorageApiError(_getErrorMessage(err), status, statusCode, namespace, err?.code) + ) + } + ) + .catch(() => { + const statusCode = status + '' + const message = responseError.statusText || `HTTP ${status} error` + reject(new StorageApiError(message, status, statusCode, namespace)) + }) + } else { + reject(new StorageUnknownError(_getErrorMessage(error), error, namespace)) + } +} + +/** + * Builds request parameters for fetch calls + * @param method - HTTP method + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters like AbortSignal + * @param body - Request body (will be JSON stringified if plain object) + * @returns Complete fetch request parameters + */ +const _getRequestParams = ( + method: RequestMethodType, + options?: FetchOptions, + parameters?: FetchParameters, + body?: object +) => { + const params: { [k: string]: any } = { method, headers: options?.headers || {} } + + if (method === 'GET' || method === 'HEAD' || !body) { + return { ...params, ...parameters } + } + + if (isPlainObject(body)) { + const headers = options?.headers || {} + let contentType: string | undefined + + for (const [key, value] of Object.entries(headers)) { + if (key.toLowerCase() === 'content-type') { + contentType = value + } + } + + params.headers = setHeader(headers, 'Content-Type', contentType ?? 'application/json') + params.body = JSON.stringify(body) + } else { + params.body = body + } + + if (options?.duplex) { + params.duplex = options.duplex + } + + return { ...params, ...parameters } +} + +/** + * Internal request handler that wraps fetch with error handling + * @param fetcher - Fetch function to use + * @param method - HTTP method + * @param url - Request URL + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @param body - Request body + * @param namespace - Error namespace ('storage' or 'vectors') + * @returns Promise with parsed response or error + */ +async function _handleRequest( + fetcher: Fetch, + method: RequestMethodType, + url: string, + options: FetchOptions | undefined, + parameters: FetchParameters | undefined, + body: object | undefined, + namespace: ErrorNamespace +): Promise { + return new Promise((resolve, reject) => { + fetcher(url, _getRequestParams(method, options, parameters, body)) + .then((result) => { + if (!result.ok) throw result + if (options?.noResolveJson) return result + + // AWS S3 Vectors API returns 200 OK with content-length: 0 for successful mutations + // (putVectors, deleteVectors) instead of 204 or JSON response. This is AWS's design choice + // for performance optimization of bulk operations (up to 500 vectors per request). + // We handle this to prevent "Unexpected end of JSON input" errors when calling result.json() + if (namespace === 'vectors') { + const contentType = result.headers.get('content-type') + const contentLength = result.headers.get('content-length') + + // Return empty object for explicitly empty responses + if (contentLength === '0' || result.status === 204) { + return {} + } + + // Return empty object if no JSON content type + if (!contentType || !contentType.includes('application/json')) { + return {} + } + } + + return result.json() + }) + .then((data) => resolve(data)) + .catch((error) => handleError(error, reject, options, namespace)) + }) +} + +/** + * Creates a fetch API with the specified namespace + * @param namespace - Error namespace ('storage' or 'vectors') + * @returns Object with HTTP method functions + */ +export function createFetchApi(namespace: ErrorNamespace = 'storage') { + return { + /** + * Performs a GET request + * @param fetcher - Fetch function to use + * @param url - Request URL + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @returns Promise with parsed response + */ + get: async ( + fetcher: Fetch, + url: string, + options?: FetchOptions, + parameters?: FetchParameters + ): Promise => { + return _handleRequest(fetcher, 'GET', url, options, parameters, undefined, namespace) + }, + + /** + * Performs a POST request + * @param fetcher - Fetch function to use + * @param url - Request URL + * @param body - Request body to be JSON stringified + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @returns Promise with parsed response + */ + post: async ( + fetcher: Fetch, + url: string, + body: object, + options?: FetchOptions, + parameters?: FetchParameters + ): Promise => { + return _handleRequest(fetcher, 'POST', url, options, parameters, body, namespace) + }, + + /** + * Performs a PUT request + * @param fetcher - Fetch function to use + * @param url - Request URL + * @param body - Request body to be JSON stringified + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @returns Promise with parsed response + */ + put: async ( + fetcher: Fetch, + url: string, + body: object, + options?: FetchOptions, + parameters?: FetchParameters + ): Promise => { + return _handleRequest(fetcher, 'PUT', url, options, parameters, body, namespace) + }, + + /** + * Performs a HEAD request + * @param fetcher - Fetch function to use + * @param url - Request URL + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @returns Promise with Response object (not JSON parsed) + */ + head: async ( + fetcher: Fetch, + url: string, + options?: FetchOptions, + parameters?: FetchParameters + ): Promise => { + return _handleRequest( + fetcher, + 'HEAD', + url, + { + ...options, + noResolveJson: true, + }, + parameters, + undefined, + namespace + ) + }, + + /** + * Performs a DELETE request + * @param fetcher - Fetch function to use + * @param url - Request URL + * @param body - Request body to be JSON stringified + * @param options - Custom fetch options + * @param parameters - Additional fetch parameters + * @returns Promise with parsed response + */ + remove: async ( + fetcher: Fetch, + url: string, + body: object, + options?: FetchOptions, + parameters?: FetchParameters + ): Promise => { + return _handleRequest(fetcher, 'DELETE', url, options, parameters, body, namespace) + }, + } +} + +// Default exports for backward compatibility with 'storage' namespace +const defaultApi = createFetchApi('storage') +export const { get, post, put, head, remove } = defaultApi + +// Vectors API with 'vectors' namespace for proper error handling +export const vectorsApi = createFetchApi('vectors') diff --git a/node_modules/@supabase/storage-js/src/lib/common/headers.ts b/node_modules/@supabase/storage-js/src/lib/common/headers.ts new file mode 100644 index 0000000000000000000000000000000000000000..7629ff1f572dae58cf37c1598166cc139ba0de17 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/common/headers.ts @@ -0,0 +1,43 @@ +/** + * Sets a header with case-insensitive deduplication. + * Removes any existing headers whose name matches (case-insensitive), + * then sets the value under the lowercase key. Does not mutate the input object. + * + * @param headers - Existing headers object + * @param name - Header name to set (stored as lowercase) + * @param value - Header value + * @returns New headers object with the header set + */ +export function setHeader( + headers: Record, + name: string, + value: string +): Record { + const result = { ...headers } + const nameLower = name.toLowerCase() + + for (const key of Object.keys(result)) { + if (key.toLowerCase() === nameLower) { + delete result[key] + } + } + + result[nameLower] = value + return result +} + +/** + * Normalizes all header keys to lowercase with case-insensitive deduplication. + * When duplicate keys exist (differing only in case), the last value wins. + * Does not mutate the input object. + * + * @param headers - Headers object to normalize + * @returns New headers object with all keys lowercased + */ +export function normalizeHeaders(headers: Record): Record { + const result: Record = {} + for (const [key, value] of Object.entries(headers)) { + result[key.toLowerCase()] = value + } + return result +} diff --git a/node_modules/@supabase/storage-js/src/lib/common/helpers.ts b/node_modules/@supabase/storage-js/src/lib/common/helpers.ts new file mode 100644 index 0000000000000000000000000000000000000000..76b66bfd2bc3b7cded3991600725267f1238f8eb --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/common/helpers.ts @@ -0,0 +1,159 @@ +type Fetch = typeof fetch + +/** + * Resolves the fetch implementation to use + * Uses custom fetch if provided, otherwise uses native fetch + * + * @param customFetch - Optional custom fetch implementation + * @returns Resolved fetch function + */ +export const resolveFetch = (customFetch?: Fetch): Fetch => { + if (customFetch) { + return (...args) => customFetch(...args) + } + return (...args) => fetch(...args) +} + +/** + * Resolves the Response constructor to use + * Returns native Response constructor + * + * @returns Response constructor + */ +export const resolveResponse = (): typeof Response => { + return Response +} + +/** + * Determine if input is a plain object + * An object is plain if it's created by either {}, new Object(), or Object.create(null) + * + * @param value - Value to check + * @returns True if value is a plain object + * @source https://github.com/sindresorhus/is-plain-obj + */ +export const isPlainObject = (value: object): boolean => { + if (typeof value !== 'object' || value === null) { + return false + } + + const prototype = Object.getPrototypeOf(value) + return ( + (prototype === null || + prototype === Object.prototype || + Object.getPrototypeOf(prototype) === null) && + !(Symbol.toStringTag in value) && + !(Symbol.iterator in value) + ) +} + +/** + * Recursively converts object keys from snake_case to camelCase + * Used for normalizing API responses + * + * @param item - Object to convert + * @returns Converted object with camelCase keys + */ +export const recursiveToCamel = (item: Record): unknown => { + if (Array.isArray(item)) { + return item.map((el) => recursiveToCamel(el)) + } else if (typeof item === 'function' || item !== Object(item)) { + return item + } + + const result: Record = {} + Object.entries(item).forEach(([key, value]) => { + const newKey = key.replace(/([-_][a-z])/gi, (c) => c.toUpperCase().replace(/[-_]/g, '')) + result[newKey] = recursiveToCamel(value) + }) + + return result +} + +/** + * Validates if a given bucket name is valid according to Supabase Storage API rules + * Mirrors backend validation from: storage/src/storage/limits.ts:isValidBucketName() + * + * Rules: + * - Length: 1-100 characters + * - Allowed characters: alphanumeric (a-z, A-Z, 0-9), underscore (_), and safe special characters + * - Safe special characters: ! - . * ' ( ) space & $ @ = ; : + , ? + * - Forbidden: path separators (/, \), path traversal (..), leading/trailing whitespace + * + * AWS S3 Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html + * + * @param bucketName - The bucket name to validate + * @returns true if valid, false otherwise + */ +export const isValidBucketName = (bucketName: string): boolean => { + if (!bucketName || typeof bucketName !== 'string') { + return false + } + + // Check length constraints (1-100 characters) + if (bucketName.length === 0 || bucketName.length > 100) { + return false + } + + // Check for leading/trailing whitespace + if (bucketName.trim() !== bucketName) { + return false + } + + // Explicitly reject path separators (security) + // Note: Consecutive periods (..) are allowed by backend - the AWS restriction + // on relative paths applies to object keys, not bucket names + if (bucketName.includes('/') || bucketName.includes('\\')) { + return false + } + + // Validate against allowed character set + // Pattern matches backend regex: /^(\w|!|-|\.|\*|'|\(|\)| |&|\$|@|=|;|:|\+|,|\?)*$/ + // This explicitly excludes path separators (/, \) and other problematic characters + const bucketNameRegex = /^[\w!.\*'() &$@=;:+,?-]+$/ + return bucketNameRegex.test(bucketName) +} + +/** + * Normalizes a number array to float32 format + * Ensures all vector values are valid 32-bit floats + * + * @param values - Array of numbers to normalize + * @returns Normalized float32 array + */ +export const normalizeToFloat32 = (values: number[]): number[] => { + // Use Float32Array to ensure proper precision + return Array.from(new Float32Array(values)) +} + +/** + * Validates vector dimensions match expected dimension + * Throws error if dimensions don't match + * + * @param vector - Vector data to validate + * @param expectedDimension - Expected vector dimension + * @throws Error if dimensions don't match + */ +export const validateVectorDimension = ( + vector: { float32: number[] }, + expectedDimension?: number +): void => { + if (expectedDimension !== undefined && vector.float32.length !== expectedDimension) { + throw new Error( + `Vector dimension mismatch: expected ${expectedDimension}, got ${vector.float32.length}` + ) + } +} + +/** + * Percent-encodes each segment of a storage path so URL delimiters within a + * key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start. + * + * Splits on `/` so real path separators stay literal — the storage server + * routes on them and decodes each segment back to the original key. + * + * @param path - A bucket id or `bucketId/objectKey` path + * @returns The path with each `/`-delimited segment percent-encoded + */ +export const encodeStoragePath = (path: string): string => + path.split('/').map(encodeURIComponent).join('/') diff --git a/node_modules/@supabase/storage-js/src/lib/constants.ts b/node_modules/@supabase/storage-js/src/lib/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c8b41ae149ed5110afa70bb39ac97fa6dac2c88 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/constants.ts @@ -0,0 +1,4 @@ +import { version } from './version' +export const DEFAULT_HEADERS = { + 'X-Client-Info': `storage-js/${version}`, +} diff --git a/node_modules/@supabase/storage-js/src/lib/types.ts b/node_modules/@supabase/storage-js/src/lib/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2b2fd9f2bc6791599296a7ed81e0d52ddf692d9 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/types.ts @@ -0,0 +1,662 @@ +import { StorageError } from './common/errors' + +/** + * Type of storage bucket + * - STANDARD: Regular file storage buckets + * - ANALYTICS: Iceberg table-based buckets for analytical workloads + */ +export type BucketType = 'STANDARD' | 'ANALYTICS' | (string & {}) + +export interface Bucket { + id: string + type?: BucketType + name: string + owner: string + file_size_limit?: number + allowed_mime_types?: string[] + created_at: string + updated_at: string + public: boolean +} + +export interface ListBucketOptions { + limit?: number + offset?: number + sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at' + sortOrder?: 'asc' | 'desc' + search?: string +} + +export interface PurgeCacheOptions { + /** + * If true, purges only the transformations (resized/formatted variants) for the object or bucket, + * leaving the original cached file intact. If omitted, purges all cached versions. + */ + transformations?: true +} + +/** + * Represents an Analytics Bucket using Apache Iceberg table format. + * Analytics buckets are optimized for analytical queries and data processing. + */ +export interface AnalyticBucket { + /** Unique identifier for the bucket */ + name: string + /** Bucket type - always 'ANALYTICS' for analytics buckets */ + type: 'ANALYTICS' + /** Storage format used (e.g., 'iceberg') */ + format: string + /** ISO 8601 timestamp of bucket creation */ + created_at: string + /** ISO 8601 timestamp of last update */ + updated_at: string +} + +/** + * Metadata object returned by the Storage API for files + * Contains information about file size, type, caching, and HTTP response details + */ +export interface FileMetadata { + /** Entity tag for caching and conditional requests */ + eTag: string + /** File size in bytes */ + size: number + /** MIME type of the file */ + mimetype: string + /** Cache control directive (e.g., "max-age=3600") */ + cacheControl: string + /** Last modification timestamp (ISO 8601) */ + lastModified: string + /** Content length in bytes (usually same as size) */ + contentLength: number + /** HTTP status code from the storage backend */ + httpStatusCode: number + /** Any additional custom metadata stored with the file */ + [key: string]: any +} + +/** + * File object returned by the List V1 API (list() method) + * Note: Folder entries will have null values for most fields except name + * + * Warning: Some fields may not be present in all API responses. Fields like + * bucket_id, owner, and buckets are not returned by list() operations. + */ +export interface FileObject { + /** File or folder name (relative to the prefix) - always present */ + name: string + /** Unique identifier for the file (null for folders) */ + id: string | null + /** Last update timestamp (null for folders) */ + updated_at: string | null + /** Creation timestamp (null for folders) */ + created_at: string | null + /** @deprecated Last access timestamp (null for folders) */ + last_accessed_at: string | null + /** File metadata including size, mimetype, etc. (null for folders) */ + metadata: FileMetadata | null + /** + * @deprecated Bucket identifier - NOT returned by list() operations. + * May be present in remove() responses. Do not rely on this field. + */ + bucket_id?: string + /** + * @deprecated Owner identifier - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + owner?: string + /** + * @deprecated Bucket object - NOT returned by list() or remove() operations. + * This field should not be relied upon. + */ + buckets?: Bucket +} + +/** + * File object returned by the Info endpoint (info() method) + * Contains detailed metadata for a specific file + */ +export interface FileObjectV2 { + /** Unique identifier for the file */ + id: string + /** File version identifier */ + version: string + /** File name */ + name: string + /** Bucket identifier */ + bucket_id: string + /** Creation timestamp */ + created_at: string + /** File size in bytes */ + size?: number + /** Cache control header value */ + cache_control?: string + /** MIME content type */ + content_type?: string + /** Entity tag for caching */ + etag?: string + /** Last modification timestamp (replaces updated_at) */ + last_modified?: string + /** Custom file metadata */ + metadata?: FileMetadata + /** + * @deprecated The API returns last_modified instead. + * This field may not be present in responses. + */ + updated_at?: string +} + +export interface SortBy { + column?: string + order?: string +} + +export interface FileOptions { + /** + * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=` header. Defaults to 3600 seconds. + */ + cacheControl?: string + /** + * the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. + */ + contentType?: string + /** + * When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false. + */ + upsert?: boolean + /** + * The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method. + */ + duplex?: string + + /** + * The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store. + */ + metadata?: Record + + /** + * Optionally add extra headers + */ + headers?: Record +} + +export interface DestinationOptions { + destinationBucket?: string +} + +export interface SearchOptions { + /** + * The number of files you want to be returned. + * @default 100 + */ + limit?: number + + /** + * The starting position. + */ + offset?: number + + /** + * The column to sort by. Can be any column inside a FileObject. + */ + sortBy?: SortBy + + /** + * The search string to filter files by. + */ + search?: string +} + +export interface SortByV2 { + column: 'name' | 'updated_at' | 'created_at' + order?: 'asc' | 'desc' +} + +export interface SearchV2Options { + /** + * The number of files you want to be returned. + * @default 1000 + */ + limit?: number + + /** + * The prefix search string to filter files by. + */ + prefix?: string + + /** + * The cursor used for pagination. Pass the value received from nextCursor of the previous request. + */ + cursor?: string + + /** + * Whether to emulate a hierarchical listing of objects using delimiters. + * + * - When `false` (default), all objects are listed as flat key/value pairs. + * - When `true`, the response groups objects by delimiter, making it appear + * like a file/folder hierarchy. + * + * @default false + */ + with_delimiter?: boolean + + /** + * The column and order to sort by + * @default 'name asc' + */ + sortBy?: SortByV2 +} + +/** + * File object returned by the List V2 API (listV2() method) + * Objects and folders are returned in separate arrays - this type represents + * actual files only. Use SearchV2Folder for folder entries. + */ +export interface SearchV2Object { + /** File name */ + name: string + /** Full object key/path */ + key?: string + /** Unique identifier for the file */ + id: string + /** Last update timestamp */ + updated_at: string + /** Creation timestamp */ + created_at: string + /** File metadata including size, mimetype, etc. (null if not yet set) */ + metadata: FileMetadata | null + /** @deprecated Last access timestamp */ + last_accessed_at: string +} + +/** + * Folder entry returned by the List V2 API (listV2() method) when using with_delimiter: true + */ +export interface SearchV2Folder { + /** Folder name/prefix */ + name: string + /** Full folder key/path */ + key?: string +} + +export interface SearchV2Result { + hasNext: boolean + folders: SearchV2Folder[] + objects: SearchV2Object[] + nextCursor?: string +} + +export interface FetchParameters { + /** + * Pass in an AbortController's signal to cancel the request. + */ + signal?: AbortSignal + + /** + * Controls how the request interacts with the browser's HTTP cache. + * - 'default': Use standard cache behavior + * - 'no-store': Bypass cache entirely (useful in Edge Functions) + * - 'reload': Bypass cache but update it with response + * - 'no-cache': Validate with server before using cached response + * - 'force-cache': Use cache even if stale + * - 'only-if-cached': Only use cache, fail if not cached + */ + cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' +} + +// TODO: need to check for metadata props. The api swagger doesnt have. +export interface Metadata { + name: string +} + +export interface TransformOptions { + /** + * The width of the image in pixels. + */ + width?: number + /** + * The height of the image in pixels. + */ + height?: number + /** + * The resize mode can be cover, contain or fill. Defaults to cover. + * Cover resizes the image to maintain it's aspect ratio while filling the entire width and height. + * Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height. + * Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit. + */ + resize?: 'cover' | 'contain' | 'fill' + /** + * Set the quality of the returned image. + * A number from 20 to 100, with 100 being the highest quality. + * Defaults to 80 + */ + quality?: number + /** + * Specify the format of the image requested. + * + * When using 'origin' we force the format to be the same as the original image. + * When this option is not passed in, images are optimized to modern image formats like Webp. + */ + format?: 'origin' +} + +type CamelCase = S extends `${infer P1}_${infer P2}${infer P3}` + ? `${Lowercase}${Uppercase}${CamelCase}` + : S + +export type Camelize = { + [K in keyof T as CamelCase>]: T[K] +} + +export type DownloadResult = + | { + data: T + error: null + } + | { + data: null + error: StorageError + } +// ============================================================================ +// VECTOR STORAGE TYPES +// ============================================================================ + +/** + * Configuration for encryption at rest + * @property kmsKeyArn - ARN of the KMS key used for encryption + * @property sseType - Server-side encryption type (e.g., 'KMS') + */ +export interface EncryptionConfiguration { + kmsKeyArn?: string + sseType?: string +} + +/** + * Vector bucket metadata + * @property vectorBucketName - Unique name of the vector bucket + * @property creationTime - Unix timestamp of when the bucket was created + * @property encryptionConfiguration - Optional encryption settings + */ +export interface VectorBucket { + vectorBucketName: string + creationTime?: number + encryptionConfiguration?: EncryptionConfiguration +} + +/** + * Metadata configuration for vector index + * Defines which metadata keys should not be indexed for filtering + * @property nonFilterableMetadataKeys - Array of metadata keys that cannot be used in filters + */ +export interface MetadataConfiguration { + nonFilterableMetadataKeys?: string[] +} + +/** + * Supported data types for vectors + * Currently only float32 is supported + */ +export type VectorDataType = 'float32' | (string & {}) + +/** + * Distance metrics for vector similarity search + */ +export type DistanceMetric = 'cosine' | 'euclidean' | 'dotproduct' | (string & {}) + +/** + * Vector index configuration and metadata + * @property indexName - Unique name of the index within the bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property dataType - Data type of vector components (currently only 'float32') + * @property dimension - Dimensionality of vectors (e.g., 384, 768, 1536) + * @property distanceMetric - Similarity metric used for queries + * @property metadataConfiguration - Configuration for metadata filtering + * @property creationTime - Unix timestamp of when the index was created + */ +export interface VectorIndex { + indexName: string + vectorBucketName: string + dataType: VectorDataType + dimension: number + distanceMetric: DistanceMetric + metadataConfiguration?: MetadataConfiguration + creationTime?: number +} + +/** + * Vector data representation + * Vectors must be float32 arrays with dimensions matching the index + * @property float32 - Array of 32-bit floating point numbers + */ +export interface VectorData { + float32: number[] +} + +/** + * Arbitrary JSON metadata attached to vectors + * Keys configured as non-filterable in the index can be stored but not queried + */ +export type VectorMetadata = Record + +/** + * Single vector object for insertion/update + * @property key - Unique identifier for the vector + * @property data - Vector embedding data + * @property metadata - Optional arbitrary metadata + */ +export interface VectorObject { + key: string + data: VectorData + metadata?: VectorMetadata +} + +/** + * Vector object returned from queries with optional distance + * @property key - Unique identifier for the vector + * @property data - Vector embedding data (if requested) + * @property metadata - Arbitrary metadata (if requested) + * @property distance - Similarity distance from query vector (if requested) + */ +export interface VectorMatch { + key: string + data?: VectorData + metadata?: VectorMetadata + distance?: number +} + +/** + * Options for fetching vector buckets + * @property prefix - Filter buckets by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +export interface ListVectorBucketsOptions { + prefix?: string + maxResults?: number + nextToken?: string +} + +/** + * Response from listing vector buckets + * @property vectorBuckets - Array of bucket names + * @property nextToken - Token for fetching next page (if more results exist) + */ +export interface ListVectorBucketsResponse { + vectorBuckets: { vectorBucketName: string }[] + nextToken?: string +} + +/** + * Options for listing indexes within a bucket + * @property vectorBucketName - Name of the parent vector bucket + * @property prefix - Filter indexes by name prefix + * @property maxResults - Maximum number of results to return (default: 100) + * @property nextToken - Token for pagination from previous response + */ +export interface ListIndexesOptions { + vectorBucketName: string + prefix?: string + maxResults?: number + nextToken?: string +} + +/** + * Response from listing indexes + * @property indexes - Array of index names + * @property nextToken - Token for fetching next page (if more results exist) + */ +export interface ListIndexesResponse { + indexes: { indexName: string }[] + nextToken?: string +} + +/** + * Options for batch reading vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to retrieve + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + */ +export interface GetVectorsOptions { + vectorBucketName: string + indexName: string + keys: string[] + returnData?: boolean + returnMetadata?: boolean +} + +/** + * Response from getting vectors + * @property vectors - Array of retrieved vector objects + */ +export interface GetVectorsResponse { + vectors: VectorMatch[] +} + +/** + * Options for batch inserting/updating vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property vectors - Array of vectors to insert/upsert (1-500 items) + */ +export interface PutVectorsOptions { + vectorBucketName: string + indexName: string + vectors: VectorObject[] +} + +/** + * Options for batch deleting vectors + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property keys - Array of vector keys to delete (1-500 items) + */ +export interface DeleteVectorsOptions { + vectorBucketName: string + indexName: string + keys: string[] +} + +/** + * Options for listing/scanning vectors in an index + * Supports parallel scanning via segment configuration + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property maxResults - Maximum number of results to return (default: 500, max: 1000) + * @property nextToken - Token for pagination from previous response + * @property returnData - Whether to include vector data in response + * @property returnMetadata - Whether to include metadata in response + * @property segmentCount - Total number of parallel segments (1-16) + * @property segmentIndex - Zero-based index of this segment (0 to segmentCount-1) + */ +export interface ListVectorsOptions { + vectorBucketName: string + indexName: string + maxResults?: number + nextToken?: string + returnData?: boolean + returnMetadata?: boolean + segmentCount?: number + segmentIndex?: number +} + +/** + * Response from listing vectors + * @property vectors - Array of vector objects + * @property nextToken - Token for fetching next page (if more results exist) + */ +export interface ListVectorsResponse { + vectors: VectorMatch[] + nextToken?: string +} + +/** + * JSON filter expression for metadata filtering + * Format and syntax depend on the S3 Vectors service implementation + */ +export type VectorFilter = Record + +/** + * Options for querying similar vectors (ANN search) + * @property vectorBucketName - Name of the vector bucket + * @property indexName - Name of the index + * @property queryVector - Query vector to find similar vectors + * @property topK - Number of nearest neighbors to return (default: 10) + * @property filter - Optional JSON filter for metadata + * @property returnDistance - Whether to include distance scores + * @property returnMetadata - Whether to include metadata in results + */ +export interface QueryVectorsOptions { + vectorBucketName: string + indexName: string + queryVector: VectorData + topK?: number + filter?: VectorFilter + returnDistance?: boolean + returnMetadata?: boolean +} + +/** + * Response from vector similarity query + * @property vectors - Array of similar vectors ordered by distance + * @property distanceMetric - The distance metric used for the similarity search + */ +export interface QueryVectorsResponse { + vectors: VectorMatch[] + distanceMetric?: DistanceMetric +} + +/** + * Fetch-specific parameters like abort signals + * @property signal - AbortSignal for cancelling requests + */ +export interface VectorFetchParameters { + signal?: AbortSignal +} + +/** + * Standard response wrapper for successful operations + * @property data - Response data of type T + * @property error - Null on success + */ +export interface SuccessResponse { + data: T + error: null +} + +/** + * Standard response wrapper for failed operations + * @property data - Null on error + * @property error - StorageError with details (named StorageVectorsError for vector operations) + */ +export interface ErrorResponse { + data: null + error: StorageError +} + +/** + * Union type for all API responses + * Follows the pattern: { data: T, error: null } | { data: null, error: Error } + */ +export type ApiResponse = SuccessResponse | ErrorResponse diff --git a/node_modules/@supabase/storage-js/src/lib/version.ts b/node_modules/@supabase/storage-js/src/lib/version.ts new file mode 100644 index 0000000000000000000000000000000000000000..728b243d9860d462498beea4f7212d24b085dddf --- /dev/null +++ b/node_modules/@supabase/storage-js/src/lib/version.ts @@ -0,0 +1,7 @@ +// Generated automatically during releases by scripts/update-version-files.ts +// This file provides runtime access to the package version for: +// - HTTP request headers (e.g., X-Client-Info header for API requests) +// - Debugging and support (identifying which version is running) +// - Telemetry and logging (version reporting in errors/analytics) +// - Ensuring build artifacts match the published package version +export const version = '2.112.3' diff --git a/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts b/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts new file mode 100644 index 0000000000000000000000000000000000000000..e10054ca12d64e0debdb4e5429ef69b453feeffb --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/BlobDownloadBuilder.ts @@ -0,0 +1,62 @@ +import { isStorageError } from '../lib/common/errors' +import { DownloadResult } from '../lib/types' +import StreamDownloadBuilder from './StreamDownloadBuilder' + +export default class BlobDownloadBuilder implements Promise> { + readonly [Symbol.toStringTag]: string = 'BlobDownloadBuilder' + private promise: Promise> | null = null + + constructor( + private downloadFn: () => Promise, + private shouldThrowOnError: boolean + ) {} + + asStream(): StreamDownloadBuilder { + return new StreamDownloadBuilder(this.downloadFn, this.shouldThrowOnError) + } + + then, TResult2 = never>( + onfulfilled?: ((value: DownloadResult) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.getPromise().then(onfulfilled, onrejected) + } + + catch( + onrejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise | TResult> { + return this.getPromise().catch(onrejected) + } + + finally(onfinally?: (() => void) | null): Promise> { + return this.getPromise().finally(onfinally) + } + + private getPromise(): Promise> { + if (!this.promise) { + this.promise = this.execute() + } + return this.promise + } + + private async execute(): Promise> { + try { + const result = await this.downloadFn() + + return { + data: await result.blob(), + error: null, + } + } catch (error) { + if (this.shouldThrowOnError) { + throw error + } + + if (isStorageError(error)) { + return { data: null, error } + } + + throw error + } + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts b/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..d80172bb07f483aa985e282cf330e6cb85dae469 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/StorageAnalyticsClient.ts @@ -0,0 +1,420 @@ +import { IcebergRestCatalog, IcebergError } from 'iceberg-js' +import { DEFAULT_HEADERS } from '../lib/constants' +import { StorageError } from '../lib/common/errors' +import { Fetch, get, post, remove } from '../lib/common/fetch' +import { isValidBucketName } from '../lib/common/helpers' +import BaseApiClient from '../lib/common/BaseApiClient' +import { AnalyticBucket } from '../lib/types' + +type WrapAsyncMethod = T extends (...args: infer A) => Promise + ? (...args: A) => Promise<{ data: R; error: null } | { data: null; error: IcebergError }> + : T + +export type WrappedIcebergRestCatalog = { + [K in keyof IcebergRestCatalog]: WrapAsyncMethod +} + +/** + * Client class for managing Analytics Buckets using Iceberg tables + * Provides methods for creating, listing, and deleting analytics buckets + */ +export default class StorageAnalyticsClient extends BaseApiClient { + /** + * @alpha + * + * Creates a new StorageAnalyticsClient instance + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param url - The base URL for the storage API + * @param headers - HTTP headers to include in requests + * @param fetch - Optional custom fetch implementation + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.storage.analytics.listBuckets() + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageAnalyticsClient } from '@supabase/storage-js' + * + * const client = new StorageAnalyticsClient(url, headers) + * ``` + */ + constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) { + const finalUrl = url.replace(/\/$/, '') + const finalHeaders = { ...DEFAULT_HEADERS, ...headers } + super(finalUrl, finalHeaders, fetch, 'storage') + } + + /** + * @alpha + * + * Creates a new analytics bucket using Iceberg tables + * Analytics buckets are optimized for analytical queries and data processing + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param name A unique name for the bucket you are creating + * @returns Promise with response containing newly created analytics bucket or error + * + * @example Create analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Creates a new analytics bucket using Iceberg tables + * - Analytics buckets are optimized for analytical queries and data processing + */ + async createBucket(name: string): Promise< + | { + data: AnalyticBucket + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await post(this.fetch, `${this.url}/bucket`, { name }, { headers: this.headers }) + }) + } + + /** + * @alpha + * + * Retrieves the details of all Analytics Storage buckets within an existing project + * Only returns buckets of type 'ANALYTICS' + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of analytics buckets or error + * + * @example List analytics buckets + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "analytics-data", + * "type": "ANALYTICS", + * "format": "iceberg", + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - Retrieves the details of all Analytics Storage buckets within an existing project + * - Only returns buckets of type 'ANALYTICS' + */ + async listBuckets(options?: { + limit?: number + offset?: number + sortColumn?: 'name' | 'created_at' | 'updated_at' + sortOrder?: 'asc' | 'desc' + search?: string + }): Promise< + | { + data: AnalyticBucket[] + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + // Build query string from options + const queryParams = new URLSearchParams() + if (options?.limit !== undefined) queryParams.set('limit', options.limit.toString()) + if (options?.offset !== undefined) queryParams.set('offset', options.offset.toString()) + if (options?.sortColumn) queryParams.set('sortColumn', options.sortColumn) + if (options?.sortOrder) queryParams.set('sortOrder', options.sortOrder) + if (options?.search) queryParams.set('search', options.search) + + const queryString = queryParams.toString() + const url = queryString ? `${this.url}/bucket?${queryString}` : `${this.url}/bucket` + + return await get(this.fetch, url, { headers: this.headers }) + }) + } + + /** + * @alpha + * + * Deletes an existing analytics bucket + * A bucket can't be deleted with existing objects inside it + * You must first empty the bucket before deletion + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName The unique identifier of the bucket you would like to delete + * @returns Promise with response containing success message or error + * + * @example Delete analytics bucket + * ```js + * const { data, error } = await supabase + * .storage + * .analytics + * .deleteBucket('analytics-data') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - Deletes an analytics bucket + */ + async deleteBucket(bucketName: string): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await remove( + this.fetch, + `${this.url}/bucket/${bucketName}`, + {}, + { headers: this.headers } + ) + }) + } + + /** + * @alpha + * + * Get an Iceberg REST Catalog client configured for a specific analytics bucket + * Use this to perform advanced table and namespace operations within the bucket + * The returned client provides full access to the Apache Iceberg REST Catalog API + * with the Supabase `{ data, error }` pattern for consistent error handling on all operations. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Analytics Buckets + * @param bucketName - The name of the analytics bucket (warehouse) to connect to + * @returns The wrapped Iceberg catalog client + * @throws {StorageError} If the bucket name is invalid + * + * @example Get catalog and create table + * ```js + * // First, create an analytics bucket + * const { data: bucket, error: bucketError } = await supabase + * .storage + * .analytics + * .createBucket('analytics-data') + * + * // Get the Iceberg catalog for that bucket + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Create a namespace + * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] }) + * + * // Create a table with schema + * const { data: tableMetadata, error: tableError } = await catalog.createTable( + * { namespace: ['default'] }, + * { + * name: 'events', + * schema: { + * type: 'struct', + * fields: [ + * { id: 1, name: 'id', type: 'long', required: true }, + * { id: 2, name: 'timestamp', type: 'timestamp', required: true }, + * { id: 3, name: 'user_id', type: 'string', required: false } + * ], + * 'schema-id': 0, + * 'identifier-field-ids': [1] + * }, + * 'partition-spec': { + * 'spec-id': 0, + * fields: [] + * }, + * 'write-order': { + * 'order-id': 0, + * fields: [] + * }, + * properties: { + * 'write.format.default': 'parquet' + * } + * } + * ) + * ``` + * + * @example List tables in namespace + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all tables in the default namespace + * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] }) + * if (listError) { + * if (listError.isNotFound()) { + * console.log('Namespace not found') + * } + * return + * } + * console.log(tables) // [{ namespace: ['default'], name: 'events' }] + * ``` + * + * @example Working with namespaces + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // List all namespaces + * const { data: namespaces } = await catalog.listNamespaces() + * + * // Create namespace with properties + * await catalog.createNamespace( + * { namespace: ['production'] }, + * { properties: { owner: 'data-team', env: 'prod' } } + * ) + * ``` + * + * @example Cleanup operations + * ```js + * const catalog = supabase.storage.analytics.from('analytics-data') + * + * // Drop table with purge option (removes all data) + * const { error: dropError } = await catalog.dropTable( + * { namespace: ['default'], name: 'events' }, + * { purge: true } + * ) + * + * if (dropError?.isNotFound()) { + * console.log('Table does not exist') + * } + * + * // Drop namespace (must be empty) + * await catalog.dropNamespace({ namespace: ['default'] }) + * ``` + * + * @remarks + * This method provides a bridge between Supabase's bucket management and the standard + * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter. + * All authentication and configuration is handled automatically using your Supabase credentials. + * + * **Error Handling**: Invalid bucket names throw immediately. All catalog + * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js. + * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling. + * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations. + * + * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently + * deletes all table data. Without it, the table is marked as deleted but data remains. + * + * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js. + * For complete API documentation and advanced usage, refer to the + * [iceberg-js documentation](https://supabase.github.io/iceberg-js/). + */ + from(bucketName: string): WrappedIcebergRestCatalog { + // Validate bucket name using same rules as Supabase Storage API backend + 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.' + ) + } + + // Construct the Iceberg REST Catalog URL + // The base URL is /storage/v1/iceberg + // Note: IcebergRestCatalog from iceberg-js automatically adds /v1/ prefix to API paths + // so we should NOT append /v1 here (it would cause double /v1/v1/ in the URL) + const catalog = new IcebergRestCatalog({ + baseUrl: this.url, + catalogName: bucketName, // Maps to the warehouse parameter in Supabase's implementation + auth: { + type: 'custom', + getHeaders: async () => this.headers, + }, + fetch: this.fetch, + }) + + const shouldThrowOnError = this.shouldThrowOnError + + const wrappedCatalog = new Proxy(catalog, { + get(target, prop: keyof IcebergRestCatalog) { + const value = target[prop] + if (typeof value !== 'function') { + return value + } + + return async (...args: unknown[]) => { + try { + const data = await (value as Function).apply(target, args) + return { data, error: null } + } catch (error) { + if (shouldThrowOnError) { + throw error + } + return { data: null, error: error as IcebergError } + } + } + }, + }) as unknown as WrappedIcebergRestCatalog + + return wrappedCatalog + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts b/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea0285860578b9db8e9cfb9c4d62ad261ec1971e --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/StorageBucketApi.ts @@ -0,0 +1,488 @@ +import { DEFAULT_HEADERS } from '../lib/constants' +import { StorageError } from '../lib/common/errors' +import { Fetch, get, post, put, remove } from '../lib/common/fetch' +import { encodeStoragePath } from '../lib/common/helpers' +import BaseApiClient from '../lib/common/BaseApiClient' +import { + Bucket, + BucketType, + FetchParameters, + ListBucketOptions, + PurgeCacheOptions, +} from '../lib/types' +import { StorageClientOptions } from '../StorageClient' + +export default class StorageBucketApi extends BaseApiClient { + constructor( + url: string, + headers: { [key: string]: string } = {}, + fetch?: Fetch, + opts?: StorageClientOptions + ) { + const baseUrl = new URL(url) + + // if legacy uri is used, replace with new storage host (disables request buffering to allow > 50GB uploads) + // "project-ref.supabase.co" becomes "project-ref.storage.supabase.co" + if (opts?.useNewHostname) { + const isSupabaseHost = /supabase\.(co|in|red)$/.test(baseUrl.hostname) + if (isSupabaseHost && !baseUrl.hostname.includes('storage.supabase.')) { + baseUrl.hostname = baseUrl.hostname.replace('supabase.', 'storage.supabase.') + } + } + + const finalUrl = baseUrl.href.replace(/\/$/, '') + const finalHeaders = { ...DEFAULT_HEADERS, ...headers } + + super(finalUrl, finalHeaders, fetch, 'storage') + } + + /** + * Retrieves the details of all Storage buckets within an existing project. + * + * @category Storage + * @subcategory File Buckets + * @param options Query parameters for listing buckets + * @param options.limit Maximum number of buckets to return + * @param options.offset Number of buckets to skip + * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at') + * @param options.sortOrder Sort order ('asc' or 'desc') + * @param options.search Search term to filter bucket names + * @returns Promise with response containing array of buckets or error + * + * @example List buckets + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets() + * ``` + * + * @example List buckets with options + * ```js + * const { data, error } = await supabase + * .storage + * .listBuckets({ + * limit: 10, + * offset: 0, + * sortColumn: 'created_at', + * sortOrder: 'desc', + * search: 'prod' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async listBuckets(options?: ListBucketOptions): Promise< + | { + data: Bucket[] + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const queryString = this.listBucketOptionsToQueryString(options) + return await get(this.fetch, `${this.url}/bucket${queryString}`, { + headers: this.headers, + }) + }) + } + + /** + * Retrieves the details of an existing Storage bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to retrieve. + * @returns Promise with response containing bucket details or error + * + * @example Get bucket + * ```js + * const { data, error } = await supabase + * .storage + * .getBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "id": "avatars", + * "name": "avatars", + * "owner": "", + * "public": false, + * "file_size_limit": 1024, + * "allowed_mime_types": [ + * "image/png" + * ], + * "created_at": "2024-05-22T22:26:05.100Z", + * "updated_at": "2024-05-22T22:26:05.100Z" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async getBucket(id: string): Promise< + | { + data: Bucket + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await get(this.fetch, `${this.url}/bucket/${id}`, { headers: this.headers }) + }) + } + + /** + * Creates a new Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are creating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details. + * - default bucket type is `STANDARD` + * @returns Promise with response containing newly created bucket name or error + * + * @example Create bucket + * ```js + * const { data, error } = await supabase + * .storage + * .createBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "name": "avatars" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `insert` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createBucket( + id: string, + options: { + public: boolean + fileSizeLimit?: number | string | null + allowedMimeTypes?: string[] | null + type?: BucketType + } = { + public: false, + } + ): Promise< + | { + data: Pick + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await post( + this.fetch, + `${this.url}/bucket`, + { + id, + name: id, + type: options.type, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes, + }, + { headers: this.headers } + ) + }) + } + + /** + * Updates a Storage bucket + * + * @category Storage + * @subcategory File Buckets + * @param id A unique identifier for the bucket you are updating. + * @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. + * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket. + * The global file size limit takes precedence over this value. + * The default value is null, which doesn't set a per bucket file size limit. + * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload. + * The default value is null, which allows files with all mime types to be uploaded. + * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png. + * @returns Promise with response containing success message or error + * + * @example Update bucket + * ```js + * const { data, error } = await supabase + * .storage + * .updateBucket('avatars', { + * public: false, + * allowedMimeTypes: ['image/png'], + * fileSizeLimit: 1024 + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully updated" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `update` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async updateBucket( + id: string, + options: { + public: boolean + fileSizeLimit?: number | string | null + allowedMimeTypes?: string[] | null + } + ): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await put( + this.fetch, + `${this.url}/bucket/${id}`, + { + id, + name: id, + public: options.public, + file_size_limit: options.fileSizeLimit, + allowed_mime_types: options.allowedMimeTypes, + }, + { headers: this.headers } + ) + }) + } + + /** + * Removes all objects inside a single bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to empty. + * @returns Promise with success message or error + * + * @example Empty bucket + * ```js + * const { data, error } = await supabase + * .storage + * .emptyBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully emptied" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` + * - `objects` table permissions: `select` and `delete` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async emptyBucket(id: string): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await post(this.fetch, `${this.url}/bucket/${id}/empty`, {}, { headers: this.headers }) + }) + } + + /** + * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. + * You must first `empty()` the bucket. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to delete. + * @returns Promise with success message or error + * + * @example Delete bucket + * ```js + * const { data, error } = await supabase + * .storage + * .deleteBucket('avatars') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully deleted" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: `select` and `delete` + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async deleteBucket(id: string): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await remove(this.fetch, `${this.url}/bucket/${id}`, {}, { headers: this.headers }) + }) + } + + /** + * Purges the CDN cache for an entire bucket. + * + * Maps to `DELETE /cdn/{bucket}` on the Storage API. The server + * issues a CDN invalidation for the bucket and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * @category Storage + * @subcategory File Buckets + * @param id The unique identifier of the bucket you would like to purge from cache. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving original cached files intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge cache for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars') + * ``` + * + * @example Purge only transformations for an entire bucket + * ```js + * const { data, error } = await supabase + * .storage + * .purgeBucketCache('avatars', { transformations: true }) + * ``` + */ + async purgeBucketCache( + id: string, + options?: PurgeCacheOptions, + parameters?: FetchParameters + ): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const query = new URLSearchParams() + if (options?.transformations) { + query.set('transformations', 'true') + } + const queryString = query.toString() + + return await remove( + this.fetch, + `${this.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ''}`, + {}, + { headers: this.headers }, + parameters + ) + }) + } + + private listBucketOptionsToQueryString(options?: ListBucketOptions): string { + const params: Record = {} + if (options) { + if ('limit' in options) { + params.limit = String(options.limit) + } + if ('offset' in options) { + params.offset = String(options.offset) + } + if (options.search) { + params.search = options.search + } + if (options.sortColumn) { + params.sortColumn = options.sortColumn + } + if (options.sortOrder) { + params.sortOrder = options.sortOrder + } + } + return Object.keys(params).length > 0 ? '?' + new URLSearchParams(params).toString() : '' + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts b/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c74c87953f4761511da3c34ff6188823c75cda2 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/StorageFileApi.ts @@ -0,0 +1,1523 @@ +import { + StorageApiError, + StorageError, + StorageUnknownError, + isStorageError, +} from '../lib/common/errors' +import { get, head, post, put, remove, Fetch } from '../lib/common/fetch' +import { setHeader } from '../lib/common/headers' +import { encodeStoragePath, recursiveToCamel } from '../lib/common/helpers' +import BaseApiClient from '../lib/common/BaseApiClient' +import { + FileObject, + FileOptions, + SearchOptions, + FetchParameters, + TransformOptions, + DestinationOptions, + FileObjectV2, + Camelize, + SearchV2Options, + SearchV2Result, + PurgeCacheOptions, +} from '../lib/types' +import BlobDownloadBuilder from './BlobDownloadBuilder' + +const DEFAULT_SEARCH_OPTIONS = { + limit: 100, + offset: 0, + sortBy: { + column: 'name', + order: 'asc', + }, +} + +const DEFAULT_FILE_OPTIONS: FileOptions = { + cacheControl: '3600', + contentType: 'text/plain;charset=UTF-8', + upsert: false, +} + +type FileBody = + | ArrayBuffer + | ArrayBufferView + | Blob + | Buffer + | File + | FormData + | NodeJS.ReadableStream + | ReadableStream + | URLSearchParams + | string + +export default class StorageFileApi extends BaseApiClient { + protected bucketId: string | undefined + + constructor( + url: string, + headers: { [key: string]: string } = {}, + bucketId?: string, + fetch?: Fetch + ) { + super(url, headers, fetch, 'storage') + this.bucketId = bucketId + } + + /** + * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one. + * + * @param method HTTP method. + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. + * @param fileBody The body of the file to be stored in the bucket. + */ + private async uploadOrUpdate( + method: 'POST' | 'PUT', + path: string, + fileBody: FileBody, + fileOptions?: FileOptions + ): Promise< + | { + data: { id: string; path: string; fullPath: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + let body + const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions } + let headers: Record = { + ...this.headers, + ...(method === 'POST' && { 'x-upsert': String(options.upsert as boolean) }), + } + + const metadata = options.metadata + + if (typeof Blob !== 'undefined' && fileBody instanceof Blob) { + body = new FormData() + body.append('cacheControl', options.cacheControl as string) + if (metadata) { + body.append('metadata', this.encodeMetadata(metadata)) + } + body.append('', fileBody) + } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) { + body = fileBody + // Only append if not already present + if (!body.has('cacheControl')) { + body.append('cacheControl', options.cacheControl as string) + } + if (metadata && !body.has('metadata')) { + body.append('metadata', this.encodeMetadata(metadata)) + } + } else { + body = fileBody + headers['cache-control'] = `max-age=${options.cacheControl}` + headers['content-type'] = options.contentType as string + + if (metadata) { + headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata)) + } + + // Node.js streams require duplex option for fetch in Node 20+ + // Check for both web ReadableStream and Node.js streams + const isStream = + (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) || + (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function') + + if (isStream && !options.duplex) { + options.duplex = 'half' + } + } + + if (fileOptions?.headers) { + for (const [key, value] of Object.entries(fileOptions.headers)) { + headers = setHeader(headers, key, value) + } + } + + const cleanPath = this._removeEmptyFolders(path) + const _path = this._getFinalPath(cleanPath) + const data = await (method == 'PUT' ? put : post)( + this.fetch, + `${this.url}/object/${_path}`, + body as object, + { headers, ...(options?.duplex ? { duplex: options.duplex } : {}) } + ) + + return { path: cleanPath, id: data.Id, fullPath: data.Key } + }) + } + + /** + * Uploads a file to an existing bucket. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Upload file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile, { + * cacheControl: '3600', + * upsert: false + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Upload file using `ArrayBuffer` from base64 file data + * ```js + * import { decode } from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @example Handling errors + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .upload('public/avatar1.png', avatarFile) + * + * if (error) { + * // Log the full error so fields like `statusCode` and `error` (the + * // Storage error name, e.g. "Duplicate") aren't hidden behind `error.message`. + * console.error(error) + * return + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async upload( + path: string, + fileBody: FileBody, + fileOptions?: FileOptions + ): Promise< + | { + data: { id: string; path: string; fullPath: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.uploadOrUpdate('POST', path, fileBody, fileOptions) + } + + /** + * Upload a file with a token generated from `createSignedUploadUrl`. + * + * @category Storage + * @subcategory File Buckets + * @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. + * @param token The token generated from `createSignedUploadUrl` + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions HTTP headers (cacheControl, contentType, etc.). + * **Note:** The `upsert` option has no effect here. To enable upsert behavior, + * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead. + * @returns Promise with response containing file path and fullPath or error + * + * @example Upload to a signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "folder/cat.jpg", + * "fullPath": "avatars/folder/cat.jpg" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async uploadToSignedUrl( + path: string, + token: string, + fileBody: FileBody, + fileOptions?: FileOptions + ) { + const cleanPath = this._removeEmptyFolders(path) + const _path = this._getFinalPath(cleanPath) + + const url = new URL(this.url + `/object/upload/sign/${_path}`) + url.searchParams.set('token', token) + + return this.handleOperation(async () => { + let body + const options = { ...DEFAULT_FILE_OPTIONS, ...fileOptions } + let headers: Record = { + ...this.headers, + ...{ 'x-upsert': String(options.upsert as boolean) }, + } + + const metadata = options.metadata + + if (typeof Blob !== 'undefined' && fileBody instanceof Blob) { + body = new FormData() + body.append('cacheControl', options.cacheControl as string) + if (metadata) { + body.append('metadata', this.encodeMetadata(metadata)) + } + body.append('', fileBody) + } else if (typeof FormData !== 'undefined' && fileBody instanceof FormData) { + body = fileBody + if (!body.has('cacheControl')) { + body.append('cacheControl', options.cacheControl as string) + } + if (metadata && !body.has('metadata')) { + body.append('metadata', this.encodeMetadata(metadata)) + } + } else { + body = fileBody + headers['cache-control'] = `max-age=${options.cacheControl}` + headers['content-type'] = options.contentType as string + if (metadata) { + headers['x-metadata'] = this.toBase64(this.encodeMetadata(metadata)) + } + + const isStream = + (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) || + (body && typeof body === 'object' && 'pipe' in body && typeof body.pipe === 'function') + + if (isStream && !options.duplex) { + options.duplex = 'half' + } + } + + if (fileOptions?.headers) { + for (const [key, value] of Object.entries(fileOptions.headers)) { + headers = setHeader(headers, key, value) + } + } + + const data = await put(this.fetch, url.toString(), body as object, { + headers, + ...(options?.duplex ? { duplex: options.duplex } : {}), + }) + + return { path: cleanPath, fullPath: data.Key } + }) + } + + /** + * Creates a signed upload URL. + * Signed upload URLs can be used to upload files to the bucket without further authentication. + * They are valid for 2 hours. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param options.upsert If set to true, allows the file to be overwritten if it already exists. + * @returns Promise with response containing signed upload URL, token, and path or error + * + * @example Create Signed Upload URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUploadUrl('folder/cat.jpg') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=", + * "path": "folder/cat.jpg", + * "token": "" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUploadUrl( + path: string, + options?: { upsert: boolean } + ): Promise< + | { + data: { signedUrl: string; token: string; path: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + let _path = this._getFinalPath(path) + + const headers = { ...this.headers } + + if (options?.upsert) { + headers['x-upsert'] = 'true' + } + + const data = await post( + this.fetch, + `${this.url}/object/upload/sign/${_path}`, + {}, + { headers } + ) + + const url = new URL(this.url + data.url) + + const token = url.searchParams.get('token') + + if (!token) { + throw new StorageError('No token returned by API') + } + + return { signedUrl: url.toString(), path, token } + }) + } + + /** + * Replaces an existing file at the specified path with a new one. + * + * @category Storage + * @subcategory File Buckets + * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. + * @param fileBody The body of the file to be stored in the bucket. + * @param fileOptions Optional file upload options including cacheControl, contentType, and metadata. + * **Note:** The `upsert` option has no effect here. `update()` always replaces the + * file at the given path, so the `x-upsert` header is not sent. To control upsert + * behavior, use `upload()` instead. + * @returns Promise with response containing file path, id, and fullPath or error + * + * @example Update file + * ```js + * const avatarFile = event.target.files[0] + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', avatarFile, { + * cacheControl: '3600' + * }) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "public/avatar1.png", + * "fullPath": "avatars/public/avatar1.png" + * }, + * "error": null + * } + * ``` + * + * @example Update file using `ArrayBuffer` from base64 file data + * ```js + * import {decode} from 'base64-arraybuffer' + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .update('public/avatar1.png', decode('base64FileData'), { + * contentType: 'image/png' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - `update()` always replaces the file at the given path regardless of the `upsert` option. + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + * - 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. + */ + async update( + path: string, + fileBody: + | ArrayBuffer + | ArrayBufferView + | Blob + | Buffer + | File + | FormData + | NodeJS.ReadableStream + | ReadableStream + | URLSearchParams + | string, + fileOptions?: FileOptions + ): Promise< + | { + data: { id: string; path: string; fullPath: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.uploadOrUpdate('PUT', path, fileBody, fileOptions) + } + + /** + * Moves an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-new.png`. + * @param options The destination options. + * @returns Promise with response containing success message or error + * + * @example Move file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .move('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "message": "Successfully moved" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `update` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async move( + fromPath: string, + toPath: string, + options?: DestinationOptions + ): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await post( + this.fetch, + `${this.url}/object/move`, + { + bucketId: this.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options?.destinationBucket, + }, + { headers: this.headers } + ) + }) + } + + /** + * Copies an existing file to a new path in the same bucket. + * + * @category Storage + * @subcategory File Buckets + * @param fromPath The original file path, including the current file name. For example `folder/image.png`. + * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`. + * @param options The destination options. + * @returns Promise with response containing copied file path or error + * + * @example Copy file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .copy('public/avatar1.png', 'private/avatar2.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "path": "avatars/private/avatar2.png" + * }, + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `insert` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async copy( + fromPath: string, + toPath: string, + options?: DestinationOptions + ): Promise< + | { + data: { path: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const data = await post( + this.fetch, + `${this.url}/object/copy`, + { + bucketId: this.bucketId, + sourceKey: fromPath, + destinationKey: toPath, + destinationBucket: options?.destinationBucket, + }, + { headers: this.headers } + ) + return { path: data.Key } + }) + } + + /** + * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the current file name. For example `folder/image.png`. + * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing signed URL or error + * + * @example Create Signed URL + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60) + * ``` + * + * Response: + * ```json + * { + * "data": { + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * "error": null + * } + * ``` + * + * @example Create a signed URL for an asset with transformations + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Create a signed URL which triggers the download of the asset + * ```js + * const { data } = await supabase + * .storage + * .from('avatars') + * .createSignedUrl('folder/avatar1.png', 60, { + * download: true, + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrl( + path: string, + expiresIn: number, + options?: { + download?: string | boolean + transform?: TransformOptions + cacheNonce?: string + } + ): Promise< + | { + data: { signedUrl: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + let _path = this._getFinalPath(path) + + const hasTransform = + typeof options?.transform === 'object' && + options.transform !== null && + Object.keys(options.transform).length > 0 + + let data = await post( + this.fetch, + `${this.url}/object/sign/${_path}`, + { expiresIn, ...(hasTransform ? { transform: options!.transform } : {}) }, + { headers: this.headers } + ) + + const query = new URLSearchParams() + if (options?.download) + query.set('download', options.download === true ? '' : options.download) + if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce)) + const queryString = query.toString() + + // `data.signedURL` contains a `token` query parameter, so append extra params with `&` + // only when we actually have something to add. + const signedUrl = encodeURI( + `${this.url}${data.signedURL}${queryString ? `&${queryString}` : ''}` + ) + + return { signedUrl } + }) + } + + /** + * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. + * + * @category Storage + * @subcategory File Buckets + * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. + * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. + * @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. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Promise with response containing array of objects with signedUrl, path, and error or error + * + * @example Create Signed URLs + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "error": null, + * "path": "folder/avatar1.png", + * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=" + * }, + * { + * "error": null, + * "path": "folder/avatar2.png", + * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=", + * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=" + * } + * ], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async createSignedUrls( + paths: string[], + expiresIn: number, + options?: { download?: string | boolean; cacheNonce?: string } + ): Promise< + | { + data: { + error: string | null + path: string | null + signedURL: string | null + signedUrl: string | null + }[] + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const data = await post( + this.fetch, + `${this.url}/object/sign/${this.bucketId}`, + { expiresIn, paths }, + { headers: this.headers } + ) + + const query = new URLSearchParams() + + if (options?.download) + query.set('download', options.download === true ? '' : options.download) + if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce)) + + const queryString = query.toString() + + return data.map( + (datum: { error: string | null; path: string | null; signedURL: string | null }) => ({ + ...datum, + signedUrl: datum.signedURL + ? encodeURI(`${this.url}${datum.signedURL}${queryString ? `&${queryString}` : ''}`) + : null, + }) + ) + }) + } + + /** + * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead. + * + * @category Storage + * @subcategory File Buckets + * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`. + * @param options Optional settings: `transform` to transform the asset before serving it to the client, and `cacheNonce` to append a cache nonce parameter to the URL to invalidate the cache. + * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control. + * @returns BlobDownloadBuilder instance for downloading the file + * + * @example Download file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": , + * "error": null + * } + * ``` + * + * @example Download file with transformations + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * quality: 80 + * } + * }) + * ``` + * + * @example Download with cache control (useful in Edge Functions) + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { cache: 'no-store' }) + * ``` + * + * @example Download with abort signal + * ```js + * const controller = new AbortController() + * setTimeout(() => controller.abort(), 5000) + * + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .download('folder/avatar1.png', {}, { signal: controller.signal }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + download( + path: string, + options?: Options, + parameters?: FetchParameters + ): BlobDownloadBuilder { + const wantsTransformation = + typeof options?.transform === 'object' && + options.transform !== null && + Object.keys(options.transform).length > 0 + const renderPath = wantsTransformation ? 'render/image/authenticated' : 'object' + + const query = new URLSearchParams() + if (options?.transform) this.applyTransformOptsToQuery(query, options.transform) + if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce)) + const queryString = query.toString() + + const _path = this._getFinalPath(path) + const downloadFn = () => + get( + this.fetch, + `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ''}`, + { + headers: this.headers, + noResolveJson: true, + }, + parameters + ) + return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError) + } + + /** + * Retrieves the details of an existing file. + * + * Returns detailed file metadata including size, content type, and timestamps. + * Note: The API returns `last_modified` field, not `updated_at`. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing file metadata or error + * + * @example Get file info + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .info('folder/avatar1.png') + * + * if (data) { + * console.log('Last modified:', data.lastModified) + * console.log('Size:', data.size) + * } + * ``` + */ + async info(path: string): Promise< + | { + data: Camelize + error: null + } + | { + data: null + error: StorageError + } + > { + const _path = this._getFinalPath(path) + + return this.handleOperation(async () => { + const data = await get(this.fetch, `${this.url}/object/info/${_path}`, { + headers: this.headers, + }) + + return recursiveToCamel(data) as Camelize + }) + } + + /** + * Checks the existence of a file. + * + * @category Storage + * @subcategory File Buckets + * @param path The file path, including the file name. For example `folder/image.png`. + * @returns Promise with response containing boolean indicating file existence or error + * + * @example Check file existence + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .exists('folder/avatar1.png') + * ``` + */ + async exists(path: string): Promise< + | { + data: boolean + error: null + } + | { + data: boolean + error: StorageError + } + > { + const _path = this._getFinalPath(path) + + try { + await head(this.fetch, `${this.url}/object/${_path}`, { + headers: this.headers, + }) + + return { data: true, error: null } + } catch (error) { + if (this.shouldThrowOnError) { + throw error + } + if (isStorageError(error)) { + // HEAD requests produce StorageApiError (via handleError) or StorageUnknownError (legacy) + const status = + error instanceof StorageApiError + ? error.status + : error instanceof StorageUnknownError + ? (error.originalError as { status: number })?.status + : undefined + + if (status !== undefined && [400, 404].includes(status)) { + return { data: false, error } + } + } + + throw error + } + } + + /** + * 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. + * 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. + * + * @category Storage + * @subcategory File Buckets + * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`. + * @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. + * @param options.transform Transform the asset before serving it to the client. + * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache. + * @returns Object with public URL + * + * @example Returns the URL for an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png') + * ``` + * + * Response: + * ```json + * { + * "data": { + * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png" + * } + * } + * ``` + * + * @example Returns the URL for an asset in a public bucket with transformations + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * transform: { + * width: 100, + * height: 100, + * } + * }) + * ``` + * + * @example Returns the URL which triggers the download of an asset in a public bucket + * ```js + * const { data } = supabase + * .storage + * .from('public-bucket') + * .getPublicUrl('folder/avatar1.png', { + * download: true, + * }) + * ``` + * + * @remarks + * - 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" + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: none + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + getPublicUrl( + path: string, + options?: { + download?: string | boolean + transform?: TransformOptions + cacheNonce?: string + } + ): { data: { publicUrl: string } } { + const _path = this._getFinalPath(path) + + const query = new URLSearchParams() + if (options?.download) query.set('download', options.download === true ? '' : options.download) + if (options?.transform) this.applyTransformOptsToQuery(query, options.transform) + if (options?.cacheNonce != null) query.set('cacheNonce', String(options.cacheNonce)) + const queryString = query.toString() + + const wantsTransformation = + typeof options?.transform === 'object' && + options.transform !== null && + Object.keys(options.transform).length > 0 + const renderPath = wantsTransformation ? 'render/image' : 'object' + + return { + data: { + publicUrl: + encodeURI(`${this.url}/${renderPath}/public/${_path}`) + + (queryString ? `?${queryString}` : ''), + }, + } + } + + /** + * Deletes files within the same bucket + * + * Returns an array of FileObject entries for the deleted files. Note that deprecated + * fields like `bucket_id` may or may not be present in the response - do not rely on them. + * + * @category Storage + * @subcategory File Buckets + * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. + * @returns Promise with response containing array of deleted file objects or error + * + * @example Delete file + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .remove(['folder/avatar1.png']) + * ``` + * + * Response: + * ```json + * { + * "data": [], + * "error": null + * } + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `delete` and `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async remove(paths: string[]): Promise< + | { + data: FileObject[] + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + return await remove( + this.fetch, + `${this.url}/object/${this.bucketId}`, + { prefixes: paths }, + { headers: this.headers } + ) + }) + } + + /** + * Purges the CDN cache for a single object in this bucket. + * + * Maps to `DELETE /cdn/{bucket}/{path}` on the Storage API. The server + * issues a CDN invalidation for the object and returns `{ message: 'success' }`. + * + * **Requires the `service_role` key.** The underlying endpoint enforces + * `service_role` JWT — calls made with the anon key or a user JWT will be + * rejected by the server. + * + * **Hosted CDN feature.** On self-hosted Supabase, the Storage service must + * have `CDN_PURGE_ENDPOINT_URL` configured and the `purgeCache` tenant + * feature enabled, otherwise the server returns an error. + * + * Operates on a single object path. There is no wildcard or recursion: pass + * the exact path of the object you want invalidated. + * + * @category Storage + * @subcategory File Buckets + * @param path The path (relative to the bucket) of the object to purge, e.g. `folder/avatar.png`. + * @param options Optional purge cache options. + * @param options.transformations If true, purges only transformations (resized/formatted variants), leaving the original cached file intact. + * @param parameters Optional fetch parameters such as an `AbortController` signal. + * @returns Promise with `{ data: { message }, error: null }` on success or `{ data: null, error }` on failure. + * + * @example Purge a single cached object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png') + * ``` + * + * @example Purge only transformations for a single object + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .purgeCache('folder/avatar1.png', { transformations: true }) + * ``` + */ + async purgeCache( + path: string, + options?: PurgeCacheOptions, + parameters?: FetchParameters + ): Promise< + | { + data: { message: string } + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const _path = encodeStoragePath(this._getFinalPath(path)) + const query = new URLSearchParams() + if (options?.transformations) { + query.set('transformations', 'true') + } + const queryString = query.toString() + + return await remove( + this.fetch, + `${this.url}/cdn/${_path}${queryString ? `?${queryString}` : ''}`, + {}, + { headers: this.headers }, + parameters + ) + }) + } + + /** + * Get file metadata + * @param id the file id to retrieve metadata + */ + // async getMetadata( + // id: string + // ): Promise< + // | { + // data: Metadata + // error: null + // } + // | { + // data: null + // error: StorageError + // } + // > { + // try { + // const data = await get(this.fetch, `${this.url}/metadata/${id}`, { headers: this.headers }) + // return { data, error: null } + // } catch (error) { + // if (isStorageError(error)) { + // return { data: null, error } + // } + + // throw error + // } + // } + + /** + * Update file metadata + * @param id the file id to update metadata + * @param meta the new file metadata + */ + // async updateMetadata( + // id: string, + // meta: Metadata + // ): Promise< + // | { + // data: Metadata + // error: null + // } + // | { + // data: null + // error: StorageError + // } + // > { + // try { + // const data = await post( + // this.fetch, + // `${this.url}/metadata/${id}`, + // { ...meta }, + // { headers: this.headers } + // ) + // return { data, error: null } + // } catch (error) { + // if (isStorageError(error)) { + // return { data: null, error } + // } + + // throw error + // } + // } + + /** + * Lists all the files and folders within a path of the bucket. + * + * **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`, + * `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated. + * Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned + * by this method. + * + * @category Storage + * @subcategory File Buckets + * @param path The folder path. + * @param options Search options including limit (defaults to 100), offset, sortBy, and search + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing array of files/folders or error + * + * @example List files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * }) + * + * // Handle files vs folders + * data?.forEach(item => { + * if (item.id !== null) { + * // It's a file + * console.log('File:', item.name, 'Size:', item.metadata?.size) + * } else { + * // It's a folder + * console.log('Folder:', item.name) + * } + * }) + * ``` + * + * Response: + * ```json + * { + * "data": [ + * { + * "name": "avatar1.png", + * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2", + * "updated_at": "2024-05-22T23:06:05.580Z", + * "created_at": "2024-05-22T23:04:34.443Z", + * "last_accessed_at": "2024-05-22T23:04:34.443Z", + * "metadata": { + * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"", + * "size": 32175, + * "mimetype": "image/png", + * "cacheControl": "max-age=3600", + * "lastModified": "2024-05-22T23:06:05.574Z", + * "contentLength": 32175, + * "httpStatusCode": 200 + * } + * } + * ], + * "error": null + * } + * ``` + * + * @example Search files in a bucket + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .list('folder', { + * limit: 100, + * offset: 0, + * sortBy: { column: 'name', order: 'asc' }, + * search: 'jon' + * }) + * ``` + * + * @remarks + * - RLS policy permissions required: + * - `buckets` table permissions: none + * - `objects` table permissions: `select` + * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works + */ + async list( + path?: string, + options?: SearchOptions, + parameters?: FetchParameters + ): Promise< + | { + data: FileObject[] + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + // Deep-merge `sortBy` so overriding only one of its keys (e.g. `column`) keeps the + // default for the other (e.g. `order`), matching how the top-level defaults behave. + const sortBy = options?.sortBy + ? { ...DEFAULT_SEARCH_OPTIONS.sortBy, ...options.sortBy } + : DEFAULT_SEARCH_OPTIONS.sortBy + const body = { ...DEFAULT_SEARCH_OPTIONS, ...options, sortBy, prefix: path || '' } + return await post( + this.fetch, + `${this.url}/object/list/${this.bucketId}`, + body, + { headers: this.headers }, + parameters + ) + }) + } + + /** + * Lists all the files and folders within a bucket using the V2 API with pagination support. + * + * **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` — + * they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available + * on entries in the `objects` array. + * + * @experimental this method signature might change in the future + * + * @category Storage + * @subcategory File Buckets + * @param options Search options including prefix, cursor for pagination, limit, with_delimiter + * @param parameters Optional fetch parameters including signal for cancellation + * @returns Promise with response containing folders/objects arrays with pagination info or error + * + * @example List files with pagination + * ```js + * const { data, error } = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * limit: 100, + * }) + * + * // Handle pagination + * if (data?.hasNext) { + * const nextPage = await supabase + * .storage + * .from('avatars') + * .listV2({ + * prefix: 'folder/', + * cursor: data.nextCursor, + * }) + * } + * + * // Handle files vs folders + * data?.objects.forEach(file => { + * if (file.id !== null) { + * console.log('File:', file.name, 'Size:', file.metadata?.size) + * } + * }) + * data?.folders.forEach(folder => { + * console.log('Folder:', folder.name) + * }) + * ``` + */ + async listV2( + options?: SearchV2Options, + parameters?: FetchParameters + ): Promise< + | { + data: SearchV2Result + error: null + } + | { + data: null + error: StorageError + } + > { + return this.handleOperation(async () => { + const body = { ...options } + return await post( + this.fetch, + `${this.url}/object/list-v2/${this.bucketId}`, + body, + { headers: this.headers }, + parameters + ) + }) + } + + protected encodeMetadata(metadata: Record) { + return JSON.stringify(metadata) + } + + toBase64(data: string) { + if (typeof Buffer !== 'undefined') { + return Buffer.from(data).toString('base64') + } + return btoa(data) + } + + private _getFinalPath(path: string) { + return `${this.bucketId}/${path.replace(/^\/+/, '')}` + } + + private _removeEmptyFolders(path: string) { + return path.replace(/^\/|\/$/g, '').replace(/\/+/g, '/') + } + + /** Modifies the `query`, appending values the from `transform` */ + private applyTransformOptsToQuery( + query: URLSearchParams, + transform: TransformOptions + ): URLSearchParams { + if (transform.width) query.set('width', transform.width.toString()) + if (transform.height) query.set('height', transform.height.toString()) + if (transform.resize) query.set('resize', transform.resize) + if (transform.format) query.set('format', transform.format) + if (transform.quality) query.set('quality', transform.quality.toString()) + + return query + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts b/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..51fb8fab49003a5bab467b0848b90e0c2282d44b --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/StorageVectorsClient.ts @@ -0,0 +1,644 @@ +import VectorIndexApi, { CreateIndexOptions } from './VectorIndexApi' +import VectorDataApi from './VectorDataApi' +import { Fetch } from '../lib/common/fetch' +import VectorBucketApi from './VectorBucketApi' +import { + ApiResponse, + DeleteVectorsOptions, + GetVectorsOptions, + ListIndexesOptions, + ListVectorsOptions, + ListVectorBucketsOptions, + ListVectorBucketsResponse, + PutVectorsOptions, + QueryVectorsOptions, + VectorBucket, +} from '../lib/types' + +/** + * + * @alpha + * + * Configuration options for the Storage Vectors client + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +export interface StorageVectorsClientOptions { + /** + * Custom headers to include in all requests + */ + headers?: { [key: string]: string } + /** + * Custom fetch implementation (optional) + * Useful for testing or custom request handling + */ + fetch?: Fetch +} + +/** + * + * @alpha + * + * Main client for interacting with S3 Vectors API + * Provides access to bucket, index, and vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * **Usage Patterns:** + * + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * + * // Access index operations via buckets + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine' + * }) + * + * // Access vector operations via index + * const index = bucket.index('documents') + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5, + * returnDistance: true + * }) + * ``` + */ +export class StorageVectorsClient extends VectorBucketApi { + /** + * @alpha + * + * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param url - Base URL of the Storage Vectors REST API. + * @param options.headers - Optional headers (for example `Authorization`) applied to every request. + * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes. + * + * @example Using supabase-js (recommended) + * ```typescript + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + * + * @example Standalone import for bundle-sensitive environments + * ```typescript + * import { StorageVectorsClient } from '@supabase/storage-js' + * + * const client = new StorageVectorsClient(url, options) + * ``` + */ + constructor(url: string, options: StorageVectorsClientOptions = {}) { + super(url, options.headers || {}, options.fetch) + } + + /** + * + * @alpha + * + * Access operations for a specific vector bucket + * Returns a scoped client for index and vector operations within the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Bucket-scoped client with index and vector operations + * + * @example Accessing a vector bucket + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + from(vectorBucketName: string): VectorBucketScope { + return new VectorBucketScope(this.url, this.headers, vectorBucketName, this.fetch) + } + + /** + * + * @alpha + * + * Creates a new vector bucket + * Vector buckets are containers for vector indexes and their data + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Unique name for the vector bucket + * @returns Promise with empty response on success or error + * + * @example Creating a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .createBucket('embeddings-prod') + * ``` + */ + async createBucket(vectorBucketName: string): Promise> { + return super.createBucket(vectorBucketName) + } + + /** + * + * @alpha + * + * Retrieves metadata for a specific vector bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket + * @returns Promise with bucket metadata or error + * + * @example Get bucket metadata + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .getBucket('embeddings-prod') + * + * console.log('Bucket created:', data?.vectorBucket.creationTime) + * ``` + */ + async getBucket(vectorBucketName: string): Promise> { + return super.getBucket(vectorBucketName) + } + + /** + * + * @alpha + * + * Lists all vector buckets with optional filtering and pagination + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Optional filters (prefix, maxResults, nextToken) + * @returns Promise with list of buckets or error + * + * @example List vector buckets + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .listBuckets({ prefix: 'embeddings-' }) + * + * data?.vectorBuckets.forEach(bucket => { + * console.log(bucket.vectorBucketName) + * }) + * ``` + */ + async listBuckets( + options: ListVectorBucketsOptions = {} + ): Promise> { + return super.listBuckets(options) + } + + /** + * + * @alpha + * + * Deletes a vector bucket (bucket must be empty) + * All indexes must be deleted before deleting the bucket + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param vectorBucketName - Name of the vector bucket to delete + * @returns Promise with empty response on success or error + * + * @example Delete a vector bucket + * ```typescript + * const { data, error } = await supabase + * .storage + * .vectors + * .deleteBucket('embeddings-old') + * ``` + */ + async deleteBucket(vectorBucketName: string): Promise> { + return super.deleteBucket(vectorBucketName) + } +} + +/** + * + * @alpha + * + * Scoped client for operations within a specific vector bucket + * Provides index management and access to vector operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +export class VectorBucketScope extends VectorIndexApi { + private vectorBucketName: string + + /** + * @alpha + * + * Creates a helper that automatically scopes all index operations to the provided bucket. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector bucket scope + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * ``` + */ + constructor( + url: string, + headers: { [key: string]: string }, + vectorBucketName: string, + fetch?: Fetch + ) { + super(url, headers, fetch) + this.vectorBucketName = vectorBucketName + } + + /** + * + * @alpha + * + * Creates a new vector index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Index configuration (vectorBucketName is automatically set) + * @returns Promise with empty response on success or error + * + * @example Creating a vector index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.createIndex({ + * indexName: 'documents-openai', + * dataType: 'float32', + * dimension: 1536, + * distanceMetric: 'cosine', + * metadataConfiguration: { + * nonFilterableMetadataKeys: ['raw_text'] + * } + * }) + * ``` + */ + override async createIndex(options: Omit) { + return super.createIndex({ + ...options, + vectorBucketName: this.vectorBucketName, + }) + } + + /** + * + * @alpha + * + * Lists indexes in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (vectorBucketName is automatically set) + * @returns Promise with response containing indexes array and pagination token or error + * + * @example List indexes + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.listIndexes({ prefix: 'documents-' }) + * ``` + */ + override async listIndexes(options: Omit = {}) { + return super.listIndexes({ + ...options, + vectorBucketName: this.vectorBucketName, + }) + } + + /** + * + * @alpha + * + * Retrieves metadata for a specific index in this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to retrieve + * @returns Promise with index metadata or error + * + * @example Get index metadata + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * const { data } = await bucket.getIndex('documents-openai') + * console.log('Dimension:', data?.index.dimension) + * ``` + */ + override async getIndex(indexName: string) { + return super.getIndex(this.vectorBucketName, indexName) + } + + /** + * + * @alpha + * + * Deletes an index from this bucket + * Convenience method that automatically includes the bucket name + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index to delete + * @returns Promise with empty response on success or error + * + * @example Delete an index + * ```typescript + * const bucket = supabase.storage.vectors.from('embeddings-prod') + * await bucket.deleteIndex('old-index') + * ``` + */ + override async deleteIndex(indexName: string) { + return super.deleteIndex(this.vectorBucketName, indexName) + } + + /** + * + * @alpha + * + * Access operations for a specific index within this bucket + * Returns a scoped client for vector data operations + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param indexName - Name of the index + * @returns Index-scoped client with vector data operations + * + * @example Accessing an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * + * // Insert vectors + * await index.putVectors({ + * vectors: [ + * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } } + * ] + * }) + * + * // Query similar vectors + * const { data } = await index.queryVectors({ + * queryVector: { float32: [...] }, + * topK: 5 + * }) + * ``` + */ + index(indexName: string): VectorIndexScope { + return new VectorIndexScope( + this.url, + this.headers, + this.vectorBucketName, + indexName, + this.fetch + ) + } +} + +/** + * + * @alpha + * + * Scoped client for operations within a specific vector index + * Provides vector data operations (put, get, list, query, delete) + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +export class VectorIndexScope extends VectorDataApi { + private vectorBucketName: string + private indexName: string + + /** + * + * @alpha + * + * Creates a helper that automatically scopes all vector operations to the provided bucket/index names. + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @example Creating a vector index scope + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * ``` + */ + constructor( + url: string, + headers: { [key: string]: string }, + vectorBucketName: string, + indexName: string, + fetch?: Fetch + ) { + super(url, headers, fetch) + this.vectorBucketName = vectorBucketName + this.indexName = indexName + } + + /** + * + * @alpha + * + * Inserts or updates vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector insertion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Insert vectors into an index + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.putVectors({ + * vectors: [ + * { + * key: 'doc-1', + * data: { float32: [0.1, 0.2, ...] }, + * metadata: { title: 'Introduction', page: 1 } + * } + * ] + * }) + * ``` + */ + override async putVectors(options: Omit) { + return super.putVectors({ + ...options, + vectorBucketName: this.vectorBucketName, + indexName: this.indexName, + }) + } + + /** + * + * @alpha + * + * Retrieves vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Vector retrieval options (bucket and index names automatically set) + * @returns Promise with response containing vectors array or error + * + * @example Get vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.getVectors({ + * keys: ['doc-1', 'doc-2'], + * returnMetadata: true + * }) + * ``` + */ + override async getVectors(options: Omit) { + return super.getVectors({ + ...options, + vectorBucketName: this.vectorBucketName, + indexName: this.indexName, + }) + } + + /** + * + * @alpha + * + * Lists vectors in this index with pagination + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Listing options (bucket and index names automatically set) + * @returns Promise with response containing vectors array and pagination token or error + * + * @example List vectors with pagination + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.listVectors({ + * maxResults: 500, + * returnMetadata: true + * }) + * ``` + */ + override async listVectors( + options: Omit = {} + ) { + return super.listVectors({ + ...options, + vectorBucketName: this.vectorBucketName, + indexName: this.indexName, + }) + } + + /** + * + * @alpha + * + * Queries for similar vectors in this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Query options (bucket and index names automatically set) + * @returns Promise with response containing matches array of similar vectors ordered by distance or error + * + * @example Query similar vectors + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * const { data } = await index.queryVectors({ + * queryVector: { float32: [0.1, 0.2, ...] }, + * topK: 5, + * filter: { category: 'technical' }, + * returnDistance: true, + * returnMetadata: true + * }) + * ``` + */ + override async queryVectors( + options: Omit + ) { + return super.queryVectors({ + ...options, + vectorBucketName: this.vectorBucketName, + indexName: this.indexName, + }) + } + + /** + * + * @alpha + * + * Deletes vectors by keys from this index + * Convenience method that automatically includes bucket and index names + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + * + * @category Storage + * @subcategory Vector Buckets + * @param options - Deletion options (bucket and index names automatically set) + * @returns Promise with empty response on success or error + * + * @example Delete vectors by keys + * ```typescript + * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai') + * await index.deleteVectors({ + * keys: ['doc-1', 'doc-2', 'doc-3'] + * }) + * ``` + */ + override async deleteVectors( + options: Omit + ) { + return super.deleteVectors({ + ...options, + vectorBucketName: this.vectorBucketName, + indexName: this.indexName, + }) + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts b/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts new file mode 100644 index 0000000000000000000000000000000000000000..02afe9cd0ae7c66ae59193d7c7df3101f182f23b --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/StreamDownloadBuilder.ts @@ -0,0 +1,59 @@ +import { isStorageError } from '../lib/common/errors' +import { DownloadResult } from '../lib/types' + +export default class StreamDownloadBuilder implements Promise> { + readonly [Symbol.toStringTag]: string = 'StreamDownloadBuilder' + private promise: Promise> | null = null + + constructor( + private downloadFn: () => Promise, + private shouldThrowOnError: boolean + ) {} + + then, TResult2 = never>( + onfulfilled?: + | ((value: DownloadResult) => TResult1 | PromiseLike) + | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.getPromise().then(onfulfilled, onrejected) + } + + catch( + onrejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise | TResult> { + return this.getPromise().catch(onrejected) + } + + finally(onfinally?: (() => void) | null): Promise> { + return this.getPromise().finally(onfinally) + } + + private getPromise(): Promise> { + if (!this.promise) { + this.promise = this.execute() + } + return this.promise + } + + private async execute(): Promise> { + try { + const result = await this.downloadFn() + + return { + data: result.body as ReadableStream, + error: null, + } + } catch (error) { + if (this.shouldThrowOnError) { + throw error + } + + if (isStorageError(error)) { + return { data: null, error } + } + + throw error + } + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts b/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..97daa5956ad32883a1ac948bf8cb7c6244df300e --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/VectorBucketApi.ts @@ -0,0 +1,73 @@ +import { DEFAULT_HEADERS } from '../lib/constants' +import { StorageError } from '../lib/common/errors' +import { Fetch, vectorsApi } from '../lib/common/fetch' +import BaseApiClient from '../lib/common/BaseApiClient' +import { + ApiResponse, + VectorBucket, + ListVectorBucketsOptions, + ListVectorBucketsResponse, +} from '../lib/types' + +/** + * @hidden + * Base implementation for vector bucket operations. + * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead. + */ +export default class VectorBucketApi extends BaseApiClient { + /** Creates a new VectorBucketApi instance */ + constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) { + const finalUrl = url.replace(/\/$/, '') + const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers } + super(finalUrl, finalHeaders, fetch, 'vectors') + } + + /** Creates a new vector bucket */ + async createBucket(vectorBucketName: string): Promise> { + return this.handleOperation(async () => { + const data = await vectorsApi.post( + this.fetch, + `${this.url}/CreateVectorBucket`, + { vectorBucketName }, + { headers: this.headers } + ) + return data || {} + }) + } + + /** Retrieves metadata for a specific vector bucket */ + async getBucket(vectorBucketName: string): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post( + this.fetch, + `${this.url}/GetVectorBucket`, + { vectorBucketName }, + { headers: this.headers } + ) + }) + } + + /** Lists vector buckets with optional filtering and pagination */ + async listBuckets( + options: ListVectorBucketsOptions = {} + ): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post(this.fetch, `${this.url}/ListVectorBuckets`, options, { + headers: this.headers, + }) + }) + } + + /** Deletes a vector bucket (must be empty first) */ + async deleteBucket(vectorBucketName: string): Promise> { + return this.handleOperation(async () => { + const data = await vectorsApi.post( + this.fetch, + `${this.url}/DeleteVectorBucket`, + { vectorBucketName }, + { headers: this.headers } + ) + return data || {} + }) + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts b/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..4dbfae1368313fa8379a39fa054381248bf949d5 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/VectorDataApi.ts @@ -0,0 +1,98 @@ +import { DEFAULT_HEADERS } from '../lib/constants' +import { StorageError } from '../lib/common/errors' +import { Fetch, vectorsApi } from '../lib/common/fetch' +import BaseApiClient from '../lib/common/BaseApiClient' +import { + ApiResponse, + PutVectorsOptions, + GetVectorsOptions, + GetVectorsResponse, + DeleteVectorsOptions, + ListVectorsOptions, + ListVectorsResponse, + QueryVectorsOptions, + QueryVectorsResponse, +} from '../lib/types' + +/** + * @hidden + * Base implementation for vector data operations. + * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead. + */ +export default class VectorDataApi extends BaseApiClient { + /** Creates a new VectorDataApi instance */ + constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) { + const finalUrl = url.replace(/\/$/, '') + const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers } + super(finalUrl, finalHeaders, fetch, 'vectors') + } + + /** Inserts or updates vectors in batch (1-500 per request) */ + async putVectors(options: PutVectorsOptions): Promise> { + // Validate batch size + if (options.vectors.length < 1 || options.vectors.length > 500) { + throw new Error('Vector batch size must be between 1 and 500 items') + } + + return this.handleOperation(async () => { + const data = await vectorsApi.post(this.fetch, `${this.url}/PutVectors`, options, { + headers: this.headers, + }) + return data || {} + }) + } + + /** Retrieves vectors by their keys in batch */ + async getVectors(options: GetVectorsOptions): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post(this.fetch, `${this.url}/GetVectors`, options, { + headers: this.headers, + }) + }) + } + + /** Lists vectors in an index with pagination */ + async listVectors(options: ListVectorsOptions): Promise> { + // Validate segment configuration + if (options.segmentCount !== undefined) { + if (options.segmentCount < 1 || options.segmentCount > 16) { + throw new Error('segmentCount must be between 1 and 16') + } + if (options.segmentIndex !== undefined) { + if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) { + throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`) + } + } + } + + return this.handleOperation(async () => { + return await vectorsApi.post(this.fetch, `${this.url}/ListVectors`, options, { + headers: this.headers, + }) + }) + } + + /** Queries for similar vectors using approximate nearest neighbor search */ + async queryVectors(options: QueryVectorsOptions): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post(this.fetch, `${this.url}/QueryVectors`, options, { + headers: this.headers, + }) + }) + } + + /** Deletes vectors by their keys in batch (1-500 per request) */ + async deleteVectors(options: DeleteVectorsOptions): Promise> { + // Validate batch size + if (options.keys.length < 1 || options.keys.length > 500) { + throw new Error('Keys batch size must be between 1 and 500 items') + } + + return this.handleOperation(async () => { + const data = await vectorsApi.post(this.fetch, `${this.url}/DeleteVectors`, options, { + headers: this.headers, + }) + return data || {} + }) + } +} diff --git a/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts b/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..6731986c3f94818406f493a0499b910cf1eae095 --- /dev/null +++ b/node_modules/@supabase/storage-js/src/packages/VectorIndexApi.ts @@ -0,0 +1,90 @@ +import { DEFAULT_HEADERS } from '../lib/constants' +import { StorageError } from '../lib/common/errors' +import { Fetch, vectorsApi } from '../lib/common/fetch' +import BaseApiClient from '../lib/common/BaseApiClient' +import { + ApiResponse, + VectorIndex, + ListIndexesOptions, + ListIndexesResponse, + VectorDataType, + DistanceMetric, + MetadataConfiguration, +} from '../lib/types' + +/** + * @alpha + * + * Options for creating a vector index + * + * **Public alpha:** This API is part of a public alpha release and may not be available to your account type. + */ +export interface CreateIndexOptions { + vectorBucketName: string + indexName: string + dataType: VectorDataType + dimension: number + distanceMetric: DistanceMetric + metadataConfiguration?: MetadataConfiguration +} + +/** + * @hidden + * Base implementation for vector index operations. + * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead. + */ +export default class VectorIndexApi extends BaseApiClient { + /** Creates a new VectorIndexApi instance */ + constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) { + const finalUrl = url.replace(/\/$/, '') + const finalHeaders = { ...DEFAULT_HEADERS, 'Content-Type': 'application/json', ...headers } + super(finalUrl, finalHeaders, fetch, 'vectors') + } + + /** Creates a new vector index within a bucket */ + async createIndex(options: CreateIndexOptions): Promise> { + return this.handleOperation(async () => { + const data = await vectorsApi.post(this.fetch, `${this.url}/CreateIndex`, options, { + headers: this.headers, + }) + return data || {} + }) + } + + /** Retrieves metadata for a specific vector index */ + async getIndex( + vectorBucketName: string, + indexName: string + ): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post( + this.fetch, + `${this.url}/GetIndex`, + { vectorBucketName, indexName }, + { headers: this.headers } + ) + }) + } + + /** Lists vector indexes within a bucket with optional filtering and pagination */ + async listIndexes(options: ListIndexesOptions): Promise> { + return this.handleOperation(async () => { + return await vectorsApi.post(this.fetch, `${this.url}/ListIndexes`, options, { + headers: this.headers, + }) + }) + } + + /** Deletes a vector index and all its data */ + async deleteIndex(vectorBucketName: string, indexName: string): Promise> { + return this.handleOperation(async () => { + const data = await vectorsApi.post( + this.fetch, + `${this.url}/DeleteIndex`, + { vectorBucketName, indexName }, + { headers: this.headers } + ) + return data || {} + }) + } +} diff --git a/node_modules/@supabase/supabase-js/AGENTS.md b/node_modules/@supabase/supabase-js/AGENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..ca1e40d3e095ad843ab9d1044f775df67dde35c3 --- /dev/null +++ b/node_modules/@supabase/supabase-js/AGENTS.md @@ -0,0 +1,11 @@ +# Agent instructions for `@supabase/supabase-js` + +Main isomorphic Supabase client for JavaScript. Aggregates `@supabase/auth-js`, `@supabase/postgrest-js`, `@supabase/realtime-js`, `@supabase/storage-js`, and `@supabase/functions-js` into one client. + +When helping a user work with this package: + +- **Usage and quick start**: [`README.md`](./README.md) +- **Full API reference**: [`src/`](./src/) — every public method and type has TSDoc with `@example` blocks. Read the source for the canonical, version-pinned answer. +- **Migration notes**: [`migrations/`](./migrations/) — per-theme markdown files for changes that need caller action. + +For broader Supabase guidance (docs site, MCP tools, schema and project workflows), use the centralized [Supabase agent skills](https://github.com/supabase/agent-skills): `npx skills add supabase/agent-skills`. Or pair with the Supabase MCP server via the [Supabase Plugin for AI Coding Agents](https://supabase.com/docs/guides/getting-started/plugins). diff --git a/node_modules/@supabase/supabase-js/LICENSE b/node_modules/@supabase/supabase-js/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ddeba6a00ae5ec536d5429e040bc73ef2c6a07d6 --- /dev/null +++ b/node_modules/@supabase/supabase-js/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Supabase + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@supabase/supabase-js/README.md b/node_modules/@supabase/supabase-js/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2f3efb754525f4b0604a963a73747c23810da644 --- /dev/null +++ b/node_modules/@supabase/supabase-js/README.md @@ -0,0 +1,297 @@ +
+

+ + + + + Supabase Logo + + + +

Supabase JS SDK

+ +

Isomorphic JavaScript SDK for Supabase - combining Auth, Database, Storage, Functions, and Realtime.

+ +

+ Guides + · + Reference Docs + · + TypeDoc +

+

+ +
+ +[![Build](https://github.com/supabase/supabase-js/workflows/CI/badge.svg)](https://github.com/supabase/supabase-js/actions?query=branch%3Amaster) +[![Package](https://img.shields.io/npm/v/@supabase/supabase-js)](https://www.npmjs.com/package/@supabase/supabase-js) +[![License: MIT](https://img.shields.io/npm/l/@supabase/supabase-js)](#license) +[![pkg.pr.new](https://pkg.pr.new/badge/supabase/supabase-js)](https://pkg.pr.new/~/supabase/supabase-js) + +
+ +## Usage + +First of all, you need to install the library: + +```sh +npm install @supabase/supabase-js +``` + +Then you're able to import the library and establish the connection with the database: + +```js +import { createClient } from '@supabase/supabase-js' + +// Create a single supabase client for interacting with your database +const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') +``` + +### UMD + +You can use plain ` +``` + +or even: + +```html + +``` + +Then you can use it from a global `supabase` variable: + +```html + +``` + +### ESM + +You can use ` +``` + +### Deno + +You can use supabase-js in the Deno runtime via [JSR](https://jsr.io/@supabase/supabase-js): + +```js +import { createClient } from 'jsr:@supabase/supabase-js@2' +``` + +### Custom `fetch` implementation + +`supabase-js` uses the runtime's global `fetch` to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior: + +```js +import { createClient } from '@supabase/supabase-js' + +// Provide a custom `fetch` implementation as an option +const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + global: { + fetch: (...args) => fetch(...args), + }, +}) +``` + +### Distributed Tracing with OpenTelemetry + +The Supabase JS SDK can attach W3C/OpenTelemetry trace context headers (`traceparent`, `tracestate`, `baggage`) to outgoing requests, enabling end-to-end request tracing from your client application through Supabase services. + +Trace propagation is **opt-in** and disabled by default. When enabled, headers are only attached to requests targeting Supabase domains (`*.supabase.co`, `*.supabase.in`, `localhost`). + +#### Enable trace propagation + +Opting in takes two steps: install `@opentelemetry/api`, and load the tracing runtime by importing the `@supabase/supabase-js/tracing` subpath once at your application entry point. The main bundle contains no OpenTelemetry code — the subpath import is what wires it up. + +```js +import '@supabase/supabase-js/tracing' +import { createClient } from '@supabase/supabase-js' +import { trace } from '@opentelemetry/api' + +const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + tracePropagation: true, +}) + +const tracer = trace.getTracer('my-app') +await tracer.startActiveSpan('fetch-users', async (span) => { + // This request now includes the active trace context. + const { data, error } = await supabase.from('users').select('*') + span.end() +}) +``` + +The subpath imports `@opentelemetry/api` directly, so module resolution fails loudly if it is not installed. If `tracePropagation` is enabled without the subpath import, the SDK logs a one-time warning and sends requests without trace headers; if no active context exists at request time, it silently no-ops. + +Trace propagation is not available via the CDN/UMD build (`https://cdn.jsdelivr.net/.../supabase.js`) — there is no way to load the tracing runtime there. + +#### Advanced configuration + +```typescript +interface TracePropagationOptions { + // Enable trace propagation (default: false). + enabled?: boolean + + // Respect upstream sampling decisions (default: true). + // When true, non-sampled requests carry only `traceparent` (flag preserved, + // so nothing is recorded downstream) — Supabase logs still get a trace_id, + // while `tracestate` and `baggage` are withheld. + respectSamplingDecision?: boolean +} +``` + +```js +// Always propagate the full trace context, even for non-sampled traces. +const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + tracePropagation: { enabled: true, respectSamplingDecision: false }, +}) +``` + +## Support Policy + +This section outlines the scope of support for various runtime environments in Supabase JavaScript client. + +### Node.js + +We only support Node.js versions that are in **Active LTS** or **Maintenance** status as defined by the [official Node.js release schedule](https://nodejs.org/en/about/previous-releases#release-schedule). This means we support versions that are currently receiving long-term support and critical bug fixes. + +When a Node.js version reaches end-of-life and is no longer in Active LTS or Maintenance status, Supabase will drop it in a **minor release**, and **this won't be considered a breaking change**. + +> ⚠️ **Node.js 18 Deprecation Notice** +> +> Node.js 18 reached end-of-life on April 30, 2025. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/37217), support for Node.js 18 was dropped in version `2.79.0`. +> +> If you must use Node.js 18, please use version `2.78.0`, which is the last version that supported Node.js 18. + +> ⚠️ **Node.js 20 Deprecation Notice** +> +> Node.js 20 reached end-of-life on April 30, 2026. As announced in [our deprecation notice](https://github.com/orgs/supabase/discussions/45715), support for Node.js 20 was dropped in version `2.110.0`. +> +> If you must use Node.js 20, please use version `2.109.0`, which is the last version that supported Node.js 20. + +### Deno + +We support Deno versions that are currently receiving active development and security updates. We follow the [official Deno release schedule](https://docs.deno.com/runtime/fundamentals/stability_and_releases/) and only support versions from the `stable` and `lts` release channels. + +When a Deno version reaches end-of-life and is no longer receiving security updates, Supabase will drop it in a **minor release**, and **this won't be considered a breaking change**. + +### Browsers + +All modern browsers are supported. We support browsers that provide native `fetch` API. For Realtime features, browsers must also support native `WebSocket` API. + +### Bun + +We support Bun runtime environments. Bun provides native fetch support and is compatible with Node.js APIs. Since Bun does not follow a structured release schedule like Node.js or Deno, we support current stable versions of Bun and may drop support for older versions in minor releases without considering it a breaking change. + +### React Native + +We support React Native environments with fetch polyfills provided by the framework. Since React Native does not follow a structured release schedule, we support current stable versions and may drop support for older versions in minor releases without considering it a breaking change. + +### Cloudflare Workers + +We support Cloudflare Workers runtime environments. Cloudflare Workers provides native fetch support. Since Cloudflare Workers does not follow a structured release schedule, we support current stable versions and may drop support for older versions in minor releases without considering it a breaking change. + +### Important Notes + +- **Experimental features**: Features marked as experimental may be removed or changed without notice + +## Known Build Warnings + +### `UNUSED_EXTERNAL_IMPORT` in Vite / Rollup / Nuxt + +When bundling your app, you may see warnings like: + +``` +"PostgrestError" is imported from external module "@supabase/postgrest-js" but never used in "...supabase-js/dist/index.mjs". +"FunctionRegion", "FunctionsError", "FunctionsFetchError", "FunctionsHttpError" and "FunctionsRelayError" are imported from external module "@supabase/functions-js" but never used in "...". +``` + +**This is a false positive — your bundle is fine.** Here is why it happens: + +`@supabase/supabase-js` re-exports `PostgrestError`, `FunctionsError`, and related symbols so you can import them directly from `@supabase/supabase-js`. However, our build tool merges all imports from the same package into a single import statement in the built output: + +```js +// dist/index.mjs (simplified) +import { PostgrestClient, PostgrestError } from '@supabase/postgrest-js' +// ^ used internally ^ re-exported for you +``` + +Your bundler checks which names from that import are used _in the code body_, and flags `PostgrestError` as unused because it only appears in an `export` statement — not called or assigned. The export itself is the usage, but downstream bundlers don't track this correctly. This is a known Rollup/Vite limitation with re-exported external imports. + +**Nothing is broken.** Tree-shaking and bundle size are unaffected. + +To suppress the warning: + +**Vite / Rollup (`vite.config.js` or `rollup.config.js`):** + +```js +export default { + build: { + rollupOptions: { + onwarn(warning, warn) { + if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/')) + return + warn(warning) + }, + }, + }, +} +``` + +**Nuxt (`nuxt.config.ts`):** + +```ts +export default defineNuxtConfig({ + vite: { + build: { + rollupOptions: { + onwarn(warning, warn) { + if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/')) + return + warn(warning) + }, + }, + }, + }, +}) +``` + +## Contributing + +We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started. + +For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes. + +### Building + +```bash +# From the monorepo root +pnpm nx build supabase-js + +# Or with watch mode for development +pnpm nx build supabase-js --watch +``` + +### Testing + +There's a complete guide on how to set up your environment for running locally the `supabase-js` integration tests. Please refer to [TESTING.md](./TESTING.md). + +## Badges + +[![Coverage Status](https://coveralls.io/repos/github/supabase/supabase-js/badge.svg?branch=master)](https://coveralls.io/github/supabase/supabase-js?branch=master) diff --git a/node_modules/@supabase/supabase-js/dist/cors.cjs b/node_modules/@supabase/supabase-js/dist/cors.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c86d72c5bed8a18e5b64caf584504f8e590f84b6 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.cjs @@ -0,0 +1,96 @@ + +//#region src/cors.ts +/** +* Canonical CORS configuration for Supabase Edge Functions +* +* This module exports CORS headers kept in sync with the headers the Supabase +* SDK sends. Using it in Edge Functions prevents CORS preflight errors when the +* SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts +* sending one (enforced by the unit tests). +* +* @example Basic usage +* ```typescript +* import { corsHeaders } from '@supabase/supabase-js/cors' +* +* Deno.serve(async (req) => { +* if (req.method === 'OPTIONS') { +* return new Response('ok', { headers: corsHeaders }) +* } +* +* return new Response( +* JSON.stringify({ data: 'Hello' }), +* { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } +* ) +* }) +* ``` +* +* @module cors +*/ +/** +* All custom headers sent by the Supabase SDK. +* These headers need to be included in CORS configuration to prevent preflight failures. +* +* Headers: +* - authorization: Bearer token for authentication +* - x-client-info: Library version information +* - apikey: Project API key +* - content-type: Standard HTTP content type +* - x-retry-count: Retry attempt number sent by postgrest-js on retried requests +* - traceparent: W3C trace context sent when `tracePropagation` is enabled +* - tracestate: Vendor-specific trace data sent alongside traceparent +* - baggage: W3C baggage sent alongside traceparent +*/ +const SUPABASE_HEADERS = [ + "authorization", + "x-client-info", + "apikey", + "content-type", + "x-retry-count", + "traceparent", + "tracestate", + "baggage" +].join(", "); +/** +* All HTTP methods used by the Supabase SDK +*/ +const SUPABASE_METHODS = [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE", + "OPTIONS" +].join(", "); +/** +* Default CORS headers for Supabase Edge Functions. +* +* Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. +* Use this for simple CORS configurations with wildcard origin. +* +* @example Basic usage +* ```typescript +* import { corsHeaders } from '@supabase/supabase-js/cors' +* +* Deno.serve(async (req) => { +* if (req.method === 'OPTIONS') { +* return new Response('ok', { headers: corsHeaders }) +* } +* +* return new Response( +* JSON.stringify({ data: 'Hello' }), +* { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } +* ) +* }) +* ``` +* +* @category Edge Functions +*/ +const corsHeaders = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": SUPABASE_HEADERS, + "Access-Control-Allow-Methods": SUPABASE_METHODS +}; + +//#endregion +exports.corsHeaders = corsHeaders; +//# sourceMappingURL=cors.cjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.cjs.map b/node_modules/@supabase/supabase-js/dist/cors.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..3c036d80d4da794f7efc07b58351d43759f3cf01 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"cors.cjs","names":["corsHeaders: CorsHeaders"],"sources":["../src/cors.ts"],"sourcesContent":["/**\n * Canonical CORS configuration for Supabase Edge Functions\n *\n * This module exports CORS headers kept in sync with the headers the Supabase\n * SDK sends. Using it in Edge Functions prevents CORS preflight errors when the\n * SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts\n * sending one (enforced by the unit tests).\n *\n * @example Basic usage\n * ```typescript\n * import { corsHeaders } from '@supabase/supabase-js/cors'\n *\n * Deno.serve(async (req) => {\n * if (req.method === 'OPTIONS') {\n * return new Response('ok', { headers: corsHeaders })\n * }\n *\n * return new Response(\n * JSON.stringify({ data: 'Hello' }),\n * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }\n * )\n * })\n * ```\n *\n * @module cors\n */\n\n/**\n * All custom headers sent by the Supabase SDK.\n * These headers need to be included in CORS configuration to prevent preflight failures.\n *\n * Headers:\n * - authorization: Bearer token for authentication\n * - x-client-info: Library version information\n * - apikey: Project API key\n * - content-type: Standard HTTP content type\n * - x-retry-count: Retry attempt number sent by postgrest-js on retried requests\n * - traceparent: W3C trace context sent when `tracePropagation` is enabled\n * - tracestate: Vendor-specific trace data sent alongside traceparent\n * - baggage: W3C baggage sent alongside traceparent\n */\nconst SUPABASE_HEADERS = [\n 'authorization',\n 'x-client-info',\n 'apikey',\n 'content-type',\n 'x-retry-count',\n 'traceparent',\n 'tracestate',\n 'baggage',\n].join(', ')\n\n/**\n * All HTTP methods used by the Supabase SDK\n */\nconst SUPABASE_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'].join(', ')\n\n/**\n * Type representing CORS headers as a record of header names to values\n */\nexport type CorsHeaders = Record\n\n/**\n * Default CORS headers for Supabase Edge Functions.\n *\n * Includes all headers sent by Supabase client libraries and allows all standard HTTP methods.\n * Use this for simple CORS configurations with wildcard origin.\n *\n * @example Basic usage\n * ```typescript\n * import { corsHeaders } from '@supabase/supabase-js/cors'\n *\n * Deno.serve(async (req) => {\n * if (req.method === 'OPTIONS') {\n * return new Response('ok', { headers: corsHeaders })\n * }\n *\n * return new Response(\n * JSON.stringify({ data: 'Hello' }),\n * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }\n * )\n * })\n * ```\n *\n * @category Edge Functions\n */\nexport const corsHeaders: CorsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Headers': SUPABASE_HEADERS,\n 'Access-Control-Allow-Methods': SUPABASE_METHODS,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,KAAK,KAAK;;;;AAKZ,MAAM,mBAAmB;CAAC;CAAO;CAAQ;CAAO;CAAS;CAAU;CAAU,CAAC,KAAK,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;AA+BxF,MAAaA,cAA2B;CACtC,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.d.cts b/node_modules/@supabase/supabase-js/dist/cors.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..a76fb86f2aca201fe4191a4cea45342ccffd358d --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.d.cts @@ -0,0 +1,59 @@ +//#region src/cors.d.ts +/** + * Canonical CORS configuration for Supabase Edge Functions + * + * This module exports CORS headers kept in sync with the headers the Supabase + * SDK sends. Using it in Edge Functions prevents CORS preflight errors when the + * SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts + * sending one (enforced by the unit tests). + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @module cors + */ +/** + * Type representing CORS headers as a record of header names to values + */ +type CorsHeaders = Record; +/** + * Default CORS headers for Supabase Edge Functions. + * + * Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. + * Use this for simple CORS configurations with wildcard origin. + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @category Edge Functions + */ +declare const corsHeaders: CorsHeaders; +//#endregion +export { CorsHeaders, corsHeaders }; +//# sourceMappingURL=cors.d.cts.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.d.cts.map b/node_modules/@supabase/supabase-js/dist/cors.d.cts.map new file mode 100644 index 0000000000000000000000000000000000000000..dd87e94f7c9d48ea84192f6f24a3469e3a136bbe --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.d.cts.map @@ -0,0 +1 @@ +{"version":3,"file":"cors.d.cts","names":[],"sources":["../src/cors.ts"],"sourcesContent":[],"mappings":";;AA4DA;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA1BY,WAAA,GAAc;;;;;;;;;;;;;;;;;;;;;;;;;cA0Bb,aAAa"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.d.mts b/node_modules/@supabase/supabase-js/dist/cors.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1f51ea355ad1c86fea778041f627779fdf997ba6 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.d.mts @@ -0,0 +1,59 @@ +//#region src/cors.d.ts +/** + * Canonical CORS configuration for Supabase Edge Functions + * + * This module exports CORS headers kept in sync with the headers the Supabase + * SDK sends. Using it in Edge Functions prevents CORS preflight errors when the + * SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts + * sending one (enforced by the unit tests). + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @module cors + */ +/** + * Type representing CORS headers as a record of header names to values + */ +type CorsHeaders = Record; +/** + * Default CORS headers for Supabase Edge Functions. + * + * Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. + * Use this for simple CORS configurations with wildcard origin. + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @category Edge Functions + */ +declare const corsHeaders: CorsHeaders; +//#endregion +export { CorsHeaders, corsHeaders }; +//# sourceMappingURL=cors.d.mts.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.d.mts.map b/node_modules/@supabase/supabase-js/dist/cors.d.mts.map new file mode 100644 index 0000000000000000000000000000000000000000..accb33ca8a0368efc7d39d20a30bec273785417c --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"cors.d.mts","names":[],"sources":["../src/cors.ts"],"sourcesContent":[],"mappings":";;AA4DA;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA1BY,WAAA,GAAc;;;;;;;;;;;;;;;;;;;;;;;;;cA0Bb,aAAa"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.mjs b/node_modules/@supabase/supabase-js/dist/cors.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f6f76f6b38d6b54f1740233cdfd458197a8ef8ce --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.mjs @@ -0,0 +1,95 @@ +//#region src/cors.ts +/** +* Canonical CORS configuration for Supabase Edge Functions +* +* This module exports CORS headers kept in sync with the headers the Supabase +* SDK sends. Using it in Edge Functions prevents CORS preflight errors when the +* SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts +* sending one (enforced by the unit tests). +* +* @example Basic usage +* ```typescript +* import { corsHeaders } from '@supabase/supabase-js/cors' +* +* Deno.serve(async (req) => { +* if (req.method === 'OPTIONS') { +* return new Response('ok', { headers: corsHeaders }) +* } +* +* return new Response( +* JSON.stringify({ data: 'Hello' }), +* { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } +* ) +* }) +* ``` +* +* @module cors +*/ +/** +* All custom headers sent by the Supabase SDK. +* These headers need to be included in CORS configuration to prevent preflight failures. +* +* Headers: +* - authorization: Bearer token for authentication +* - x-client-info: Library version information +* - apikey: Project API key +* - content-type: Standard HTTP content type +* - x-retry-count: Retry attempt number sent by postgrest-js on retried requests +* - traceparent: W3C trace context sent when `tracePropagation` is enabled +* - tracestate: Vendor-specific trace data sent alongside traceparent +* - baggage: W3C baggage sent alongside traceparent +*/ +const SUPABASE_HEADERS = [ + "authorization", + "x-client-info", + "apikey", + "content-type", + "x-retry-count", + "traceparent", + "tracestate", + "baggage" +].join(", "); +/** +* All HTTP methods used by the Supabase SDK +*/ +const SUPABASE_METHODS = [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE", + "OPTIONS" +].join(", "); +/** +* Default CORS headers for Supabase Edge Functions. +* +* Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. +* Use this for simple CORS configurations with wildcard origin. +* +* @example Basic usage +* ```typescript +* import { corsHeaders } from '@supabase/supabase-js/cors' +* +* Deno.serve(async (req) => { +* if (req.method === 'OPTIONS') { +* return new Response('ok', { headers: corsHeaders }) +* } +* +* return new Response( +* JSON.stringify({ data: 'Hello' }), +* { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } +* ) +* }) +* ``` +* +* @category Edge Functions +*/ +const corsHeaders = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": SUPABASE_HEADERS, + "Access-Control-Allow-Methods": SUPABASE_METHODS +}; + +//#endregion +export { corsHeaders }; +//# sourceMappingURL=cors.mjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/cors.mjs.map b/node_modules/@supabase/supabase-js/dist/cors.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..381da9cb9a7e0a674f705386e9e1dff5e56c9298 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/cors.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"cors.mjs","names":["corsHeaders: CorsHeaders"],"sources":["../src/cors.ts"],"sourcesContent":["/**\n * Canonical CORS configuration for Supabase Edge Functions\n *\n * This module exports CORS headers kept in sync with the headers the Supabase\n * SDK sends. Using it in Edge Functions prevents CORS preflight errors when the\n * SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts\n * sending one (enforced by the unit tests).\n *\n * @example Basic usage\n * ```typescript\n * import { corsHeaders } from '@supabase/supabase-js/cors'\n *\n * Deno.serve(async (req) => {\n * if (req.method === 'OPTIONS') {\n * return new Response('ok', { headers: corsHeaders })\n * }\n *\n * return new Response(\n * JSON.stringify({ data: 'Hello' }),\n * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }\n * )\n * })\n * ```\n *\n * @module cors\n */\n\n/**\n * All custom headers sent by the Supabase SDK.\n * These headers need to be included in CORS configuration to prevent preflight failures.\n *\n * Headers:\n * - authorization: Bearer token for authentication\n * - x-client-info: Library version information\n * - apikey: Project API key\n * - content-type: Standard HTTP content type\n * - x-retry-count: Retry attempt number sent by postgrest-js on retried requests\n * - traceparent: W3C trace context sent when `tracePropagation` is enabled\n * - tracestate: Vendor-specific trace data sent alongside traceparent\n * - baggage: W3C baggage sent alongside traceparent\n */\nconst SUPABASE_HEADERS = [\n 'authorization',\n 'x-client-info',\n 'apikey',\n 'content-type',\n 'x-retry-count',\n 'traceparent',\n 'tracestate',\n 'baggage',\n].join(', ')\n\n/**\n * All HTTP methods used by the Supabase SDK\n */\nconst SUPABASE_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'].join(', ')\n\n/**\n * Type representing CORS headers as a record of header names to values\n */\nexport type CorsHeaders = Record\n\n/**\n * Default CORS headers for Supabase Edge Functions.\n *\n * Includes all headers sent by Supabase client libraries and allows all standard HTTP methods.\n * Use this for simple CORS configurations with wildcard origin.\n *\n * @example Basic usage\n * ```typescript\n * import { corsHeaders } from '@supabase/supabase-js/cors'\n *\n * Deno.serve(async (req) => {\n * if (req.method === 'OPTIONS') {\n * return new Response('ok', { headers: corsHeaders })\n * }\n *\n * return new Response(\n * JSON.stringify({ data: 'Hello' }),\n * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }\n * )\n * })\n * ```\n *\n * @category Edge Functions\n */\nexport const corsHeaders: CorsHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Headers': SUPABASE_HEADERS,\n 'Access-Control-Allow-Methods': SUPABASE_METHODS,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,KAAK,KAAK;;;;AAKZ,MAAM,mBAAmB;CAAC;CAAO;CAAQ;CAAO;CAAS;CAAU;CAAU,CAAC,KAAK,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;AA+BxF,MAAaA,cAA2B;CACtC,+BAA+B;CAC/B,gCAAgC;CAChC,gCAAgC;CACjC"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.cjs b/node_modules/@supabase/supabase-js/dist/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..cd5a079084bbd7a9c7564fde920a7f61e543ee3e --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.cjs @@ -0,0 +1,936 @@ +const require_tracingRegistry = require('./tracingRegistry.cjs'); +let _supabase_functions_js = require("@supabase/functions-js"); +let _supabase_postgrest_js = require("@supabase/postgrest-js"); +let _supabase_realtime_js = require("@supabase/realtime-js"); +let _supabase_storage_js = require("@supabase/storage-js"); +let _supabase_auth_js = require("@supabase/auth-js"); + +//#region src/lib/version.ts +const version = "2.112.3"; + +//#endregion +//#region src/lib/constants.ts +let JS_ENV = ""; +let JS_RUNTIME_VERSION; +if (typeof Deno !== "undefined") { + var _Deno$version; + JS_ENV = "deno"; + JS_RUNTIME_VERSION = (_Deno$version = Deno.version) === null || _Deno$version === void 0 ? void 0 : _Deno$version.deno; +} else if (typeof document !== "undefined") JS_ENV = "web"; +else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") JS_ENV = "react-native"; +else { + var _process$version; + JS_ENV = "node"; + const _process = globalThis["process"]; + JS_RUNTIME_VERSION = _process === null || _process === void 0 || (_process$version = _process["version"]) === null || _process$version === void 0 ? void 0 : _process$version.replace(/^v/, ""); +} +const _runtimeMeta = [`runtime=${JS_ENV}`]; +if (JS_RUNTIME_VERSION) _runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`); +const DEFAULT_HEADERS = { "X-Client-Info": `supabase-js/${version}; ${_runtimeMeta.join("; ")}` }; +const DEFAULT_GLOBAL_OPTIONS = { headers: DEFAULT_HEADERS }; +const DEFAULT_DB_OPTIONS = { schema: "public" }; +const DEFAULT_AUTH_OPTIONS = { + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: true, + flowType: "implicit" +}; +const DEFAULT_REALTIME_OPTIONS = {}; +const DEFAULT_TRACE_PROPAGATION_OPTIONS = { + enabled: false, + respectSamplingDecision: true +}; + +//#endregion +//#region ../../shared/tracing/dist/module/parse.js +/** +* Parse W3C traceparent header according to the specification. +* +* The traceparent header format is: version-traceid-parentid-traceflags +* - version: 2 hex digits (currently always "00") +* - traceid: 32 hex digits (128-bit trace identifier) +* - parentid: 16 hex digits (64-bit span/parent identifier) +* - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag) +* +* @param traceparent - The traceparent header value +* @returns Parsed traceparent object, or null if invalid format +* +* @see https://www.w3.org/TR/trace-context/#traceparent-header +* +* @example +* ```typescript +* const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01') +* +* console.log(parsed) +* // { +* // version: '00', +* // traceId: '0af7651916cd43dd8448eb211c80319c', +* // parentId: 'b7ad6b7169203331', +* // traceFlags: '01', +* // isSampled: true +* // } +* ``` +*/ +function parseTraceParent(traceparent) { + if (!traceparent || typeof traceparent !== "string") return null; + const parts = traceparent.split("-"); + if (parts.length !== 4) return null; + const [version$1, traceId, parentId, traceFlags] = parts; + if (version$1.length !== 2 || traceId.length !== 32 || parentId.length !== 16 || traceFlags.length !== 2) return null; + const hexRegex = /^[0-9a-f]+$/i; + if (!hexRegex.test(version$1) || !hexRegex.test(traceId) || !hexRegex.test(parentId) || !hexRegex.test(traceFlags)) return null; + if (traceId === "00000000000000000000000000000000" || parentId === "0000000000000000") return null; + return { + version: version$1, + traceId, + parentId, + traceFlags, + isSampled: (parseInt(traceFlags, 16) & 1) === 1 + }; +} + +//#endregion +//#region ../../shared/tracing/dist/module/validate.js +/** +* Check if trace context should be propagated to the target URL. +* +* This function checks if the target URL matches any of the configured +* propagation targets. Targets can be: +* - String: Exact hostname match or wildcard domain (*.example.com) +* - RegExp: Pattern matching hostname +* - Function: Custom logic to determine if URL should receive trace context +* +* @param targetUrl - The URL to check +* @param targets - Array of propagation targets +* @returns True if trace context should be propagated, false otherwise +* +* @example +* ```typescript +* const targets = [ +* 'myproject.supabase.co', // Exact match +* '*.supabase.co', // Wildcard domain +* /.*\.supabase\.co$/, // Regex pattern +* (url) => url.hostname === 'localhost' // Custom function +* ] +* +* shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets) +* // true +* +* shouldPropagateToTarget('https://evil.com/api', targets) +* // false +* ``` +*/ +function shouldPropagateToTarget(targetUrl, targets) { + if (!targetUrl || !targets || targets.length === 0) return false; + let url; + if (targetUrl instanceof URL) url = targetUrl; + else try { + url = new URL(targetUrl); + } catch (error) { + return false; + } + for (const target of targets) try { + if (typeof target === "string") { + if (matchStringTarget(url.hostname, target)) return true; + } else if (target instanceof RegExp) { + if (target.test(url.hostname)) return true; + } else if (typeof target === "function") { + if (target(url)) return true; + } + } catch (error) { + continue; + } + return false; +} +/** +* Match hostname against string target (exact match or wildcard) +* +* @param hostname - The hostname to check +* @param target - The target pattern (exact or wildcard) +* @returns True if hostname matches target +*/ +function matchStringTarget(hostname, target) { + if (target === hostname) return true; + if (target.startsWith("*.")) { + const domain = target.slice(2); + if (hostname.endsWith(domain)) { + if (hostname === domain || hostname.endsWith("." + domain)) return true; + } + } + return false; +} + +//#endregion +//#region ../../shared/tracing/dist/module/defaults.js +/** +* Generate default propagation targets based on the Supabase project URL. +* +* By default, trace context is only propagated to Supabase domains for +* security. This prevents leaking trace context to potentially malicious +* third-party services. +* +* Wildcard strings (e.g. `*.supabase.co`) are matched with linear string +* operations rather than regex, avoiding ReDoS risk. +* +* @param supabaseUrl - The Supabase project URL +* @returns Array of default propagation targets +*/ +function getDefaultPropagationTargets(supabaseUrl) { + const targets = []; + try { + const url = new URL(supabaseUrl); + targets.push(url.hostname); + } catch (error) {} + targets.push("*.supabase.co", "*.supabase.in"); + targets.push("localhost", "127.0.0.1", "[::1]"); + return targets; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) { + return typeof o$1; + } : function(o$1) { + return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1; + }, _typeof(o); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r$1) { + return Object.getOwnPropertyDescriptor(e, r$1).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) { + _defineProperty(e, r$1, t[r$1]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) { + Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1)); + }); + } + return e; +} + +//#endregion +//#region src/lib/fetch.ts +const resolveFetch = (customFetch) => { + if (customFetch) return (...args) => customFetch(...args); + return (...args) => fetch(...args); +}; +const resolveHeadersConstructor = () => { + return Headers; +}; +/** +* New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and +* must never be sent as a Bearer token — they belong only in the `apikey` header. +* All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_` +* subtypes) keep the Bearer fallback. +*/ +const isNewApiKey = (key) => key.startsWith("sb_publishable_") || key.startsWith("sb_secret_"); +const TEMP_KEY_PREFIX = "sb_temp_"; +const warnedKeySubtypes = /* @__PURE__ */ new Set(); +/** +* Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes. +* Never throws — the server, not the SDK, decides key validity. The key value is never +* included in the message. +*/ +const checkApiKeyFormat = (key) => { + var _key$match$, _key$match; + if (!key.startsWith("sb_") || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) return; + const subtype = (_key$match$ = (_key$match = key.match(/^sb_[a-zA-Z0-9]+_/)) === null || _key$match === void 0 ? void 0 : _key$match[0]) !== null && _key$match$ !== void 0 ? _key$match$ : "unknown"; + if (warnedKeySubtypes.has(subtype)) return; + warnedKeySubtypes.add(subtype); + console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."); +}; +const fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions, options) => { + const fetch$1 = resolveFetch(customFetch); + const HeadersConstructor = resolveHeadersConstructor(); + const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) === true; + const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== false; + const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null; + const allowKeyAsBearer = !((options === null || options === void 0 ? void 0 : options.omitApiKeyAsBearer) && isNewApiKey(supabaseKey)); + return async (input, init) => { + const realToken = await getAccessToken(); + let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers); + if (!headers.has("apikey")) headers.set("apikey", supabaseKey); + if (!headers.has("Authorization")) { + const bearer = realToken !== null && realToken !== void 0 ? realToken : allowKeyAsBearer ? supabaseKey : null; + if (bearer) headers.set("Authorization", `Bearer ${bearer}`); + } + if (traceTargets) { + const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling); + if (traceHeaders) { + if (traceHeaders.traceparent && !headers.has("traceparent")) headers.set("traceparent", traceHeaders.traceparent); + if (traceHeaders.tracestate && !headers.has("tracestate")) headers.set("tracestate", traceHeaders.tracestate); + if (traceHeaders.baggage && !headers.has("baggage")) headers.set("baggage", traceHeaders.baggage); + } + } + return fetch$1(input, _objectSpread2(_objectSpread2({}, init), {}, { headers })); + }; +}; +let warnedMissingTracingRuntime = false; +let warnedNonW3CPropagator = false; +function getTraceHeaders(input, targets, respectSampling) { + const extractTraceContext = require_tracingRegistry.getTraceContextExtractor(); + if (!extractTraceContext) { + if (!warnedMissingTracingRuntime) { + warnedMissingTracingRuntime = true; + console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation."); + } + return null; + } + if (!shouldPropagateToTarget(typeof input === "string" ? input : input instanceof URL ? input : input.url, targets)) return null; + const traceContext = extractTraceContext(); + if (!traceContext || !traceContext.traceparent) { + var _traceContext$carrier; + if ((traceContext === null || traceContext === void 0 || (_traceContext$carrier = traceContext.carrierKeys) === null || _traceContext$carrier === void 0 ? void 0 : _traceContext$carrier.length) && !warnedNonW3CPropagator) { + warnedNonW3CPropagator = true; + const sentryHint = traceContext.carrierKeys.includes("sentry-trace") ? " Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it." : " Configure your tracing SDK to emit W3C trace context on outgoing requests."; + console.warn(`@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its propagator wrote [${traceContext.carrierKeys.join(", ")}] and no W3C traceparent header, so trace headers will not be attached.` + sentryHint); + } + return null; + } + if (respectSampling) { + const parsed = parseTraceParent(traceContext.traceparent); + if (parsed && !parsed.isSampled) return { traceparent: traceContext.traceparent }; + } + return traceContext; +} + +//#endregion +//#region src/lib/helpers.ts +function normalizeTracePropagation(value) { + return typeof value === "boolean" ? { enabled: value } : value; +} +function ensureTrailingSlash(url) { + return url.endsWith("/") ? url : url + "/"; +} +function applySettingDefaults(options, defaults) { + var _DEFAULT_GLOBAL_OPTIO, _globalOptions$header, _ref, _tracePropagationOpti, _ref2, _tracePropagationOpti2; + const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options; + const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults; + const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation); + const DEFAULT_TRACE_PROPAGATION_OPTIONS$1 = normalizeTracePropagation(defaults.tracePropagation); + const result = { + db: _objectSpread2(_objectSpread2({}, DEFAULT_DB_OPTIONS$1), dbOptions), + auth: _objectSpread2(_objectSpread2({}, DEFAULT_AUTH_OPTIONS$1), authOptions), + realtime: _objectSpread2(_objectSpread2({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions), + storage: {}, + global: _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread2(_objectSpread2({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }), + tracePropagation: { + enabled: (_ref = (_tracePropagationOpti = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) !== null && _tracePropagationOpti !== void 0 ? _tracePropagationOpti : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.enabled) !== null && _ref !== void 0 ? _ref : false, + respectSamplingDecision: (_ref2 = (_tracePropagationOpti2 = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== null && _tracePropagationOpti2 !== void 0 ? _tracePropagationOpti2 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.respectSamplingDecision) !== null && _ref2 !== void 0 ? _ref2 : true + }, + accessToken: async () => "" + }; + if (options.accessToken) result.accessToken = options.accessToken; + else delete result.accessToken; + return result; +} +/** +* Validates a Supabase client URL +* +* @param {string} supabaseUrl - The Supabase client URL string. +* @returns {URL} - The validated base URL. +* @throws {Error} +*/ +function validateSupabaseUrl(supabaseUrl) { + const trimmedUrl = supabaseUrl === null || supabaseUrl === void 0 ? void 0 : supabaseUrl.trim(); + if (!trimmedUrl) throw new Error("supabaseUrl is required."); + if (!trimmedUrl.match(/^https?:\/\//i)) throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL."); + try { + return new URL(ensureTrailingSlash(trimmedUrl)); + } catch (_unused) { + throw Error("Invalid supabaseUrl: Provided URL is malformed."); + } +} + +//#endregion +//#region src/lib/SupabaseAuthClient.ts +var SupabaseAuthClient = class extends _supabase_auth_js.AuthClient { + constructor(options) { + super(options); + } +}; + +//#endregion +//#region src/SupabaseClient.ts +/** +* Supabase Client. +* +* An isomorphic Javascript client for interacting with Postgres. +*/ +var SupabaseClient = class { + /** + * Create a new client for use in the browser. + * + * @category Initializing + * + * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard. + * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard. + * @param options Optional configuration for the client: + * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase. + * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring. + * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage. + * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user. + * - `realtime` — Options passed along to the realtime-js constructor. + * - `storage` — Options passed along to the storage-js constructor. + * - `global.fetch` — A custom fetch implementation. + * - `global.headers` — Any additional headers to send with each network request. + * + * @example Creating a client + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Create a single supabase client for interacting with your database + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * ``` + * + * @example With a custom domain + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Use a custom domain as the supabase URL + * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key') + * ``` + * + * @example With additional parameters + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const options = { + * db: { + * schema: 'public', + * }, + * auth: { + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: true + * }, + * global: { + * headers: { 'x-my-custom-header': 'my-app-name' }, + * }, + * } + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options) + * ``` + * + * @exampleDescription With custom schemas + * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. + * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API. + * + * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. + * + * @example With custom schemas + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * // Provide a custom schema. Defaults to "public". + * db: { schema: 'other_schema' } + * }) + * ``` + * + * @exampleDescription Custom fetch implementation + * `supabase-js` uses the runtime's global `fetch` to make HTTP requests, + * but an alternative `fetch` implementation can be provided as an option. + * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior. + * + * @example Custom fetch implementation + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * global: { fetch: fetch.bind(globalThis) } + * }) + * ``` + * + * @exampleDescription React Native options with AsyncStorage + * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. + * + * @example React Native options with AsyncStorage + * ```js + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from "@react-native-async-storage/async-storage"; + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: AsyncStorage, + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @exampleDescription React Native options with Expo SecureStore + * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore. + * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode. + * A new 256-bit encryption key is generated using the `react-native-get-random-values` library. + * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage. + * + * Please make sure that: + * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date. + * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs. + * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed. + * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities. + * + * @example React Native options with Expo SecureStore + * ```ts + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from '@react-native-async-storage/async-storage'; + * import * as SecureStore from 'expo-secure-store'; + * import * as aesjs from 'aes-js'; + * import 'react-native-get-random-values'; + * + * // As Expo's SecureStore does not support values larger than 2048 + * // bytes, an AES-256 key is generated and stored in SecureStore, while + * // it is used to encrypt/decrypt values stored in AsyncStorage. + * class LargeSecureStore { + * private async _encrypt(key: string, value: string) { + * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8)); + * + * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1)); + * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value)); + * + * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey)); + * + * return aesjs.utils.hex.fromBytes(encryptedBytes); + * } + * + * private async _decrypt(key: string, value: string) { + * const encryptionKeyHex = await SecureStore.getItemAsync(key); + * if (!encryptionKeyHex) { + * return encryptionKeyHex; + * } + * + * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1)); + * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value)); + * + * return aesjs.utils.utf8.fromBytes(decryptedBytes); + * } + * + * async getItem(key: string) { + * const encrypted = await AsyncStorage.getItem(key); + * if (!encrypted) { return encrypted; } + * + * return await this._decrypt(key, encrypted); + * } + * + * async removeItem(key: string) { + * await AsyncStorage.removeItem(key); + * await SecureStore.deleteItemAsync(key); + * } + * + * async setItem(key: string, value: string) { + * const encrypted = await this._encrypt(key, value); + * + * await AsyncStorage.setItem(key, encrypted); + * } + * } + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: new LargeSecureStore(), + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @example With a database query + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * + * const { data } = await supabase.from('profiles').select('*') + * ``` + * + * @exampleDescription With OpenTelemetry tracing + * Opt in to W3C trace context propagation so the `trace_id` from your + * client-side spans is attached to Supabase requests and appears in API + * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be + * installed in your application and the tracing runtime to be loaded via + * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing). + * + * @example With OpenTelemetry tracing + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * tracePropagation: true, + * }) + * + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Outgoing request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + */ + constructor(supabaseUrl, supabaseKey, options) { + var _settings$auth$storag, _settings$global$head; + this.supabaseUrl = supabaseUrl; + this.supabaseKey = supabaseKey; + const baseUrl = validateSupabaseUrl(supabaseUrl); + if (!supabaseKey) throw new Error("supabaseKey is required."); + checkApiKeyFormat(supabaseKey); + this.realtimeUrl = new URL("realtime/v1", baseUrl); + this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace("http", "ws"); + this.authUrl = new URL("auth/v1", baseUrl); + this.storageUrl = new URL("storage/v1", baseUrl); + this.functionsUrl = new URL("functions/v1", baseUrl); + const defaultStorageKey = `sb-${baseUrl.hostname.split(".")[0]}-auth-token`; + const DEFAULTS = { + db: DEFAULT_DB_OPTIONS, + realtime: DEFAULT_REALTIME_OPTIONS, + auth: _objectSpread2(_objectSpread2({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }), + global: DEFAULT_GLOBAL_OPTIONS, + tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS + }; + const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS); + this.settings = settings; + this.storageKey = (_settings$auth$storag = settings.auth.storageKey) !== null && _settings$auth$storag !== void 0 ? _settings$auth$storag : ""; + this.headers = (_settings$global$head = settings.global.headers) !== null && _settings$global$head !== void 0 ? _settings$global$head : {}; + if (!settings.accessToken) { + var _settings$auth; + this.auth = this._initSupabaseAuthClient((_settings$auth = settings.auth) !== null && _settings$auth !== void 0 ? _settings$auth : {}, this.headers, settings.global.fetch); + } else { + this.accessToken = settings.accessToken; + this.auth = new Proxy({}, { get: (_, prop) => { + throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`); + } }); + } + this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation); + this.functionsFetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation, { omitApiKeyAsBearer: true }); + this.realtime = this._initRealtimeClient(_objectSpread2({ + headers: this.headers, + accessToken: this._getAccessToken.bind(this), + fetch: this.fetch + }, settings.realtime)); + if (this.accessToken) Promise.resolve(this.accessToken()).then((token) => this.realtime.setAuth(token)).catch((e) => console.warn("Failed to set initial Realtime auth token:", e)); + this.rest = new _supabase_postgrest_js.PostgrestClient(new URL("rest/v1", baseUrl).href, { + headers: this.headers, + schema: settings.db.schema, + fetch: this.fetch, + timeout: settings.db.timeout, + urlLengthLimit: settings.db.urlLengthLimit, + retry: settings.db.retry + }); + this.storage = new _supabase_storage_js.StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage); + if (!settings.accessToken) this._listenForAuthEvents(); + } + /** + * Supabase Functions allows you to deploy and invoke edge functions. + */ + get functions() { + return new _supabase_functions_js.FunctionsClient(this.functionsUrl.href, { + headers: this.headers, + customFetch: this.functionsFetch + }); + } + /** + * Perform a query on a table or a view. + * + * @param relation - The table or view name to query + */ + from(relation) { + return this.rest.from(relation); + } + /** + * Select a schema to query or perform an function (rpc) call. + * + * The schema needs to be on the list of exposed schemas inside Supabase. + * + * @param schema - The schema to query + */ + schema(schema) { + return this.rest.schema(schema); + } + /** + * Perform a function call. + * + * @param fn - The function name to call + * @param args - The arguments to pass to the function call + * @param options - Named parameters + * @param options.head - When set to `true`, `data` will not be returned. + * Useful if you only need the count. + * @param options.get - When set to `true`, the function will be called with + * read-only access mode. + * @param options.count - Count algorithm to use to count rows returned by the + * function. Only applicable for [set-returning + * functions](https://www.postgresql.org/docs/current/functions-srf.html). + * + * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the + * hood. + * + * `"planned"`: Approximated but fast count algorithm. Uses the Postgres + * statistics under the hood. + * + * `"estimated"`: Uses exact count for low numbers and planned count for high + * numbers. + */ + rpc(fn, args = {}, options = { + head: false, + get: false, + count: void 0 + }) { + return this.rest.rpc(fn, args, options); + } + /** + * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. + * + * @param {string} name - The name of the Realtime channel. + * @param {Object} opts - The options to pass to the Realtime channel. + * + * @category Realtime + */ + channel(name, opts = { config: {} }) { + return this.realtime.channel(name, opts); + } + /** + * Returns all Realtime channels. + * + * @category Realtime + * + * @example Get all channels + * ```js + * const channels = supabase.getChannels() + * ``` + */ + getChannels() { + return this.realtime.getChannels(); + } + /** + * Unsubscribes and removes Realtime channel from Realtime client. + * + * @param {RealtimeChannel} channel - The name of the Realtime channel. + * + * + * @category Realtime + * + * @remarks + * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Removes a channel + * ```js + * supabase.removeChannel(myChannel) + * ``` + */ + removeChannel(channel) { + return this.realtime.removeChannel(channel); + } + /** + * Unsubscribes and removes all Realtime channels from Realtime client. + * + * @category Realtime + * + * @remarks + * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Remove all channels + * ```js + * supabase.removeAllChannels() + * ``` + */ + removeAllChannels() { + return this.realtime.removeAllChannels(); + } + /** + * The raw session token — the custom `accessToken` result or the signed-in user's JWT — + * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back + * to `supabaseKey`, so callers can distinguish "no session" from "has session". + */ + async _getSessionToken() { + var _this = this; + var _data$session$access_, _data$session; + if (_this.accessToken) return await _this.accessToken(); + const { data } = await _this.auth.getSession(); + return (_data$session$access_ = (_data$session = data.session) === null || _data$session === void 0 ? void 0 : _data$session.access_token) !== null && _data$session$access_ !== void 0 ? _data$session$access_ : null; + } + async _getAccessToken() { + var _this2 = this; + var _await$this$_getSessi; + return (_await$this$_getSessi = await _this2._getSessionToken()) !== null && _await$this$_getSessi !== void 0 ? _await$this$_getSessi : _this2.supabaseKey; + } + _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, experimental, lockAcquireTimeout, skipAutoInitialize }, headers, fetch$1) { + const authHeaders = { + Authorization: `Bearer ${this.supabaseKey}`, + apikey: `${this.supabaseKey}` + }; + return new SupabaseAuthClient({ + url: this.authUrl.href, + headers: _objectSpread2(_objectSpread2({}, authHeaders), headers), + storageKey, + autoRefreshToken, + persistSession, + detectSessionInUrl, + storage, + userStorage, + flowType, + lock, + debug, + throwOnError, + experimental, + fetch: fetch$1, + lockAcquireTimeout, + skipAutoInitialize, + hasCustomAuthorizationHeader: Object.keys(this.headers).some((key) => key.toLowerCase() === "authorization") + }); + } + _initRealtimeClient(options) { + return new _supabase_realtime_js.RealtimeClient(this.realtimeUrl.href, _objectSpread2(_objectSpread2({}, options), {}, { params: _objectSpread2(_objectSpread2({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) })); + } + _listenForAuthEvents() { + return this.auth.onAuthStateChange((event, session) => { + this._handleTokenChanged(event, "CLIENT", session === null || session === void 0 ? void 0 : session.access_token); + }); + } + _handleTokenChanged(event, source, token) { + if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN" || event === "INITIAL_SESSION") && this.changedAccessToken !== token) { + this.changedAccessToken = token; + this.realtime.setAuth(token); + } else if (event === "SIGNED_OUT") { + this.realtime.setAuth(); + if (source == "STORAGE") this.auth.signOut(); + this.changedAccessToken = void 0; + } + } +}; + +//#endregion +//#region src/index.ts +/** +* Creates a new Supabase Client. +* +* @example Creating a Supabase client +* ```ts +* import { createClient } from '@supabase/supabase-js' +* +* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') +* const { data, error } = await supabase.from('profiles').select('*') +* ``` +*/ +const createClient = (supabaseUrl, supabaseKey, options) => { + return new SupabaseClient(supabaseUrl, supabaseKey, options); +}; +function shouldShowDeprecationWarning() { + if (typeof window !== "undefined" || globalThis["Deno"] !== void 0) return false; + const _process = globalThis["process"]; + if (!_process) return false; + const processVersion = _process["version"]; + if (processVersion === void 0 || processVersion === null) return false; + const versionMatch = processVersion.match(/^v(\d+)\./); + if (!versionMatch) return false; + return parseInt(versionMatch[1], 10) <= 20; +} +if (shouldShowDeprecationWarning()) console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715"); + +//#endregion +Object.defineProperty(exports, 'FunctionRegion', { + enumerable: true, + get: function () { + return _supabase_functions_js.FunctionRegion; + } +}); +Object.defineProperty(exports, 'FunctionsError', { + enumerable: true, + get: function () { + return _supabase_functions_js.FunctionsError; + } +}); +Object.defineProperty(exports, 'FunctionsFetchError', { + enumerable: true, + get: function () { + return _supabase_functions_js.FunctionsFetchError; + } +}); +Object.defineProperty(exports, 'FunctionsHttpError', { + enumerable: true, + get: function () { + return _supabase_functions_js.FunctionsHttpError; + } +}); +Object.defineProperty(exports, 'FunctionsRelayError', { + enumerable: true, + get: function () { + return _supabase_functions_js.FunctionsRelayError; + } +}); +Object.defineProperty(exports, 'PostgrestError', { + enumerable: true, + get: function () { + return _supabase_postgrest_js.PostgrestError; + } +}); +Object.defineProperty(exports, 'StorageApiError', { + enumerable: true, + get: function () { + return _supabase_storage_js.StorageApiError; + } +}); +exports.SupabaseClient = SupabaseClient; +exports.createClient = createClient; +Object.keys(_supabase_auth_js).forEach(function (k) { + if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return _supabase_auth_js[k]; } + }); +}); + +Object.keys(_supabase_realtime_js).forEach(function (k) { + if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return _supabase_realtime_js[k]; } + }); +}); + +//# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.cjs.map b/node_modules/@supabase/supabase-js/dist/index.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..0ff4034df533804d05fdcd82f070bec7d55ca0b4 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs","names":["JS_RUNTIME_VERSION: string | undefined","DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions","DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions","DEFAULT_TRACE_PROPAGATION_OPTIONS: TracePropagationOptions","version","fetch","traceTargets: TracePropagationTarget[] | null","getTraceContextExtractor","DEFAULT_DB_OPTIONS","DEFAULT_AUTH_OPTIONS","DEFAULT_REALTIME_OPTIONS","DEFAULT_GLOBAL_OPTIONS","DEFAULT_TRACE_PROPAGATION_OPTIONS","result: ResolvedSupabaseClientOptions","AuthClient","supabaseUrl: string","supabaseKey: string","PostgrestClient","SupabaseStorageClient","FunctionsClient","this","RealtimeClient"],"sources":["../src/lib/version.ts","../src/lib/constants.ts","../../../shared/tracing/dist/module/parse.js","../../../shared/tracing/dist/module/validate.js","../../../shared/tracing/dist/module/defaults.js","../src/lib/fetch.ts","../src/lib/helpers.ts","../src/lib/SupabaseAuthClient.ts","../src/SupabaseClient.ts","../src/index.ts"],"sourcesContent":["// Generated automatically during releases by scripts/update-version-files.ts\n// This file provides runtime access to the package version for:\n// - HTTP request headers (e.g., X-Client-Info header for API requests)\n// - Debugging and support (identifying which version is running)\n// - Telemetry and logging (version reporting in errors/analytics)\n// - Ensuring build artifacts match the published package version\nexport const version = '2.112.3'\n","// constants.ts\nimport { RealtimeClientOptions } from '@supabase/realtime-js'\nimport { SupabaseAuthClientOptions, TracePropagationOptions } from './types'\nimport { version } from './version'\n\nlet JS_ENV = ''\nlet JS_RUNTIME_VERSION: string | undefined\n// @ts-ignore\nif (typeof Deno !== 'undefined') {\n JS_ENV = 'deno'\n // @ts-ignore\n JS_RUNTIME_VERSION = Deno.version?.deno\n} else if (typeof document !== 'undefined') {\n JS_ENV = 'web'\n} else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n JS_ENV = 'react-native'\n} else {\n JS_ENV = 'node'\n const _process = (globalThis as any)['process']\n JS_RUNTIME_VERSION = _process?.['version']?.replace(/^v/, '')\n}\n\nconst _runtimeMeta = [`runtime=${JS_ENV}`]\nif (JS_RUNTIME_VERSION) {\n _runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`)\n}\n\nexport const DEFAULT_HEADERS = {\n 'X-Client-Info': `supabase-js/${version}; ${_runtimeMeta.join('; ')}`,\n}\n\nexport const DEFAULT_GLOBAL_OPTIONS = {\n headers: DEFAULT_HEADERS,\n}\n\nexport const DEFAULT_DB_OPTIONS = {\n schema: 'public',\n}\n\nexport const DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions = {\n autoRefreshToken: true,\n persistSession: true,\n detectSessionInUrl: true,\n flowType: 'implicit',\n}\n\nexport const DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions = {}\n\nexport const DEFAULT_TRACE_PROPAGATION_OPTIONS: TracePropagationOptions = {\n enabled: false,\n respectSamplingDecision: true,\n}\n","/**\n * Parse W3C traceparent header according to the specification.\n *\n * The traceparent header format is: version-traceid-parentid-traceflags\n * - version: 2 hex digits (currently always \"00\")\n * - traceid: 32 hex digits (128-bit trace identifier)\n * - parentid: 16 hex digits (64-bit span/parent identifier)\n * - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag)\n *\n * @param traceparent - The traceparent header value\n * @returns Parsed traceparent object, or null if invalid format\n *\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n *\n * @example\n * ```typescript\n * const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01')\n *\n * console.log(parsed)\n * // {\n * // version: '00',\n * // traceId: '0af7651916cd43dd8448eb211c80319c',\n * // parentId: 'b7ad6b7169203331',\n * // traceFlags: '01',\n * // isSampled: true\n * // }\n * ```\n */\nexport function parseTraceParent(traceparent) {\n if (!traceparent || typeof traceparent !== 'string') {\n return null;\n }\n // Split by hyphen\n const parts = traceparent.split('-');\n // Must have exactly 4 parts\n if (parts.length !== 4) {\n return null;\n }\n const [version, traceId, parentId, traceFlags] = parts;\n // Validate field lengths according to W3C spec\n if (version.length !== 2 ||\n traceId.length !== 32 ||\n parentId.length !== 16 ||\n traceFlags.length !== 2) {\n return null;\n }\n // Validate that all fields are valid hexadecimal\n const hexRegex = /^[0-9a-f]+$/i;\n if (!hexRegex.test(version) ||\n !hexRegex.test(traceId) ||\n !hexRegex.test(parentId) ||\n !hexRegex.test(traceFlags)) {\n return null;\n }\n // Validate that trace-id and parent-id are not all zeros (invalid per spec)\n if (traceId === '00000000000000000000000000000000' || parentId === '0000000000000000') {\n return null;\n }\n // Parse sampling decision from trace-flags (bit 0)\n const flags = parseInt(traceFlags, 16);\n const isSampled = (flags & 0x01) === 0x01;\n return {\n version,\n traceId,\n parentId,\n traceFlags,\n isSampled,\n };\n}\n//# sourceMappingURL=parse.js.map","/**\n * Check if trace context should be propagated to the target URL.\n *\n * This function checks if the target URL matches any of the configured\n * propagation targets. Targets can be:\n * - String: Exact hostname match or wildcard domain (*.example.com)\n * - RegExp: Pattern matching hostname\n * - Function: Custom logic to determine if URL should receive trace context\n *\n * @param targetUrl - The URL to check\n * @param targets - Array of propagation targets\n * @returns True if trace context should be propagated, false otherwise\n *\n * @example\n * ```typescript\n * const targets = [\n * 'myproject.supabase.co', // Exact match\n * '*.supabase.co', // Wildcard domain\n * /.*\\.supabase\\.co$/, // Regex pattern\n * (url) => url.hostname === 'localhost' // Custom function\n * ]\n *\n * shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets)\n * // true\n *\n * shouldPropagateToTarget('https://evil.com/api', targets)\n * // false\n * ```\n */\nexport function shouldPropagateToTarget(targetUrl, targets) {\n if (!targetUrl || !targets || targets.length === 0) {\n return false;\n }\n let url;\n if (targetUrl instanceof URL) {\n url = targetUrl;\n }\n else {\n try {\n url = new URL(targetUrl);\n }\n catch (error) {\n // Invalid URL\n return false;\n }\n }\n // Check each target\n for (const target of targets) {\n try {\n if (typeof target === 'string') {\n // String matcher: exact match or wildcard domain\n if (matchStringTarget(url.hostname, target)) {\n return true;\n }\n }\n else if (target instanceof RegExp) {\n // Regex matcher\n if (target.test(url.hostname)) {\n return true;\n }\n }\n else if (typeof target === 'function') {\n // Function matcher\n if (target(url)) {\n return true;\n }\n }\n }\n catch (error) {\n // Ignore errors from individual matchers and continue\n continue;\n }\n }\n return false;\n}\n/**\n * Match hostname against string target (exact match or wildcard)\n *\n * @param hostname - The hostname to check\n * @param target - The target pattern (exact or wildcard)\n * @returns True if hostname matches target\n */\nfunction matchStringTarget(hostname, target) {\n // Exact match\n if (target === hostname) {\n return true;\n }\n // Wildcard domain match (*.example.com)\n if (target.startsWith('*.')) {\n const domain = target.slice(2); // Remove \"*.\"\n // Check if hostname ends with the domain\n if (hostname.endsWith(domain)) {\n // Ensure it's either an exact match or has a subdomain\n // (prevents \"notexample.com\" from matching \"*.example.com\")\n if (hostname === domain || hostname.endsWith('.' + domain)) {\n return true;\n }\n }\n }\n return false;\n}\n//# sourceMappingURL=validate.js.map","/**\n * Generate default propagation targets based on the Supabase project URL.\n *\n * By default, trace context is only propagated to Supabase domains for\n * security. This prevents leaking trace context to potentially malicious\n * third-party services.\n *\n * Wildcard strings (e.g. `*.supabase.co`) are matched with linear string\n * operations rather than regex, avoiding ReDoS risk.\n *\n * @param supabaseUrl - The Supabase project URL\n * @returns Array of default propagation targets\n */\nexport function getDefaultPropagationTargets(supabaseUrl) {\n const targets = [];\n // Add exact project hostname\n try {\n const url = new URL(supabaseUrl);\n targets.push(url.hostname);\n }\n catch (error) {\n // Invalid URL, skip exact hostname\n }\n // Supabase cloud domains. Use wildcard strings (not regex) — these are\n // matched by linear hostname-suffix checks, so there is no ReDoS surface.\n targets.push('*.supabase.co', '*.supabase.in');\n // Localhost and loopback addresses for local development.\n targets.push('localhost', '127.0.0.1', '[::1]');\n return targets;\n}\n//# sourceMappingURL=defaults.js.map","import {\n parseTraceParent,\n shouldPropagateToTarget,\n getDefaultPropagationTargets,\n type TraceContext,\n type TracePropagationTarget,\n} from '@supabase/tracing'\nimport { getTraceContextExtractor } from './tracingRegistry'\nimport type { TracePropagationOptions } from './types'\n\ntype Fetch = typeof fetch\n\nexport const resolveFetch = (customFetch?: Fetch): Fetch => {\n if (customFetch) {\n return (...args: Parameters) => customFetch(...args)\n }\n return (...args: Parameters) => fetch(...args)\n}\n\nexport const resolveHeadersConstructor = () => {\n return Headers\n}\n\n/**\n * New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and\n * must never be sent as a Bearer token — they belong only in the `apikey` header.\n * All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_`\n * subtypes) keep the Bearer fallback.\n */\nconst isNewApiKey = (key: string): boolean =>\n key.startsWith('sb_publishable_') || key.startsWith('sb_secret_')\n\nconst TEMP_KEY_PREFIX = 'sb_temp_'\n\nconst warnedKeySubtypes = new Set()\n\n/**\n * Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes.\n * Never throws — the server, not the SDK, decides key validity. The key value is never\n * included in the message.\n */\nexport const checkApiKeyFormat = (key: string): void => {\n if (!key.startsWith('sb_') || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) {\n return\n }\n const subtype = key.match(/^sb_[a-zA-Z0-9]+_/)?.[0] ?? 'unknown'\n if (warnedKeySubtypes.has(subtype)) {\n return\n }\n warnedKeySubtypes.add(subtype)\n console.warn(\n '@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed ' +\n 'and send this key as-is; if you see authentication errors you may need to upgrade ' +\n '@supabase/supabase-js to a version that recognizes this key type.'\n )\n}\n\nexport const fetchWithAuth = (\n supabaseKey: string,\n supabaseUrl: string,\n getAccessToken: () => Promise,\n customFetch?: Fetch,\n tracePropagationOptions?: TracePropagationOptions,\n options?: { omitApiKeyAsBearer?: boolean }\n): Fetch => {\n const fetch = resolveFetch(customFetch)\n const HeadersConstructor = resolveHeadersConstructor()\n\n // Pre-compute trace propagation state once. When disabled, the per-request\n // path skips all tracing work with a single truthy check.\n const traceEnabled = tracePropagationOptions?.enabled === true\n const respectSampling = tracePropagationOptions?.respectSamplingDecision !== false\n const traceTargets: TracePropagationTarget[] | null = traceEnabled\n ? getDefaultPropagationTargets(supabaseUrl)\n : null\n\n // Whether the API key may be used as the `Authorization` Bearer fallback when there is no\n // session token. Disabled for Edge Functions with a new-format key (see `isNewApiKey`).\n // Static per instance, so it is computed once here rather than on every request.\n const allowKeyAsBearer = !(options?.omitApiKeyAsBearer && isNewApiKey(supabaseKey))\n\n return async (input, init) => {\n const realToken = await getAccessToken()\n let headers = new HeadersConstructor(init?.headers)\n\n if (!headers.has('apikey')) {\n headers.set('apikey', supabaseKey)\n }\n\n if (!headers.has('Authorization')) {\n const bearer = realToken ?? (allowKeyAsBearer ? supabaseKey : null)\n if (bearer) {\n headers.set('Authorization', `Bearer ${bearer}`)\n }\n }\n\n if (traceTargets) {\n const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling)\n\n if (traceHeaders) {\n if (traceHeaders.traceparent && !headers.has('traceparent')) {\n headers.set('traceparent', traceHeaders.traceparent)\n }\n if (traceHeaders.tracestate && !headers.has('tracestate')) {\n headers.set('tracestate', traceHeaders.tracestate)\n }\n if (traceHeaders.baggage && !headers.has('baggage')) {\n headers.set('baggage', traceHeaders.baggage)\n }\n }\n }\n\n return fetch(input, { ...init, headers })\n }\n}\n\nlet warnedMissingTracingRuntime = false\nlet warnedNonW3CPropagator = false\n\n/**\n * For tests only. Resets the one-time missing-tracing-runtime warning.\n *\n * @internal\n */\nexport function _resetTracingRuntimeWarning(): void {\n warnedMissingTracingRuntime = false\n}\n\n/**\n * For tests only. Resets the one-time non-W3C-propagator warning.\n *\n * @internal\n */\nexport function _resetNonW3CPropagatorWarning(): void {\n warnedNonW3CPropagator = false\n}\n\nfunction getTraceHeaders(\n input: RequestInfo | URL,\n targets: TracePropagationTarget[],\n respectSampling: boolean\n): TraceContext | null {\n // Read the registry before the target check so the warning fires on the\n // first request with tracing enabled, not only on Supabase-target ones.\n // Reading per request (one globalThis property access) deliberately\n // supports late registration: with ESM evaluation order, `createClient`\n // can run in a module evaluated before the application entry point's\n // `import '@supabase/supabase-js/tracing'`.\n const extractTraceContext = getTraceContextExtractor()\n\n if (!extractTraceContext) {\n if (!warnedMissingTracingRuntime) {\n warnedMissingTracingRuntime = true\n console.warn(\n '@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, ' +\n \"so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at \" +\n 'your application entry point (requires the OpenTelemetry API package to be installed). ' +\n 'The CDN/UMD build does not support trace propagation.'\n )\n }\n return null\n }\n\n const targetUrl: string | URL =\n typeof input === 'string' ? input : input instanceof URL ? input : input.url\n\n if (!shouldPropagateToTarget(targetUrl, targets)) {\n return null\n }\n\n const traceContext = extractTraceContext()\n\n if (!traceContext || !traceContext.traceparent) {\n // An active propagator that writes vendor headers but no W3C\n // `traceparent` (e.g. Sentry without `propagateTraceparent: true`) is\n // otherwise indistinguishable from \"no active trace\" — warn once so the\n // user learns why no trace headers are attached. An empty carrier means\n // no active trace: normal, stay silent.\n if (traceContext?.carrierKeys?.length && !warnedNonW3CPropagator) {\n warnedNonW3CPropagator = true\n const sentryHint = traceContext.carrierKeys.includes('sentry-trace')\n ? ' Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.'\n : ' Configure your tracing SDK to emit W3C trace context on outgoing requests.'\n console.warn(\n '@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its ' +\n `propagator wrote [${traceContext.carrierKeys.join(', ')}] and no W3C traceparent header, ` +\n 'so trace headers will not be attached.' +\n sentryHint\n )\n }\n return null\n }\n\n if (respectSampling) {\n const parsed = parseTraceParent(traceContext.traceparent)\n if (parsed && !parsed.isSampled) {\n // Unsampled traces still carry `traceparent` so Supabase logs get a\n // trace_id to correlate on; the flag stays `00`, so downstream tracing\n // never records it as sampled. `tracestate` and `baggage` (the\n // vendor/application data channels) are withheld on these requests.\n return { traceparent: traceContext.traceparent }\n }\n }\n\n return traceContext\n}\n","// helpers.ts\nimport { SupabaseClientOptions, TracePropagationOptions } from './types'\n\nfunction normalizeTracePropagation(\n value: TracePropagationOptions | boolean | undefined\n): TracePropagationOptions | undefined {\n return typeof value === 'boolean' ? { enabled: value } : value\n}\n\nexport function uuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\nexport function ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : url + '/'\n}\n\nexport const isBrowser = () => typeof window !== 'undefined'\n\nexport type ResolvedSupabaseClientOptions = Omit<\n Required>,\n 'tracePropagation'\n> & {\n tracePropagation: TracePropagationOptions\n}\n\nexport function applySettingDefaults<\n Database = any,\n SchemaName extends string & keyof Database = 'public' extends keyof Database\n ? 'public'\n : string & keyof Database,\n>(\n options: SupabaseClientOptions,\n defaults: SupabaseClientOptions\n): ResolvedSupabaseClientOptions {\n const {\n db: dbOptions,\n auth: authOptions,\n realtime: realtimeOptions,\n global: globalOptions,\n } = options\n const {\n db: DEFAULT_DB_OPTIONS,\n auth: DEFAULT_AUTH_OPTIONS,\n realtime: DEFAULT_REALTIME_OPTIONS,\n global: DEFAULT_GLOBAL_OPTIONS,\n } = defaults\n\n // Accept either a boolean shorthand or an options object on both sides.\n const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation)\n const DEFAULT_TRACE_PROPAGATION_OPTIONS = normalizeTracePropagation(defaults.tracePropagation)\n\n const result: ResolvedSupabaseClientOptions = {\n db: {\n ...DEFAULT_DB_OPTIONS,\n ...dbOptions,\n },\n auth: {\n ...DEFAULT_AUTH_OPTIONS,\n ...authOptions,\n },\n realtime: {\n ...DEFAULT_REALTIME_OPTIONS,\n ...realtimeOptions,\n },\n storage: {},\n global: {\n ...DEFAULT_GLOBAL_OPTIONS,\n ...globalOptions,\n headers: {\n ...(DEFAULT_GLOBAL_OPTIONS?.headers ?? {}),\n ...(globalOptions?.headers ?? {}),\n },\n },\n tracePropagation: {\n enabled:\n tracePropagationOptions?.enabled ?? DEFAULT_TRACE_PROPAGATION_OPTIONS?.enabled ?? false,\n respectSamplingDecision:\n tracePropagationOptions?.respectSamplingDecision ??\n DEFAULT_TRACE_PROPAGATION_OPTIONS?.respectSamplingDecision ??\n true,\n },\n accessToken: async () => '',\n }\n\n if (options.accessToken) {\n result.accessToken = options.accessToken\n } else {\n // hack around Required<>\n delete (result as any).accessToken\n }\n\n return result\n}\n\n/**\n * Validates a Supabase client URL\n *\n * @param {string} supabaseUrl - The Supabase client URL string.\n * @returns {URL} - The validated base URL.\n * @throws {Error}\n */\nexport function validateSupabaseUrl(supabaseUrl: string): URL {\n const trimmedUrl = supabaseUrl?.trim()\n\n if (!trimmedUrl) {\n throw new Error('supabaseUrl is required.')\n }\n\n if (!trimmedUrl.match(/^https?:\\/\\//i)) {\n throw new Error('Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.')\n }\n\n try {\n return new URL(ensureTrailingSlash(trimmedUrl))\n } catch {\n throw Error('Invalid supabaseUrl: Provided URL is malformed.')\n }\n}\n","import { AuthClient } from '@supabase/auth-js'\nimport { SupabaseAuthClientOptions } from './types'\n\nexport class SupabaseAuthClient extends AuthClient {\n constructor(options: SupabaseAuthClientOptions) {\n super(options)\n }\n}\n","import type { AuthChangeEvent } from '@supabase/auth-js'\nimport { FunctionsClient } from '@supabase/functions-js'\nimport {\n PostgrestClient,\n type PostgrestFilterBuilder,\n type PostgrestQueryBuilder,\n} from '@supabase/postgrest-js'\nimport {\n type RealtimeChannel,\n type RealtimeChannelOptions,\n RealtimeClient,\n type RealtimeClientOptions,\n type RealtimeRemoveChannelResponse,\n} from '@supabase/realtime-js'\nimport { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'\nimport {\n DEFAULT_AUTH_OPTIONS,\n DEFAULT_DB_OPTIONS,\n DEFAULT_GLOBAL_OPTIONS,\n DEFAULT_REALTIME_OPTIONS,\n DEFAULT_TRACE_PROPAGATION_OPTIONS,\n} from './lib/constants'\nimport { checkApiKeyFormat, fetchWithAuth } from './lib/fetch'\nimport {\n applySettingDefaults,\n validateSupabaseUrl,\n type ResolvedSupabaseClientOptions,\n} from './lib/helpers'\nimport { SupabaseAuthClient } from './lib/SupabaseAuthClient'\nimport type {\n Fetch,\n GenericSchema,\n SupabaseAuthClientOptions,\n SupabaseClientOptions,\n} from './lib/types'\nimport { GetRpcFunctionFilterBuilderByArgs } from './lib/rest/types/common/rpc'\n\n/**\n * Supabase Client.\n *\n * An isomorphic Javascript client for interacting with Postgres.\n */\nexport default class SupabaseClient<\n Database = any,\n // The second type parameter is also used for specifying db_schema, so we\n // support both cases.\n // TODO: Allow setting db_schema from ClientOptions.\n SchemaNameOrClientOptions extends\n | (string & keyof Omit)\n | { PostgrestVersion: string } = 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit,\n SchemaName extends string & keyof Omit =\n SchemaNameOrClientOptions extends string & keyof Omit\n ? SchemaNameOrClientOptions\n : 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit, '__InternalSupabase'>,\n Schema extends Omit[SchemaName] extends GenericSchema\n ? Omit[SchemaName]\n : never = Omit[SchemaName] extends GenericSchema\n ? Omit[SchemaName]\n : never,\n ClientOptions extends { PostgrestVersion: string } = SchemaNameOrClientOptions extends string &\n keyof Omit\n ? // If the version isn't explicitly set, look for it in the __InternalSupabase object to infer the right version\n Database extends { __InternalSupabase: { PostgrestVersion: string } }\n ? Database['__InternalSupabase']\n : // otherwise default to 12\n { PostgrestVersion: '12' }\n : SchemaNameOrClientOptions extends { PostgrestVersion: string }\n ? SchemaNameOrClientOptions\n : never,\n> {\n /**\n * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.\n */\n auth: SupabaseAuthClient\n realtime: RealtimeClient\n /**\n * Supabase Storage allows you to manage user-generated content, such as photos or videos.\n */\n storage: SupabaseStorageClient\n\n protected realtimeUrl: URL\n protected authUrl: URL\n protected storageUrl: URL\n protected functionsUrl: URL\n protected rest: PostgrestClient\n protected storageKey: string\n protected fetch?: Fetch\n protected functionsFetch?: Fetch\n protected changedAccessToken?: string\n protected accessToken?: () => Promise\n\n protected headers: Record\n protected settings?: ResolvedSupabaseClientOptions\n\n /**\n * Create a new client for use in the browser.\n *\n * @category Initializing\n *\n * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.\n * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.\n * @param options Optional configuration for the client:\n * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.\n * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring.\n * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage.\n * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user.\n * - `realtime` — Options passed along to the realtime-js constructor.\n * - `storage` — Options passed along to the storage-js constructor.\n * - `global.fetch` — A custom fetch implementation.\n * - `global.headers` — Any additional headers to send with each network request.\n *\n * @example Creating a client\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * // Create a single supabase client for interacting with your database\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * ```\n *\n * @example With a custom domain\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * // Use a custom domain as the supabase URL\n * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key')\n * ```\n *\n * @example With additional parameters\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const options = {\n * db: {\n * schema: 'public',\n * },\n * auth: {\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: true\n * },\n * global: {\n * headers: { 'x-my-custom-header': 'my-app-name' },\n * },\n * }\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", options)\n * ```\n *\n * @exampleDescription With custom schemas\n * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.\n * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API.\n *\n * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.\n *\n * @example With custom schemas\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * // Provide a custom schema. Defaults to \"public\".\n * db: { schema: 'other_schema' }\n * })\n * ```\n *\n * @exampleDescription Custom fetch implementation\n * `supabase-js` uses the runtime's global `fetch` to make HTTP requests,\n * but an alternative `fetch` implementation can be provided as an option.\n * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior.\n *\n * @example Custom fetch implementation\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * global: { fetch: fetch.bind(globalThis) }\n * })\n * ```\n *\n * @exampleDescription React Native options with AsyncStorage\n * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.\n *\n * @example React Native options with AsyncStorage\n * ```js\n * import 'react-native-url-polyfill/auto'\n * import { createClient } from '@supabase/supabase-js'\n * import AsyncStorage from \"@react-native-async-storage/async-storage\";\n *\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", {\n * auth: {\n * storage: AsyncStorage,\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: false,\n * },\n * });\n * ```\n *\n * @exampleDescription React Native options with Expo SecureStore\n * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore.\n * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode.\n * A new 256-bit encryption key is generated using the `react-native-get-random-values` library.\n * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage.\n *\n * Please make sure that:\n * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date.\n * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs.\n * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed.\n * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities.\n *\n * @example React Native options with Expo SecureStore\n * ```ts\n * import 'react-native-url-polyfill/auto'\n * import { createClient } from '@supabase/supabase-js'\n * import AsyncStorage from '@react-native-async-storage/async-storage';\n * import * as SecureStore from 'expo-secure-store';\n * import * as aesjs from 'aes-js';\n * import 'react-native-get-random-values';\n *\n * // As Expo's SecureStore does not support values larger than 2048\n * // bytes, an AES-256 key is generated and stored in SecureStore, while\n * // it is used to encrypt/decrypt values stored in AsyncStorage.\n * class LargeSecureStore {\n * private async _encrypt(key: string, value: string) {\n * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8));\n *\n * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1));\n * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value));\n *\n * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey));\n *\n * return aesjs.utils.hex.fromBytes(encryptedBytes);\n * }\n *\n * private async _decrypt(key: string, value: string) {\n * const encryptionKeyHex = await SecureStore.getItemAsync(key);\n * if (!encryptionKeyHex) {\n * return encryptionKeyHex;\n * }\n *\n * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1));\n * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value));\n *\n * return aesjs.utils.utf8.fromBytes(decryptedBytes);\n * }\n *\n * async getItem(key: string) {\n * const encrypted = await AsyncStorage.getItem(key);\n * if (!encrypted) { return encrypted; }\n *\n * return await this._decrypt(key, encrypted);\n * }\n *\n * async removeItem(key: string) {\n * await AsyncStorage.removeItem(key);\n * await SecureStore.deleteItemAsync(key);\n * }\n *\n * async setItem(key: string, value: string) {\n * const encrypted = await this._encrypt(key, value);\n *\n * await AsyncStorage.setItem(key, encrypted);\n * }\n * }\n *\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", {\n * auth: {\n * storage: new LargeSecureStore(),\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: false,\n * },\n * });\n * ```\n *\n * @example With a database query\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n *\n * const { data } = await supabase.from('profiles').select('*')\n * ```\n *\n * @exampleDescription With OpenTelemetry tracing\n * Opt in to W3C trace context propagation so the `trace_id` from your\n * client-side spans is attached to Supabase requests and appears in API\n * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be\n * installed in your application and the tracing runtime to be loaded via\n * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing).\n *\n * @example With OpenTelemetry tracing\n * ```ts\n * import '@supabase/supabase-js/tracing'\n * import { createClient } from '@supabase/supabase-js'\n * import { trace } from '@opentelemetry/api'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * tracePropagation: true,\n * })\n *\n * const tracer = trace.getTracer('my-app')\n *\n * await tracer.startActiveSpan('fetch-users', async (span) => {\n * // Outgoing request carries the active trace context.\n * const { data, error } = await supabase.from('users').select('*')\n * span.end()\n * })\n * ```\n */\n constructor(\n protected supabaseUrl: string,\n protected supabaseKey: string,\n options?: SupabaseClientOptions\n ) {\n const baseUrl = validateSupabaseUrl(supabaseUrl)\n if (!supabaseKey) throw new Error('supabaseKey is required.')\n checkApiKeyFormat(supabaseKey)\n\n this.realtimeUrl = new URL('realtime/v1', baseUrl)\n this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')\n this.authUrl = new URL('auth/v1', baseUrl)\n this.storageUrl = new URL('storage/v1', baseUrl)\n this.functionsUrl = new URL('functions/v1', baseUrl)\n\n // default storage key uses the supabase project ref as a namespace\n const defaultStorageKey = `sb-${baseUrl.hostname.split('.')[0]}-auth-token`\n const DEFAULTS = {\n db: DEFAULT_DB_OPTIONS,\n realtime: DEFAULT_REALTIME_OPTIONS,\n auth: { ...DEFAULT_AUTH_OPTIONS, storageKey: defaultStorageKey },\n global: DEFAULT_GLOBAL_OPTIONS,\n tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS,\n }\n\n const settings = applySettingDefaults(options ?? {}, DEFAULTS)\n this.settings = settings\n\n this.storageKey = settings.auth.storageKey ?? ''\n this.headers = settings.global.headers ?? {}\n\n if (!settings.accessToken) {\n this.auth = this._initSupabaseAuthClient(\n settings.auth ?? {},\n this.headers,\n settings.global.fetch\n )\n } else {\n this.accessToken = settings.accessToken\n\n this.auth = new Proxy({} as any, {\n get: (_, prop) => {\n throw new Error(\n `@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(\n prop\n )} is not possible`\n )\n },\n })\n }\n\n // The fetch wrappers receive the raw session token (null when there is no session) and\n // decide the `Authorization` fallback themselves, so the API-key fallback lives in one place.\n this.fetch = fetchWithAuth(\n supabaseKey,\n supabaseUrl,\n this._getSessionToken.bind(this),\n settings.global.fetch,\n settings.tracePropagation\n )\n // Edge Functions use a dedicated fetch that never falls back to a new-format API key in\n // the Authorization header (see `isNewApiKey` in ./lib/fetch). Other services use `this.fetch`.\n this.functionsFetch = fetchWithAuth(\n supabaseKey,\n supabaseUrl,\n this._getSessionToken.bind(this),\n settings.global.fetch,\n settings.tracePropagation,\n { omitApiKeyAsBearer: true }\n )\n this.realtime = this._initRealtimeClient({\n headers: this.headers,\n accessToken: this._getAccessToken.bind(this),\n fetch: this.fetch,\n ...settings.realtime,\n })\n if (this.accessToken) {\n // Start auth immediately to avoid race condition with channel subscriptions\n // Wrap Promise to avoid Firefox extension cross-context Promise access errors\n Promise.resolve(this.accessToken())\n .then((token) => this.realtime.setAuth(token))\n .catch((e) => console.warn('Failed to set initial Realtime auth token:', e))\n }\n\n this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, {\n headers: this.headers,\n schema: settings.db.schema,\n fetch: this.fetch,\n timeout: settings.db.timeout,\n urlLengthLimit: settings.db.urlLengthLimit,\n retry: settings.db.retry,\n })\n\n this.storage = new SupabaseStorageClient(\n this.storageUrl.href,\n this.headers,\n this.fetch,\n options?.storage\n )\n\n if (!settings.accessToken) {\n this._listenForAuthEvents()\n }\n }\n\n /**\n * Supabase Functions allows you to deploy and invoke edge functions.\n */\n get functions(): FunctionsClient {\n return new FunctionsClient(this.functionsUrl.href, {\n headers: this.headers,\n customFetch: this.functionsFetch,\n })\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.from\n from<\n TableName extends string & keyof Schema['Tables'],\n Table extends Schema['Tables'][TableName],\n >(relation: TableName): PostgrestQueryBuilder\n from(\n relation: ViewName\n ): PostgrestQueryBuilder\n /**\n * Perform a query on a table or a view.\n *\n * @param relation - The table or view name to query\n */\n from(relation: string): PostgrestQueryBuilder {\n return this.rest.from(relation)\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.schema\n /**\n * Select a schema to query or perform an function (rpc) call.\n *\n * The schema needs to be on the list of exposed schemas inside Supabase.\n *\n * @param schema - The schema to query\n */\n schema>(\n schema: DynamicSchema\n ): PostgrestClient<\n Database,\n ClientOptions,\n DynamicSchema,\n Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any\n > {\n return this.rest.schema(schema)\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.rpc\n /**\n * Perform a function call.\n *\n * @param fn - The function name to call\n * @param args - The arguments to pass to the function call\n * @param options - Named parameters\n * @param options.head - When set to `true`, `data` will not be returned.\n * Useful if you only need the count.\n * @param options.get - When set to `true`, the function will be called with\n * read-only access mode.\n * @param options.count - Count algorithm to use to count rows returned by the\n * function. Only applicable for [set-returning\n * functions](https://www.postgresql.org/docs/current/functions-srf.html).\n *\n * `\"exact\"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the\n * hood.\n *\n * `\"planned\"`: Approximated but fast count algorithm. Uses the Postgres\n * statistics under the hood.\n *\n * `\"estimated\"`: Uses exact count for low numbers and planned count for high\n * numbers.\n */\n rpc<\n FnName extends string & keyof Schema['Functions'],\n Args extends Schema['Functions'][FnName]['Args'] = never,\n FilterBuilder extends GetRpcFunctionFilterBuilderByArgs =\n GetRpcFunctionFilterBuilderByArgs,\n >(\n fn: FnName,\n args: Args = {} as Args,\n options: {\n head?: boolean\n get?: boolean\n count?: 'exact' | 'planned' | 'estimated'\n } = {\n head: false,\n get: false,\n count: undefined,\n }\n ): PostgrestFilterBuilder<\n ClientOptions,\n Schema,\n FilterBuilder['Row'],\n FilterBuilder['Result'],\n FilterBuilder['RelationName'],\n FilterBuilder['Relationships'],\n 'RPC'\n > {\n return this.rest.rpc(fn, args, options) as unknown as PostgrestFilterBuilder<\n ClientOptions,\n Schema,\n FilterBuilder['Row'],\n FilterBuilder['Result'],\n FilterBuilder['RelationName'],\n FilterBuilder['Relationships'],\n 'RPC'\n >\n }\n\n /**\n * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.\n *\n * @param {string} name - The name of the Realtime channel.\n * @param {Object} opts - The options to pass to the Realtime channel.\n *\n * @category Realtime\n */\n channel(name: string, opts: RealtimeChannelOptions = { config: {} }): RealtimeChannel {\n return this.realtime.channel(name, opts)\n }\n\n /**\n * Returns all Realtime channels.\n *\n * @category Realtime\n *\n * @example Get all channels\n * ```js\n * const channels = supabase.getChannels()\n * ```\n */\n getChannels(): RealtimeChannel[] {\n return this.realtime.getChannels()\n }\n\n /**\n * Unsubscribes and removes Realtime channel from Realtime client.\n *\n * @param {RealtimeChannel} channel - The name of the Realtime channel.\n *\n *\n * @category Realtime\n *\n * @remarks\n * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n *\n * @example Removes a channel\n * ```js\n * supabase.removeChannel(myChannel)\n * ```\n */\n removeChannel(channel: RealtimeChannel): Promise {\n return this.realtime.removeChannel(channel)\n }\n\n /**\n * Unsubscribes and removes all Realtime channels from Realtime client.\n *\n * @category Realtime\n *\n * @remarks\n * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n *\n * @example Remove all channels\n * ```js\n * supabase.removeAllChannels()\n * ```\n */\n removeAllChannels(): Promise {\n return this.realtime.removeAllChannels()\n }\n\n /**\n * The raw session token — the custom `accessToken` result or the signed-in user's JWT —\n * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back\n * to `supabaseKey`, so callers can distinguish \"no session\" from \"has session\".\n */\n private async _getSessionToken(): Promise {\n if (this.accessToken) {\n return await this.accessToken()\n }\n\n const { data } = await this.auth.getSession()\n\n return data.session?.access_token ?? null\n }\n\n private async _getAccessToken() {\n return (await this._getSessionToken()) ?? this.supabaseKey\n }\n\n private _initSupabaseAuthClient(\n {\n autoRefreshToken,\n persistSession,\n detectSessionInUrl,\n storage,\n userStorage,\n storageKey,\n flowType,\n lock,\n debug,\n throwOnError,\n experimental,\n lockAcquireTimeout,\n skipAutoInitialize,\n }: SupabaseAuthClientOptions,\n headers?: Record,\n fetch?: Fetch\n ) {\n const authHeaders = {\n Authorization: `Bearer ${this.supabaseKey}`,\n apikey: `${this.supabaseKey}`,\n }\n return new SupabaseAuthClient({\n url: this.authUrl.href,\n headers: { ...authHeaders, ...headers },\n storageKey: storageKey,\n autoRefreshToken,\n persistSession,\n detectSessionInUrl,\n storage,\n userStorage,\n flowType,\n lock,\n debug,\n throwOnError,\n experimental,\n fetch,\n lockAcquireTimeout,\n skipAutoInitialize,\n // auth checks if there is a custom authorizaiton header using this flag\n // so it knows whether to return an error when getUser is called with no session\n hasCustomAuthorizationHeader: Object.keys(this.headers).some(\n (key) => key.toLowerCase() === 'authorization'\n ),\n })\n }\n\n private _initRealtimeClient(options: RealtimeClientOptions) {\n return new RealtimeClient(this.realtimeUrl.href, {\n ...options,\n params: { ...{ apikey: this.supabaseKey }, ...options?.params },\n })\n }\n\n private _listenForAuthEvents() {\n const data = this.auth.onAuthStateChange((event, session) => {\n this._handleTokenChanged(event, 'CLIENT', session?.access_token)\n })\n return data\n }\n\n private _handleTokenChanged(\n event: AuthChangeEvent,\n source: 'CLIENT' | 'STORAGE',\n token?: string\n ) {\n if (\n (event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN' || event === 'INITIAL_SESSION') &&\n this.changedAccessToken !== token\n ) {\n this.changedAccessToken = token\n this.realtime.setAuth(token)\n } else if (event === 'SIGNED_OUT') {\n this.realtime.setAuth()\n if (source == 'STORAGE') this.auth.signOut()\n this.changedAccessToken = undefined\n }\n }\n}\n","import SupabaseClient from './SupabaseClient'\nimport type { SupabaseClientOptions } from './lib/types'\n\nexport * from '@supabase/auth-js'\nexport type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js'\nexport type {\n PostgrestResponse,\n PostgrestSingleResponse,\n PostgrestMaybeSingleResponse,\n PostgrestBuilder,\n PostgrestFilterBuilder,\n PostgrestTransformBuilder,\n PostgrestQueryBuilder,\n} from '@supabase/postgrest-js'\nexport { PostgrestError } from '@supabase/postgrest-js'\nexport { StorageApiError } from '@supabase/storage-js'\nexport type { FunctionInvokeOptions } from '@supabase/functions-js'\nexport {\n FunctionsHttpError,\n FunctionsFetchError,\n FunctionsRelayError,\n FunctionsError,\n FunctionRegion,\n} from '@supabase/functions-js'\nexport * from '@supabase/realtime-js'\nexport { default as SupabaseClient } from './SupabaseClient'\nexport type {\n SupabaseClientOptions,\n TracePropagationOptions,\n QueryResult,\n QueryData,\n QueryError,\n DatabaseWithoutInternals,\n} from './lib/types'\n\n/**\n * Creates a new Supabase Client.\n *\n * @example Creating a Supabase client\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const { data, error } = await supabase.from('profiles').select('*')\n * ```\n */\nexport const createClient = <\n Database = any,\n SchemaNameOrClientOptions extends\n | (string & keyof Omit)\n | { PostgrestVersion: string } = 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit,\n SchemaName extends string & keyof Omit =\n SchemaNameOrClientOptions extends string & keyof Omit\n ? SchemaNameOrClientOptions\n : 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit, '__InternalSupabase'>,\n>(\n supabaseUrl: string,\n supabaseKey: string,\n options?: SupabaseClientOptions\n): SupabaseClient => {\n return new SupabaseClient(\n supabaseUrl,\n supabaseKey,\n options\n )\n}\n\n// Check for Node.js <= 20 deprecation\nfunction shouldShowDeprecationWarning(): boolean {\n // Skip in browser and Deno environments\n if (typeof window !== 'undefined' || (globalThis as any)['Deno'] !== undefined) {\n return false\n }\n\n // Skip if process is not available (e.g., Edge Runtime)\n // Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings\n const _process = (globalThis as any)['process']\n if (!_process) {\n return false\n }\n\n const processVersion = _process['version']\n if (processVersion === undefined || processVersion === null) {\n return false\n }\n\n const versionMatch = processVersion.match(/^v(\\d+)\\./)\n if (!versionMatch) {\n return false\n }\n\n const majorVersion = parseInt(versionMatch[1], 10)\n return majorVersion <= 20\n}\n\nif (shouldShowDeprecationWarning()) {\n console.warn(\n `⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +\n `Please upgrade to Node.js 22 or later. ` +\n `For more information, visit: https://github.com/orgs/supabase/discussions/45715`\n )\n}\n"],"mappings":";;;;;;;;AAMA,MAAa,UAAU;;;;ACDvB,IAAI,SAAS;AACb,IAAIA;AAEJ,IAAI,OAAO,SAAS,aAAa;;AAC/B,UAAS;AAET,uCAAqB,KAAK,uEAAS;WAC1B,OAAO,aAAa,YAC7B,UAAS;SACA,OAAO,cAAc,eAAe,UAAU,YAAY,cACnE,UAAS;KACJ;;AACL,UAAS;CACT,MAAM,WAAY,WAAmB;AACrC,sFAAqB,SAAW,gFAAY,QAAQ,MAAM,GAAG;;AAG/D,MAAM,eAAe,CAAC,WAAW,SAAS;AAC1C,IAAI,mBACF,cAAa,KAAK,mBAAmB,qBAAqB;AAG5D,MAAa,kBAAkB,EAC7B,iBAAiB,eAAe,QAAQ,IAAI,aAAa,KAAK,KAAK,IACpE;AAED,MAAa,yBAAyB,EACpC,SAAS,iBACV;AAED,MAAa,qBAAqB,EAChC,QAAQ,UACT;AAED,MAAaC,uBAAkD;CAC7D,kBAAkB;CAClB,gBAAgB;CAChB,oBAAoB;CACpB,UAAU;CACX;AAED,MAAaC,2BAAkD,EAAE;AAEjE,MAAaC,oCAA6D;CACxE,SAAS;CACT,yBAAyB;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvBD,SAAgB,iBAAiB,aAAa;AAC1C,KAAI,CAAC,eAAe,OAAO,gBAAgB,SACvC,QAAO;CAGX,MAAM,QAAQ,YAAY,MAAM,IAAI;AAEpC,KAAI,MAAM,WAAW,EACj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AY,wCACtC,gBACH,0CAAa,EAAE,QAAQ,KAAK,aAAa,qDAAK,QAAS,WACvD;;CAGJ,AAAQ,uBAAuB;AAI7B,SAHa,KAAK,KAAK,mBAAmB,OAAO,YAAY;AAC3D,QAAK,oBAAoB,OAAO,4DAAU,QAAS,aAAa;IAChE;;CAIJ,AAAQ,oBACN,OACA,QACA,OACA;AACA,OACG,UAAU,qBAAqB,UAAU,eAAe,UAAU,sBACnE,KAAK,uBAAuB,OAC5B;AACA,QAAK,qBAAqB;AAC1B,QAAK,SAAS,QAAQ,MAAM;aACnB,UAAU,cAAc;AACjC,QAAK,SAAS,SAAS;AACvB,OAAI,UAAU,UAAW,MAAK,KAAK,SAAS;AAC5C,QAAK,qBAAqB;;;;;;;;;;;;;;;;;;AC5nBhC,MAAa,gBAcX,aACA,aACA,YACoE;AACpE,QAAO,IAAI,eACT,aACA,aACA,QACD;;AAIH,SAAS,+BAAwC;AAE/C,KAAI,OAAO,WAAW,eAAgB,WAAmB,YAAY,OACnE,QAAO;CAKT,MAAM,WAAY,WAAmB;AACrC,KAAI,CAAC,SACH,QAAO;CAGT,MAAM,iBAAiB,SAAS;AAChC,KAAI,mBAAmB,UAAa,mBAAmB,KACrD,QAAO;CAGT,MAAM,eAAe,eAAe,MAAM,YAAY;AACtD,KAAI,CAAC,aACH,QAAO;AAIT,QADqB,SAAS,aAAa,IAAI,GAAG,IAC3B;;AAGzB,IAAI,8BAA8B,CAChC,SAAQ,KACN,8OAGD"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.d.cts b/node_modules/@supabase/supabase-js/dist/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..e7dfdc0d7d9481db9dcd8e8811254999e11c3cf6 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.d.cts @@ -0,0 +1,802 @@ +import { FunctionInvokeOptions, FunctionRegion, FunctionsClient, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError } from "@supabase/functions-js"; +import { PostgrestBuilder, PostgrestClient, PostgrestError, PostgrestError as PostgrestError$1, PostgrestFilterBuilder, PostgrestFilterBuilder as PostgrestFilterBuilder$1, PostgrestMaybeSingleResponse, PostgrestQueryBuilder, PostgrestQueryBuilder as PostgrestQueryBuilder$1, PostgrestResponse, PostgrestSingleResponse, PostgrestTransformBuilder } from "@supabase/postgrest-js"; +import { RealtimeChannel, RealtimeChannelOptions, RealtimeClient, RealtimeClientOptions, RealtimeRemoveChannelResponse } from "@supabase/realtime-js"; +import { StorageApiError, StorageClient, StorageClientOptions } from "@supabase/storage-js"; +import { AuthClient, GoTrueClientOptions, Session as AuthSession, User as AuthUser } from "@supabase/auth-js"; +export * from "@supabase/realtime-js"; +export * from "@supabase/auth-js"; + +//#region src/lib/rest/types/common/common.d.ts + +type GenericRelationship = { + foreignKeyName: string; + columns: string[]; + isOneToOne?: boolean; + referencedRelation: string; + referencedColumns: string[]; +}; +type GenericTable = { + Row: Record; + Insert: Record; + Update: Record; + Relationships: GenericRelationship[]; +}; +type GenericUpdatableView = { + Row: Record; + Insert: Record; + Update: Record; + Relationships: GenericRelationship[]; +}; +type GenericNonUpdatableView = { + Row: Record; + Relationships: GenericRelationship[]; +}; +type GenericView = GenericUpdatableView | GenericNonUpdatableView; +type GenericSetofOption = { + isSetofReturn?: boolean | undefined; + isOneToOne?: boolean | undefined; + isNotNullable?: boolean | undefined; + to: string; + from: string; +}; +type GenericFunction = { + Args: Record | never; + Returns: unknown; + SetofOptions?: GenericSetofOption; +}; +type GenericSchema = { + Tables: Record; + Views: Record; + Functions: Record; +}; +//#endregion +//#region src/lib/types.d.ts +interface SupabaseAuthClientOptions extends GoTrueClientOptions {} +type Fetch = typeof fetch; +/** + * Configuration options for trace context propagation. + * + * Enables distributed tracing across Supabase services using W3C Trace Context + * and OpenTelemetry standards. When enabled, the SDK automatically attaches + * trace context headers (`traceparent`, `tracestate`, `baggage`) to outgoing + * requests to Supabase domains. The resulting `trace_id` appears in API + * Gateway and Edge Function logs, so logs forwarded through Log Drains can + * be correlated back to the originating client-side span. + * + * Requires two opt-in steps: install `@opentelemetry/api` in the consuming + * application, and load the tracing runtime with + * `import '@supabase/supabase-js/tracing'` at the application entry point. + * If the runtime is not loaded, the SDK logs a one-time warning and sends + * requests without trace headers; if there is no active context at request + * time, propagation silently no-ops. Not available via the CDN/UMD build. + * + * @example Enable with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + * + * @see https://www.w3.org/TR/trace-context/ + * @see https://opentelemetry.io/docs/concepts/context-propagation/ + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + */ +interface TracePropagationOptions { + /** + * Enable trace propagation. Disabled by default. + * + * When enabled, automatically detects and propagates active trace context + * from the OpenTelemetry API to outgoing Supabase requests. Trace context + * is only propagated to Supabase domains (`*.supabase.co`, `*.supabase.in`, + * `localhost`) for security — third-party hosts never receive trace headers. + * + * @default false + * + * @example + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + */ + enabled?: boolean; + /** + * Respect upstream sampling decisions. + * + * When true (the default), requests whose upstream trace is not sampled + * (sampled flag = `0` in the `traceparent` header) carry only the + * `traceparent` header — the sampled flag is preserved, so downstream + * tracing never records them, while Supabase logs still get a `trace_id` + * to correlate on. The `tracestate` and `baggage` headers are withheld on + * these requests. + * + * Set to `false` to always propagate the full trace context + * (`traceparent`, `tracestate`, `baggage`) regardless of the sampling + * decision. + * + * @default true + * + * @example Always propagate the full context, ignore sampling + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + */ + respectSamplingDecision?: boolean; +} +type SupabaseClientOptions = { + /** + * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`. + */ + db?: { + schema?: SchemaName; + /** + * Optional timeout in milliseconds for PostgREST requests. + * When set, requests will automatically abort after this duration to prevent indefinite hangs. + * + * @example With timeout + * ```ts + * const supabase = createClient(url, key, { + * db: { timeout: 30000 } // 30 second timeout + * }) + * ``` + */ + timeout?: number; + /** + * Maximum URL length in characters before warnings/errors are triggered. + * Defaults to 8000 characters. Used to provide helpful hints when URLs + * exceed server limits. + * + * @example With custom URL length limit + * ```ts + * const supabase = createClient(url, key, { + * db: { urlLengthLimit: 10000 } // Custom limit + * }) + * ``` + */ + urlLengthLimit?: number; + /** + * Enable or disable automatic retries for transient PostgREST errors. + * Defaults to `true`. + */ + retry?: boolean; + }; + auth?: { + /** + * Automatically refreshes the token for logged-in users. Defaults to true. + */ + autoRefreshToken?: boolean; + /** + * Optional key name used for storing tokens in local storage. + */ + storageKey?: string; + /** + * Whether to persist a logged-in session to storage. Defaults to true. + */ + persistSession?: boolean; + /** + * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true. + * + * Can be set to a function to provide custom logic for determining if a URL contains + * a Supabase auth callback. The function receives the current URL and parsed parameters, + * and should return true if the URL should be processed as a Supabase auth callback. + * + * This is useful when your app uses other OAuth providers (e.g., Facebook Login) that + * also return access_token in the URL fragment, which would otherwise be incorrectly + * intercepted by Supabase Auth. + * + * @example With custom detection logic + * ```ts + * detectSessionInUrl: (url, params) => { + * // Ignore Facebook OAuth redirects + * if (url.pathname === '/facebook/redirect') return false + * // Use default detection for other URLs + * return Boolean(params.access_token || params.error_description) + * } + * ``` + */ + detectSessionInUrl?: boolean | ((url: URL, params: { + [parameter: string]: string; + }) => boolean); + /** + * A storage provider. Used to store the logged-in session. + */ + storage?: SupabaseAuthClientOptions['storage']; + /** + * A storage provider to store the user profile separately from the session. + * Useful when you need to store the session information in cookies, + * without bloating the data with the redundant user object. + * + * @experimental + */ + userStorage?: SupabaseAuthClientOptions['userStorage']; + /** + * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications. + */ + flowType?: SupabaseAuthClientOptions['flowType']; + /** + * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library. + */ + debug?: SupabaseAuthClientOptions['debug']; + /** + * Provide your own locking mechanism based on the environment. By default + * the auth client coordinates refreshes itself and the server resolves + * cross-tab races. Passing a custom `lock` opts into a legacy path that + * wraps every auth operation in your supplied lock. + * + * @deprecated Custom locks still work in v2.x for backwards compatibility. + * The legacy lock path will be removed in v3 — drop this option from your + * `createClient` options before upgrading. + */ + lock?: SupabaseAuthClientOptions['lock']; + /** + * If there is an error with the query, throwOnError will reject the promise by + * throwing the error instead of returning it as part of a successful response. + */ + throwOnError?: SupabaseAuthClientOptions['throwOnError']; + /** + * Opt-in flags for experimental features. These APIs may change without + * notice and are disabled by default. + * + * @experimental + */ + experimental?: SupabaseAuthClientOptions['experimental']; + /** + * Maximum time in milliseconds to wait for acquiring the custom lock + * supplied via `lock`. Only consulted when a custom `lock` is passed. + * + * @default 5000 + * + * @deprecated Only used by the legacy lock path. Will be removed in v3 + * along with the `lock` option. + */ + lockAcquireTimeout?: SupabaseAuthClientOptions['lockAcquireTimeout']; + /** + * If true, skips automatic initialization in the auth client constructor. + * Useful for SSR contexts where initialization timing must be controlled to + * prevent race conditions with HTTP response generation. + * + * @default false + */ + skipAutoInitialize?: SupabaseAuthClientOptions['skipAutoInitialize']; + }; + /** + * Options passed to the realtime-js instance + */ + realtime?: RealtimeClientOptions; + storage?: StorageClientOptions; + global?: { + /** + * A custom `fetch` implementation. + */ + fetch?: Fetch; + /** + * Optional headers for initializing the client. + */ + headers?: Record; + }; + /** + * Optional function for using a third-party authentication system with + * Supabase. The function should return an access token or ID token (JWT) by + * obtaining it from the third-party auth SDK. Note that this + * function may be called concurrently and many times. Use memoization and + * locking techniques if this is not supported by the SDKs. + * + * When set, the `auth` namespace of the Supabase client cannot be used. + * Create another client if you wish to use Supabase Auth and third-party + * authentications concurrently in the same application. + */ + accessToken?: () => Promise; + /** + * Enable OpenTelemetry / W3C trace context propagation to Supabase services. + * + * Disabled by default. Pass `true` for the common case (auto-detect an + * active OpenTelemetry context and inject `traceparent` / `tracestate` / + * `baggage` headers) or an object for fine-grained control. + * + * Requires `@opentelemetry/api` to be installed in your application AND + * the tracing runtime to be loaded with + * `import '@supabase/supabase-js/tracing'` at your application entry + * point. Without that import, the SDK logs a one-time warning and sends + * requests without trace headers. Not available via the CDN/UMD build. + * Trace headers are only attached to requests targeting Supabase domains, + * so third-party hosts called through a custom `fetch` are never tagged. + * + * The resulting `trace_id` appears in Supabase logs (API Gateway, Edge + * Functions), letting you correlate client-side spans with server-side + * log entries — including logs forwarded via Log Drains. + * + * @example Shorthand — opt in with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * ``` + * + * @example With an active OpenTelemetry span + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + * + * @example Advanced — always propagate, even for non-sampled traces + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + * + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + * @see https://www.w3.org/TR/trace-context/ + */ + tracePropagation?: TracePropagationOptions | boolean; +}; +/** + * Helper types for query results. + */ +type QueryResult = T extends PromiseLike ? U : never; +type QueryData = T extends PromiseLike<{ + data: infer U; +}> ? Exclude : never; +type QueryError = PostgrestError$1; +/** + * Strips internal Supabase metadata from Database types. + * Useful for libraries defining generic constraints on Database types. + * + * @example Stripping internal Supabase metadata + * ```typescript + * type CleanDB = DatabaseWithoutInternals + * ``` + */ +type DatabaseWithoutInternals = Omit; +//#endregion +//#region src/lib/helpers.d.ts +type ResolvedSupabaseClientOptions = Omit>, 'tracePropagation'> & { + tracePropagation: TracePropagationOptions; +}; +//#endregion +//#region src/lib/SupabaseAuthClient.d.ts +declare class SupabaseAuthClient extends AuthClient { + constructor(options: SupabaseAuthClientOptions); +} +//#endregion +//#region src/lib/rest/types/common/rpc.d.ts +type IsMatchingArgs = [FnArgs] extends [Record] ? PassedArgs extends Record ? true : false : keyof PassedArgs extends keyof FnArgs ? PassedArgs extends FnArgs ? true : false : false; +type MatchingFunctionArgs = Fn$1 extends { + Args: infer A extends GenericFunction['Args']; +} ? IsMatchingArgs extends true ? Fn$1 : never : false; +type FindMatchingFunctionByArgs = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs : false; +type TablesAndViews = Schema['Tables'] & Exclude; +type UnionToIntersection = (U$1 extends any ? (k: U$1) => void : never) extends ((k: infer I) => void) ? I : never; +type LastOf = UnionToIntersection T : never> extends (() => infer R) ? R : never; +type IsAny = 0 extends 1 & T ? true : false; +type ExactMatch = [T] extends [S] ? ([S] extends [T] ? true : false) : false; +type ExtractExactFunction = Fns extends infer F ? F extends GenericFunction ? ExactMatch extends true ? F : never : never : never; +type IsNever = [T] extends [never] ? true : false; +type RpcFunctionNotFound = { + Row: any; + Result: { + error: true; + } & "Couldn't infer function definition matching provided arguments"; + RelationName: FnName; + Relationships: null; +}; +type CrossSchemaError = { + error: true; +} & `Function returns SETOF from a different schema ('${TableRef}'). Use .overrideTypes() to specify the return type explicitly.`; +type GetRpcFunctionFilterBuilderByArgs = { + 0: Schema['Functions'][FnName]; + 1: IsAny extends true ? any : IsNever extends true ? IsNever> extends true ? LastOf : ExtractExactFunction : Args extends Record ? LastOf : Args extends GenericFunction['Args'] ? IsNever>> extends true ? LastOf : LastOf> : ExtractExactFunction extends GenericFunction ? ExtractExactFunction : any; +}[1] extends infer Fn ? IsAny extends true ? { + Row: any; + Result: any; + RelationName: FnName; + Relationships: null; +} : Fn extends GenericFunction ? { + Row: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof TablesAndViews ? TablesAndViews[Fn['SetofOptions']['to']]['Row'] : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record ? Fn['Returns'][number] : CrossSchemaError : Fn['Returns'] extends Record ? Fn['Returns'] : CrossSchemaError : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record ? Fn['Returns'][number] : never : Fn['Returns'] extends Record ? Fn['Returns'] : never; + Result: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? Fn['SetofOptions']['isOneToOne'] extends true ? Fn['Returns'][] : Fn['Returns'] : Fn['Returns'] : Fn['Returns']; + RelationName: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] : FnName; + Relationships: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] : Fn['SetofOptions']['to'] extends keyof Schema['Views'] ? Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] : null : null; +} : Fn extends false ? RpcFunctionNotFound : RpcFunctionNotFound : RpcFunctionNotFound; +//#endregion +//#region src/SupabaseClient.d.ts +/** + * Supabase Client. + * + * An isomorphic Javascript client for interacting with Postgres. + */ +declare class SupabaseClient) | { + PostgrestVersion: string; +} = ('public' extends keyof Omit ? 'public' : string & keyof Omit), SchemaName extends string & keyof Omit = (SchemaNameOrClientOptions extends string & keyof Omit ? SchemaNameOrClientOptions : 'public' extends keyof Omit ? 'public' : string & keyof Omit, '__InternalSupabase'>), Schema extends (Omit[SchemaName] extends GenericSchema ? Omit[SchemaName] : never) = (Omit[SchemaName] extends GenericSchema ? Omit[SchemaName] : never), ClientOptions extends { + PostgrestVersion: string; +} = (SchemaNameOrClientOptions extends string & keyof Omit ? Database extends { + __InternalSupabase: { + PostgrestVersion: string; + }; +} ? Database['__InternalSupabase'] : { + PostgrestVersion: '12'; +} : SchemaNameOrClientOptions extends { + PostgrestVersion: string; +} ? SchemaNameOrClientOptions : never)> { + protected supabaseUrl: string; + protected supabaseKey: string; + /** + * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies. + */ + auth: SupabaseAuthClient; + realtime: RealtimeClient; + /** + * Supabase Storage allows you to manage user-generated content, such as photos or videos. + */ + storage: StorageClient; + protected realtimeUrl: URL; + protected authUrl: URL; + protected storageUrl: URL; + protected functionsUrl: URL; + protected rest: PostgrestClient; + protected storageKey: string; + protected fetch?: Fetch; + protected functionsFetch?: Fetch; + protected changedAccessToken?: string; + protected accessToken?: () => Promise; + protected headers: Record; + protected settings?: ResolvedSupabaseClientOptions; + /** + * Create a new client for use in the browser. + * + * @category Initializing + * + * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard. + * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard. + * @param options Optional configuration for the client: + * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase. + * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring. + * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage. + * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user. + * - `realtime` — Options passed along to the realtime-js constructor. + * - `storage` — Options passed along to the storage-js constructor. + * - `global.fetch` — A custom fetch implementation. + * - `global.headers` — Any additional headers to send with each network request. + * + * @example Creating a client + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Create a single supabase client for interacting with your database + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * ``` + * + * @example With a custom domain + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Use a custom domain as the supabase URL + * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key') + * ``` + * + * @example With additional parameters + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const options = { + * db: { + * schema: 'public', + * }, + * auth: { + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: true + * }, + * global: { + * headers: { 'x-my-custom-header': 'my-app-name' }, + * }, + * } + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options) + * ``` + * + * @exampleDescription With custom schemas + * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. + * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API. + * + * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. + * + * @example With custom schemas + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * // Provide a custom schema. Defaults to "public". + * db: { schema: 'other_schema' } + * }) + * ``` + * + * @exampleDescription Custom fetch implementation + * `supabase-js` uses the runtime's global `fetch` to make HTTP requests, + * but an alternative `fetch` implementation can be provided as an option. + * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior. + * + * @example Custom fetch implementation + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * global: { fetch: fetch.bind(globalThis) } + * }) + * ``` + * + * @exampleDescription React Native options with AsyncStorage + * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. + * + * @example React Native options with AsyncStorage + * ```js + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from "@react-native-async-storage/async-storage"; + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: AsyncStorage, + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @exampleDescription React Native options with Expo SecureStore + * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore. + * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode. + * A new 256-bit encryption key is generated using the `react-native-get-random-values` library. + * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage. + * + * Please make sure that: + * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date. + * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs. + * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed. + * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities. + * + * @example React Native options with Expo SecureStore + * ```ts + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from '@react-native-async-storage/async-storage'; + * import * as SecureStore from 'expo-secure-store'; + * import * as aesjs from 'aes-js'; + * import 'react-native-get-random-values'; + * + * // As Expo's SecureStore does not support values larger than 2048 + * // bytes, an AES-256 key is generated and stored in SecureStore, while + * // it is used to encrypt/decrypt values stored in AsyncStorage. + * class LargeSecureStore { + * private async _encrypt(key: string, value: string) { + * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8)); + * + * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1)); + * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value)); + * + * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey)); + * + * return aesjs.utils.hex.fromBytes(encryptedBytes); + * } + * + * private async _decrypt(key: string, value: string) { + * const encryptionKeyHex = await SecureStore.getItemAsync(key); + * if (!encryptionKeyHex) { + * return encryptionKeyHex; + * } + * + * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1)); + * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value)); + * + * return aesjs.utils.utf8.fromBytes(decryptedBytes); + * } + * + * async getItem(key: string) { + * const encrypted = await AsyncStorage.getItem(key); + * if (!encrypted) { return encrypted; } + * + * return await this._decrypt(key, encrypted); + * } + * + * async removeItem(key: string) { + * await AsyncStorage.removeItem(key); + * await SecureStore.deleteItemAsync(key); + * } + * + * async setItem(key: string, value: string) { + * const encrypted = await this._encrypt(key, value); + * + * await AsyncStorage.setItem(key, encrypted); + * } + * } + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: new LargeSecureStore(), + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @example With a database query + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * + * const { data } = await supabase.from('profiles').select('*') + * ``` + * + * @exampleDescription With OpenTelemetry tracing + * Opt in to W3C trace context propagation so the `trace_id` from your + * client-side spans is attached to Supabase requests and appears in API + * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be + * installed in your application and the tracing runtime to be loaded via + * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing). + * + * @example With OpenTelemetry tracing + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * tracePropagation: true, + * }) + * + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Outgoing request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + */ + constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions); + /** + * Supabase Functions allows you to deploy and invoke edge functions. + */ + get functions(): FunctionsClient; + from(relation: TableName): PostgrestQueryBuilder$1; + from(relation: ViewName): PostgrestQueryBuilder$1; + /** + * Select a schema to query or perform an function (rpc) call. + * + * The schema needs to be on the list of exposed schemas inside Supabase. + * + * @param schema - The schema to query + */ + schema>(schema: DynamicSchema): PostgrestClient; + /** + * Perform a function call. + * + * @param fn - The function name to call + * @param args - The arguments to pass to the function call + * @param options - Named parameters + * @param options.head - When set to `true`, `data` will not be returned. + * Useful if you only need the count. + * @param options.get - When set to `true`, the function will be called with + * read-only access mode. + * @param options.count - Count algorithm to use to count rows returned by the + * function. Only applicable for [set-returning + * functions](https://www.postgresql.org/docs/current/functions-srf.html). + * + * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the + * hood. + * + * `"planned"`: Approximated but fast count algorithm. Uses the Postgres + * statistics under the hood. + * + * `"estimated"`: Uses exact count for low numbers and planned count for high + * numbers. + */ + rpc = GetRpcFunctionFilterBuilderByArgs>(fn: FnName, args?: Args, options?: { + head?: boolean; + get?: boolean; + count?: 'exact' | 'planned' | 'estimated'; + }): PostgrestFilterBuilder$1; + /** + * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. + * + * @param {string} name - The name of the Realtime channel. + * @param {Object} opts - The options to pass to the Realtime channel. + * + * @category Realtime + */ + channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel; + /** + * Returns all Realtime channels. + * + * @category Realtime + * + * @example Get all channels + * ```js + * const channels = supabase.getChannels() + * ``` + */ + getChannels(): RealtimeChannel[]; + /** + * Unsubscribes and removes Realtime channel from Realtime client. + * + * @param {RealtimeChannel} channel - The name of the Realtime channel. + * + * + * @category Realtime + * + * @remarks + * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Removes a channel + * ```js + * supabase.removeChannel(myChannel) + * ``` + */ + removeChannel(channel: RealtimeChannel): Promise; + /** + * Unsubscribes and removes all Realtime channels from Realtime client. + * + * @category Realtime + * + * @remarks + * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Remove all channels + * ```js + * supabase.removeAllChannels() + * ``` + */ + removeAllChannels(): Promise; + /** + * The raw session token — the custom `accessToken` result or the signed-in user's JWT — + * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back + * to `supabaseKey`, so callers can distinguish "no session" from "has session". + */ + private _getSessionToken; + private _getAccessToken; + private _initSupabaseAuthClient; + private _initRealtimeClient; + private _listenForAuthEvents; + private _handleTokenChanged; +} +//#endregion +//#region src/index.d.ts +/** + * Creates a new Supabase Client. + * + * @example Creating a Supabase client + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.from('profiles').select('*') + * ``` + */ +declare const createClient: ) | { + PostgrestVersion: string; +} = ("public" extends keyof Omit ? "public" : string & keyof Omit), SchemaName extends string & keyof Omit = (SchemaNameOrClientOptions extends string & keyof Omit ? SchemaNameOrClientOptions : "public" extends keyof Omit ? "public" : string & keyof Omit, "__InternalSupabase">)>(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions) => SupabaseClient; +//#endregion +export { type AuthSession, type AuthUser, type DatabaseWithoutInternals, type FunctionInvokeOptions, FunctionRegion, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, type PostgrestBuilder, PostgrestError, type PostgrestFilterBuilder, type PostgrestMaybeSingleResponse, type PostgrestQueryBuilder, type PostgrestResponse, type PostgrestSingleResponse, type PostgrestTransformBuilder, type QueryData, type QueryError, type QueryResult, StorageApiError, SupabaseClient, type SupabaseClientOptions, type TracePropagationOptions, createClient }; +//# sourceMappingURL=index.d.cts.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.d.cts.map b/node_modules/@supabase/supabase-js/dist/index.d.cts.map new file mode 100644 index 0000000000000000000000000000000000000000..3cd3680fb8ffa824e21ecb119167bd7877230b21 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.d.cts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.cts","names":[],"sources":["../src/lib/rest/types/common/common.ts","../src/lib/types.ts","../src/lib/helpers.ts","../src/lib/SupabaseAuthClient.ts","../src/lib/rest/types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AAA,CAAA,EAAA,oBAAA,CAAA,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EMN5D,qBNM4D,CMNtC,UNMsC,CAAA,EAAA,GMLrE,cNKqE,CMLtD,QNKsD,EML5C,yBNK4C,EMLjB,UNKiB,CAAA"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.d.mts b/node_modules/@supabase/supabase-js/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bab2f83196d55d2dd89634ad09b7fd98624fe05b --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.d.mts @@ -0,0 +1,802 @@ +import { FunctionInvokeOptions, FunctionRegion, FunctionsClient, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError } from "@supabase/functions-js"; +import { PostgrestBuilder, PostgrestClient, PostgrestError, PostgrestError as PostgrestError$1, PostgrestFilterBuilder, PostgrestFilterBuilder as PostgrestFilterBuilder$1, PostgrestMaybeSingleResponse, PostgrestQueryBuilder, PostgrestQueryBuilder as PostgrestQueryBuilder$1, PostgrestResponse, PostgrestSingleResponse, PostgrestTransformBuilder } from "@supabase/postgrest-js"; +import { RealtimeChannel, RealtimeChannelOptions, RealtimeClient, RealtimeClientOptions, RealtimeRemoveChannelResponse } from "@supabase/realtime-js"; +import { StorageApiError, StorageClient, StorageClientOptions } from "@supabase/storage-js"; +import { AuthClient, GoTrueClientOptions, Session as AuthSession, User as AuthUser } from "@supabase/auth-js"; +export * from "@supabase/realtime-js"; +export * from "@supabase/auth-js"; + +//#region src/lib/rest/types/common/common.d.ts + +type GenericRelationship = { + foreignKeyName: string; + columns: string[]; + isOneToOne?: boolean; + referencedRelation: string; + referencedColumns: string[]; +}; +type GenericTable = { + Row: Record; + Insert: Record; + Update: Record; + Relationships: GenericRelationship[]; +}; +type GenericUpdatableView = { + Row: Record; + Insert: Record; + Update: Record; + Relationships: GenericRelationship[]; +}; +type GenericNonUpdatableView = { + Row: Record; + Relationships: GenericRelationship[]; +}; +type GenericView = GenericUpdatableView | GenericNonUpdatableView; +type GenericSetofOption = { + isSetofReturn?: boolean | undefined; + isOneToOne?: boolean | undefined; + isNotNullable?: boolean | undefined; + to: string; + from: string; +}; +type GenericFunction = { + Args: Record | never; + Returns: unknown; + SetofOptions?: GenericSetofOption; +}; +type GenericSchema = { + Tables: Record; + Views: Record; + Functions: Record; +}; +//#endregion +//#region src/lib/types.d.ts +interface SupabaseAuthClientOptions extends GoTrueClientOptions {} +type Fetch = typeof fetch; +/** + * Configuration options for trace context propagation. + * + * Enables distributed tracing across Supabase services using W3C Trace Context + * and OpenTelemetry standards. When enabled, the SDK automatically attaches + * trace context headers (`traceparent`, `tracestate`, `baggage`) to outgoing + * requests to Supabase domains. The resulting `trace_id` appears in API + * Gateway and Edge Function logs, so logs forwarded through Log Drains can + * be correlated back to the originating client-side span. + * + * Requires two opt-in steps: install `@opentelemetry/api` in the consuming + * application, and load the tracing runtime with + * `import '@supabase/supabase-js/tracing'` at the application entry point. + * If the runtime is not loaded, the SDK logs a one-time warning and sends + * requests without trace headers; if there is no active context at request + * time, propagation silently no-ops. Not available via the CDN/UMD build. + * + * @example Enable with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + * + * @see https://www.w3.org/TR/trace-context/ + * @see https://opentelemetry.io/docs/concepts/context-propagation/ + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + */ +interface TracePropagationOptions { + /** + * Enable trace propagation. Disabled by default. + * + * When enabled, automatically detects and propagates active trace context + * from the OpenTelemetry API to outgoing Supabase requests. Trace context + * is only propagated to Supabase domains (`*.supabase.co`, `*.supabase.in`, + * `localhost`) for security — third-party hosts never receive trace headers. + * + * @default false + * + * @example + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + */ + enabled?: boolean; + /** + * Respect upstream sampling decisions. + * + * When true (the default), requests whose upstream trace is not sampled + * (sampled flag = `0` in the `traceparent` header) carry only the + * `traceparent` header — the sampled flag is preserved, so downstream + * tracing never records them, while Supabase logs still get a `trace_id` + * to correlate on. The `tracestate` and `baggage` headers are withheld on + * these requests. + * + * Set to `false` to always propagate the full trace context + * (`traceparent`, `tracestate`, `baggage`) regardless of the sampling + * decision. + * + * @default true + * + * @example Always propagate the full context, ignore sampling + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + */ + respectSamplingDecision?: boolean; +} +type SupabaseClientOptions = { + /** + * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`. + */ + db?: { + schema?: SchemaName; + /** + * Optional timeout in milliseconds for PostgREST requests. + * When set, requests will automatically abort after this duration to prevent indefinite hangs. + * + * @example With timeout + * ```ts + * const supabase = createClient(url, key, { + * db: { timeout: 30000 } // 30 second timeout + * }) + * ``` + */ + timeout?: number; + /** + * Maximum URL length in characters before warnings/errors are triggered. + * Defaults to 8000 characters. Used to provide helpful hints when URLs + * exceed server limits. + * + * @example With custom URL length limit + * ```ts + * const supabase = createClient(url, key, { + * db: { urlLengthLimit: 10000 } // Custom limit + * }) + * ``` + */ + urlLengthLimit?: number; + /** + * Enable or disable automatic retries for transient PostgREST errors. + * Defaults to `true`. + */ + retry?: boolean; + }; + auth?: { + /** + * Automatically refreshes the token for logged-in users. Defaults to true. + */ + autoRefreshToken?: boolean; + /** + * Optional key name used for storing tokens in local storage. + */ + storageKey?: string; + /** + * Whether to persist a logged-in session to storage. Defaults to true. + */ + persistSession?: boolean; + /** + * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true. + * + * Can be set to a function to provide custom logic for determining if a URL contains + * a Supabase auth callback. The function receives the current URL and parsed parameters, + * and should return true if the URL should be processed as a Supabase auth callback. + * + * This is useful when your app uses other OAuth providers (e.g., Facebook Login) that + * also return access_token in the URL fragment, which would otherwise be incorrectly + * intercepted by Supabase Auth. + * + * @example With custom detection logic + * ```ts + * detectSessionInUrl: (url, params) => { + * // Ignore Facebook OAuth redirects + * if (url.pathname === '/facebook/redirect') return false + * // Use default detection for other URLs + * return Boolean(params.access_token || params.error_description) + * } + * ``` + */ + detectSessionInUrl?: boolean | ((url: URL, params: { + [parameter: string]: string; + }) => boolean); + /** + * A storage provider. Used to store the logged-in session. + */ + storage?: SupabaseAuthClientOptions['storage']; + /** + * A storage provider to store the user profile separately from the session. + * Useful when you need to store the session information in cookies, + * without bloating the data with the redundant user object. + * + * @experimental + */ + userStorage?: SupabaseAuthClientOptions['userStorage']; + /** + * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications. + */ + flowType?: SupabaseAuthClientOptions['flowType']; + /** + * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library. + */ + debug?: SupabaseAuthClientOptions['debug']; + /** + * Provide your own locking mechanism based on the environment. By default + * the auth client coordinates refreshes itself and the server resolves + * cross-tab races. Passing a custom `lock` opts into a legacy path that + * wraps every auth operation in your supplied lock. + * + * @deprecated Custom locks still work in v2.x for backwards compatibility. + * The legacy lock path will be removed in v3 — drop this option from your + * `createClient` options before upgrading. + */ + lock?: SupabaseAuthClientOptions['lock']; + /** + * If there is an error with the query, throwOnError will reject the promise by + * throwing the error instead of returning it as part of a successful response. + */ + throwOnError?: SupabaseAuthClientOptions['throwOnError']; + /** + * Opt-in flags for experimental features. These APIs may change without + * notice and are disabled by default. + * + * @experimental + */ + experimental?: SupabaseAuthClientOptions['experimental']; + /** + * Maximum time in milliseconds to wait for acquiring the custom lock + * supplied via `lock`. Only consulted when a custom `lock` is passed. + * + * @default 5000 + * + * @deprecated Only used by the legacy lock path. Will be removed in v3 + * along with the `lock` option. + */ + lockAcquireTimeout?: SupabaseAuthClientOptions['lockAcquireTimeout']; + /** + * If true, skips automatic initialization in the auth client constructor. + * Useful for SSR contexts where initialization timing must be controlled to + * prevent race conditions with HTTP response generation. + * + * @default false + */ + skipAutoInitialize?: SupabaseAuthClientOptions['skipAutoInitialize']; + }; + /** + * Options passed to the realtime-js instance + */ + realtime?: RealtimeClientOptions; + storage?: StorageClientOptions; + global?: { + /** + * A custom `fetch` implementation. + */ + fetch?: Fetch; + /** + * Optional headers for initializing the client. + */ + headers?: Record; + }; + /** + * Optional function for using a third-party authentication system with + * Supabase. The function should return an access token or ID token (JWT) by + * obtaining it from the third-party auth SDK. Note that this + * function may be called concurrently and many times. Use memoization and + * locking techniques if this is not supported by the SDKs. + * + * When set, the `auth` namespace of the Supabase client cannot be used. + * Create another client if you wish to use Supabase Auth and third-party + * authentications concurrently in the same application. + */ + accessToken?: () => Promise; + /** + * Enable OpenTelemetry / W3C trace context propagation to Supabase services. + * + * Disabled by default. Pass `true` for the common case (auto-detect an + * active OpenTelemetry context and inject `traceparent` / `tracestate` / + * `baggage` headers) or an object for fine-grained control. + * + * Requires `@opentelemetry/api` to be installed in your application AND + * the tracing runtime to be loaded with + * `import '@supabase/supabase-js/tracing'` at your application entry + * point. Without that import, the SDK logs a one-time warning and sends + * requests without trace headers. Not available via the CDN/UMD build. + * Trace headers are only attached to requests targeting Supabase domains, + * so third-party hosts called through a custom `fetch` are never tagged. + * + * The resulting `trace_id` appears in Supabase logs (API Gateway, Edge + * Functions), letting you correlate client-side spans with server-side + * log entries — including logs forwarded via Log Drains. + * + * @example Shorthand — opt in with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * ``` + * + * @example With an active OpenTelemetry span + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + * + * @example Advanced — always propagate, even for non-sampled traces + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + * + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + * @see https://www.w3.org/TR/trace-context/ + */ + tracePropagation?: TracePropagationOptions | boolean; +}; +/** + * Helper types for query results. + */ +type QueryResult = T extends PromiseLike ? U : never; +type QueryData = T extends PromiseLike<{ + data: infer U; +}> ? Exclude : never; +type QueryError = PostgrestError$1; +/** + * Strips internal Supabase metadata from Database types. + * Useful for libraries defining generic constraints on Database types. + * + * @example Stripping internal Supabase metadata + * ```typescript + * type CleanDB = DatabaseWithoutInternals + * ``` + */ +type DatabaseWithoutInternals = Omit; +//#endregion +//#region src/lib/helpers.d.ts +type ResolvedSupabaseClientOptions = Omit>, 'tracePropagation'> & { + tracePropagation: TracePropagationOptions; +}; +//#endregion +//#region src/lib/SupabaseAuthClient.d.ts +declare class SupabaseAuthClient extends AuthClient { + constructor(options: SupabaseAuthClientOptions); +} +//#endregion +//#region src/lib/rest/types/common/rpc.d.ts +type IsMatchingArgs = [FnArgs] extends [Record] ? PassedArgs extends Record ? true : false : keyof PassedArgs extends keyof FnArgs ? PassedArgs extends FnArgs ? true : false : false; +type MatchingFunctionArgs = Fn$1 extends { + Args: infer A extends GenericFunction['Args']; +} ? IsMatchingArgs extends true ? Fn$1 : never : false; +type FindMatchingFunctionByArgs = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs : false; +type TablesAndViews = Schema['Tables'] & Exclude; +type UnionToIntersection = (U$1 extends any ? (k: U$1) => void : never) extends ((k: infer I) => void) ? I : never; +type LastOf = UnionToIntersection T : never> extends (() => infer R) ? R : never; +type IsAny = 0 extends 1 & T ? true : false; +type ExactMatch = [T] extends [S] ? ([S] extends [T] ? true : false) : false; +type ExtractExactFunction = Fns extends infer F ? F extends GenericFunction ? ExactMatch extends true ? F : never : never : never; +type IsNever = [T] extends [never] ? true : false; +type RpcFunctionNotFound = { + Row: any; + Result: { + error: true; + } & "Couldn't infer function definition matching provided arguments"; + RelationName: FnName; + Relationships: null; +}; +type CrossSchemaError = { + error: true; +} & `Function returns SETOF from a different schema ('${TableRef}'). Use .overrideTypes() to specify the return type explicitly.`; +type GetRpcFunctionFilterBuilderByArgs = { + 0: Schema['Functions'][FnName]; + 1: IsAny extends true ? any : IsNever extends true ? IsNever> extends true ? LastOf : ExtractExactFunction : Args extends Record ? LastOf : Args extends GenericFunction['Args'] ? IsNever>> extends true ? LastOf : LastOf> : ExtractExactFunction extends GenericFunction ? ExtractExactFunction : any; +}[1] extends infer Fn ? IsAny extends true ? { + Row: any; + Result: any; + RelationName: FnName; + Relationships: null; +} : Fn extends GenericFunction ? { + Row: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof TablesAndViews ? TablesAndViews[Fn['SetofOptions']['to']]['Row'] : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record ? Fn['Returns'][number] : CrossSchemaError : Fn['Returns'] extends Record ? Fn['Returns'] : CrossSchemaError : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record ? Fn['Returns'][number] : never : Fn['Returns'] extends Record ? Fn['Returns'] : never; + Result: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? Fn['SetofOptions']['isOneToOne'] extends true ? Fn['Returns'][] : Fn['Returns'] : Fn['Returns'] : Fn['Returns']; + RelationName: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] : FnName; + Relationships: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] : Fn['SetofOptions']['to'] extends keyof Schema['Views'] ? Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] : null : null; +} : Fn extends false ? RpcFunctionNotFound : RpcFunctionNotFound : RpcFunctionNotFound; +//#endregion +//#region src/SupabaseClient.d.ts +/** + * Supabase Client. + * + * An isomorphic Javascript client for interacting with Postgres. + */ +declare class SupabaseClient) | { + PostgrestVersion: string; +} = ('public' extends keyof Omit ? 'public' : string & keyof Omit), SchemaName extends string & keyof Omit = (SchemaNameOrClientOptions extends string & keyof Omit ? SchemaNameOrClientOptions : 'public' extends keyof Omit ? 'public' : string & keyof Omit, '__InternalSupabase'>), Schema extends (Omit[SchemaName] extends GenericSchema ? Omit[SchemaName] : never) = (Omit[SchemaName] extends GenericSchema ? Omit[SchemaName] : never), ClientOptions extends { + PostgrestVersion: string; +} = (SchemaNameOrClientOptions extends string & keyof Omit ? Database extends { + __InternalSupabase: { + PostgrestVersion: string; + }; +} ? Database['__InternalSupabase'] : { + PostgrestVersion: '12'; +} : SchemaNameOrClientOptions extends { + PostgrestVersion: string; +} ? SchemaNameOrClientOptions : never)> { + protected supabaseUrl: string; + protected supabaseKey: string; + /** + * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies. + */ + auth: SupabaseAuthClient; + realtime: RealtimeClient; + /** + * Supabase Storage allows you to manage user-generated content, such as photos or videos. + */ + storage: StorageClient; + protected realtimeUrl: URL; + protected authUrl: URL; + protected storageUrl: URL; + protected functionsUrl: URL; + protected rest: PostgrestClient; + protected storageKey: string; + protected fetch?: Fetch; + protected functionsFetch?: Fetch; + protected changedAccessToken?: string; + protected accessToken?: () => Promise; + protected headers: Record; + protected settings?: ResolvedSupabaseClientOptions; + /** + * Create a new client for use in the browser. + * + * @category Initializing + * + * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard. + * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard. + * @param options Optional configuration for the client: + * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase. + * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring. + * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage. + * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user. + * - `realtime` — Options passed along to the realtime-js constructor. + * - `storage` — Options passed along to the storage-js constructor. + * - `global.fetch` — A custom fetch implementation. + * - `global.headers` — Any additional headers to send with each network request. + * + * @example Creating a client + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Create a single supabase client for interacting with your database + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * ``` + * + * @example With a custom domain + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Use a custom domain as the supabase URL + * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key') + * ``` + * + * @example With additional parameters + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const options = { + * db: { + * schema: 'public', + * }, + * auth: { + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: true + * }, + * global: { + * headers: { 'x-my-custom-header': 'my-app-name' }, + * }, + * } + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options) + * ``` + * + * @exampleDescription With custom schemas + * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. + * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API. + * + * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. + * + * @example With custom schemas + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * // Provide a custom schema. Defaults to "public". + * db: { schema: 'other_schema' } + * }) + * ``` + * + * @exampleDescription Custom fetch implementation + * `supabase-js` uses the runtime's global `fetch` to make HTTP requests, + * but an alternative `fetch` implementation can be provided as an option. + * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior. + * + * @example Custom fetch implementation + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * global: { fetch: fetch.bind(globalThis) } + * }) + * ``` + * + * @exampleDescription React Native options with AsyncStorage + * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. + * + * @example React Native options with AsyncStorage + * ```js + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from "@react-native-async-storage/async-storage"; + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: AsyncStorage, + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @exampleDescription React Native options with Expo SecureStore + * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore. + * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode. + * A new 256-bit encryption key is generated using the `react-native-get-random-values` library. + * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage. + * + * Please make sure that: + * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date. + * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs. + * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed. + * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities. + * + * @example React Native options with Expo SecureStore + * ```ts + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from '@react-native-async-storage/async-storage'; + * import * as SecureStore from 'expo-secure-store'; + * import * as aesjs from 'aes-js'; + * import 'react-native-get-random-values'; + * + * // As Expo's SecureStore does not support values larger than 2048 + * // bytes, an AES-256 key is generated and stored in SecureStore, while + * // it is used to encrypt/decrypt values stored in AsyncStorage. + * class LargeSecureStore { + * private async _encrypt(key: string, value: string) { + * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8)); + * + * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1)); + * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value)); + * + * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey)); + * + * return aesjs.utils.hex.fromBytes(encryptedBytes); + * } + * + * private async _decrypt(key: string, value: string) { + * const encryptionKeyHex = await SecureStore.getItemAsync(key); + * if (!encryptionKeyHex) { + * return encryptionKeyHex; + * } + * + * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1)); + * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value)); + * + * return aesjs.utils.utf8.fromBytes(decryptedBytes); + * } + * + * async getItem(key: string) { + * const encrypted = await AsyncStorage.getItem(key); + * if (!encrypted) { return encrypted; } + * + * return await this._decrypt(key, encrypted); + * } + * + * async removeItem(key: string) { + * await AsyncStorage.removeItem(key); + * await SecureStore.deleteItemAsync(key); + * } + * + * async setItem(key: string, value: string) { + * const encrypted = await this._encrypt(key, value); + * + * await AsyncStorage.setItem(key, encrypted); + * } + * } + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: new LargeSecureStore(), + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @example With a database query + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * + * const { data } = await supabase.from('profiles').select('*') + * ``` + * + * @exampleDescription With OpenTelemetry tracing + * Opt in to W3C trace context propagation so the `trace_id` from your + * client-side spans is attached to Supabase requests and appears in API + * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be + * installed in your application and the tracing runtime to be loaded via + * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing). + * + * @example With OpenTelemetry tracing + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * tracePropagation: true, + * }) + * + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Outgoing request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + */ + constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions); + /** + * Supabase Functions allows you to deploy and invoke edge functions. + */ + get functions(): FunctionsClient; + from(relation: TableName): PostgrestQueryBuilder$1; + from(relation: ViewName): PostgrestQueryBuilder$1; + /** + * Select a schema to query or perform an function (rpc) call. + * + * The schema needs to be on the list of exposed schemas inside Supabase. + * + * @param schema - The schema to query + */ + schema>(schema: DynamicSchema): PostgrestClient; + /** + * Perform a function call. + * + * @param fn - The function name to call + * @param args - The arguments to pass to the function call + * @param options - Named parameters + * @param options.head - When set to `true`, `data` will not be returned. + * Useful if you only need the count. + * @param options.get - When set to `true`, the function will be called with + * read-only access mode. + * @param options.count - Count algorithm to use to count rows returned by the + * function. Only applicable for [set-returning + * functions](https://www.postgresql.org/docs/current/functions-srf.html). + * + * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the + * hood. + * + * `"planned"`: Approximated but fast count algorithm. Uses the Postgres + * statistics under the hood. + * + * `"estimated"`: Uses exact count for low numbers and planned count for high + * numbers. + */ + rpc = GetRpcFunctionFilterBuilderByArgs>(fn: FnName, args?: Args, options?: { + head?: boolean; + get?: boolean; + count?: 'exact' | 'planned' | 'estimated'; + }): PostgrestFilterBuilder$1; + /** + * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. + * + * @param {string} name - The name of the Realtime channel. + * @param {Object} opts - The options to pass to the Realtime channel. + * + * @category Realtime + */ + channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel; + /** + * Returns all Realtime channels. + * + * @category Realtime + * + * @example Get all channels + * ```js + * const channels = supabase.getChannels() + * ``` + */ + getChannels(): RealtimeChannel[]; + /** + * Unsubscribes and removes Realtime channel from Realtime client. + * + * @param {RealtimeChannel} channel - The name of the Realtime channel. + * + * + * @category Realtime + * + * @remarks + * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Removes a channel + * ```js + * supabase.removeChannel(myChannel) + * ``` + */ + removeChannel(channel: RealtimeChannel): Promise; + /** + * Unsubscribes and removes all Realtime channels from Realtime client. + * + * @category Realtime + * + * @remarks + * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Remove all channels + * ```js + * supabase.removeAllChannels() + * ``` + */ + removeAllChannels(): Promise; + /** + * The raw session token — the custom `accessToken` result or the signed-in user's JWT — + * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back + * to `supabaseKey`, so callers can distinguish "no session" from "has session". + */ + private _getSessionToken; + private _getAccessToken; + private _initSupabaseAuthClient; + private _initRealtimeClient; + private _listenForAuthEvents; + private _handleTokenChanged; +} +//#endregion +//#region src/index.d.ts +/** + * Creates a new Supabase Client. + * + * @example Creating a Supabase client + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.from('profiles').select('*') + * ``` + */ +declare const createClient: ) | { + PostgrestVersion: string; +} = ("public" extends keyof Omit ? "public" : string & keyof Omit), SchemaName extends string & keyof Omit = (SchemaNameOrClientOptions extends string & keyof Omit ? SchemaNameOrClientOptions : "public" extends keyof Omit ? "public" : string & keyof Omit, "__InternalSupabase">)>(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions) => SupabaseClient; +//#endregion +export { type AuthSession, type AuthUser, type DatabaseWithoutInternals, type FunctionInvokeOptions, FunctionRegion, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, type PostgrestBuilder, PostgrestError, type PostgrestFilterBuilder, type PostgrestMaybeSingleResponse, type PostgrestQueryBuilder, type PostgrestResponse, type PostgrestSingleResponse, type PostgrestTransformBuilder, type QueryData, type QueryError, type QueryResult, StorageApiError, SupabaseClient, type SupabaseClientOptions, type TracePropagationOptions, createClient }; +//# sourceMappingURL=index.d.mts.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.d.mts.map b/node_modules/@supabase/supabase-js/dist/index.d.mts.map new file mode 100644 index 0000000000000000000000000000000000000000..ff86a07990e4bb23da6908b020420aadb1174b91 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/rest/types/common/common.ts","../src/lib/types.ts","../src/lib/helpers.ts","../src/lib/SupabaseAuthClient.ts","../src/lib/rest/types/common/rpc.ts","../src/SupabaseClient.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAsFS,KA7CG,mBAAA,GA6CH;EACmB,cAAA,EAAA,MAAA;EAAf,OAAA,EAAA,MAAA,EAAA;EAAM,UAAA,CAAA,EAAA,OAAA;;;;AChEF,KD0BL,YAAA,GC1BK;EAEL,GAAA,EDyBL,MCzBU,CAAA,MAAA,EAAU,OAAK,CAAA;EAgCf,MAAA,EDNP,MCMO,CAAA,MAAA,EAAA,OAAuB,CAAA;EAkD5B,MAAA,EDvDF,MCuDE,CAAA,MAAA,EAAA,OAAqB,CAAA;EAKpB,aAAA,ED3DI,mBC2DJ,EAAA;CAmE6B;AAI5B,KD/HF,oBAAA,GC+HE;EAQI,GAAA,EDtIX,MCsIW,CAAA,MAAA,EAAA,OAAA,CAAA;EAIH,MAAA,EDzIL,MCyIK,CAAA,MAAA,EAAA,OAAA,CAAA;EAIH,MAAA,ED5IF,MC4IE,CAAA,MAAA,EAAA,OAAA,CAAA;EAWD,aAAA,EDtJM,mBCsJN,EAAA;CAKQ;AAOA,KD/JP,uBAAA,GC+JO;EAUM,GAAA,EDxK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A,CAAA,GAAA;EAGxB,gBAAA,EAAA,MAAA;AAKZ,CAAA,IAAY,QAAA,SAAW,MMlBqC,INkBlC,CMlBuC,QNkBvC,EAAA,oBAAuB,CAAA,GAAA,QAAA,GAAuB,MAAA,GAAA,MMhBnD,INgBmD,CMhB9C,QNgB8C,EAAA,oBAAA,CAAA,GAAA,mBAAA,MAAA,GAAA,MMfpC,INeoC,CMf/B,QNe+B,EAAA,oBAAA,CAAA,IMdpE,yBNcoE,SAAA,MAAA,GAAA,MMdnB,INcmB,CMdd,QNcc,EAAA,oBAAA,CAAA,GMbhE,yBNagE,GAAA,QAAA,SAAA,MMZzC,INYyC,CMZpC,QNYoC,EAAA,oBAAA,CAAA,GAAA,QAAA,GAAA,MAAA,GAAA,MMV/C,INU+C,CMV1C,INU0C,CMVrC,QNUqC,EAAA,oBAAA,CAAA,EAAA,oBAAA,CAAA,EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EMN5D,qBNM4D,CMNtC,UNMsC,CAAA,EAAA,GMLrE,cNKqE,CMLtD,QNKsD,EML5C,yBNK4C,EMLjB,UNKiB,CAAA"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.mjs b/node_modules/@supabase/supabase-js/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6135e7741e0c44f3407607b2a4865353081352f4 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.mjs @@ -0,0 +1,883 @@ +import { t as getTraceContextExtractor } from "./tracingRegistry.mjs"; +import { FunctionRegion, FunctionsClient, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError } from "@supabase/functions-js"; +import { PostgrestClient, PostgrestError } from "@supabase/postgrest-js"; +import { RealtimeClient } from "@supabase/realtime-js"; +import { StorageApiError, StorageClient } from "@supabase/storage-js"; +import { AuthClient } from "@supabase/auth-js"; + +export * from "@supabase/realtime-js" + +export * from "@supabase/auth-js" + +//#region src/lib/version.ts +const version = "2.112.3"; + +//#endregion +//#region src/lib/constants.ts +let JS_ENV = ""; +let JS_RUNTIME_VERSION; +if (typeof Deno !== "undefined") { + var _Deno$version; + JS_ENV = "deno"; + JS_RUNTIME_VERSION = (_Deno$version = Deno.version) === null || _Deno$version === void 0 ? void 0 : _Deno$version.deno; +} else if (typeof document !== "undefined") JS_ENV = "web"; +else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") JS_ENV = "react-native"; +else { + var _process$version; + JS_ENV = "node"; + const _process = globalThis["process"]; + JS_RUNTIME_VERSION = _process === null || _process === void 0 || (_process$version = _process["version"]) === null || _process$version === void 0 ? void 0 : _process$version.replace(/^v/, ""); +} +const _runtimeMeta = [`runtime=${JS_ENV}`]; +if (JS_RUNTIME_VERSION) _runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`); +const DEFAULT_HEADERS = { "X-Client-Info": `supabase-js/${version}; ${_runtimeMeta.join("; ")}` }; +const DEFAULT_GLOBAL_OPTIONS = { headers: DEFAULT_HEADERS }; +const DEFAULT_DB_OPTIONS = { schema: "public" }; +const DEFAULT_AUTH_OPTIONS = { + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: true, + flowType: "implicit" +}; +const DEFAULT_REALTIME_OPTIONS = {}; +const DEFAULT_TRACE_PROPAGATION_OPTIONS = { + enabled: false, + respectSamplingDecision: true +}; + +//#endregion +//#region ../../shared/tracing/dist/module/parse.js +/** +* Parse W3C traceparent header according to the specification. +* +* The traceparent header format is: version-traceid-parentid-traceflags +* - version: 2 hex digits (currently always "00") +* - traceid: 32 hex digits (128-bit trace identifier) +* - parentid: 16 hex digits (64-bit span/parent identifier) +* - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag) +* +* @param traceparent - The traceparent header value +* @returns Parsed traceparent object, or null if invalid format +* +* @see https://www.w3.org/TR/trace-context/#traceparent-header +* +* @example +* ```typescript +* const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01') +* +* console.log(parsed) +* // { +* // version: '00', +* // traceId: '0af7651916cd43dd8448eb211c80319c', +* // parentId: 'b7ad6b7169203331', +* // traceFlags: '01', +* // isSampled: true +* // } +* ``` +*/ +function parseTraceParent(traceparent) { + if (!traceparent || typeof traceparent !== "string") return null; + const parts = traceparent.split("-"); + if (parts.length !== 4) return null; + const [version$1, traceId, parentId, traceFlags] = parts; + if (version$1.length !== 2 || traceId.length !== 32 || parentId.length !== 16 || traceFlags.length !== 2) return null; + const hexRegex = /^[0-9a-f]+$/i; + if (!hexRegex.test(version$1) || !hexRegex.test(traceId) || !hexRegex.test(parentId) || !hexRegex.test(traceFlags)) return null; + if (traceId === "00000000000000000000000000000000" || parentId === "0000000000000000") return null; + return { + version: version$1, + traceId, + parentId, + traceFlags, + isSampled: (parseInt(traceFlags, 16) & 1) === 1 + }; +} + +//#endregion +//#region ../../shared/tracing/dist/module/validate.js +/** +* Check if trace context should be propagated to the target URL. +* +* This function checks if the target URL matches any of the configured +* propagation targets. Targets can be: +* - String: Exact hostname match or wildcard domain (*.example.com) +* - RegExp: Pattern matching hostname +* - Function: Custom logic to determine if URL should receive trace context +* +* @param targetUrl - The URL to check +* @param targets - Array of propagation targets +* @returns True if trace context should be propagated, false otherwise +* +* @example +* ```typescript +* const targets = [ +* 'myproject.supabase.co', // Exact match +* '*.supabase.co', // Wildcard domain +* /.*\.supabase\.co$/, // Regex pattern +* (url) => url.hostname === 'localhost' // Custom function +* ] +* +* shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets) +* // true +* +* shouldPropagateToTarget('https://evil.com/api', targets) +* // false +* ``` +*/ +function shouldPropagateToTarget(targetUrl, targets) { + if (!targetUrl || !targets || targets.length === 0) return false; + let url; + if (targetUrl instanceof URL) url = targetUrl; + else try { + url = new URL(targetUrl); + } catch (error) { + return false; + } + for (const target of targets) try { + if (typeof target === "string") { + if (matchStringTarget(url.hostname, target)) return true; + } else if (target instanceof RegExp) { + if (target.test(url.hostname)) return true; + } else if (typeof target === "function") { + if (target(url)) return true; + } + } catch (error) { + continue; + } + return false; +} +/** +* Match hostname against string target (exact match or wildcard) +* +* @param hostname - The hostname to check +* @param target - The target pattern (exact or wildcard) +* @returns True if hostname matches target +*/ +function matchStringTarget(hostname, target) { + if (target === hostname) return true; + if (target.startsWith("*.")) { + const domain = target.slice(2); + if (hostname.endsWith(domain)) { + if (hostname === domain || hostname.endsWith("." + domain)) return true; + } + } + return false; +} + +//#endregion +//#region ../../shared/tracing/dist/module/defaults.js +/** +* Generate default propagation targets based on the Supabase project URL. +* +* By default, trace context is only propagated to Supabase domains for +* security. This prevents leaking trace context to potentially malicious +* third-party services. +* +* Wildcard strings (e.g. `*.supabase.co`) are matched with linear string +* operations rather than regex, avoiding ReDoS risk. +* +* @param supabaseUrl - The Supabase project URL +* @returns Array of default propagation targets +*/ +function getDefaultPropagationTargets(supabaseUrl) { + const targets = []; + try { + const url = new URL(supabaseUrl); + targets.push(url.hostname); + } catch (error) {} + targets.push("*.supabase.co", "*.supabase.in"); + targets.push("localhost", "127.0.0.1", "[::1]"); + return targets; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) { + return typeof o$1; + } : function(o$1) { + return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1; + }, _typeof(o); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} + +//#endregion +//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r$1) { + return Object.getOwnPropertyDescriptor(e, r$1).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) { + _defineProperty(e, r$1, t[r$1]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) { + Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1)); + }); + } + return e; +} + +//#endregion +//#region src/lib/fetch.ts +const resolveFetch = (customFetch) => { + if (customFetch) return (...args) => customFetch(...args); + return (...args) => fetch(...args); +}; +const resolveHeadersConstructor = () => { + return Headers; +}; +/** +* New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and +* must never be sent as a Bearer token — they belong only in the `apikey` header. +* All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_` +* subtypes) keep the Bearer fallback. +*/ +const isNewApiKey = (key) => key.startsWith("sb_publishable_") || key.startsWith("sb_secret_"); +const TEMP_KEY_PREFIX = "sb_temp_"; +const warnedKeySubtypes = /* @__PURE__ */ new Set(); +/** +* Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes. +* Never throws — the server, not the SDK, decides key validity. The key value is never +* included in the message. +*/ +const checkApiKeyFormat = (key) => { + var _key$match$, _key$match; + if (!key.startsWith("sb_") || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) return; + const subtype = (_key$match$ = (_key$match = key.match(/^sb_[a-zA-Z0-9]+_/)) === null || _key$match === void 0 ? void 0 : _key$match[0]) !== null && _key$match$ !== void 0 ? _key$match$ : "unknown"; + if (warnedKeySubtypes.has(subtype)) return; + warnedKeySubtypes.add(subtype); + console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."); +}; +const fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions, options) => { + const fetch$1 = resolveFetch(customFetch); + const HeadersConstructor = resolveHeadersConstructor(); + const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) === true; + const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== false; + const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null; + const allowKeyAsBearer = !((options === null || options === void 0 ? void 0 : options.omitApiKeyAsBearer) && isNewApiKey(supabaseKey)); + return async (input, init) => { + const realToken = await getAccessToken(); + let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers); + if (!headers.has("apikey")) headers.set("apikey", supabaseKey); + if (!headers.has("Authorization")) { + const bearer = realToken !== null && realToken !== void 0 ? realToken : allowKeyAsBearer ? supabaseKey : null; + if (bearer) headers.set("Authorization", `Bearer ${bearer}`); + } + if (traceTargets) { + const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling); + if (traceHeaders) { + if (traceHeaders.traceparent && !headers.has("traceparent")) headers.set("traceparent", traceHeaders.traceparent); + if (traceHeaders.tracestate && !headers.has("tracestate")) headers.set("tracestate", traceHeaders.tracestate); + if (traceHeaders.baggage && !headers.has("baggage")) headers.set("baggage", traceHeaders.baggage); + } + } + return fetch$1(input, _objectSpread2(_objectSpread2({}, init), {}, { headers })); + }; +}; +let warnedMissingTracingRuntime = false; +let warnedNonW3CPropagator = false; +function getTraceHeaders(input, targets, respectSampling) { + const extractTraceContext = getTraceContextExtractor(); + if (!extractTraceContext) { + if (!warnedMissingTracingRuntime) { + warnedMissingTracingRuntime = true; + console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation."); + } + return null; + } + if (!shouldPropagateToTarget(typeof input === "string" ? input : input instanceof URL ? input : input.url, targets)) return null; + const traceContext = extractTraceContext(); + if (!traceContext || !traceContext.traceparent) { + var _traceContext$carrier; + if ((traceContext === null || traceContext === void 0 || (_traceContext$carrier = traceContext.carrierKeys) === null || _traceContext$carrier === void 0 ? void 0 : _traceContext$carrier.length) && !warnedNonW3CPropagator) { + warnedNonW3CPropagator = true; + const sentryHint = traceContext.carrierKeys.includes("sentry-trace") ? " Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it." : " Configure your tracing SDK to emit W3C trace context on outgoing requests."; + console.warn(`@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its propagator wrote [${traceContext.carrierKeys.join(", ")}] and no W3C traceparent header, so trace headers will not be attached.` + sentryHint); + } + return null; + } + if (respectSampling) { + const parsed = parseTraceParent(traceContext.traceparent); + if (parsed && !parsed.isSampled) return { traceparent: traceContext.traceparent }; + } + return traceContext; +} + +//#endregion +//#region src/lib/helpers.ts +function normalizeTracePropagation(value) { + return typeof value === "boolean" ? { enabled: value } : value; +} +function ensureTrailingSlash(url) { + return url.endsWith("/") ? url : url + "/"; +} +function applySettingDefaults(options, defaults) { + var _DEFAULT_GLOBAL_OPTIO, _globalOptions$header, _ref, _tracePropagationOpti, _ref2, _tracePropagationOpti2; + const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options; + const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults; + const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation); + const DEFAULT_TRACE_PROPAGATION_OPTIONS$1 = normalizeTracePropagation(defaults.tracePropagation); + const result = { + db: _objectSpread2(_objectSpread2({}, DEFAULT_DB_OPTIONS$1), dbOptions), + auth: _objectSpread2(_objectSpread2({}, DEFAULT_AUTH_OPTIONS$1), authOptions), + realtime: _objectSpread2(_objectSpread2({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions), + storage: {}, + global: _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread2(_objectSpread2({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }), + tracePropagation: { + enabled: (_ref = (_tracePropagationOpti = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) !== null && _tracePropagationOpti !== void 0 ? _tracePropagationOpti : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.enabled) !== null && _ref !== void 0 ? _ref : false, + respectSamplingDecision: (_ref2 = (_tracePropagationOpti2 = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== null && _tracePropagationOpti2 !== void 0 ? _tracePropagationOpti2 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.respectSamplingDecision) !== null && _ref2 !== void 0 ? _ref2 : true + }, + accessToken: async () => "" + }; + if (options.accessToken) result.accessToken = options.accessToken; + else delete result.accessToken; + return result; +} +/** +* Validates a Supabase client URL +* +* @param {string} supabaseUrl - The Supabase client URL string. +* @returns {URL} - The validated base URL. +* @throws {Error} +*/ +function validateSupabaseUrl(supabaseUrl) { + const trimmedUrl = supabaseUrl === null || supabaseUrl === void 0 ? void 0 : supabaseUrl.trim(); + if (!trimmedUrl) throw new Error("supabaseUrl is required."); + if (!trimmedUrl.match(/^https?:\/\//i)) throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL."); + try { + return new URL(ensureTrailingSlash(trimmedUrl)); + } catch (_unused) { + throw Error("Invalid supabaseUrl: Provided URL is malformed."); + } +} + +//#endregion +//#region src/lib/SupabaseAuthClient.ts +var SupabaseAuthClient = class extends AuthClient { + constructor(options) { + super(options); + } +}; + +//#endregion +//#region src/SupabaseClient.ts +/** +* Supabase Client. +* +* An isomorphic Javascript client for interacting with Postgres. +*/ +var SupabaseClient = class { + /** + * Create a new client for use in the browser. + * + * @category Initializing + * + * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard. + * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard. + * @param options Optional configuration for the client: + * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase. + * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring. + * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage. + * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user. + * - `realtime` — Options passed along to the realtime-js constructor. + * - `storage` — Options passed along to the storage-js constructor. + * - `global.fetch` — A custom fetch implementation. + * - `global.headers` — Any additional headers to send with each network request. + * + * @example Creating a client + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Create a single supabase client for interacting with your database + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * ``` + * + * @example With a custom domain + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Use a custom domain as the supabase URL + * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key') + * ``` + * + * @example With additional parameters + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const options = { + * db: { + * schema: 'public', + * }, + * auth: { + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: true + * }, + * global: { + * headers: { 'x-my-custom-header': 'my-app-name' }, + * }, + * } + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options) + * ``` + * + * @exampleDescription With custom schemas + * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. + * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API. + * + * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. + * + * @example With custom schemas + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * // Provide a custom schema. Defaults to "public". + * db: { schema: 'other_schema' } + * }) + * ``` + * + * @exampleDescription Custom fetch implementation + * `supabase-js` uses the runtime's global `fetch` to make HTTP requests, + * but an alternative `fetch` implementation can be provided as an option. + * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior. + * + * @example Custom fetch implementation + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * global: { fetch: fetch.bind(globalThis) } + * }) + * ``` + * + * @exampleDescription React Native options with AsyncStorage + * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. + * + * @example React Native options with AsyncStorage + * ```js + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from "@react-native-async-storage/async-storage"; + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: AsyncStorage, + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @exampleDescription React Native options with Expo SecureStore + * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore. + * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode. + * A new 256-bit encryption key is generated using the `react-native-get-random-values` library. + * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage. + * + * Please make sure that: + * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date. + * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs. + * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed. + * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities. + * + * @example React Native options with Expo SecureStore + * ```ts + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from '@react-native-async-storage/async-storage'; + * import * as SecureStore from 'expo-secure-store'; + * import * as aesjs from 'aes-js'; + * import 'react-native-get-random-values'; + * + * // As Expo's SecureStore does not support values larger than 2048 + * // bytes, an AES-256 key is generated and stored in SecureStore, while + * // it is used to encrypt/decrypt values stored in AsyncStorage. + * class LargeSecureStore { + * private async _encrypt(key: string, value: string) { + * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8)); + * + * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1)); + * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value)); + * + * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey)); + * + * return aesjs.utils.hex.fromBytes(encryptedBytes); + * } + * + * private async _decrypt(key: string, value: string) { + * const encryptionKeyHex = await SecureStore.getItemAsync(key); + * if (!encryptionKeyHex) { + * return encryptionKeyHex; + * } + * + * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1)); + * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value)); + * + * return aesjs.utils.utf8.fromBytes(decryptedBytes); + * } + * + * async getItem(key: string) { + * const encrypted = await AsyncStorage.getItem(key); + * if (!encrypted) { return encrypted; } + * + * return await this._decrypt(key, encrypted); + * } + * + * async removeItem(key: string) { + * await AsyncStorage.removeItem(key); + * await SecureStore.deleteItemAsync(key); + * } + * + * async setItem(key: string, value: string) { + * const encrypted = await this._encrypt(key, value); + * + * await AsyncStorage.setItem(key, encrypted); + * } + * } + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: new LargeSecureStore(), + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @example With a database query + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * + * const { data } = await supabase.from('profiles').select('*') + * ``` + * + * @exampleDescription With OpenTelemetry tracing + * Opt in to W3C trace context propagation so the `trace_id` from your + * client-side spans is attached to Supabase requests and appears in API + * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be + * installed in your application and the tracing runtime to be loaded via + * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing). + * + * @example With OpenTelemetry tracing + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * tracePropagation: true, + * }) + * + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Outgoing request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + */ + constructor(supabaseUrl, supabaseKey, options) { + var _settings$auth$storag, _settings$global$head; + this.supabaseUrl = supabaseUrl; + this.supabaseKey = supabaseKey; + const baseUrl = validateSupabaseUrl(supabaseUrl); + if (!supabaseKey) throw new Error("supabaseKey is required."); + checkApiKeyFormat(supabaseKey); + this.realtimeUrl = new URL("realtime/v1", baseUrl); + this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace("http", "ws"); + this.authUrl = new URL("auth/v1", baseUrl); + this.storageUrl = new URL("storage/v1", baseUrl); + this.functionsUrl = new URL("functions/v1", baseUrl); + const defaultStorageKey = `sb-${baseUrl.hostname.split(".")[0]}-auth-token`; + const DEFAULTS = { + db: DEFAULT_DB_OPTIONS, + realtime: DEFAULT_REALTIME_OPTIONS, + auth: _objectSpread2(_objectSpread2({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }), + global: DEFAULT_GLOBAL_OPTIONS, + tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS + }; + const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS); + this.settings = settings; + this.storageKey = (_settings$auth$storag = settings.auth.storageKey) !== null && _settings$auth$storag !== void 0 ? _settings$auth$storag : ""; + this.headers = (_settings$global$head = settings.global.headers) !== null && _settings$global$head !== void 0 ? _settings$global$head : {}; + if (!settings.accessToken) { + var _settings$auth; + this.auth = this._initSupabaseAuthClient((_settings$auth = settings.auth) !== null && _settings$auth !== void 0 ? _settings$auth : {}, this.headers, settings.global.fetch); + } else { + this.accessToken = settings.accessToken; + this.auth = new Proxy({}, { get: (_, prop) => { + throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`); + } }); + } + this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation); + this.functionsFetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation, { omitApiKeyAsBearer: true }); + this.realtime = this._initRealtimeClient(_objectSpread2({ + headers: this.headers, + accessToken: this._getAccessToken.bind(this), + fetch: this.fetch + }, settings.realtime)); + if (this.accessToken) Promise.resolve(this.accessToken()).then((token) => this.realtime.setAuth(token)).catch((e) => console.warn("Failed to set initial Realtime auth token:", e)); + this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, { + headers: this.headers, + schema: settings.db.schema, + fetch: this.fetch, + timeout: settings.db.timeout, + urlLengthLimit: settings.db.urlLengthLimit, + retry: settings.db.retry + }); + this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage); + if (!settings.accessToken) this._listenForAuthEvents(); + } + /** + * Supabase Functions allows you to deploy and invoke edge functions. + */ + get functions() { + return new FunctionsClient(this.functionsUrl.href, { + headers: this.headers, + customFetch: this.functionsFetch + }); + } + /** + * Perform a query on a table or a view. + * + * @param relation - The table or view name to query + */ + from(relation) { + return this.rest.from(relation); + } + /** + * Select a schema to query or perform an function (rpc) call. + * + * The schema needs to be on the list of exposed schemas inside Supabase. + * + * @param schema - The schema to query + */ + schema(schema) { + return this.rest.schema(schema); + } + /** + * Perform a function call. + * + * @param fn - The function name to call + * @param args - The arguments to pass to the function call + * @param options - Named parameters + * @param options.head - When set to `true`, `data` will not be returned. + * Useful if you only need the count. + * @param options.get - When set to `true`, the function will be called with + * read-only access mode. + * @param options.count - Count algorithm to use to count rows returned by the + * function. Only applicable for [set-returning + * functions](https://www.postgresql.org/docs/current/functions-srf.html). + * + * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the + * hood. + * + * `"planned"`: Approximated but fast count algorithm. Uses the Postgres + * statistics under the hood. + * + * `"estimated"`: Uses exact count for low numbers and planned count for high + * numbers. + */ + rpc(fn, args = {}, options = { + head: false, + get: false, + count: void 0 + }) { + return this.rest.rpc(fn, args, options); + } + /** + * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. + * + * @param {string} name - The name of the Realtime channel. + * @param {Object} opts - The options to pass to the Realtime channel. + * + * @category Realtime + */ + channel(name, opts = { config: {} }) { + return this.realtime.channel(name, opts); + } + /** + * Returns all Realtime channels. + * + * @category Realtime + * + * @example Get all channels + * ```js + * const channels = supabase.getChannels() + * ``` + */ + getChannels() { + return this.realtime.getChannels(); + } + /** + * Unsubscribes and removes Realtime channel from Realtime client. + * + * @param {RealtimeChannel} channel - The name of the Realtime channel. + * + * + * @category Realtime + * + * @remarks + * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Removes a channel + * ```js + * supabase.removeChannel(myChannel) + * ``` + */ + removeChannel(channel) { + return this.realtime.removeChannel(channel); + } + /** + * Unsubscribes and removes all Realtime channels from Realtime client. + * + * @category Realtime + * + * @remarks + * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Remove all channels + * ```js + * supabase.removeAllChannels() + * ``` + */ + removeAllChannels() { + return this.realtime.removeAllChannels(); + } + /** + * The raw session token — the custom `accessToken` result or the signed-in user's JWT — + * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back + * to `supabaseKey`, so callers can distinguish "no session" from "has session". + */ + async _getSessionToken() { + var _this = this; + var _data$session$access_, _data$session; + if (_this.accessToken) return await _this.accessToken(); + const { data } = await _this.auth.getSession(); + return (_data$session$access_ = (_data$session = data.session) === null || _data$session === void 0 ? void 0 : _data$session.access_token) !== null && _data$session$access_ !== void 0 ? _data$session$access_ : null; + } + async _getAccessToken() { + var _this2 = this; + var _await$this$_getSessi; + return (_await$this$_getSessi = await _this2._getSessionToken()) !== null && _await$this$_getSessi !== void 0 ? _await$this$_getSessi : _this2.supabaseKey; + } + _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, experimental, lockAcquireTimeout, skipAutoInitialize }, headers, fetch$1) { + const authHeaders = { + Authorization: `Bearer ${this.supabaseKey}`, + apikey: `${this.supabaseKey}` + }; + return new SupabaseAuthClient({ + url: this.authUrl.href, + headers: _objectSpread2(_objectSpread2({}, authHeaders), headers), + storageKey, + autoRefreshToken, + persistSession, + detectSessionInUrl, + storage, + userStorage, + flowType, + lock, + debug, + throwOnError, + experimental, + fetch: fetch$1, + lockAcquireTimeout, + skipAutoInitialize, + hasCustomAuthorizationHeader: Object.keys(this.headers).some((key) => key.toLowerCase() === "authorization") + }); + } + _initRealtimeClient(options) { + return new RealtimeClient(this.realtimeUrl.href, _objectSpread2(_objectSpread2({}, options), {}, { params: _objectSpread2(_objectSpread2({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) })); + } + _listenForAuthEvents() { + return this.auth.onAuthStateChange((event, session) => { + this._handleTokenChanged(event, "CLIENT", session === null || session === void 0 ? void 0 : session.access_token); + }); + } + _handleTokenChanged(event, source, token) { + if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN" || event === "INITIAL_SESSION") && this.changedAccessToken !== token) { + this.changedAccessToken = token; + this.realtime.setAuth(token); + } else if (event === "SIGNED_OUT") { + this.realtime.setAuth(); + if (source == "STORAGE") this.auth.signOut(); + this.changedAccessToken = void 0; + } + } +}; + +//#endregion +//#region src/index.ts +/** +* Creates a new Supabase Client. +* +* @example Creating a Supabase client +* ```ts +* import { createClient } from '@supabase/supabase-js' +* +* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') +* const { data, error } = await supabase.from('profiles').select('*') +* ``` +*/ +const createClient = (supabaseUrl, supabaseKey, options) => { + return new SupabaseClient(supabaseUrl, supabaseKey, options); +}; +function shouldShowDeprecationWarning() { + if (typeof window !== "undefined" || globalThis["Deno"] !== void 0) return false; + const _process = globalThis["process"]; + if (!_process) return false; + const processVersion = _process["version"]; + if (processVersion === void 0 || processVersion === null) return false; + const versionMatch = processVersion.match(/^v(\d+)\./); + if (!versionMatch) return false; + return parseInt(versionMatch[1], 10) <= 20; +} +if (shouldShowDeprecationWarning()) console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715"); + +//#endregion +export { FunctionRegion, FunctionsError, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, PostgrestError, StorageApiError, SupabaseClient, createClient }; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/index.mjs.map b/node_modules/@supabase/supabase-js/dist/index.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..e2008eb96270895a3af888aa84a5ceaeb1d2beee --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","names":["JS_RUNTIME_VERSION: string | undefined","DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions","DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions","DEFAULT_TRACE_PROPAGATION_OPTIONS: TracePropagationOptions","version","fetch","traceTargets: TracePropagationTarget[] | null","DEFAULT_DB_OPTIONS","DEFAULT_AUTH_OPTIONS","DEFAULT_REALTIME_OPTIONS","DEFAULT_GLOBAL_OPTIONS","DEFAULT_TRACE_PROPAGATION_OPTIONS","result: ResolvedSupabaseClientOptions","supabaseUrl: string","supabaseKey: string","SupabaseStorageClient","this"],"sources":["../src/lib/version.ts","../src/lib/constants.ts","../../../shared/tracing/dist/module/parse.js","../../../shared/tracing/dist/module/validate.js","../../../shared/tracing/dist/module/defaults.js","../src/lib/fetch.ts","../src/lib/helpers.ts","../src/lib/SupabaseAuthClient.ts","../src/SupabaseClient.ts","../src/index.ts"],"sourcesContent":["// Generated automatically during releases by scripts/update-version-files.ts\n// This file provides runtime access to the package version for:\n// - HTTP request headers (e.g., X-Client-Info header for API requests)\n// - Debugging and support (identifying which version is running)\n// - Telemetry and logging (version reporting in errors/analytics)\n// - Ensuring build artifacts match the published package version\nexport const version = '2.112.3'\n","// constants.ts\nimport { RealtimeClientOptions } from '@supabase/realtime-js'\nimport { SupabaseAuthClientOptions, TracePropagationOptions } from './types'\nimport { version } from './version'\n\nlet JS_ENV = ''\nlet JS_RUNTIME_VERSION: string | undefined\n// @ts-ignore\nif (typeof Deno !== 'undefined') {\n JS_ENV = 'deno'\n // @ts-ignore\n JS_RUNTIME_VERSION = Deno.version?.deno\n} else if (typeof document !== 'undefined') {\n JS_ENV = 'web'\n} else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n JS_ENV = 'react-native'\n} else {\n JS_ENV = 'node'\n const _process = (globalThis as any)['process']\n JS_RUNTIME_VERSION = _process?.['version']?.replace(/^v/, '')\n}\n\nconst _runtimeMeta = [`runtime=${JS_ENV}`]\nif (JS_RUNTIME_VERSION) {\n _runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`)\n}\n\nexport const DEFAULT_HEADERS = {\n 'X-Client-Info': `supabase-js/${version}; ${_runtimeMeta.join('; ')}`,\n}\n\nexport const DEFAULT_GLOBAL_OPTIONS = {\n headers: DEFAULT_HEADERS,\n}\n\nexport const DEFAULT_DB_OPTIONS = {\n schema: 'public',\n}\n\nexport const DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions = {\n autoRefreshToken: true,\n persistSession: true,\n detectSessionInUrl: true,\n flowType: 'implicit',\n}\n\nexport const DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions = {}\n\nexport const DEFAULT_TRACE_PROPAGATION_OPTIONS: TracePropagationOptions = {\n enabled: false,\n respectSamplingDecision: true,\n}\n","/**\n * Parse W3C traceparent header according to the specification.\n *\n * The traceparent header format is: version-traceid-parentid-traceflags\n * - version: 2 hex digits (currently always \"00\")\n * - traceid: 32 hex digits (128-bit trace identifier)\n * - parentid: 16 hex digits (64-bit span/parent identifier)\n * - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag)\n *\n * @param traceparent - The traceparent header value\n * @returns Parsed traceparent object, or null if invalid format\n *\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n *\n * @example\n * ```typescript\n * const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01')\n *\n * console.log(parsed)\n * // {\n * // version: '00',\n * // traceId: '0af7651916cd43dd8448eb211c80319c',\n * // parentId: 'b7ad6b7169203331',\n * // traceFlags: '01',\n * // isSampled: true\n * // }\n * ```\n */\nexport function parseTraceParent(traceparent) {\n if (!traceparent || typeof traceparent !== 'string') {\n return null;\n }\n // Split by hyphen\n const parts = traceparent.split('-');\n // Must have exactly 4 parts\n if (parts.length !== 4) {\n return null;\n }\n const [version, traceId, parentId, traceFlags] = parts;\n // Validate field lengths according to W3C spec\n if (version.length !== 2 ||\n traceId.length !== 32 ||\n parentId.length !== 16 ||\n traceFlags.length !== 2) {\n return null;\n }\n // Validate that all fields are valid hexadecimal\n const hexRegex = /^[0-9a-f]+$/i;\n if (!hexRegex.test(version) ||\n !hexRegex.test(traceId) ||\n !hexRegex.test(parentId) ||\n !hexRegex.test(traceFlags)) {\n return null;\n }\n // Validate that trace-id and parent-id are not all zeros (invalid per spec)\n if (traceId === '00000000000000000000000000000000' || parentId === '0000000000000000') {\n return null;\n }\n // Parse sampling decision from trace-flags (bit 0)\n const flags = parseInt(traceFlags, 16);\n const isSampled = (flags & 0x01) === 0x01;\n return {\n version,\n traceId,\n parentId,\n traceFlags,\n isSampled,\n };\n}\n//# sourceMappingURL=parse.js.map","/**\n * Check if trace context should be propagated to the target URL.\n *\n * This function checks if the target URL matches any of the configured\n * propagation targets. Targets can be:\n * - String: Exact hostname match or wildcard domain (*.example.com)\n * - RegExp: Pattern matching hostname\n * - Function: Custom logic to determine if URL should receive trace context\n *\n * @param targetUrl - The URL to check\n * @param targets - Array of propagation targets\n * @returns True if trace context should be propagated, false otherwise\n *\n * @example\n * ```typescript\n * const targets = [\n * 'myproject.supabase.co', // Exact match\n * '*.supabase.co', // Wildcard domain\n * /.*\\.supabase\\.co$/, // Regex pattern\n * (url) => url.hostname === 'localhost' // Custom function\n * ]\n *\n * shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets)\n * // true\n *\n * shouldPropagateToTarget('https://evil.com/api', targets)\n * // false\n * ```\n */\nexport function shouldPropagateToTarget(targetUrl, targets) {\n if (!targetUrl || !targets || targets.length === 0) {\n return false;\n }\n let url;\n if (targetUrl instanceof URL) {\n url = targetUrl;\n }\n else {\n try {\n url = new URL(targetUrl);\n }\n catch (error) {\n // Invalid URL\n return false;\n }\n }\n // Check each target\n for (const target of targets) {\n try {\n if (typeof target === 'string') {\n // String matcher: exact match or wildcard domain\n if (matchStringTarget(url.hostname, target)) {\n return true;\n }\n }\n else if (target instanceof RegExp) {\n // Regex matcher\n if (target.test(url.hostname)) {\n return true;\n }\n }\n else if (typeof target === 'function') {\n // Function matcher\n if (target(url)) {\n return true;\n }\n }\n }\n catch (error) {\n // Ignore errors from individual matchers and continue\n continue;\n }\n }\n return false;\n}\n/**\n * Match hostname against string target (exact match or wildcard)\n *\n * @param hostname - The hostname to check\n * @param target - The target pattern (exact or wildcard)\n * @returns True if hostname matches target\n */\nfunction matchStringTarget(hostname, target) {\n // Exact match\n if (target === hostname) {\n return true;\n }\n // Wildcard domain match (*.example.com)\n if (target.startsWith('*.')) {\n const domain = target.slice(2); // Remove \"*.\"\n // Check if hostname ends with the domain\n if (hostname.endsWith(domain)) {\n // Ensure it's either an exact match or has a subdomain\n // (prevents \"notexample.com\" from matching \"*.example.com\")\n if (hostname === domain || hostname.endsWith('.' + domain)) {\n return true;\n }\n }\n }\n return false;\n}\n//# sourceMappingURL=validate.js.map","/**\n * Generate default propagation targets based on the Supabase project URL.\n *\n * By default, trace context is only propagated to Supabase domains for\n * security. This prevents leaking trace context to potentially malicious\n * third-party services.\n *\n * Wildcard strings (e.g. `*.supabase.co`) are matched with linear string\n * operations rather than regex, avoiding ReDoS risk.\n *\n * @param supabaseUrl - The Supabase project URL\n * @returns Array of default propagation targets\n */\nexport function getDefaultPropagationTargets(supabaseUrl) {\n const targets = [];\n // Add exact project hostname\n try {\n const url = new URL(supabaseUrl);\n targets.push(url.hostname);\n }\n catch (error) {\n // Invalid URL, skip exact hostname\n }\n // Supabase cloud domains. Use wildcard strings (not regex) — these are\n // matched by linear hostname-suffix checks, so there is no ReDoS surface.\n targets.push('*.supabase.co', '*.supabase.in');\n // Localhost and loopback addresses for local development.\n targets.push('localhost', '127.0.0.1', '[::1]');\n return targets;\n}\n//# sourceMappingURL=defaults.js.map","import {\n parseTraceParent,\n shouldPropagateToTarget,\n getDefaultPropagationTargets,\n type TraceContext,\n type TracePropagationTarget,\n} from '@supabase/tracing'\nimport { getTraceContextExtractor } from './tracingRegistry'\nimport type { TracePropagationOptions } from './types'\n\ntype Fetch = typeof fetch\n\nexport const resolveFetch = (customFetch?: Fetch): Fetch => {\n if (customFetch) {\n return (...args: Parameters) => customFetch(...args)\n }\n return (...args: Parameters) => fetch(...args)\n}\n\nexport const resolveHeadersConstructor = () => {\n return Headers\n}\n\n/**\n * New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and\n * must never be sent as a Bearer token — they belong only in the `apikey` header.\n * All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_`\n * subtypes) keep the Bearer fallback.\n */\nconst isNewApiKey = (key: string): boolean =>\n key.startsWith('sb_publishable_') || key.startsWith('sb_secret_')\n\nconst TEMP_KEY_PREFIX = 'sb_temp_'\n\nconst warnedKeySubtypes = new Set()\n\n/**\n * Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes.\n * Never throws — the server, not the SDK, decides key validity. The key value is never\n * included in the message.\n */\nexport const checkApiKeyFormat = (key: string): void => {\n if (!key.startsWith('sb_') || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) {\n return\n }\n const subtype = key.match(/^sb_[a-zA-Z0-9]+_/)?.[0] ?? 'unknown'\n if (warnedKeySubtypes.has(subtype)) {\n return\n }\n warnedKeySubtypes.add(subtype)\n console.warn(\n '@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed ' +\n 'and send this key as-is; if you see authentication errors you may need to upgrade ' +\n '@supabase/supabase-js to a version that recognizes this key type.'\n )\n}\n\nexport const fetchWithAuth = (\n supabaseKey: string,\n supabaseUrl: string,\n getAccessToken: () => Promise,\n customFetch?: Fetch,\n tracePropagationOptions?: TracePropagationOptions,\n options?: { omitApiKeyAsBearer?: boolean }\n): Fetch => {\n const fetch = resolveFetch(customFetch)\n const HeadersConstructor = resolveHeadersConstructor()\n\n // Pre-compute trace propagation state once. When disabled, the per-request\n // path skips all tracing work with a single truthy check.\n const traceEnabled = tracePropagationOptions?.enabled === true\n const respectSampling = tracePropagationOptions?.respectSamplingDecision !== false\n const traceTargets: TracePropagationTarget[] | null = traceEnabled\n ? getDefaultPropagationTargets(supabaseUrl)\n : null\n\n // Whether the API key may be used as the `Authorization` Bearer fallback when there is no\n // session token. Disabled for Edge Functions with a new-format key (see `isNewApiKey`).\n // Static per instance, so it is computed once here rather than on every request.\n const allowKeyAsBearer = !(options?.omitApiKeyAsBearer && isNewApiKey(supabaseKey))\n\n return async (input, init) => {\n const realToken = await getAccessToken()\n let headers = new HeadersConstructor(init?.headers)\n\n if (!headers.has('apikey')) {\n headers.set('apikey', supabaseKey)\n }\n\n if (!headers.has('Authorization')) {\n const bearer = realToken ?? (allowKeyAsBearer ? supabaseKey : null)\n if (bearer) {\n headers.set('Authorization', `Bearer ${bearer}`)\n }\n }\n\n if (traceTargets) {\n const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling)\n\n if (traceHeaders) {\n if (traceHeaders.traceparent && !headers.has('traceparent')) {\n headers.set('traceparent', traceHeaders.traceparent)\n }\n if (traceHeaders.tracestate && !headers.has('tracestate')) {\n headers.set('tracestate', traceHeaders.tracestate)\n }\n if (traceHeaders.baggage && !headers.has('baggage')) {\n headers.set('baggage', traceHeaders.baggage)\n }\n }\n }\n\n return fetch(input, { ...init, headers })\n }\n}\n\nlet warnedMissingTracingRuntime = false\nlet warnedNonW3CPropagator = false\n\n/**\n * For tests only. Resets the one-time missing-tracing-runtime warning.\n *\n * @internal\n */\nexport function _resetTracingRuntimeWarning(): void {\n warnedMissingTracingRuntime = false\n}\n\n/**\n * For tests only. Resets the one-time non-W3C-propagator warning.\n *\n * @internal\n */\nexport function _resetNonW3CPropagatorWarning(): void {\n warnedNonW3CPropagator = false\n}\n\nfunction getTraceHeaders(\n input: RequestInfo | URL,\n targets: TracePropagationTarget[],\n respectSampling: boolean\n): TraceContext | null {\n // Read the registry before the target check so the warning fires on the\n // first request with tracing enabled, not only on Supabase-target ones.\n // Reading per request (one globalThis property access) deliberately\n // supports late registration: with ESM evaluation order, `createClient`\n // can run in a module evaluated before the application entry point's\n // `import '@supabase/supabase-js/tracing'`.\n const extractTraceContext = getTraceContextExtractor()\n\n if (!extractTraceContext) {\n if (!warnedMissingTracingRuntime) {\n warnedMissingTracingRuntime = true\n console.warn(\n '@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, ' +\n \"so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at \" +\n 'your application entry point (requires the OpenTelemetry API package to be installed). ' +\n 'The CDN/UMD build does not support trace propagation.'\n )\n }\n return null\n }\n\n const targetUrl: string | URL =\n typeof input === 'string' ? input : input instanceof URL ? input : input.url\n\n if (!shouldPropagateToTarget(targetUrl, targets)) {\n return null\n }\n\n const traceContext = extractTraceContext()\n\n if (!traceContext || !traceContext.traceparent) {\n // An active propagator that writes vendor headers but no W3C\n // `traceparent` (e.g. Sentry without `propagateTraceparent: true`) is\n // otherwise indistinguishable from \"no active trace\" — warn once so the\n // user learns why no trace headers are attached. An empty carrier means\n // no active trace: normal, stay silent.\n if (traceContext?.carrierKeys?.length && !warnedNonW3CPropagator) {\n warnedNonW3CPropagator = true\n const sentryHint = traceContext.carrierKeys.includes('sentry-trace')\n ? ' Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.'\n : ' Configure your tracing SDK to emit W3C trace context on outgoing requests.'\n console.warn(\n '@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its ' +\n `propagator wrote [${traceContext.carrierKeys.join(', ')}] and no W3C traceparent header, ` +\n 'so trace headers will not be attached.' +\n sentryHint\n )\n }\n return null\n }\n\n if (respectSampling) {\n const parsed = parseTraceParent(traceContext.traceparent)\n if (parsed && !parsed.isSampled) {\n // Unsampled traces still carry `traceparent` so Supabase logs get a\n // trace_id to correlate on; the flag stays `00`, so downstream tracing\n // never records it as sampled. `tracestate` and `baggage` (the\n // vendor/application data channels) are withheld on these requests.\n return { traceparent: traceContext.traceparent }\n }\n }\n\n return traceContext\n}\n","// helpers.ts\nimport { SupabaseClientOptions, TracePropagationOptions } from './types'\n\nfunction normalizeTracePropagation(\n value: TracePropagationOptions | boolean | undefined\n): TracePropagationOptions | undefined {\n return typeof value === 'boolean' ? { enabled: value } : value\n}\n\nexport function uuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\nexport function ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : url + '/'\n}\n\nexport const isBrowser = () => typeof window !== 'undefined'\n\nexport type ResolvedSupabaseClientOptions = Omit<\n Required>,\n 'tracePropagation'\n> & {\n tracePropagation: TracePropagationOptions\n}\n\nexport function applySettingDefaults<\n Database = any,\n SchemaName extends string & keyof Database = 'public' extends keyof Database\n ? 'public'\n : string & keyof Database,\n>(\n options: SupabaseClientOptions,\n defaults: SupabaseClientOptions\n): ResolvedSupabaseClientOptions {\n const {\n db: dbOptions,\n auth: authOptions,\n realtime: realtimeOptions,\n global: globalOptions,\n } = options\n const {\n db: DEFAULT_DB_OPTIONS,\n auth: DEFAULT_AUTH_OPTIONS,\n realtime: DEFAULT_REALTIME_OPTIONS,\n global: DEFAULT_GLOBAL_OPTIONS,\n } = defaults\n\n // Accept either a boolean shorthand or an options object on both sides.\n const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation)\n const DEFAULT_TRACE_PROPAGATION_OPTIONS = normalizeTracePropagation(defaults.tracePropagation)\n\n const result: ResolvedSupabaseClientOptions = {\n db: {\n ...DEFAULT_DB_OPTIONS,\n ...dbOptions,\n },\n auth: {\n ...DEFAULT_AUTH_OPTIONS,\n ...authOptions,\n },\n realtime: {\n ...DEFAULT_REALTIME_OPTIONS,\n ...realtimeOptions,\n },\n storage: {},\n global: {\n ...DEFAULT_GLOBAL_OPTIONS,\n ...globalOptions,\n headers: {\n ...(DEFAULT_GLOBAL_OPTIONS?.headers ?? {}),\n ...(globalOptions?.headers ?? {}),\n },\n },\n tracePropagation: {\n enabled:\n tracePropagationOptions?.enabled ?? DEFAULT_TRACE_PROPAGATION_OPTIONS?.enabled ?? false,\n respectSamplingDecision:\n tracePropagationOptions?.respectSamplingDecision ??\n DEFAULT_TRACE_PROPAGATION_OPTIONS?.respectSamplingDecision ??\n true,\n },\n accessToken: async () => '',\n }\n\n if (options.accessToken) {\n result.accessToken = options.accessToken\n } else {\n // hack around Required<>\n delete (result as any).accessToken\n }\n\n return result\n}\n\n/**\n * Validates a Supabase client URL\n *\n * @param {string} supabaseUrl - The Supabase client URL string.\n * @returns {URL} - The validated base URL.\n * @throws {Error}\n */\nexport function validateSupabaseUrl(supabaseUrl: string): URL {\n const trimmedUrl = supabaseUrl?.trim()\n\n if (!trimmedUrl) {\n throw new Error('supabaseUrl is required.')\n }\n\n if (!trimmedUrl.match(/^https?:\\/\\//i)) {\n throw new Error('Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.')\n }\n\n try {\n return new URL(ensureTrailingSlash(trimmedUrl))\n } catch {\n throw Error('Invalid supabaseUrl: Provided URL is malformed.')\n }\n}\n","import { AuthClient } from '@supabase/auth-js'\nimport { SupabaseAuthClientOptions } from './types'\n\nexport class SupabaseAuthClient extends AuthClient {\n constructor(options: SupabaseAuthClientOptions) {\n super(options)\n }\n}\n","import type { AuthChangeEvent } from '@supabase/auth-js'\nimport { FunctionsClient } from '@supabase/functions-js'\nimport {\n PostgrestClient,\n type PostgrestFilterBuilder,\n type PostgrestQueryBuilder,\n} from '@supabase/postgrest-js'\nimport {\n type RealtimeChannel,\n type RealtimeChannelOptions,\n RealtimeClient,\n type RealtimeClientOptions,\n type RealtimeRemoveChannelResponse,\n} from '@supabase/realtime-js'\nimport { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'\nimport {\n DEFAULT_AUTH_OPTIONS,\n DEFAULT_DB_OPTIONS,\n DEFAULT_GLOBAL_OPTIONS,\n DEFAULT_REALTIME_OPTIONS,\n DEFAULT_TRACE_PROPAGATION_OPTIONS,\n} from './lib/constants'\nimport { checkApiKeyFormat, fetchWithAuth } from './lib/fetch'\nimport {\n applySettingDefaults,\n validateSupabaseUrl,\n type ResolvedSupabaseClientOptions,\n} from './lib/helpers'\nimport { SupabaseAuthClient } from './lib/SupabaseAuthClient'\nimport type {\n Fetch,\n GenericSchema,\n SupabaseAuthClientOptions,\n SupabaseClientOptions,\n} from './lib/types'\nimport { GetRpcFunctionFilterBuilderByArgs } from './lib/rest/types/common/rpc'\n\n/**\n * Supabase Client.\n *\n * An isomorphic Javascript client for interacting with Postgres.\n */\nexport default class SupabaseClient<\n Database = any,\n // The second type parameter is also used for specifying db_schema, so we\n // support both cases.\n // TODO: Allow setting db_schema from ClientOptions.\n SchemaNameOrClientOptions extends\n | (string & keyof Omit)\n | { PostgrestVersion: string } = 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit,\n SchemaName extends string & keyof Omit =\n SchemaNameOrClientOptions extends string & keyof Omit\n ? SchemaNameOrClientOptions\n : 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit, '__InternalSupabase'>,\n Schema extends Omit[SchemaName] extends GenericSchema\n ? Omit[SchemaName]\n : never = Omit[SchemaName] extends GenericSchema\n ? Omit[SchemaName]\n : never,\n ClientOptions extends { PostgrestVersion: string } = SchemaNameOrClientOptions extends string &\n keyof Omit\n ? // If the version isn't explicitly set, look for it in the __InternalSupabase object to infer the right version\n Database extends { __InternalSupabase: { PostgrestVersion: string } }\n ? Database['__InternalSupabase']\n : // otherwise default to 12\n { PostgrestVersion: '12' }\n : SchemaNameOrClientOptions extends { PostgrestVersion: string }\n ? SchemaNameOrClientOptions\n : never,\n> {\n /**\n * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.\n */\n auth: SupabaseAuthClient\n realtime: RealtimeClient\n /**\n * Supabase Storage allows you to manage user-generated content, such as photos or videos.\n */\n storage: SupabaseStorageClient\n\n protected realtimeUrl: URL\n protected authUrl: URL\n protected storageUrl: URL\n protected functionsUrl: URL\n protected rest: PostgrestClient\n protected storageKey: string\n protected fetch?: Fetch\n protected functionsFetch?: Fetch\n protected changedAccessToken?: string\n protected accessToken?: () => Promise\n\n protected headers: Record\n protected settings?: ResolvedSupabaseClientOptions\n\n /**\n * Create a new client for use in the browser.\n *\n * @category Initializing\n *\n * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.\n * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.\n * @param options Optional configuration for the client:\n * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.\n * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring.\n * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage.\n * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user.\n * - `realtime` — Options passed along to the realtime-js constructor.\n * - `storage` — Options passed along to the storage-js constructor.\n * - `global.fetch` — A custom fetch implementation.\n * - `global.headers` — Any additional headers to send with each network request.\n *\n * @example Creating a client\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * // Create a single supabase client for interacting with your database\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * ```\n *\n * @example With a custom domain\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * // Use a custom domain as the supabase URL\n * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key')\n * ```\n *\n * @example With additional parameters\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const options = {\n * db: {\n * schema: 'public',\n * },\n * auth: {\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: true\n * },\n * global: {\n * headers: { 'x-my-custom-header': 'my-app-name' },\n * },\n * }\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", options)\n * ```\n *\n * @exampleDescription With custom schemas\n * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.\n * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API.\n *\n * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.\n *\n * @example With custom schemas\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * // Provide a custom schema. Defaults to \"public\".\n * db: { schema: 'other_schema' }\n * })\n * ```\n *\n * @exampleDescription Custom fetch implementation\n * `supabase-js` uses the runtime's global `fetch` to make HTTP requests,\n * but an alternative `fetch` implementation can be provided as an option.\n * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior.\n *\n * @example Custom fetch implementation\n * ```js\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * global: { fetch: fetch.bind(globalThis) }\n * })\n * ```\n *\n * @exampleDescription React Native options with AsyncStorage\n * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.\n *\n * @example React Native options with AsyncStorage\n * ```js\n * import 'react-native-url-polyfill/auto'\n * import { createClient } from '@supabase/supabase-js'\n * import AsyncStorage from \"@react-native-async-storage/async-storage\";\n *\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", {\n * auth: {\n * storage: AsyncStorage,\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: false,\n * },\n * });\n * ```\n *\n * @exampleDescription React Native options with Expo SecureStore\n * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore.\n * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode.\n * A new 256-bit encryption key is generated using the `react-native-get-random-values` library.\n * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage.\n *\n * Please make sure that:\n * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date.\n * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs.\n * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed.\n * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities.\n *\n * @example React Native options with Expo SecureStore\n * ```ts\n * import 'react-native-url-polyfill/auto'\n * import { createClient } from '@supabase/supabase-js'\n * import AsyncStorage from '@react-native-async-storage/async-storage';\n * import * as SecureStore from 'expo-secure-store';\n * import * as aesjs from 'aes-js';\n * import 'react-native-get-random-values';\n *\n * // As Expo's SecureStore does not support values larger than 2048\n * // bytes, an AES-256 key is generated and stored in SecureStore, while\n * // it is used to encrypt/decrypt values stored in AsyncStorage.\n * class LargeSecureStore {\n * private async _encrypt(key: string, value: string) {\n * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8));\n *\n * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1));\n * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value));\n *\n * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey));\n *\n * return aesjs.utils.hex.fromBytes(encryptedBytes);\n * }\n *\n * private async _decrypt(key: string, value: string) {\n * const encryptionKeyHex = await SecureStore.getItemAsync(key);\n * if (!encryptionKeyHex) {\n * return encryptionKeyHex;\n * }\n *\n * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1));\n * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value));\n *\n * return aesjs.utils.utf8.fromBytes(decryptedBytes);\n * }\n *\n * async getItem(key: string) {\n * const encrypted = await AsyncStorage.getItem(key);\n * if (!encrypted) { return encrypted; }\n *\n * return await this._decrypt(key, encrypted);\n * }\n *\n * async removeItem(key: string) {\n * await AsyncStorage.removeItem(key);\n * await SecureStore.deleteItemAsync(key);\n * }\n *\n * async setItem(key: string, value: string) {\n * const encrypted = await this._encrypt(key, value);\n *\n * await AsyncStorage.setItem(key, encrypted);\n * }\n * }\n *\n * const supabase = createClient(\"https://xyzcompany.supabase.co\", \"your-publishable-key\", {\n * auth: {\n * storage: new LargeSecureStore(),\n * autoRefreshToken: true,\n * persistSession: true,\n * detectSessionInUrl: false,\n * },\n * });\n * ```\n *\n * @example With a database query\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n *\n * const { data } = await supabase.from('profiles').select('*')\n * ```\n *\n * @exampleDescription With OpenTelemetry tracing\n * Opt in to W3C trace context propagation so the `trace_id` from your\n * client-side spans is attached to Supabase requests and appears in API\n * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be\n * installed in your application and the tracing runtime to be loaded via\n * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing).\n *\n * @example With OpenTelemetry tracing\n * ```ts\n * import '@supabase/supabase-js/tracing'\n * import { createClient } from '@supabase/supabase-js'\n * import { trace } from '@opentelemetry/api'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {\n * tracePropagation: true,\n * })\n *\n * const tracer = trace.getTracer('my-app')\n *\n * await tracer.startActiveSpan('fetch-users', async (span) => {\n * // Outgoing request carries the active trace context.\n * const { data, error } = await supabase.from('users').select('*')\n * span.end()\n * })\n * ```\n */\n constructor(\n protected supabaseUrl: string,\n protected supabaseKey: string,\n options?: SupabaseClientOptions\n ) {\n const baseUrl = validateSupabaseUrl(supabaseUrl)\n if (!supabaseKey) throw new Error('supabaseKey is required.')\n checkApiKeyFormat(supabaseKey)\n\n this.realtimeUrl = new URL('realtime/v1', baseUrl)\n this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws')\n this.authUrl = new URL('auth/v1', baseUrl)\n this.storageUrl = new URL('storage/v1', baseUrl)\n this.functionsUrl = new URL('functions/v1', baseUrl)\n\n // default storage key uses the supabase project ref as a namespace\n const defaultStorageKey = `sb-${baseUrl.hostname.split('.')[0]}-auth-token`\n const DEFAULTS = {\n db: DEFAULT_DB_OPTIONS,\n realtime: DEFAULT_REALTIME_OPTIONS,\n auth: { ...DEFAULT_AUTH_OPTIONS, storageKey: defaultStorageKey },\n global: DEFAULT_GLOBAL_OPTIONS,\n tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS,\n }\n\n const settings = applySettingDefaults(options ?? {}, DEFAULTS)\n this.settings = settings\n\n this.storageKey = settings.auth.storageKey ?? ''\n this.headers = settings.global.headers ?? {}\n\n if (!settings.accessToken) {\n this.auth = this._initSupabaseAuthClient(\n settings.auth ?? {},\n this.headers,\n settings.global.fetch\n )\n } else {\n this.accessToken = settings.accessToken\n\n this.auth = new Proxy({} as any, {\n get: (_, prop) => {\n throw new Error(\n `@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(\n prop\n )} is not possible`\n )\n },\n })\n }\n\n // The fetch wrappers receive the raw session token (null when there is no session) and\n // decide the `Authorization` fallback themselves, so the API-key fallback lives in one place.\n this.fetch = fetchWithAuth(\n supabaseKey,\n supabaseUrl,\n this._getSessionToken.bind(this),\n settings.global.fetch,\n settings.tracePropagation\n )\n // Edge Functions use a dedicated fetch that never falls back to a new-format API key in\n // the Authorization header (see `isNewApiKey` in ./lib/fetch). Other services use `this.fetch`.\n this.functionsFetch = fetchWithAuth(\n supabaseKey,\n supabaseUrl,\n this._getSessionToken.bind(this),\n settings.global.fetch,\n settings.tracePropagation,\n { omitApiKeyAsBearer: true }\n )\n this.realtime = this._initRealtimeClient({\n headers: this.headers,\n accessToken: this._getAccessToken.bind(this),\n fetch: this.fetch,\n ...settings.realtime,\n })\n if (this.accessToken) {\n // Start auth immediately to avoid race condition with channel subscriptions\n // Wrap Promise to avoid Firefox extension cross-context Promise access errors\n Promise.resolve(this.accessToken())\n .then((token) => this.realtime.setAuth(token))\n .catch((e) => console.warn('Failed to set initial Realtime auth token:', e))\n }\n\n this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, {\n headers: this.headers,\n schema: settings.db.schema,\n fetch: this.fetch,\n timeout: settings.db.timeout,\n urlLengthLimit: settings.db.urlLengthLimit,\n retry: settings.db.retry,\n })\n\n this.storage = new SupabaseStorageClient(\n this.storageUrl.href,\n this.headers,\n this.fetch,\n options?.storage\n )\n\n if (!settings.accessToken) {\n this._listenForAuthEvents()\n }\n }\n\n /**\n * Supabase Functions allows you to deploy and invoke edge functions.\n */\n get functions(): FunctionsClient {\n return new FunctionsClient(this.functionsUrl.href, {\n headers: this.headers,\n customFetch: this.functionsFetch,\n })\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.from\n from<\n TableName extends string & keyof Schema['Tables'],\n Table extends Schema['Tables'][TableName],\n >(relation: TableName): PostgrestQueryBuilder\n from(\n relation: ViewName\n ): PostgrestQueryBuilder\n /**\n * Perform a query on a table or a view.\n *\n * @param relation - The table or view name to query\n */\n from(relation: string): PostgrestQueryBuilder {\n return this.rest.from(relation)\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.schema\n /**\n * Select a schema to query or perform an function (rpc) call.\n *\n * The schema needs to be on the list of exposed schemas inside Supabase.\n *\n * @param schema - The schema to query\n */\n schema>(\n schema: DynamicSchema\n ): PostgrestClient<\n Database,\n ClientOptions,\n DynamicSchema,\n Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any\n > {\n return this.rest.schema(schema)\n }\n\n // NOTE: signatures must be kept in sync with PostgrestClient.rpc\n /**\n * Perform a function call.\n *\n * @param fn - The function name to call\n * @param args - The arguments to pass to the function call\n * @param options - Named parameters\n * @param options.head - When set to `true`, `data` will not be returned.\n * Useful if you only need the count.\n * @param options.get - When set to `true`, the function will be called with\n * read-only access mode.\n * @param options.count - Count algorithm to use to count rows returned by the\n * function. Only applicable for [set-returning\n * functions](https://www.postgresql.org/docs/current/functions-srf.html).\n *\n * `\"exact\"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the\n * hood.\n *\n * `\"planned\"`: Approximated but fast count algorithm. Uses the Postgres\n * statistics under the hood.\n *\n * `\"estimated\"`: Uses exact count for low numbers and planned count for high\n * numbers.\n */\n rpc<\n FnName extends string & keyof Schema['Functions'],\n Args extends Schema['Functions'][FnName]['Args'] = never,\n FilterBuilder extends GetRpcFunctionFilterBuilderByArgs =\n GetRpcFunctionFilterBuilderByArgs,\n >(\n fn: FnName,\n args: Args = {} as Args,\n options: {\n head?: boolean\n get?: boolean\n count?: 'exact' | 'planned' | 'estimated'\n } = {\n head: false,\n get: false,\n count: undefined,\n }\n ): PostgrestFilterBuilder<\n ClientOptions,\n Schema,\n FilterBuilder['Row'],\n FilterBuilder['Result'],\n FilterBuilder['RelationName'],\n FilterBuilder['Relationships'],\n 'RPC'\n > {\n return this.rest.rpc(fn, args, options) as unknown as PostgrestFilterBuilder<\n ClientOptions,\n Schema,\n FilterBuilder['Row'],\n FilterBuilder['Result'],\n FilterBuilder['RelationName'],\n FilterBuilder['Relationships'],\n 'RPC'\n >\n }\n\n /**\n * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.\n *\n * @param {string} name - The name of the Realtime channel.\n * @param {Object} opts - The options to pass to the Realtime channel.\n *\n * @category Realtime\n */\n channel(name: string, opts: RealtimeChannelOptions = { config: {} }): RealtimeChannel {\n return this.realtime.channel(name, opts)\n }\n\n /**\n * Returns all Realtime channels.\n *\n * @category Realtime\n *\n * @example Get all channels\n * ```js\n * const channels = supabase.getChannels()\n * ```\n */\n getChannels(): RealtimeChannel[] {\n return this.realtime.getChannels()\n }\n\n /**\n * Unsubscribes and removes Realtime channel from Realtime client.\n *\n * @param {RealtimeChannel} channel - The name of the Realtime channel.\n *\n *\n * @category Realtime\n *\n * @remarks\n * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n *\n * @example Removes a channel\n * ```js\n * supabase.removeChannel(myChannel)\n * ```\n */\n removeChannel(channel: RealtimeChannel): Promise {\n return this.realtime.removeChannel(channel)\n }\n\n /**\n * Unsubscribes and removes all Realtime channels from Realtime client.\n *\n * @category Realtime\n *\n * @remarks\n * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n *\n * @example Remove all channels\n * ```js\n * supabase.removeAllChannels()\n * ```\n */\n removeAllChannels(): Promise {\n return this.realtime.removeAllChannels()\n }\n\n /**\n * The raw session token — the custom `accessToken` result or the signed-in user's JWT —\n * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back\n * to `supabaseKey`, so callers can distinguish \"no session\" from \"has session\".\n */\n private async _getSessionToken(): Promise {\n if (this.accessToken) {\n return await this.accessToken()\n }\n\n const { data } = await this.auth.getSession()\n\n return data.session?.access_token ?? null\n }\n\n private async _getAccessToken() {\n return (await this._getSessionToken()) ?? this.supabaseKey\n }\n\n private _initSupabaseAuthClient(\n {\n autoRefreshToken,\n persistSession,\n detectSessionInUrl,\n storage,\n userStorage,\n storageKey,\n flowType,\n lock,\n debug,\n throwOnError,\n experimental,\n lockAcquireTimeout,\n skipAutoInitialize,\n }: SupabaseAuthClientOptions,\n headers?: Record,\n fetch?: Fetch\n ) {\n const authHeaders = {\n Authorization: `Bearer ${this.supabaseKey}`,\n apikey: `${this.supabaseKey}`,\n }\n return new SupabaseAuthClient({\n url: this.authUrl.href,\n headers: { ...authHeaders, ...headers },\n storageKey: storageKey,\n autoRefreshToken,\n persistSession,\n detectSessionInUrl,\n storage,\n userStorage,\n flowType,\n lock,\n debug,\n throwOnError,\n experimental,\n fetch,\n lockAcquireTimeout,\n skipAutoInitialize,\n // auth checks if there is a custom authorizaiton header using this flag\n // so it knows whether to return an error when getUser is called with no session\n hasCustomAuthorizationHeader: Object.keys(this.headers).some(\n (key) => key.toLowerCase() === 'authorization'\n ),\n })\n }\n\n private _initRealtimeClient(options: RealtimeClientOptions) {\n return new RealtimeClient(this.realtimeUrl.href, {\n ...options,\n params: { ...{ apikey: this.supabaseKey }, ...options?.params },\n })\n }\n\n private _listenForAuthEvents() {\n const data = this.auth.onAuthStateChange((event, session) => {\n this._handleTokenChanged(event, 'CLIENT', session?.access_token)\n })\n return data\n }\n\n private _handleTokenChanged(\n event: AuthChangeEvent,\n source: 'CLIENT' | 'STORAGE',\n token?: string\n ) {\n if (\n (event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN' || event === 'INITIAL_SESSION') &&\n this.changedAccessToken !== token\n ) {\n this.changedAccessToken = token\n this.realtime.setAuth(token)\n } else if (event === 'SIGNED_OUT') {\n this.realtime.setAuth()\n if (source == 'STORAGE') this.auth.signOut()\n this.changedAccessToken = undefined\n }\n }\n}\n","import SupabaseClient from './SupabaseClient'\nimport type { SupabaseClientOptions } from './lib/types'\n\nexport * from '@supabase/auth-js'\nexport type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js'\nexport type {\n PostgrestResponse,\n PostgrestSingleResponse,\n PostgrestMaybeSingleResponse,\n PostgrestBuilder,\n PostgrestFilterBuilder,\n PostgrestTransformBuilder,\n PostgrestQueryBuilder,\n} from '@supabase/postgrest-js'\nexport { PostgrestError } from '@supabase/postgrest-js'\nexport { StorageApiError } from '@supabase/storage-js'\nexport type { FunctionInvokeOptions } from '@supabase/functions-js'\nexport {\n FunctionsHttpError,\n FunctionsFetchError,\n FunctionsRelayError,\n FunctionsError,\n FunctionRegion,\n} from '@supabase/functions-js'\nexport * from '@supabase/realtime-js'\nexport { default as SupabaseClient } from './SupabaseClient'\nexport type {\n SupabaseClientOptions,\n TracePropagationOptions,\n QueryResult,\n QueryData,\n QueryError,\n DatabaseWithoutInternals,\n} from './lib/types'\n\n/**\n * Creates a new Supabase Client.\n *\n * @example Creating a Supabase client\n * ```ts\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')\n * const { data, error } = await supabase.from('profiles').select('*')\n * ```\n */\nexport const createClient = <\n Database = any,\n SchemaNameOrClientOptions extends\n | (string & keyof Omit)\n | { PostgrestVersion: string } = 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit,\n SchemaName extends string & keyof Omit =\n SchemaNameOrClientOptions extends string & keyof Omit\n ? SchemaNameOrClientOptions\n : 'public' extends keyof Omit\n ? 'public'\n : string & keyof Omit, '__InternalSupabase'>,\n>(\n supabaseUrl: string,\n supabaseKey: string,\n options?: SupabaseClientOptions\n): SupabaseClient => {\n return new SupabaseClient(\n supabaseUrl,\n supabaseKey,\n options\n )\n}\n\n// Check for Node.js <= 20 deprecation\nfunction shouldShowDeprecationWarning(): boolean {\n // Skip in browser and Deno environments\n if (typeof window !== 'undefined' || (globalThis as any)['Deno'] !== undefined) {\n return false\n }\n\n // Skip if process is not available (e.g., Edge Runtime)\n // Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings\n const _process = (globalThis as any)['process']\n if (!_process) {\n return false\n }\n\n const processVersion = _process['version']\n if (processVersion === undefined || processVersion === null) {\n return false\n }\n\n const versionMatch = processVersion.match(/^v(\\d+)\\./)\n if (!versionMatch) {\n return false\n }\n\n const majorVersion = parseInt(versionMatch[1], 10)\n return majorVersion <= 20\n}\n\nif (shouldShowDeprecationWarning()) {\n console.warn(\n `⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +\n `Please upgrade to Node.js 22 or later. ` +\n `For more information, visit: https://github.com/orgs/supabase/discussions/45715`\n )\n}\n"],"mappings":";;;;;;;;;;;;AAMA,MAAa,UAAU;;;;ACDvB,IAAI,SAAS;AACb,IAAIA;AAEJ,IAAI,OAAO,SAAS,aAAa;;AAC/B,UAAS;AAET,uCAAqB,KAAK,uEAAS;WAC1B,OAAO,aAAa,YAC7B,UAAS;SACA,OAAO,cAAc,eAAe,UAAU,YAAY,cACnE,UAAS;KACJ;;AACL,UAAS;CACT,MAAM,WAAY,WAAmB;AACrC,sFAAqB,SAAW,gFAAY,QAAQ,MAAM,GAAG;;AAG/D,MAAM,eAAe,CAAC,WAAW,SAAS;AAC1C,IAAI,mBACF,cAAa,KAAK,mBAAmB,qBAAqB;AAG5D,MAAa,kBAAkB,EAC7B,iBAAiB,eAAe,QAAQ,IAAI,aAAa,KAAK,KAAK,IACpE;AAED,MAAa,yBAAyB,EACpC,SAAS,iBACV;AAED,MAAa,qBAAqB,EAChC,QAAQ,UACT;AAED,MAAaC,uBAAkD;CAC7D,kBAAkB;CAClB,gBAAgB;CAChB,oBAAoB;CACpB,UAAU;CACX;AAED,MAAaC,2BAAkD,EAAE;AAEjE,MAAaC,oCAA6D;CACxE,SAAS;CACT,yBAAyB;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvBD,SAAgB,iBAAiB,aAAa;AAC1C,KAAI,CAAC,eAAe,OAAO,gBAAgB,SACvC,QAAO;CAGX,MAAM,QAAQ,YAAY,MAAM,IAAI;AAEpC,KAAI,MAAM,WAAW,EACjB,QAAO;CAEX,MAAM,CAACC,WAAS,SAAS,UAAU,cAAc;AAEjD,KAAIA,UAAQ,WAAW,KACnB,QAAQ,WA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a,KAAK,KAAK,mBAAmB,OAAO,YAAY;AAC3D,QAAK,oBAAoB,OAAO,4DAAU,QAAS,aAAa;IAChE;;CAIJ,AAAQ,oBACN,OACA,QACA,OACA;AACA,OACG,UAAU,qBAAqB,UAAU,eAAe,UAAU,sBACnE,KAAK,uBAAuB,OAC5B;AACA,QAAK,qBAAqB;AAC1B,QAAK,SAAS,QAAQ,MAAM;aACnB,UAAU,cAAc;AACjC,QAAK,SAAS,SAAS;AACvB,OAAI,UAAU,UAAW,MAAK,KAAK,SAAS;AAC5C,QAAK,qBAAqB;;;;;;;;;;;;;;;;;;AC5nBhC,MAAa,gBAcX,aACA,aACA,YACoE;AACpE,QAAO,IAAI,eACT,aACA,aACA,QACD;;AAIH,SAAS,+BAAwC;AAE/C,KAAI,OAAO,WAAW,eAAgB,WAAmB,YAAY,OACnE,QAAO;CAKT,MAAM,WAAY,WAAmB;AACrC,KAAI,CAAC,SACH,QAAO;CAGT,MAAM,iBAAiB,SAAS;AAChC,KAAI,mBAAmB,UAAa,mBAAmB,KACrD,QAAO;CAGT,MAAM,eAAe,eAAe,MAAM,YAAY;AACtD,KAAI,CAAC,aACH,QAAO;AAIT,QADqB,SAAS,aAAa,IAAI,GAAG,IAC3B;;AAGzB,IAAI,8BAA8B,CAChC,SAAQ,KACN,8OAGD"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.cjs b/node_modules/@supabase/supabase-js/dist/tracing.cjs new file mode 100644 index 0000000000000000000000000000000000000000..a84420304b6b6688fb3d9fb4240a1a403f994315 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.cjs @@ -0,0 +1,66 @@ +const require_tracingRegistry = require('./tracingRegistry.cjs'); +let _opentelemetry_api = require("@opentelemetry/api"); + +//#region ../../shared/tracing/dist/module/create-extractor.js +/** +* Build a {@link TraceContextExtractor} from an OpenTelemetry API object. +* +* The extractor injects the active context into a fresh carrier on every +* call and returns the W3C trace headers found there. When there is no +* `traceparent`, it returns null for an empty carrier (no active trace) or +* a headerless result carrying only {@link TraceExtractionResult.carrierKeys} +* when the propagator wrote non-W3C headers. Returns null when the API +* throws. +*/ +function createTraceContextExtractor(otel) { + return () => { + try { + const carrier = {}; + otel.propagation.inject(otel.context.active(), carrier); + const traceparent = carrier["traceparent"]; + if (!traceparent) { + const carrierKeys = Object.keys(carrier); + if (carrierKeys.length === 0) return null; + return { carrierKeys }; + } + return { + traceparent, + tracestate: carrier["tracestate"], + baggage: carrier["baggage"] + }; + } catch (_a) { + return null; + } + }; +} + +//#endregion +//#region src/tracing.ts +/** +* Opt-in OpenTelemetry runtime for `tracePropagation`. +* +* Importing this module registers the OpenTelemetry trace context extractor +* used by every Supabase client in the process. It has no exports — the +* import itself is the opt-in: +* +* ```ts +* import '@supabase/supabase-js/tracing' +* import { createClient } from '@supabase/supabase-js' +* +* const supabase = createClient(url, key, { tracePropagation: true }) +* ``` +* +* Requires `@opentelemetry/api` to be installed — this module imports it +* directly, so bundlers include it and resolution fails loudly when it is +* missing. Without this import, enabling `tracePropagation` logs a one-time +* warning and requests are sent without trace headers. +* +* @module tracing +*/ +require_tracingRegistry.registerTraceContextExtractor(createTraceContextExtractor({ + propagation: _opentelemetry_api.propagation, + context: _opentelemetry_api.context +})); + +//#endregion +//# sourceMappingURL=tracing.cjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.cjs.map b/node_modules/@supabase/supabase-js/dist/tracing.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..c21f89dbe22c35dacdfff116240b21ee4d9f1886 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"tracing.cjs","names":["registerTraceContextExtractor"],"sources":["../../../shared/tracing/dist/module/create-extractor.js","../src/tracing.ts"],"sourcesContent":["/**\n * Build a {@link TraceContextExtractor} from an OpenTelemetry API object.\n *\n * The extractor injects the active context into a fresh carrier on every\n * call and returns the W3C trace headers found there. When there is no\n * `traceparent`, it returns null for an empty carrier (no active trace) or\n * a headerless result carrying only {@link TraceExtractionResult.carrierKeys}\n * when the propagator wrote non-W3C headers. Returns null when the API\n * throws.\n */\nexport function createTraceContextExtractor(otel) {\n return () => {\n try {\n const carrier = {};\n otel.propagation.inject(otel.context.active(), carrier);\n const traceparent = carrier['traceparent'];\n if (!traceparent) {\n const carrierKeys = Object.keys(carrier);\n if (carrierKeys.length === 0) {\n return null;\n }\n return { carrierKeys };\n }\n return {\n traceparent,\n tracestate: carrier['tracestate'],\n baggage: carrier['baggage'],\n };\n }\n catch (_a) {\n return null;\n }\n };\n}\n//# sourceMappingURL=create-extractor.js.map","/**\n * Opt-in OpenTelemetry runtime for `tracePropagation`.\n *\n * Importing this module registers the OpenTelemetry trace context extractor\n * used by every Supabase client in the process. It has no exports — the\n * import itself is the opt-in:\n *\n * ```ts\n * import '@supabase/supabase-js/tracing'\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient(url, key, { tracePropagation: true })\n * ```\n *\n * Requires `@opentelemetry/api` to be installed — this module imports it\n * directly, so bundlers include it and resolution fails loudly when it is\n * missing. Without this import, enabling `tracePropagation` logs a one-time\n * warning and requests are sent without trace headers.\n *\n * @module tracing\n */\nimport { propagation, context } from '@opentelemetry/api'\nimport { createTraceContextExtractor } from '@supabase/tracing'\nimport { registerTraceContextExtractor } from './lib/tracingRegistry'\n\nregisterTraceContextExtractor(createTraceContextExtractor({ propagation, context }))\n"],"mappings":";;;;;;;;;;;;;;AAUA,SAAgB,4BAA4B,MAAM;AAC9C,cAAa;AACT,MAAI;GACA,MAAM,UAAU,EAAE;AAClB,QAAK,YAAY,OAAO,KAAK,QAAQ,QAAQ,EAAE,QAAQ;GACvD,MAAM,cAAc,QAAQ;AAC5B,OAAI,CAAC,aAAa;IACd,MAAM,cAAc,OAAO,KAAK,QAAQ;AACxC,QAAI,YAAY,WAAW,EACvB,QAAO;AAEX,WAAO,EAAE,aAAa;;AAE1B,UAAO;IACH;IACA,YAAY,QAAQ;IACpB,SAAS,QAAQ;IACpB;WAEE,IAAI;AACP,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACLnBA,sDAA8B,4BAA4B;CAAE;CAAa;CAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.d.cts b/node_modules/@supabase/supabase-js/dist/tracing.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..619fbdd604fbee4c44b0f702136d170241eeba2a --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.d.cts @@ -0,0 +1 @@ +export { }; \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.d.mts b/node_modules/@supabase/supabase-js/dist/tracing.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..619fbdd604fbee4c44b0f702136d170241eeba2a --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.d.mts @@ -0,0 +1 @@ +export { }; \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.mjs b/node_modules/@supabase/supabase-js/dist/tracing.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f5491939a262bcd8215700422e266dd2ed9b31d5 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.mjs @@ -0,0 +1,67 @@ +import { n as registerTraceContextExtractor } from "./tracingRegistry.mjs"; +import { context, propagation } from "@opentelemetry/api"; + +//#region ../../shared/tracing/dist/module/create-extractor.js +/** +* Build a {@link TraceContextExtractor} from an OpenTelemetry API object. +* +* The extractor injects the active context into a fresh carrier on every +* call and returns the W3C trace headers found there. When there is no +* `traceparent`, it returns null for an empty carrier (no active trace) or +* a headerless result carrying only {@link TraceExtractionResult.carrierKeys} +* when the propagator wrote non-W3C headers. Returns null when the API +* throws. +*/ +function createTraceContextExtractor(otel) { + return () => { + try { + const carrier = {}; + otel.propagation.inject(otel.context.active(), carrier); + const traceparent = carrier["traceparent"]; + if (!traceparent) { + const carrierKeys = Object.keys(carrier); + if (carrierKeys.length === 0) return null; + return { carrierKeys }; + } + return { + traceparent, + tracestate: carrier["tracestate"], + baggage: carrier["baggage"] + }; + } catch (_a) { + return null; + } + }; +} + +//#endregion +//#region src/tracing.ts +/** +* Opt-in OpenTelemetry runtime for `tracePropagation`. +* +* Importing this module registers the OpenTelemetry trace context extractor +* used by every Supabase client in the process. It has no exports — the +* import itself is the opt-in: +* +* ```ts +* import '@supabase/supabase-js/tracing' +* import { createClient } from '@supabase/supabase-js' +* +* const supabase = createClient(url, key, { tracePropagation: true }) +* ``` +* +* Requires `@opentelemetry/api` to be installed — this module imports it +* directly, so bundlers include it and resolution fails loudly when it is +* missing. Without this import, enabling `tracePropagation` logs a one-time +* warning and requests are sent without trace headers. +* +* @module tracing +*/ +registerTraceContextExtractor(createTraceContextExtractor({ + propagation, + context +})); + +//#endregion +export { }; +//# sourceMappingURL=tracing.mjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracing.mjs.map b/node_modules/@supabase/supabase-js/dist/tracing.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..310419c501e1827048989272d5b658e10d8ea068 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracing.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"tracing.mjs","names":[],"sources":["../../../shared/tracing/dist/module/create-extractor.js","../src/tracing.ts"],"sourcesContent":["/**\n * Build a {@link TraceContextExtractor} from an OpenTelemetry API object.\n *\n * The extractor injects the active context into a fresh carrier on every\n * call and returns the W3C trace headers found there. When there is no\n * `traceparent`, it returns null for an empty carrier (no active trace) or\n * a headerless result carrying only {@link TraceExtractionResult.carrierKeys}\n * when the propagator wrote non-W3C headers. Returns null when the API\n * throws.\n */\nexport function createTraceContextExtractor(otel) {\n return () => {\n try {\n const carrier = {};\n otel.propagation.inject(otel.context.active(), carrier);\n const traceparent = carrier['traceparent'];\n if (!traceparent) {\n const carrierKeys = Object.keys(carrier);\n if (carrierKeys.length === 0) {\n return null;\n }\n return { carrierKeys };\n }\n return {\n traceparent,\n tracestate: carrier['tracestate'],\n baggage: carrier['baggage'],\n };\n }\n catch (_a) {\n return null;\n }\n };\n}\n//# sourceMappingURL=create-extractor.js.map","/**\n * Opt-in OpenTelemetry runtime for `tracePropagation`.\n *\n * Importing this module registers the OpenTelemetry trace context extractor\n * used by every Supabase client in the process. It has no exports — the\n * import itself is the opt-in:\n *\n * ```ts\n * import '@supabase/supabase-js/tracing'\n * import { createClient } from '@supabase/supabase-js'\n *\n * const supabase = createClient(url, key, { tracePropagation: true })\n * ```\n *\n * Requires `@opentelemetry/api` to be installed — this module imports it\n * directly, so bundlers include it and resolution fails loudly when it is\n * missing. Without this import, enabling `tracePropagation` logs a one-time\n * warning and requests are sent without trace headers.\n *\n * @module tracing\n */\nimport { propagation, context } from '@opentelemetry/api'\nimport { createTraceContextExtractor } from '@supabase/tracing'\nimport { registerTraceContextExtractor } from './lib/tracingRegistry'\n\nregisterTraceContextExtractor(createTraceContextExtractor({ propagation, context }))\n"],"mappings":";;;;;;;;;;;;;;AAUA,SAAgB,4BAA4B,MAAM;AAC9C,cAAa;AACT,MAAI;GACA,MAAM,UAAU,EAAE;AAClB,QAAK,YAAY,OAAO,KAAK,QAAQ,QAAQ,EAAE,QAAQ;GACvD,MAAM,cAAc,QAAQ;AAC5B,OAAI,CAAC,aAAa;IACd,MAAM,cAAc,OAAO,KAAK,QAAQ;AACxC,QAAI,YAAY,WAAW,EACvB,QAAO;AAEX,WAAO,EAAE,aAAa;;AAE1B,UAAO;IACH;IACA,YAAY,QAAQ;IACpB,SAAS,QAAQ;IACpB;WAEE,IAAI;AACP,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACLnB,8BAA8B,4BAA4B;CAAE;CAAa;CAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs b/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs new file mode 100644 index 0000000000000000000000000000000000000000..35414aba2be91d20763277be6c0ecf7908ed6c19 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs @@ -0,0 +1,32 @@ + +//#region src/lib/tracingRegistry.ts +const EXTRACTOR_KEY = Symbol.for("@supabase/supabase-js.traceContextExtractor"); +/** +* Register the trace context extractor used by all Supabase clients in this +* process. Called by the `@supabase/supabase-js/tracing` subpath as an import +* side effect; the last registration wins. +*/ +function registerTraceContextExtractor(extractor) { + globalThis[EXTRACTOR_KEY] = extractor; +} +/** +* The currently registered trace context extractor, if any. +*/ +function getTraceContextExtractor() { + return globalThis[EXTRACTOR_KEY]; +} + +//#endregion +Object.defineProperty(exports, 'getTraceContextExtractor', { + enumerable: true, + get: function () { + return getTraceContextExtractor; + } +}); +Object.defineProperty(exports, 'registerTraceContextExtractor', { + enumerable: true, + get: function () { + return registerTraceContextExtractor; + } +}); +//# sourceMappingURL=tracingRegistry.cjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs.map b/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..80263abef2476555542dee671a2e9e3c633b7985 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracingRegistry.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"tracingRegistry.cjs","names":[],"sources":["../src/lib/tracingRegistry.ts"],"sourcesContent":["import type { TraceContextExtractor } from '@supabase/tracing'\n\nexport type { TraceContextExtractor }\n\n// The extractor lives in a `Symbol.for()`-keyed slot on `globalThis` rather\n// than a module-level variable. Bundlers and the ESM/CJS dual build can load\n// this module more than once in a single application (e.g. the tracing\n// subpath resolved to `dist/tracing.mjs` while the main entry resolves to\n// `dist/index.cjs`) — separate module instances would each get their own\n// variable, but they all share the global symbol registry.\n//\n// The symbol string is a de-facto stable contract: module-resolution tests\n// read the slot directly, and changing it orphans registrations from other\n// copies of this package in the same process.\nconst EXTRACTOR_KEY = Symbol.for('@supabase/supabase-js.traceContextExtractor')\n\ntype ExtractorSlot = { [EXTRACTOR_KEY]?: TraceContextExtractor }\n\n/**\n * Register the trace context extractor used by all Supabase clients in this\n * process. Called by the `@supabase/supabase-js/tracing` subpath as an import\n * side effect; the last registration wins.\n */\nexport function registerTraceContextExtractor(extractor: TraceContextExtractor): void {\n ;(globalThis as ExtractorSlot)[EXTRACTOR_KEY] = extractor\n}\n\n/**\n * The currently registered trace context extractor, if any.\n */\nexport function getTraceContextExtractor(): TraceContextExtractor | undefined {\n return (globalThis as ExtractorSlot)[EXTRACTOR_KEY]\n}\n\n/**\n * For tests only. Removes the registered extractor.\n *\n * @internal\n */\nexport function _unregisterTraceContextExtractor(): void {\n delete (globalThis as ExtractorSlot)[EXTRACTOR_KEY]\n}\n"],"mappings":";;AAcA,MAAM,gBAAgB,OAAO,IAAI,8CAA8C;;;;;;AAS/E,SAAgB,8BAA8B,WAAwC;AACnF,CAAC,WAA6B,iBAAiB;;;;;AAMlD,SAAgB,2BAA8D;AAC5E,QAAQ,WAA6B"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs b/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs new file mode 100644 index 0000000000000000000000000000000000000000..186a2bc9e9aaf3148950f0327457c58cbc527696 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs @@ -0,0 +1,20 @@ +//#region src/lib/tracingRegistry.ts +const EXTRACTOR_KEY = Symbol.for("@supabase/supabase-js.traceContextExtractor"); +/** +* Register the trace context extractor used by all Supabase clients in this +* process. Called by the `@supabase/supabase-js/tracing` subpath as an import +* side effect; the last registration wins. +*/ +function registerTraceContextExtractor(extractor) { + globalThis[EXTRACTOR_KEY] = extractor; +} +/** +* The currently registered trace context extractor, if any. +*/ +function getTraceContextExtractor() { + return globalThis[EXTRACTOR_KEY]; +} + +//#endregion +export { registerTraceContextExtractor as n, getTraceContextExtractor as t }; +//# sourceMappingURL=tracingRegistry.mjs.map \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs.map b/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..9d20bf6b417ae529748ba598a9c9917578e2ccd7 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"tracingRegistry.mjs","names":[],"sources":["../src/lib/tracingRegistry.ts"],"sourcesContent":["import type { TraceContextExtractor } from '@supabase/tracing'\n\nexport type { TraceContextExtractor }\n\n// The extractor lives in a `Symbol.for()`-keyed slot on `globalThis` rather\n// than a module-level variable. Bundlers and the ESM/CJS dual build can load\n// this module more than once in a single application (e.g. the tracing\n// subpath resolved to `dist/tracing.mjs` while the main entry resolves to\n// `dist/index.cjs`) — separate module instances would each get their own\n// variable, but they all share the global symbol registry.\n//\n// The symbol string is a de-facto stable contract: module-resolution tests\n// read the slot directly, and changing it orphans registrations from other\n// copies of this package in the same process.\nconst EXTRACTOR_KEY = Symbol.for('@supabase/supabase-js.traceContextExtractor')\n\ntype ExtractorSlot = { [EXTRACTOR_KEY]?: TraceContextExtractor }\n\n/**\n * Register the trace context extractor used by all Supabase clients in this\n * process. Called by the `@supabase/supabase-js/tracing` subpath as an import\n * side effect; the last registration wins.\n */\nexport function registerTraceContextExtractor(extractor: TraceContextExtractor): void {\n ;(globalThis as ExtractorSlot)[EXTRACTOR_KEY] = extractor\n}\n\n/**\n * The currently registered trace context extractor, if any.\n */\nexport function getTraceContextExtractor(): TraceContextExtractor | undefined {\n return (globalThis as ExtractorSlot)[EXTRACTOR_KEY]\n}\n\n/**\n * For tests only. Removes the registered extractor.\n *\n * @internal\n */\nexport function _unregisterTraceContextExtractor(): void {\n delete (globalThis as ExtractorSlot)[EXTRACTOR_KEY]\n}\n"],"mappings":";AAcA,MAAM,gBAAgB,OAAO,IAAI,8CAA8C;;;;;;AAS/E,SAAgB,8BAA8B,WAAwC;AACnF,CAAC,WAA6B,iBAAiB;;;;;AAMlD,SAAgB,2BAA8D;AAC5E,QAAQ,WAA6B"} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/dist/umd/supabase.js b/node_modules/@supabase/supabase-js/dist/umd/supabase.js new file mode 100644 index 0000000000000000000000000000000000000000..6c43d34f52d43abc846df6746971afa3f6845ab4 --- /dev/null +++ b/node_modules/@supabase/supabase-js/dist/umd/supabase.js @@ -0,0 +1,11 @@ +var supabase=(function(e){function t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);ie?(...t)=>e(...t):(...e)=>fetch(...e);var i=class extends Error{constructor(e,t=`FunctionsError`,n){super(e),this.name=t,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}},a=class extends i{constructor(e){super(`Failed to send a request to the Edge Function`,`FunctionsFetchError`,e)}},o=class extends i{constructor(e){super(`Relay Error invoking the Edge Function`,`FunctionsRelayError`,e)}},s=class extends i{constructor(e){super(`Edge Function returned a non-2xx status code`,`FunctionsHttpError`,e)}},c;(function(e){e.Any=`any`,e.ApNortheast1=`ap-northeast-1`,e.ApNortheast2=`ap-northeast-2`,e.ApSouth1=`ap-south-1`,e.ApSoutheast1=`ap-southeast-1`,e.ApSoutheast2=`ap-southeast-2`,e.CaCentral1=`ca-central-1`,e.EuCentral1=`eu-central-1`,e.EuWest1=`eu-west-1`,e.EuWest2=`eu-west-2`,e.EuWest3=`eu-west-3`,e.SaEast1=`sa-east-1`,e.UsEast1=`us-east-1`,e.UsWest1=`us-west-1`,e.UsWest2=`us-west-2`})(c||={});var l=class{constructor(e,{headers:t={},customFetch:n,region:i=c.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=r(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return n(this,arguments,void 0,function*(e,t={}){var n;let r,i,c;try{let{headers:n,method:l,body:u,signal:d,timeout:f}=t,p={},{region:m}=t;m||=this.region;let h=new URL(`${this.url}/${e}`);m&&m!==`any`&&(p[`x-region`]=m,h.searchParams.set(`forceFunctionRegion`,m));let g,ee=!!n&&Object.keys(n).some(e=>e.toLowerCase()===`content-type`);u&&!ee?typeof Blob<`u`&&u instanceof Blob||u instanceof ArrayBuffer?(p[`Content-Type`]=`application/octet-stream`,g=u):typeof u==`string`?(p[`Content-Type`]=`text/plain`,g=u):typeof FormData<`u`&&u instanceof FormData?g=u:(p[`Content-Type`]=`application/json`,g=JSON.stringify(u)):g=u&&typeof u!=`string`&&!(typeof Blob<`u`&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<`u`&&u instanceof FormData)?JSON.stringify(u):u;let te=d;f&&(i=new AbortController,r=setTimeout(()=>i.abort(),f),d?(te=i.signal,c=()=>i.abort(),d.addEventListener(`abort`,c)):te=i.signal);let _=yield this.fetch(h.toString(),{method:l||`POST`,headers:Object.assign(Object.assign(Object.assign({},p),this.headers),n),body:g,signal:te}).catch(e=>{throw new a(e)}),ne=_.headers.get(`x-relay-error`);if(ne&&ne===`true`)throw new o(_);if(!_.ok)throw new s(_);let re=(_.headers.get(`Content-Type`)??`text/plain`).split(`;`)[0].trim().toLowerCase(),ie;return ie=re===`application/json`?yield _.json():re===`application/octet-stream`||re===`application/pdf`?yield _.blob():re===`text/event-stream`?_:re===`multipart/form-data`?yield _.formData():yield _.text(),{data:ie,error:null,response:_}}catch(e){return{data:null,error:e,response:e instanceof s||e instanceof o?e.context:void 0}}finally{r&&clearTimeout(r),c&&((n=t.signal)==null||n.removeEventListener(`abort`,c))}})}};let u=e=>Math.min(1e3*2**e,3e4),d=[520,503],f=[`GET`,`HEAD`,`OPTIONS`];var p=class extends Error{constructor(e){super(e.message),this.name=`PostgrestError`,this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function m(e){"@babel/helpers - typeof";return m=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},m(e)}function h(e,t){if(m(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(m(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function g(e){var t=h(e,`string`);return m(t)==`symbol`?t:t+``}function ee(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t{if(t?.aborted){n();return}let r=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t?.addEventListener(`abort`,i)})}function re(e,t,n,r){return!(!r||n>=3||!f.includes(e)||!d.includes(t))}var ie=class{constructor(e){this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError??!1,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle??!1,this.shouldStripNulls=e.shouldStripNulls??!1,this.urlLengthLimit=e.urlLengthLimit??8e3,this.retryEnabled=e.retry??!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get(`Accept`)===`text/csv`)throw Error(`stripNulls() cannot be used with csv()`);return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||([`GET`,`HEAD`].includes(this.method)?this.headers.set(`Accept-Profile`,this.schema):this.headers.set(`Content-Profile`,this.schema)),this.method!==`GET`&&this.method!==`HEAD`&&this.headers.set(`Content-Type`,`application/json`),this.shouldStripNulls){let e=this.headers.get(`Accept`);e===`application/vnd.pgrst.object+json`?this.headers.set(`Accept`,`application/vnd.pgrst.object+json;nulls=stripped`):(!e||e===`application/json`)&&this.headers.set(`Accept`,`application/vnd.pgrst.array+json;nulls=stripped`)}let r=this.fetch,i=(async()=>{let e=0;for(;;){let t={};n.headers.forEach((e,n)=>{t[n]=e}),e>0&&(t[`X-Retry-Count`]=String(e));let i;try{i=await r(n.url.toString(),{method:n.method,headers:t,body:JSON.stringify(n.body,(e,t)=>typeof t==`bigint`?t.toString():t),signal:n.signal})}catch(t){if(t?.name===`AbortError`||t?.code===`ABORT_ERR`||!f.includes(n.method))throw t;if(n.retryEnabled&&e<3){let t=u(e);e++,await ne(t,n.signal);continue}throw t}if(re(n.method,i.status,e,n.retryEnabled)){let t=i.headers?.get(`Retry-After`)??null,r=t===null?u(e):Math.max(0,parseInt(t,10)||0)*1e3;await i.text(),e++,await ne(r,n.signal);continue}return await n.processResponse(i)}})();return this.shouldThrowOnError||(i=i.catch(e=>{let t=``,n=``,r=``,i=e?.cause;if(i){let n=i?.message??``,r=i?.code??``;t=`${e?.name??`FetchError`}: ${e?.message}`,t+=`\n\nCaused by: ${i?.name??`Error`}: ${n}`,r&&(t+=` (${r})`),i?.stack&&(t+=`\n${i.stack}`)}else t=e?.stack??``;let a=this.url.toString().length;return e?.name===`AbortError`||e?.code===`ABORT_ERR`?(r=``,n=`Request was aborted (timeout or manual cancellation)`,a>this.urlLengthLimit&&(n+=`. Note: Your request URL is ${a} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(i?.name===`HeadersOverflowError`||i?.code===`UND_ERR_HEADERS_OVERFLOW`)&&(r=``,n=`HTTP headers exceeded server limits (typically 16KB)`,a>this.urlLengthLimit&&(n+=`. Your request URL is ${a} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${e?.name??`FetchError`}: ${e?.message}`,details:t,hint:n,code:r},data:null,count:null,status:0,statusText:``}})),i.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,i=null,a=e.status,o=e.statusText;if(e.ok){if(t.method!==`HEAD`){let i=await e.text();if(i!==``)if(t.headers.get(`Accept`)===`text/csv`)r=i;else if(t.headers.get(`Accept`)&&t.headers.get(`Accept`)?.includes(`application/vnd.pgrst.plan+text`))r=i;else try{r=JSON.parse(i)}catch{if(n={message:i},r=null,t.shouldThrowOnError)throw new p({message:i,details:``,hint:``,code:``})}}let s=t.headers.get(`Prefer`)?.match(/count=(exact|planned|estimated)/),c=e.headers.get(`content-range`)?.split(`/`);if(s&&c&&c.length>1&&(i=parseInt(c[1])),t.isMaybeSingle&&Array.isArray(r))if(r.length>1){if(n={code:`PGRST116`,details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:`JSON object requested, multiple (or no) rows returned`},r=null,i=null,a=406,o=`Not Acceptable`,t.shouldThrowOnError)throw new p(_(_({},n),{},{hint:n.hint??``}))}else r=r.length===1?r[0]:null}else{let i=await e.text();try{n=JSON.parse(i),Array.isArray(n)&&e.status===404&&(r=[],n=null,a=200,o=`OK`)}catch{e.status===404&&i===``?(a=204,o=`No Content`):n={message:i}}if(n&&t.shouldThrowOnError)throw new p(n)}return{success:n===null,error:n,data:r,count:i,status:a,statusText:o}}returns(){return this}overrideTypes(){return this}},ae=class extends ie{throwOnError(){return super.throwOnError()}select(e){let t=!1,n=(e??`*`).split(``).map(e=>/\s/.test(e)&&!t?``:(e===`"`&&(t=!t),e)).join(``);return this.url.searchParams.set(`select`,n),this.headers.append(`Prefer`,`return=representation`),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){let a=i?`${i}.order`:`order`,o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:``}${e}.${t?`asc`:`desc`}${n===void 0?``:n?`.nullsfirst`:`.nullslast`}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){let r=n===void 0?`limit`:`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){let i=r===void 0?`offset`:`${r}.offset`,a=r===void 0?`limit`:`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set(`Accept`,`application/vnd.pgrst.object+json`),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set(`Accept`,`text/csv`),this}geojson(){return this.headers.set(`Accept`,`application/geo+json`),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:a=`text`}={}){let o=[e?`analyze`:null,t?`verbose`:null,n?`settings`:null,r?`buffers`:null,i?`wal`:null].filter(Boolean).join(`|`),s=this.headers.get(`Accept`)??`application/json`;return this.headers.set(`Accept`,`application/vnd.pgrst.plan+${a}; for="${s}"; options=${o};`),this}rollback(){return this.headers.append(`Prefer`,`tx=rollback`),this}returns(){return this}maxAffected(e){return this.headers.append(`Prefer`,`handling=strict`),this.headers.append(`Prefer`,`max-affected=${e}`),this}};let oe=RegExp(`[,()]`);var se=class extends ae{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(`,`)}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(`,`)}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(`,`)}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(`,`)}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&oe.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){let n=Array.from(new Set(t)).map(e=>typeof e==`string`&&oe.test(e)?`"${e}"`:`${e}`).join(`,`);return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t==`string`?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(`,`)}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t==`string`?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(`,`)}}`),this}textSearch(e,t,{config:n,type:r}={}){let i=``;r===`plain`?i=`pl`:r===`phrase`?i=`ph`:r===`websearch`&&(i=`w`);let a=n===void 0?``:`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>t!==void 0).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){let r=n?`${n}.or`:`or`;return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},ce=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:i=8e3,retry:a}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=i,this.retry=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:n=!1,count:r}=t??{},i=n?`HEAD`:`GET`,a=!1,o=(e??`*`).split(``).map(e=>/\s/.test(e)&&!a?``:(e===`"`&&(a=!a),e)).join(``),{url:s,headers:c}=this.cloneRequestState();return s.searchParams.set(`select`,o),r&&c.append(`Prefer`,`count=${r}`),new se({method:i,url:s,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){let{url:r,headers:i}=this.cloneRequestState();if(t&&i.append(`Prefer`,`count=${t}`),n||i.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);r.searchParams.set(`columns`,e.join(`,`))}}return new se({method:`POST`,url:r,headers:i,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){let{url:a,headers:o}=this.cloneRequestState();if(o.append(`Prefer`,`resolution=${n?`ignore`:`merge`}-duplicates`),t!==void 0&&a.searchParams.set(`on_conflict`,t),r&&o.append(`Prefer`,`count=${r}`),i||o.append(`Prefer`,`missing=default`),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);a.searchParams.set(`columns`,e.join(`,`))}}return new se({method:`POST`,url:a,headers:o,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){let{url:n,headers:r}=this.cloneRequestState();return t&&r.append(`Prefer`,`count=${t}`),new se({method:`PATCH`,url:n,headers:r,schema:this.schema,body:e,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){let{url:t,headers:n}=this.cloneRequestState();return e&&n.append(`Prefer`,`count=${e}`),new se({method:`DELETE`,url:t,headers:n,schema:this.schema,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},le=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=a;let s=r??globalThis.fetch;i!==void 0&&i>0?this.fetch=(e,t)=>{let n=new AbortController,r=setTimeout(()=>n.abort(),i),a=t?.signal;if(a){if(a.aborted)return clearTimeout(r),s(e,t);let i=()=>{clearTimeout(r),n.abort()};return a.addEventListener(`abort`,i,{once:!0}),s(e,_(_({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),a.removeEventListener(`abort`,i)})}return s(e,_(_({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:this.fetch=s,this.retry=o}from(e){if(!e||typeof e!=`string`||e.trim()===``)throw Error(`Invalid relation name: relation must be a non-empty string.`);return new ce(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:n=!1,get:r=!1,count:i}={}){let a,o=new URL(`${this.url}/rpc/${e}`),s,c=e=>typeof e==`object`&&!!e&&(!Array.isArray(e)||e.some(c)),l=n&&Object.values(t).some(c);l?(a=`POST`,s=t):n||r?(a=n?`HEAD`:`GET`,Object.entries(t).filter(([e,t])=>t!==void 0).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(`,`)}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(a=`POST`,s=t);let u=new Headers(this.headers);return l?u.set(`Prefer`,i?`count=${i},return=minimal`:`return=minimal`):i&&u.set(`Prefer`,`count=${i}`),new se({method:a,url:o,headers:u,schema:this.schemaName,body:s,fetch:this.fetch??fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},ue=class{constructor(){}static detectEnvironment(){if(typeof WebSocket<`u`)return{type:`native`,wsConstructor:WebSocket};let e=globalThis;if(typeof globalThis<`u`&&e.WebSocket!==void 0)return{type:`native`,wsConstructor:e.WebSocket};let t=typeof global<`u`?global:void 0;if(t&&t.WebSocket!==void 0)return{type:`native`,wsConstructor:t.WebSocket};if(typeof globalThis<`u`&&e.WebSocketPair!==void 0&&globalThis.WebSocket===void 0)return{type:`cloudflare`,error:`Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.`,workaround:`Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.`};if(typeof globalThis<`u`&&e.EdgeRuntime||typeof navigator<`u`&&navigator.userAgent?.includes(`Vercel-Edge`))return{type:`unsupported`,error:`Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.`,workaround:`Use serverless functions or a different deployment target for WebSocket functionality.`};let n=globalThis.process;if(n){let e=n.versions;if(e&&e.node)return{type:`unsupported`,error:`Node.js detected but native WebSocket not found.`,workaround:`Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option.`}}return{type:`unsupported`,error:`Unknown JavaScript runtime without WebSocket support.`,workaround:`Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation.`}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let t=e.error||`WebSocket not supported in this environment.`;throw e.workaround&&(t+=`\n\nSuggested solution: ${e.workaround}`),Error(t)}static isWebSocketSupported(){try{return this.detectEnvironment().type===`native`}catch{return!1}}};let v={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},de={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`,access_token:`access_token`},fe={connecting:`connecting`,open:`open`,closing:`closing`,closed:`closed`};var pe=class{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT=`broadcast`,this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event==`string`)return t(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){return this._isArrayBuffer(e.payload?.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){let t=e.payload?.payload??new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,t)}_encodeJsonUserBroadcastPush(e){let t=e.payload?.payload??{},n=new TextEncoder().encode(JSON.stringify(t)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,n)}_encodeUserBroadcastPush(e,t,n){let r=new TextEncoder,i=r.encode(e.topic),a=r.encode(e.ref??``),o=r.encode(e.join_ref??``),s=r.encode(e.payload.event),c=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},l=r.encode(Object.keys(c).length===0?``:JSON.stringify(c));if(o.length>255)throw Error(`joinRef length ${o.length} exceeds maximum of 255`);if(a.length>255)throw Error(`ref length ${a.length} exceeds maximum of 255`);if(i.length>255)throw Error(`topic length ${i.length} exceeds maximum of 255`);if(s.length>255)throw Error(`userEvent length ${s.length} exceeds maximum of 255`);if(l.length>255)throw Error(`metadata length ${l.length} exceeds maximum of 255`);let u=this.USER_BROADCAST_PUSH_META_LENGTH+o.length+a.length+i.length+s.length+l.length,d=new ArrayBuffer(this.HEADER_LENGTH+u),f=new DataView(d),p=new Uint8Array(d),m=0;f.setUint8(m++,this.KINDS.userBroadcastPush),f.setUint8(m++,o.length),f.setUint8(m++,a.length),f.setUint8(m++,i.length),f.setUint8(m++,s.length),f.setUint8(m++,l.length),f.setUint8(m++,t),p.set(o,m),m+=o.length,p.set(a,m),m+=a.length,p.set(i,m),m+=i.length,p.set(s,m),m+=s.length,p.set(l,m),m+=l.length;var h=new Uint8Array(d.byteLength+n.byteLength);return h.set(new Uint8Array(d),0),h.set(new Uint8Array(n),d.byteLength),h.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if(typeof e==`string`){let[n,r,i,a,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:a,payload:o})}return t({})}_binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,t,r)}}_decodeUserBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4),s=this.HEADER_LENGTH+4,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+i));s+=i;let u=n.decode(e.slice(s,s+a));s+=a;let d=e.slice(s,e.byteLength),f=o===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,p={type:this.BROADCAST_EVENT,event:l,payload:f};return a>0&&(p.meta=JSON.parse(u)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){return e instanceof ArrayBuffer||e?.constructor?.name===`ArrayBuffer`}_pick(e,t){return!e||typeof e!=`object`?{}:Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e)))}},y;(function(e){e.abstime=`abstime`,e.bool=`bool`,e.date=`date`,e.daterange=`daterange`,e.float4=`float4`,e.float8=`float8`,e.int2=`int2`,e.int4=`int4`,e.int4range=`int4range`,e.int8=`int8`,e.int8range=`int8range`,e.json=`json`,e.jsonb=`jsonb`,e.money=`money`,e.numeric=`numeric`,e.oid=`oid`,e.reltime=`reltime`,e.text=`text`,e.time=`time`,e.timestamp=`timestamp`,e.timestamptz=`timestamptz`,e.timetz=`timetz`,e.tsrange=`tsrange`,e.tstzrange=`tstzrange`})(y||={});let me=(e,t,n={})=>{let r=n.skipTypes??[];return t?Object.keys(t).reduce((n,i)=>(n[i]=he(i,e,t,r),n),{}):{}},he=(e,t,n,r)=>{let i=t.find(t=>t.name===e)?.type,a=n[e];return i&&!r.includes(i)?ge(i,a):_e(a)},ge=(e,t)=>{if(e.charAt(0)===`_`)return xe(t,e.slice(1,e.length));switch(e){case y.bool:return ve(t);case y.float4:case y.float8:case y.int2:case y.int4:case y.int8:case y.numeric:case y.oid:return ye(t);case y.json:case y.jsonb:return be(t);case y.timestamp:return Se(t);case y.abstime:case y.date:case y.daterange:case y.int4range:case y.int8range:case y.money:case y.reltime:case y.text:case y.time:case y.timestamptz:case y.timetz:case y.tsrange:case y.tstzrange:return _e(t);default:return _e(t)}},_e=e=>e,ve=e=>{switch(e){case`t`:return!0;case`f`:return!1;default:return e}},ye=e=>{if(typeof e==`string`){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},be=e=>{if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e},xe=(e,t)=>{if(typeof e!=`string`)return e;let n=e.length-1,r=e[n];if(e[0]===`{`&&r===`}`){let r,i=e.slice(1,n);try{r=JSON.parse(`[`+i+`]`)}catch{r=i?i.split(`,`):[]}return r.map(e=>ge(t,e))}return e},Se=e=>typeof e==`string`?e.replace(` `,`T`):e,Ce=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,`http`),t.pathname=t.pathname.replace(/\/+$/,``).replace(/\/socket\/websocket$/i,``).replace(/\/socket$/i,``).replace(/\/websocket$/i,``),t.pathname===``||t.pathname===`/`?t.pathname=`/api/broadcast`:t.pathname+=`/api/broadcast`,t.href};var we=e=>typeof e==`function`?e:function(){return e},Te=typeof self<`u`?self:null,Ee=typeof window<`u`?window:null,b=Te||Ee||globalThis,De=`2.0.0`,Oe=1e4,ke=1e3,Ae=100,x={connecting:0,open:1,closing:2,closed:3},S={closed:`closed`,errored:`errored`,joined:`joined`,joining:`joining`,leaving:`leaving`},C={close:`phx_close`,error:`phx_error`,join:`phx_join`,reply:`phx_reply`,leave:`phx_leave`},je={longpoll:`longpoll`,websocket:`websocket`},Me={complete:4},Ne=`base64url.bearer.phx.`,Pe=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived(`timeout`)||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger(`timeout`,{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Fe=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries+=1,this.callback()},this.timerCalc(this.tries+1))}},Ie=class{constructor(e,t,n){this.state=S.closed,this.topic=e,this.params=we(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Pe(this,C.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Fe(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive(`ok`,()=>{this.state=S.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive(`error`,e=>{this.state=S.errored,this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log(`channel`,`close ${this.topic}`),this.state=S.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log(`channel`,`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=S.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive(`timeout`,()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`timeout ${this.topic}`,this.joinPush.timeout),new Pe(this,C.leave,we({}),this.timeout).send(),this.state=S.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(C.reply,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw Error(`tried to join multiple times. 'join' can only be called a single time per channel instance`);return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=S.closed,this.bindings=[]}onClose(e){this.on(C.close,e)}onError(e){return this.on(C.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(t===void 0||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t||={},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Pe(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=S.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log(`channel`,`leave ${this.topic}`),this.trigger(C.close,`leave`)},n=new Pe(this,C.leave,we({}),e);return n.receive(`ok`,()=>t()).receive(`timeout`,()=>t()),n.send(),this.canPush()||n.trigger(`ok`,{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic===e?r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log(`channel`,`dropping outdated message`,{topic:e,event:t,payload:n,joinRef:r}),!1):!0:!1}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=S.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let i=this.onMessage(e,t,n,r);if(t&&!i)throw Error(`channel onMessage callbacks must return the payload, modified or unmodified`);let a=this.bindings.filter(r=>r.event===e&&this.filterBindings(r,t,n));for(let e=0;ec.abort(),i),s.signal=c.signal),b.fetch(t,s).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>o&&o(e)).catch(e=>{e.name===`AbortError`&&a?a():o&&o(null)}),c}static xdomainRequest(e,t,n,r,i,a,o){return e.timeout=i,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);o&&o(t)},a&&(e.ontimeout=a),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,i,a,o,s){e.open(t,n,!0),e.timeout=a;for(let[t,n]of Object.entries(r))e.setRequestHeader(t,n);return e.onerror=()=>s&&s(null),e.onreadystatechange=()=>{e.readyState===Me.complete&&s&&s(this.parseJSON(e.responseText))},o&&(e.ontimeout=o),e.send(i),e}static parseJSON(e){if(!e||e===``)return null;try{return JSON.parse(e)}catch{return console&&console.log(`failed to parse JSON response`,e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t?`${t}[${r}]`:r,a=e[r];typeof a==`object`?n.push(this.serialize(a,i)):n.push(encodeURIComponent(i)+`=`+encodeURIComponent(a))}return n.join(`&`)}static appendParams(e,t){return Object.keys(t).length===0?e:`${e}${e.match(/\?/)?`&`:`?`}${this.serialize(t)}`}},Re=e=>{let t=``,n=new Uint8Array(e),r=n.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace(`ws://`,`http://`).replace(`wss://`,`https://`).replace(RegExp(`(.*)/`+je.websocket),`$1/`+je.longpoll)}endpointURL(){return Le.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=x.connecting}ontimeout(){this.onerror(`timeout`),this.closeAndRetry(1005,`timeout`,!1)}isActive(){return this.readyState===x.open||this.readyState===x.connecting}poll(){let e={Accept:`application/json`};this.authToken&&(e[`X-Phoenix-AuthToken`]=this.authToken),this.ajax(`GET`,e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:r}=e;if(t===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,`session_gone`,!1);return}this.token=n}else t=0;switch(t){case 200:r.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=x.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,`forbidden`,!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,`internal server error`,500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){typeof e!=`string`&&(e=Re(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e,t=0){this.awaitingBatchAck=!0;let n=t+Ae,r=e.slice(t,n);this.ajax(`POST`,{"Content-Type":`application/x-ndjson`},r.join(` +`),()=>this.onerror(`timeout`),t=>{!t||t.status!==200?(this.awaitingBatchAck=!1,this.onerror(t&&t.status),this.closeAndRetry(1011,`internal server error`,!1)):n0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1})}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=x.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<`u`?this.onclose(new CloseEvent(`close`,r)):this.onclose(r)}ajax(e,t,n,r,i){let a;a=Le.request(e,this.endpointURL(),t,n,this.timeout,()=>{this.reqs.delete(a),r()},e=>{this.reqs.delete(a),this.isActive()&&i(e)}),this.reqs.add(a)}},ze=class e{constructor(t,n={}){let r=n.events||{state:`presence_state`,diff:`presence_diff`};this.state=Object.create(null),this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,t=>{let{onJoin:n,onLeave:r,onSync:i}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,n,r),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,n,r)}),this.pendingDiffs=[],i()}),this.channel.on(r.diff,t=>{let{onJoin:n,onLeave:r,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,n,r),i())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,n,r){let i=this.toNullProtoObj(this.clone(e));t=this.toNullProtoObj(t);let a=Object.create(null),o=Object.create(null);return this.map(i,(e,n)=>{t[e]||(o[e]=n)}),this.map(t,(e,t)=>{let n=i[e];if(n){let r=t.metas.map(e=>e.phx_ref),i=n.metas.map(e=>e.phx_ref),s=t.metas.filter(e=>i.indexOf(e.phx_ref)<0),c=n.metas.filter(e=>r.indexOf(e.phx_ref)<0);s.length>0&&(a[e]=t,a[e].metas=s),c.length>0&&(o[e]=this.clone(n),o[e].metas=c)}else a[e]=t}),this.syncDiff(i,{joins:a,leaves:o},n,r)}static syncDiff(e,t,n,r){e=this.toNullProtoObj(e);let{joins:i,leaves:a}=this.clone(t);return n||=function(){},r||=function(){},this.map(i,(t,r)=>{let i=e[t];if(e[t]=this.clone(r),i){let n=e[t].metas.map(e=>e.phx_ref),r=i.metas.filter(e=>n.indexOf(e.phx_ref)<0);e[t].metas.unshift(...r)}n(t,i,r)}),this.map(a,(t,n)=>{let i=e[t];if(!i)return;let a=n.metas.map(e=>e.phx_ref);i.metas=i.metas.filter(e=>a.indexOf(e.phx_ref)<0),r(t,i,n),i.metas.length===0&&delete e[t]}),e}static list(e,t){return t||=function(e,t){return t},this.map(e,(e,n)=>t(e,n))}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static toNullProtoObj(e){if(Object.getPrototypeOf(e)===null)return e;let t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(n=>{t[n]=e[n]}),t}static clone(e){return JSON.parse(JSON.stringify(e))}},Be={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,i,a,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:a,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:i,payload:a}=e,o=new TextEncoder,s=o.encode(t),c=o.encode(n),l=o.encode(i),u=o.encode(r);this.assertFieldSize(s.byteLength,`join_ref`),this.assertFieldSize(c.byteLength,`ref`),this.assertFieldSize(l.byteLength,`topic`),this.assertFieldSize(u.byteLength,`event`);let d=this.META_LENGTH+s.byteLength+c.byteLength+l.byteLength+u.byteLength,f=new ArrayBuffer(this.HEADER_LENGTH+d),p=new Uint8Array(f),m=new DataView(f),h=0;m.setUint8(h++,this.KINDS.push),m.setUint8(h++,s.byteLength),m.setUint8(h++,c.byteLength),m.setUint8(h++,l.byteLength),m.setUint8(h++,u.byteLength),p.set(s,h),h+=s.byteLength,p.set(c,h),h+=c.byteLength,p.set(l,h),h+=l.byteLength,p.set(u,h),h+=u.byteLength;var g=new Uint8Array(f.byteLength+a.byteLength);return g.set(p,0),g.set(new Uint8Array(a),f.byteLength),g.buffer},assertFieldSize(e,t){if(e>255)throw Error(`unable to convert ${t} to binary: must be less than or equal to 255 bytes, but is ${e} bytes`)},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,s=n.decode(e.slice(o,o+r));o+=r;let c=n.decode(e.slice(o,o+i));o+=i;let l=n.decode(e.slice(o,o+a));return o+=a,{join_ref:s,ref:null,topic:c,event:l,payload:e.slice(o,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4),s=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(s,s+r));s+=r;let l=n.decode(e.slice(s,s+i));s+=i;let u=n.decode(e.slice(s,s+a));s+=a;let d=n.decode(e.slice(s,s+o));s+=o;let f={status:d,response:e.slice(s,e.byteLength)};return{join_ref:c,ref:l,topic:u,event:C.reply,payload:f}},decodeBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),a=this.HEADER_LENGTH+2,o=n.decode(e.slice(a,a+r));a+=r;let s=n.decode(e.slice(a,a+i));return a+=i,{join_ref:null,ref:null,topic:o,event:s,payload:e.slice(a,e.byteLength)}}},Ve=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Oe,this.transport=t.transport||b.WebSocket||w,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=b&&b.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=Be.encode.bind(Be),this.defaultDecoder=Be.decode.bind(Be),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||`arraybuffer`,this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport===w?(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder):(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder);let r=null;Ee&&Ee.addEventListener&&(Ee.addEventListener(`pagehide`,e=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Ee.addEventListener(`pageshow`,e=>{r===this.connectClock&&(r=null,this.connect())}),Ee.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=we(t.params||{}),this.endPoint=`${e}/${je.websocket}`,this.vsn=t.vsn||De,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Fe(()=>{if(this.pageHidden){this.log(`Not reconnecting as page is hidden!`),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken&&we(t.authToken)}getLongPollTransport(){return w}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&=(this.conn.close(),null),this.transport=e}protocol(){return location.protocol.match(/^https/)?`wss`:`ws`}endPointURL(){let e=Le.appendParams(Le.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)===`/`?e.charAt(1)===`/`?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`:e}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log(`passing params to connect is deprecated. Instead pass :params to the Socket constructor`),this.params=we(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==w?this.connectWithFallback(w,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:t});let r=this.onMessage(i=>{i.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case w:return`LongPoll`;default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=[`phoenix`,`${Ne}${btoa(this.authToken()).replace(/=/g,``)}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,i,a=this.transportName(e),o=t=>{this.log(`transport`,`falling back to ${a}...`,t),this.off([void 0,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o(`memorized`);this.fallbackTimer=setTimeout(o,t),i=this.onError(e=>{this.log(`transport`,`error`,e),r&&!n&&(clearTimeout(this.fallbackTimer),o(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,`true`),this.log(`transport`,`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(e=>{this.log(`transport`,`connected to primary after`,e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log(`transport`,`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks(`open`)}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log(`transport`,`heartbeat timeout. Attempting to re-establish connection`);try{this.heartbeatCallback(`timeout`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.triggerChanError(Error(`heartbeat timeout`)),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),ke,`heartbeat timeout`)}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||``):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===x.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log(`transport`,`close`,e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks(`close`,e)}onConnError(e){this.hasLogger()&&this.log(`transport`,`error`,e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks(`error`,e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(C.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case x.connecting:return`connecting`;case x.open:return`open`;case x.closing:return`closing`;default:return`closed`}}isConnected(){return this.connectionState()===`open`}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>e.indexOf(t)===-1)}channel(e,t={}){let n=new Ie(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;this.log(`push`,`${t} ${n} (${a}, ${i})`,r)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback(`disconnected`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:`phoenix`,event:`heartbeat`,payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback(`sent`)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:n,payload:r,ref:i,join_ref:a}=e;if(i&&i===this.pendingHeartbeatRef){let e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status===`ok`?`ok`:`error`,e)}catch(e){this.log(`error`,`error in heartbeat callback`,e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log(`receive`,`${r.status||``} ${t} ${n} ${i&&`(`+i+`)`||``}`.trim(),r);for(let e=0;e{try{r(...t)}catch(t){this.log(`error`,`error in ${e} callback`,t)}})}catch(t){this.log(`error`,`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log(`transport`,`leaving duplicate topic "${e}"`),t.leave())}},He=class e{constructor(t,n){let r=Ge(n);this.presence=new ze(t.getChannel(),r),this.presence.onJoin((n,r,i)=>{let a=e.onJoinPayload(n,r,i);t.getChannel().trigger(`presence`,a)}),this.presence.onLeave((n,r,i)=>{let a=e.onLeavePayload(n,r,i);t.getChannel().trigger(`presence`,a)}),this.presence.onSync(()=>{t.getChannel().trigger(`presence`,{event:`sync`})})}get state(){return e.transformState(this.presence.state)}static transformState(e){return e=We(e),Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return t[n]=Ue(r),t},{})}static onJoinPayload(e,t,n){return{event:`join`,key:e,currentPresences:Ke(t),newPresences:Ue(n)}}static onLeavePayload(e,t,n){return{event:`leave`,key:e,currentPresences:Ke(t),leftPresences:Ue(n)}}};function Ue(e){return e.metas.map(e=>{let t=Object.getOwnPropertyDescriptors(e),n=Object.defineProperties({},t);return n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n})}function We(e){return JSON.parse(JSON.stringify(e))}function Ge(e){return e?.events&&{events:e.events}}function Ke(e){return e?.metas?Ue(e):[]}var qe;(function(e){e.SYNC=`sync`,e.JOIN=`join`,e.LEAVE=`leave`})(qe||={});var Je=class{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new He(this.channel.channelAdapter,t)}};function Ye(e){if(e instanceof Error)return e;if(typeof e==`string`)return Error(e);if(e&&typeof e==`object`){let t=e;if(typeof t.code==`number`){let n=typeof t.reason==`string`&&t.reason?` (${t.reason})`:``;return Error(`socket closed: ${t.code}${n}`,{cause:e})}return Error(`channel error: transport failure`,{cause:e})}return Error(`channel error: connection lost`)}var Xe=class{constructor(e,t,n){let r=Ze(n);this.channel=e.getSocket().channel(t,r),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,n){let r;try{r=this.channel.push(e,t,n)}catch{throw Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>100){let e=this.channel.pushBuffer.shift();e.cancelTimeout(),this.socket.log(`channel`,`discarded push due to buffer overflow: ${e.event}`,e.payload())}return r}updateJoinPayload(e){let t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===v.joined}isJoined(){return this.state===v.joined}isJoining(){return this.state===v.joining}isClosed(){return this.state===v.closed}isLeaving(){return this.state===v.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}};function Ze(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},e.config)}}let Qe=/[,()"\\]/,$e=e=>Qe.test(e)||e!==e.trim(),et=e=>`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`,tt=e=>{let t=e===null?`null`:String(e);return $e(t)?et(t):t},nt=e=>e===null?`null`:String(e),rt=(e,t)=>{if(e===`in`){let e=Array.isArray(t)?t:[t];if(e.length===0)throw Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(e)).map(e=>tt(e)).join(`,`)})`}return e===`is`?`is.${nt(t)}`:`${e}.${tt(t)}`};var it=class{constructor(){this.filters=[]}add(e,t,n,r=!1){let i=r?`not.`:``;return this.filters.push(`${e}=${i}${rt(t,n)}`),this}eq(e,t){return this.add(e,`eq`,t)}neq(e,t){return this.add(e,`neq`,t)}gt(e,t){return this.add(e,`gt`,t)}gte(e,t){return this.add(e,`gte`,t)}lt(e,t){return this.add(e,`lt`,t)}lte(e,t){return this.add(e,`lte`,t)}in(e,t){return this.add(e,`in`,t)}like(e,t){return this.add(e,`like`,t)}ilike(e,t){return this.add(e,`ilike`,t)}match(e,t){return this.add(e,`match`,t)}imatch(e,t){return this.add(e,`imatch`,t)}is(e,t){return this.add(e,`is`,t)}isDistinct(e,t){return this.add(e,`isdistinct`,t)}not(e,t,n){return this.add(e,t,n,!0)}build(){return this.filters.join(`,`)}toString(){return this.build()}};let at=()=>new it;var ot;(function(e){e.ALL=`*`,e.INSERT=`INSERT`,e.UPDATE=`UPDATE`,e.DELETE=`DELETE`})(ot||={});var T;(function(e){e.BROADCAST=`broadcast`,e.PRESENCE=`presence`,e.POSTGRES_CHANGES=`postgres_changes`,e.SYSTEM=`system`})(T||={});var E;(function(e){e.SUBSCRIBED=`SUBSCRIBED`,e.TIMED_OUT=`TIMED_OUT`,e.CLOSED=`CLOSED`,e.CHANNEL_ERROR=`CHANNEL_ERROR`})(E||={});let st=v;var ct=class e{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,``),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:``,enabled:!1},private:!1},t.config),this.channelAdapter=new Xe(this.socket.socketAdapter,e,this.params),this.presence=new Je(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Ce(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&this.params.config?.broadcast?.replay)throw Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){let{config:{broadcast:n,presence:r,private:i}}=this.params,a=this.bindings.postgres_changes?.map(e=>e.filter)??[],o=!!this.bindings[T.PRESENCE]&&this.bindings[T.PRESENCE].length>0||this.params.config.presence?.enabled===!0,s={},c={broadcast:n,presence:Object.assign(Object.assign({},r),{enabled:o}),postgres_changes:a,private:i};this.socket.accessTokenValue&&(s.access_token=this.socket.accessTokenValue),this._onError(t=>{e?.(E.CHANNEL_ERROR,Ye(t))}),this._onClose(()=>e?.(E.CLOSED)),this.updateJoinPayload(Object.assign({config:c},s)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive(`ok`,async({postgres_changes:t})=>{if(this.socket._isManualToken()||this.socket.setAuth(),t===void 0){e?.(E.SUBSCRIBED);return}this._updatePostgresBindings(t,e)}).receive(`error`,t=>{this.state=v.errored;let n=Object.values(t).join(`, `)||`error`;e?.(E.CHANNEL_ERROR,Error(n,{cause:t}))}).receive(`timeout`,()=>{e?.(E.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){let r=this.bindings.postgres_changes,i=r?.length??0,a=[];for(let o=0;o{let r=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);e.type===`broadcast`&&!this.params?.config?.broadcast?.ack&&n(`ok`),r.receive(`ok`,()=>n(`ok`)),r.receive(`error`,()=>n(`error`)),r.receive(`timeout`,()=>n(`timed out`))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive(`ok`,()=>t(`ok`)).receive(`timeout`,()=>t(`timed out`)).receive(`error`,()=>t(`error`))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){let r=new AbortController,i=setTimeout(()=>r.abort(),n),a=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(i),a}_on(t,n,r){let i=t.toLocaleLowerCase(),a=n?.filter;if((a instanceof it||typeof a==`object`&&a&&typeof a.build==`function`)&&(n=Object.assign(Object.assign({},n),{filter:a.build()})),i===T.POSTGRES_CHANGES&&this.bindings[i]?.find(t=>e.isSamePostgresFilter(t.filter,n)))return this.socket.log(`error`,`duplicate \`postgres_changes\` binding for ${this.topic} ignored`,n),this;let o=this.channelAdapter.on(t,r),s={type:i,filter:n,callback:r,ref:o};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{let r=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(r,n))return!1;let i=this.bindings[r]?.find(t=>t.ref===e.ref);if(!i)return!0;if([`broadcast`,`presence`,`postgres_changes`].includes(r))if(`id`in i){let e=i.id,n=i.filter?.event;return e&&t.ids?.includes(e)&&(n===`*`||n?.toLocaleLowerCase()===t.data?.type.toLocaleLowerCase())}else{let e=(i?.filter?.event)?.toLocaleLowerCase();return e===`*`||e===(t?.event)?.toLocaleLowerCase()}else return i.type.toLocaleLowerCase()===r})}_notThisChannelEvent(e,t){let{close:n,error:r,leave:i,join:a}=de;return t&&[n,r,i,a].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if(typeof t==`object`&&`ids`in t){let e=t.data,{schema:n,table:r,commit_timestamp:i,type:a,errors:o}=e,s={schema:n,table:r,commit_timestamp:i,eventType:a,new:{},old:{},errors:o};return Object.assign(Object.assign({},s),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw Error(`cannot copy bindings into joined channel`);for(let t in e.bindings)for(let n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(e??void 0)===(t??void 0)}static isSamePostgresFilter(t,n){let r=(t?.select)?.join()??void 0,i=(n?.select)?.join()??void 0;return t?.event===n?.event&&e.isFilterValueEqual(t?.schema,n?.schema)&&e.isFilterValueEqual(t?.table,n?.table)&&e.isFilterValueEqual(t?.filter,n?.filter)&&r===i}_getPayloadRecords(e){let t={new:{},old:{}};return(e.type===`INSERT`||e.type===`UPDATE`)&&(t.new=me(e.columns,e.record)),(e.type===`UPDATE`||e.type===`DELETE`)&&(t.old=me(e.columns,e.old_record)),t}},lt=class{constructor(e,t){this.socket=new Ve(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,n,r=1e4){return new Promise(i=>{setTimeout(()=>i(`timeout`),r),this.socket.disconnect(()=>{e(),i(`ok`)},t,n)})}push(e){this.socket.push(e)}log(e,t,n){this.socket.log(e,t,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==fe.connecting}isDisconnecting(){return this.socket.connectionState()==fe.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}};let ut={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},dt=[1e3,2e3,5e3,1e4];function ft(){let e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){return Array.from(e.keys())[t]??null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function pt(){try{if(typeof globalThis<`u`&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return ft()}var mt=class{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){if(this.channels=[],this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint=``,this.headers={},this.params={},this.ref=0,this.serializer=new pe,this._manuallySetToken=!1,this._authPromise=null,this._authGeneration=0,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!t?.params?.apikey)throw Error(`API key is required to connect to Realtime`);this.apiKey=t.params.apikey,this.socketAdapter=new lt(e,this._initializeOptions(t)),this.httpEndpoint=Ce(e),this.fetch=this._resolveFetch(t?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely(`connect`),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){let t=e.message;throw Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?`ok`:await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return t===`ok`&&e.teardown(),t}async removeAllChannels(){let e=this.channels.map(async e=>{let t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||fe.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){let n=`realtime:${e}`,r=this.getChannels().find(e=>e.topic===n);if(r)return r;{let n=new ct(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){let t=++this._authGeneration,n=this._performAuth(e,t);t===this._authGeneration&&(this._authPromise=n);try{await n}finally{this._authPromise===n&&(this._authPromise=null)}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),this.channels.length===0&&(this.log(`transport`,`no channels remaining, scheduling disconnect`),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log(`transport`,`disconnecting immediately - no channels`),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log(`transport`,`deferred disconnect fired - no channels, disconnecting`),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log(`transport`,`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log(`transport`,`pending disconnect cancelled - channel activity detected`),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e,t){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(e){this.log(`error`,`Error fetching access token from callback`,e),n=this.accessTokenValue}else n=this.accessTokenValue;t===this._authGeneration&&(this.accessToken?this._manuallySetToken=!1:r&&(this._manuallySetToken=!0),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(e=>{let t={access_token:n,version:`realtime-js/2.112.3`};e.updateJoinPayload(t),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(de.access_token,{access_token:n})})))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e=`general`){this._isManualToken()||this.setAuth().catch(t=>{this.log(`error`,`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log(`error`,`error waiting for auth on connect`,e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{t!==`disconnected`&&(t==`sent`&&this._setAuthSafely(),e&&e(t,n))}}_startWorkerHeartbeat(){this.workerUrl?this.log(`worker`,`starting worker for from ${this.workerUrl}`):this.log(`worker`,`starting default worker`);let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log(`worker`,`worker error`,e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{e.data.event===`keepAlive`&&this.sendHeartbeat()},this.workerRef.postMessage({event:`start`,interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&=(this.log(`worker`,`terminating worker`),this.workerRef.terminate(),void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([` + addEventListener("message", (e) => { + if (e.data.event === "start") { + setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); + } + });`],{type:`application/javascript`});t=URL.createObjectURL(e)}return t}_initializeOptions(e){this.worker=e?.worker??!1,this.accessToken=e?.accessToken??null;let t={};t.timeout=e?.timeout??1e4,t.heartbeatIntervalMs=e?.heartbeatIntervalMs??ut.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=e?.disconnectOnEmptyChannelsAfterMs??2*(e?.heartbeatIntervalMs??ut.HEARTBEAT_INTERVAL),t.transport=e?.transport??ue.getWebSocketConstructor(),t.params=e?.params,t.logger=e?.logger,t.heartbeatCallback=this._wrapHeartbeatCallback(e?.heartbeatCallback),t.sessionStorage=e?.sessionStorage??pt(),t.reconnectAfterMs=e?.reconnectAfterMs??(e=>dt[e-1]||1e4);let n,r,i=e?.vsn??`2.0.0`;switch(i){case`1.0.0`:n=(e,t)=>t(JSON.stringify(e)),r=(e,t)=>t(JSON.parse(e));break;case`2.0.0`:n=this.serializer.encode.bind(this.serializer),r=this.serializer.decode.bind(this.serializer);break;default:throw Error(`Unsupported serializer version: ${t.vsn}`)}if(t.vsn=i,t.encode=e?.encode??n,t.decode=e?.decode??r,t.beforeReconnect=this._reconnectAuth.bind(this),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,t.params=Object.assign(Object.assign({},t.params),{log_level:this.logLevel})),this.worker){if(typeof window<`u`&&!window.Worker)throw Error(`Web Worker is not supported`);this.workerUrl=e?.workerUrl,t.autoSendHeartbeat=!this.worker}return t}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}},ht=class extends Error{constructor(e,t){super(e),this.name=`IcebergError`,this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType===`CommitStateUnknownException`||[500,502,504].includes(t.status)&&t.icebergType?.includes(`CommitState`)===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function gt(e,t,n){let r=new URL(t,e);if(n)for(let[e,t]of Object.entries(n))t!==void 0&&r.searchParams.set(e,t);return r.toString()}async function _t(e){return!e||e.type===`none`?{}:e.type===`bearer`?{Authorization:`Bearer ${e.token}`}:e.type===`header`?{[e.name]:e.value}:e.type===`custom`?await e.getHeaders():{}}function vt(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:a,headers:o}){let s=gt(e.baseUrl,r,i),c=await _t(e.auth),l=await t(s,{method:n,headers:{...a?{"Content-Type":`application/json`}:{},...c,...o},body:a?JSON.stringify(a):void 0}),u=await l.text(),d=(l.headers.get(`content-type`)||``).includes(`application/json`),f=d&&u?JSON.parse(u):u;if(!l.ok){let e=d?f:void 0,t=e?.error;throw new ht(t?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:l.status,headers:l.headers,data:f}}}}function yt(e){return e.join(``)}var bt=class{constructor(e,t=``){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:yt(e.namespace)}:void 0;return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${yt(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${yt(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${yt(e.namespace)}`}),!0}catch(e){if(e instanceof ht&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof ht&&e.status===409)return;throw e}}};function xt(e){return e.join(``)}var St=class{constructor(e,t=``,n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let n={};return this.accessDelegation&&(n[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){let n=await this.client.request({method:`POST`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data[`metadata-location`],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:`DELETE`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation),(await this.client.request({method:`GET`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t[`X-Iceberg-Access-Delegation`]=this.accessDelegation);try{return await this.client.request({method:`HEAD`,path:`${this.prefix}/namespaces/${xt(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof ht&&e.status===404)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof ht&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Ct=class{constructor(e){let t=`v1`;e.catalogName&&(t+=`/${e.catalogName}`),this.client=vt({baseUrl:e.baseUrl.endsWith(`/`)?e.baseUrl:`${e.baseUrl}/`,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(`,`),this.namespaceOps=new bt(this.client,t),this.tableOps=new St(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function wt(e){"@babel/helpers - typeof";return wt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wt(e)}function Tt(e,t){if(wt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(wt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Et(e){var t=Tt(e,`string`);return wt(t)==`symbol`?t:t+``}function Dt(e,t,n){return(t=Et(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),It=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Lt=e=>{if(Array.isArray(e))return e.map(e=>Lt(e));if(typeof e==`function`||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,n])=>{let r=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,``));t[r]=Lt(n)}),t},Rt=e=>!e||typeof e!=`string`||e.length===0||e.length>100||e.trim()!==e||e.includes(`/`)||e.includes(`\\`)?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),zt=e=>e.split(`/`).map(encodeURIComponent).join(`/`),Bt=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error;if(typeof t.error==`object`&&t.error!==null){let e=t.error;if(typeof e.message==`string`)return e.message}}return JSON.stringify(e)},Vt=async(e,t,n,r)=>{if(typeof e==`object`&&e&&`json`in e&&typeof e.json==`function`){let n=e,i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(e=>{let n=e?.statusCode||e?.code||i+``;t(new jt(Bt(e),i,n,r,e?.code))}).catch(()=>{let e=i+``;t(new jt(n.statusText||`HTTP ${i} error`,i,e,r))})}else t(new Mt(Bt(e),e,r))},Ht=(e,t,n,r)=>{let i={method:e,headers:t?.headers||{}};if(e===`GET`||e===`HEAD`||!r)return D(D({},i),n);if(It(r)){let e=t?.headers||{},n;for(let[t,r]of Object.entries(e))t.toLowerCase()===`content-type`&&(n=r);i.headers=Nt(e,`Content-Type`,n??`application/json`),i.body=JSON.stringify(r)}else i.body=r;return t?.duplex&&(i.duplex=t.duplex),D(D({},i),n)};async function Ut(e,t,n,r,i,a,o){return new Promise((s,c)=>{e(n,Ht(t,r,i,a)).then(e=>{if(!e.ok)throw e;if(r?.noResolveJson)return e;if(o===`vectors`){let t=e.headers.get(`content-type`);if(e.headers.get(`content-length`)===`0`||e.status===204||!t||!t.includes(`application/json`))return{}}return e.json()}).then(e=>s(e)).catch(e=>Vt(e,c,r,o))})}function Wt(e=`storage`){return{get:async(t,n,r,i)=>Ut(t,`GET`,n,r,i,void 0,e),post:async(t,n,r,i,a)=>Ut(t,`POST`,n,i,a,r,e),put:async(t,n,r,i,a)=>Ut(t,`PUT`,n,i,a,r,e),head:async(t,n,r,i)=>Ut(t,`HEAD`,n,D(D({},r),{},{noResolveJson:!0}),i,void 0,e),remove:async(t,n,r,i,a)=>Ut(t,`DELETE`,n,i,a,r,e)}}let{get:Gt,post:O,put:Kt,head:qt,remove:Jt}=Wt(`storage`),k=Wt(`vectors`);var Yt=class{constructor(e,t={},n,r=`storage`){this.shouldThrowOnError=!1,this.url=e,this.headers=Pt(t),this.fetch=Ft(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Nt(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(At(e))return{data:null,error:e};throw e}}};let Xt;Xt=Symbol.toStringTag;var Zt=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Xt]=`StreamDownloadBuilder`,this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(At(t))return{data:null,error:t};throw t}}};let Qt;Qt=Symbol.toStringTag;var $t=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Qt]=`BlobDownloadBuilder`,this.promise=null}asStream(){return new Zt(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||=this.execute(),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(At(t))return{data:null,error:t};throw t}}};let en={limit:100,offset:0,sortBy:{column:`name`,order:`asc`}},tn={cacheControl:`3600`,contentType:`text/plain;charset=UTF-8`,upsert:!1};var nn=class extends Yt{constructor(e,t={},n,r){super(e,t,r,`storage`),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var i=this;return i.handleOperation(async()=>{let a,o=D(D({},tn),r),s=D(D({},i.headers),e===`POST`&&{"x-upsert":String(o.upsert)}),c=o.metadata;if(typeof Blob<`u`&&n instanceof Blob?(a=new FormData,a.append(`cacheControl`,o.cacheControl),c&&a.append(`metadata`,i.encodeMetadata(c)),a.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(a=n,a.has(`cacheControl`)||a.append(`cacheControl`,o.cacheControl),c&&!a.has(`metadata`)&&a.append(`metadata`,i.encodeMetadata(c))):(a=n,s[`cache-control`]=`max-age=${o.cacheControl}`,s[`content-type`]=o.contentType,c&&(s[`x-metadata`]=i.toBase64(i.encodeMetadata(c))),(typeof ReadableStream<`u`&&a instanceof ReadableStream||a&&typeof a==`object`&&`pipe`in a&&typeof a.pipe==`function`)&&!o.duplex&&(o.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))s=Nt(s,e,t);let l=i._removeEmptyFolders(t),u=i._getFinalPath(l),d=await(e==`PUT`?Kt:O)(i.fetch,`${i.url}/object/${u}`,a,D({headers:s},o?.duplex?{duplex:o.duplex}:{}));return{path:l,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate(`POST`,e,t,n)}async uploadToSignedUrl(e,t,n,r){var i=this;let a=i._removeEmptyFolders(e),o=i._getFinalPath(a),s=new URL(i.url+`/object/upload/sign/${o}`);return s.searchParams.set(`token`,t),i.handleOperation(async()=>{let e,t=D(D({},tn),r),o=D(D({},i.headers),{"x-upsert":String(t.upsert)}),c=t.metadata;if(typeof Blob<`u`&&n instanceof Blob?(e=new FormData,e.append(`cacheControl`,t.cacheControl),c&&e.append(`metadata`,i.encodeMetadata(c)),e.append(``,n)):typeof FormData<`u`&&n instanceof FormData?(e=n,e.has(`cacheControl`)||e.append(`cacheControl`,t.cacheControl),c&&!e.has(`metadata`)&&e.append(`metadata`,i.encodeMetadata(c))):(e=n,o[`cache-control`]=`max-age=${t.cacheControl}`,o[`content-type`]=t.contentType,c&&(o[`x-metadata`]=i.toBase64(i.encodeMetadata(c))),(typeof ReadableStream<`u`&&e instanceof ReadableStream||e&&typeof e==`object`&&`pipe`in e&&typeof e.pipe==`function`)&&!t.duplex&&(t.duplex=`half`)),r?.headers)for(let[e,t]of Object.entries(r.headers))o=Nt(o,e,t);return{path:a,fullPath:(await Kt(i.fetch,s.toString(),e,D({headers:o},t?.duplex?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e),i=D({},n.headers);t?.upsert&&(i[`x-upsert`]=`true`);let a=await O(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(n.url+a.url),s=o.searchParams.get(`token`);if(!s)throw new kt(`No token returned by API`);return{signedUrl:o.toString(),path:e,token:s}})}async update(e,t,n){return this.uploadOrUpdate(`PUT`,e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await O(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await O(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let i=r._getFinalPath(e),a=typeof n?.transform==`object`&&n.transform!==null&&Object.keys(n.transform).length>0,o=await O(r.fetch,`${r.url}/object/sign/${i}`,D({expiresIn:t},a?{transform:n.transform}:{}),{headers:r.headers}),s=new URLSearchParams;n?.download&&s.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&s.set(`cacheNonce`,String(n.cacheNonce));let c=s.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${c?`&${c}`:``}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{let i=await O(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),a=new URLSearchParams;n?.download&&a.set(`download`,n.download===!0?``:n.download),n?.cacheNonce!=null&&a.set(`cacheNonce`,String(n.cacheNonce));let o=a.toString();return i.map(e=>D(D({},e),{},{signedUrl:e.signedURL?encodeURI(`${r.url}${e.signedURL}${o?`&${o}`:``}`):null}))})}download(e,t,n){let r=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image/authenticated`:`object`,i=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(i,t.transform),t?.cacheNonce!=null&&i.set(`cacheNonce`,String(t.cacheNonce));let a=i.toString(),o=this._getFinalPath(e);return new $t(()=>Gt(this.fetch,`${this.url}/${r}/${o}${a?`?${a}`:``}`,{headers:this.headers,noResolveJson:!0},n),this.shouldThrowOnError)}async info(e){var t=this;let n=t._getFinalPath(e);return t.handleOperation(async()=>Lt(await Gt(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;let n=t._getFinalPath(e);try{return await qt(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(At(e)){let t=e instanceof jt?e.status:e instanceof Mt?e.originalError?.status:void 0;if(t!==void 0&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){let n=this._getFinalPath(e),r=new URLSearchParams;t?.download&&r.set(`download`,t.download===!0?``:t.download),t?.transform&&this.applyTransformOptsToQuery(r,t.transform),t?.cacheNonce!=null&&r.set(`cacheNonce`,String(t.cacheNonce));let i=r.toString(),a=typeof t?.transform==`object`&&t.transform!==null&&Object.keys(t.transform).length>0?`render/image`:`object`;return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}`)+(i?`?${i}`:``)}}}async remove(e){var t=this;return t.handleOperation(async()=>await Jt(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,n){var r=this;return r.handleOperation(async()=>{let i=zt(r._getFinalPath(e)),a=new URLSearchParams;t?.transformations&&a.set(`transformations`,`true`);let o=a.toString();return await Jt(r.fetch,`${r.url}/cdn/${i}${o?`?${o}`:``}`,{},{headers:r.headers},n)})}async list(e,t,n){var r=this;return r.handleOperation(async()=>{let i=t?.sortBy?D(D({},en.sortBy),t.sortBy):en.sortBy,a=D(D(D({},en),t),{},{sortBy:i,prefix:e||``});return await O(r.fetch,`${r.url}/object/list/${r.bucketId}`,a,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{let r=D({},e);return await O(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,``)}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)}applyTransformOptsToQuery(e,t){return t.width&&e.set(`width`,t.width.toString()),t.height&&e.set(`height`,t.height.toString()),t.resize&&e.set(`resize`,t.resize),t.format&&e.set(`format`,t.format),t.quality&&e.set(`quality`,t.quality.toString()),e}};let rn={"X-Client-Info":`storage-js/2.112.3`};var an=class extends Yt{constructor(e,t={},n,r){let i=new URL(e);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes(`storage.supabase.`)&&(i.hostname=i.hostname.replace(`supabase.`,`storage.supabase.`));let a=i.href.replace(/\/$/,``),o=D(D({},rn),t);super(a,o,n,`storage`)}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let n=t.listBucketOptionsToQueryString(e);return await Gt(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Gt(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await O(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await Kt(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await O(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Jt(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,n){var r=this;return r.handleOperation(async()=>{let i=new URLSearchParams;t?.transformations&&i.set(`transformations`,`true`);let a=i.toString();return await Jt(r.fetch,`${r.url}/cdn/${zt(e)}${a?`?${a}`:``}`,{},{headers:r.headers},n)})}listBucketOptionsToQueryString(e){let t={};return e&&(`limit`in e&&(t.limit=String(e.limit)),`offset`in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?`?`+new URLSearchParams(t).toString():``}},on=class extends Yt{constructor(e,t={},n){let r=e.replace(/\/$/,``),i=D(D({},rn),t);super(r,i,n,`storage`)}async createBucket(e){var t=this;return t.handleOperation(async()=>await O(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let n=new URLSearchParams;e?.limit!==void 0&&n.set(`limit`,e.limit.toString()),e?.offset!==void 0&&n.set(`offset`,e.offset.toString()),e?.sortColumn&&n.set(`sortColumn`,e.sortColumn),e?.sortOrder&&n.set(`sortOrder`,e.sortOrder),e?.search&&n.set(`search`,e.search);let r=n.toString(),i=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Gt(t.fetch,i,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Jt(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Rt(e))throw new kt(`Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.`);let n=new Ct({baseUrl:this.url,catalogName:e,auth:{type:`custom`,getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(e,t){let n=e[t];return typeof n==`function`?async(...t)=>{try{return{data:await n.apply(e,t),error:null}}catch(e){if(r)throw e;return{data:null,error:e}}}:n}})}},sn=class extends Yt{constructor(e,t={},n){let r=e.replace(/\/$/,``),i=D(D({},rn),{},{"Content-Type":`application/json`},t);super(r,i,n,`vectors`)}async createIndex(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await k.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await k.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},cn=class extends Yt{constructor(e,t={},n){let r=e.replace(/\/$/,``),i=D(D({},rn),{},{"Content-Type":`application/json`},t);super(r,i,n,`vectors`)}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw Error(`Vector batch size must be between 1 and 500 items`);return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw Error(`segmentCount must be between 1 and 16`);if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw Error(`Keys batch size must be between 1 and 500 items`);return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},ln=class extends Yt{constructor(e,t={},n){let r=e.replace(/\/$/,``),i=D(D({},rn),{},{"Content-Type":`application/json`},t);super(r,i,n,`vectors`)}async createBucket(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await k.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},un=class extends ln{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new dn(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},dn=class extends sn{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new fn(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},fn=class extends cn{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,D(D({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},pn=class extends an{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new nn(this.url,this.headers,e,this.fetch)}get vectors(){return new un(this.url+`/vector`,{headers:this.headers,fetch:this.fetch})}get analytics(){return new on(this.url+`/iceberg`,this.headers,this.fetch)}};let mn=``,hn;typeof Deno<`u`?(mn=`deno`,hn=Deno.version?.deno):typeof document<`u`?mn=`web`:typeof navigator<`u`&&navigator.product===`ReactNative`?mn=`react-native`:(mn=`node`,hn=globalThis.process?.version?.replace(/^v/,``));let gn=[`runtime=${mn}`];hn&&gn.push(`runtime-version=${hn}`);let _n={headers:{"X-Client-Info":`supabase-js/2.112.3; ${gn.join(`; `)}`}},vn={schema:`public`},yn={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:`implicit`},bn={},xn={enabled:!1,respectSamplingDecision:!0};function Sn(e){if(!e||typeof e!=`string`)return null;let t=e.split(`-`);if(t.length!==4)return null;let[n,r,i,a]=t;if(n.length!==2||r.length!==32||i.length!==16||a.length!==2)return null;let o=/^[0-9a-f]+$/i;return!o.test(n)||!o.test(r)||!o.test(i)||!o.test(a)||r===`00000000000000000000000000000000`||i===`0000000000000000`?null:{version:n,traceId:r,parentId:i,traceFlags:a,isSampled:(parseInt(a,16)&1)==1}}function Cn(e,t){if(!e||!t||t.length===0)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch{return!1}for(let e of t)try{if(typeof e==`string`){if(wn(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if(typeof e==`function`&&e(n))return!0}catch{continue}return!1}function wn(e,t){if(t===e)return!0;if(t.startsWith(`*.`)){let n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith(`.`+n)))return!0}return!1}function Tn(e){let t=[];try{let n=new URL(e);t.push(n.hostname)}catch{}return t.push(`*.supabase.co`,`*.supabase.in`),t.push(`localhost`,`127.0.0.1`,`[::1]`),t}let En=Symbol.for(`@supabase/supabase-js.traceContextExtractor`);function Dn(){return globalThis[En]}let On=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),kn=()=>Headers,An=e=>e.startsWith(`sb_publishable_`)||e.startsWith(`sb_secret_`),jn=new Set,Mn=e=>{if(!e.startsWith(`sb_`)||An(e)||e.startsWith(`sb_temp_`))return;let t=e.match(/^sb_[a-zA-Z0-9]+_/)?.[0]??`unknown`;jn.has(t)||(jn.add(t),console.warn(`@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type.`))},Nn=(e,t,n,r,i,a)=>{let o=On(r),s=kn(),c=i?.enabled===!0,l=i?.respectSamplingDecision!==!1,u=c?Tn(t):null,d=!(a?.omitApiKeyAsBearer&&An(e));return async(t,r)=>{let i=await n(),a=new s(r?.headers);if(a.has(`apikey`)||a.set(`apikey`,e),!a.has(`Authorization`)){let t=i??(d?e:null);t&&a.set(`Authorization`,`Bearer ${t}`)}if(u){let e=In(t,u,l);e&&(e.traceparent&&!a.has(`traceparent`)&&a.set(`traceparent`,e.traceparent),e.tracestate&&!a.has(`tracestate`)&&a.set(`tracestate`,e.tracestate),e.baggage&&!a.has(`baggage`)&&a.set(`baggage`,e.baggage))}return o(t,{...r,headers:a})}},Pn=!1,Fn=!1;function In(e,t,n){let r=Dn();if(!r)return Pn||(Pn=!0,console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation.")),null;if(!Cn(typeof e==`string`||e instanceof URL?e:e.url,t))return null;let i=r();if(!i||!i.traceparent){if(i?.carrierKeys?.length&&!Fn){Fn=!0;let e=i.carrierKeys.includes(`sentry-trace`)?" Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.":` Configure your tracing SDK to emit W3C trace context on outgoing requests.`;console.warn(`@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its propagator wrote [${i.carrierKeys.join(`, `)}] and no W3C traceparent header, so trace headers will not be attached.`+e)}return null}if(n){let e=Sn(i.traceparent);if(e&&!e.isSampled)return{traceparent:i.traceparent}}return i}function Ln(e){return typeof e==`boolean`?{enabled:e}:e}function Rn(e){return e.endsWith(`/`)?e:e+`/`}function zn(e,t){let{db:n,auth:r,realtime:i,global:a}=e,{db:o,auth:s,realtime:c,global:l}=t,u=Ln(e.tracePropagation),d=Ln(t.tracePropagation),f={db:{...o,...n},auth:{...s,...r},realtime:{...c,...i},storage:{},global:{...l,...a,headers:{...l?.headers??{},...a?.headers??{}}},tracePropagation:{enabled:u?.enabled??d?.enabled??!1,respectSamplingDecision:u?.respectSamplingDecision??d?.respectSamplingDecision??!0},accessToken:async()=>``};return e.accessToken?f.accessToken=e.accessToken:delete f.accessToken,f}function Bn(e){let t=e?.trim();if(!t)throw Error(`supabaseUrl is required.`);if(!t.match(/^https?:\/\//i))throw Error(`Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.`);try{return new URL(Rn(t))}catch{throw Error(`Invalid supabaseUrl: Provided URL is malformed.`)}}let Vn=`2.112.3`,A=30*1e3,Hn=3*A;2*A;let Un={"X-Client-Info":`gotrue-js/${Vn}`},Wn=`X-Supabase-Api-Version`,Gn={"2024-01-01":{timestamp:Date.parse(`2024-01-01T00:00:00.0Z`),name:`2024-01-01`}},Kn=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,j=`sb_flow_id`;var qn=class extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name=`AuthError`,this.status=t,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}};function M(e){return typeof e==`object`&&!!e&&`__isAuthError`in e}var Jn=class extends qn{constructor(e,t,n){super(e,t,n),this.name=`AuthApiError`,this.status=t,this.code=n}};function Yn(e){return M(e)&&e.name===`AuthApiError`}var N=class extends qn{constructor(e,t){super(e),this.name=`AuthUnknownError`,this.originalError=t}},P=class extends qn{constructor(e,t,n,r){super(e,n,r),this.name=t,this.status=n}},F=class extends P{constructor(){super(`Auth session missing!`,`AuthSessionMissingError`,400,void 0)}};function Xn(e){return M(e)&&e.name===`AuthSessionMissingError`}var I=class extends P{constructor(){super(`Auth session or user missing`,`AuthInvalidTokenResponseError`,500,void 0)}},Zn=class extends P{constructor(e){super(e,`AuthInvalidCredentialsError`,400,void 0)}},Qn=class extends P{constructor(e,t=null){super(e,`AuthImplicitGrantRedirectError`,500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}};function $n(e){return M(e)&&e.name===`AuthImplicitGrantRedirectError`}var er=class extends P{constructor(e,t=null){super(e,`AuthPKCEGrantCodeExchangeError`,500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}},tr=class extends P{constructor(){super(`PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.`,`AuthPKCECodeVerifierMissingError`,400,`pkce_code_verifier_not_found`)}};function nr(e){return M(e)&&e.name===`AuthPKCECodeVerifierMissingError`}var rr=class extends P{constructor(e,t){super(e,`AuthRetryableFetchError`,t,void 0)}};function ir(e){return M(e)&&e.name===`AuthRetryableFetchError`}var ar=class extends P{constructor(e=`Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)`){super(e,`AuthRefreshDiscardedError`,409,void 0)}};function or(e){return M(e)&&e.name===`AuthRefreshDiscardedError`}var sr=class extends P{constructor(e,t,n){super(e,`AuthWeakPasswordError`,t,`weak_password`),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}};function cr(e){return M(e)&&e.name===`AuthWeakPasswordError`}var lr=class extends P{constructor(e){super(e,`AuthInvalidJwtError`,400,`invalid_jwt`)}};let ur=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`.split(``),dr=` +\r=`.split(``),fr=(()=>{let e=Array(128);for(let t=0;t=6;)n(ur[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue<<=6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)n(ur[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function mr(e,t,n){let r=fr[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(r===-2)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function hr(e){let t=[],n=e=>{t.push(String.fromCodePoint(e))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},a=e=>{vr(e,r,n)};for(let t=0;t>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function _r(e,t){for(let n=0;n55295&&r<=56319){let t=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|t)+65536,n+=1}gr(r,t)}}function vr(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw Error(`Invalid UTF-8 sequence`);--t.utf8seq}else if(t.utf8seq>0){if(e<=127)throw Error(`Invalid UTF-8 sequence`);t.codepoint=t.codepoint<<6|e&63,--t.utf8seq,t.utf8seq===0&&n(t.codepoint)}}function L(e){let t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};for(let t=0;tt.push(e)),new Uint8Array(t)}function R(e){let t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};return e.forEach(e=>pr(e,n,r)),pr(null,n,r),t.join(``)}function br(e){return Math.round(Date.now()/1e3)+e}function xr(){return Symbol(`auth-callback`)}let z=()=>typeof window<`u`&&typeof document<`u`,B={tested:!1,writable:!1},Sr=()=>{if(!z())return!1;try{if(typeof globalThis.localStorage!=`object`)return!1}catch{return!1}if(B.tested)return B.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),B.tested=!0,B.writable=!0}catch{B.tested=!0,B.writable=!1}return B.writable};function Cr(e){let t={},n=new URL(e);if(n.hash&&n.hash[0]===`#`)try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch{}return n.searchParams.forEach((e,n)=>{t[n]=e}),t}let wr=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),Tr=e=>typeof e==`object`&&!!e&&`status`in e&&`ok`in e&&`json`in e&&typeof e.json==`function`,V=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},H=async(e,t)=>{let n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},U=async(e,t)=>{await e.removeItem(t)};var Er=class e{constructor(){this.promise=new e.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}};Er.promiseConstructor=Promise;function Dr(e){let t=e.split(`.`);if(t.length!==3)throw new lr(`Invalid JWT structure`);for(let e=0;e{setTimeout(()=>t(null),e)})}function kr(e,t){return new Promise((n,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{let r=await e(i);if(!t(i,null,r)){n(r);return}}catch(e){if(!t(i,e)){r(e);return}}})()})}function Ar(e){return(`0`+e.toString(16)).substr(-2)}function jr(){let e=new Uint32Array(56);if(typeof crypto>`u`){let e=``;for(let t=0;t<56;t++)e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`.charAt(Math.floor(Math.random()*66));return e}return crypto.getRandomValues(e),Array.from(e,Ar).join(``)}async function Mr(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n);return Array.from(r).map(e=>String.fromCharCode(e)).join(``)}async function Nr(e){if(!(typeof crypto<`u`&&crypto.subtle!==void 0&&typeof TextEncoder<`u`))return console.warn(`WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.`),e;let t=await Mr(e);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}let Pr=/^[a-zA-Z0-9_-]{8,64}$/;function Fr(e){return typeof e==`string`&&Pr.test(e)?e:null}function Ir(){if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,Ar).join(``)}let e=``;for(let t=0;t<32;t++)e+=Math.floor(Math.random()*16).toString(16);return e}let Lr=(e,t)=>`${e}-flow-${t}-code-verifier`,Rr=e=>`${e}-flows-code-verifier`;async function zr(e,t){let n=await H(e,Rr(t));return Array.isArray(n)?n.filter(e=>Fr(e)!==null):[]}async function Br(e,t,n,r,i){await V(e,Lr(t,n),r);let a=(await zr(e,t)).filter(e=>e!==n);for(a.push(n);a.length>5;){let n=a.shift();await U(e,Lr(t,n)),i?.(n)}await V(e,Rr(t),a),await V(e,`${t}-code-verifier`,r)}async function Vr(e,t,n){if(n){let r=await H(e,Lr(t,n));return{verifier:typeof r==`string`?r:null,flowId:n}}let r=await H(e,`${t}-code-verifier`);return{verifier:typeof r==`string`?r:null,flowId:null}}async function W(e,t,n){let r=`${t}-code-verifier`;if(!n){await U(e,r);return}let i=Lr(t,n),a=await H(e,i);await U(e,i);let o=await zr(e,t),s=o.filter(e=>e!==n);s.length!==o.length&&(s.length>0?await V(e,Rr(t),s):await U(e,Rr(t))),a!=null&&a===await H(e,r)&&await U(e,r)}async function Hr(e,t){let n=await zr(e,t);for(let r of n)await U(e,Lr(t,r));await U(e,Rr(t)),await U(e,`${t}-code-verifier`)}function Ur(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n),a=r.indexOf(`?`);if(a!==-1){let e=r.slice(0,a),t=r.slice(a+1).split(`&`).filter(e=>e!==``&&e!==j&&!e.startsWith(`${j}=`));r=t.length>0?`${e}?${t.join(`&`)}`:e}let o=r.includes(`?`)?`&`:`?`;return`${r}${o}${j}=${encodeURIComponent(t)}${i}`}async function Wr(e,t,n=!1,r){let i=jr(),a=i;n&&(a+=`/recovery`);let o=Ir();await Br(e,t,o,a,r);let s=await Nr(i);return[s,i===s?`plain`:`s256`,o]}let Gr=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Kr(e){let t=e.headers.get(Wn);if(!t||!t.match(Gr))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function qr(e){if(!e)throw Error(`Missing exp claim`);if(e<=Math.floor(Date.now()/1e3))throw Error(`JWT has expired`)}function Jr(e){switch(e){case`RS256`:return{name:`RSASSA-PKCS1-v1_5`,hash:{name:`SHA-256`}};case`ES256`:return{name:`ECDSA`,namedCurve:`P-256`,hash:{name:`SHA-256`}};default:throw Error(`Invalid alg claim`)}}let Yr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function G(e){if(!Yr.test(e))throw Error(`@supabase/auth-js: Expected parameter to be UUID but is not`)}function K(e){if(!e.passkey)throw Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Xr(){return new Proxy({},{get:(e,t)=>{if(t===`__isUserNotAvailableProxy`)return!0;if(typeof t==`symbol`){let e=t.toString();if(e===`Symbol(Symbol.toPrimitive)`||e===`Symbol(Symbol.toStringTag)`||e===`Symbol(util.inspect.custom)`)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Zr(e,t){return new Proxy(e,{get:(e,n,r)=>{if(n===`__isInsecureUserWarningProxy`)return!0;if(typeof n==`symbol`){let t=n.toString();if(t===`Symbol(Symbol.toPrimitive)`||t===`Symbol(Symbol.toStringTag)`||t===`Symbol(util.inspect.custom)`||t===`Symbol(nodejs.util.inspect.custom)`)return Reflect.get(e,n,r)}return!t.value&&typeof n==`string`&&(console.warn(`Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.`),t.value=!0),Reflect.get(e,n,r)}})}function Qr(e){return JSON.parse(JSON.stringify(e))}let q=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.msg==`string`)return t.msg;if(typeof t.message==`string`)return t.message;if(typeof t.error_description==`string`)return t.error_description;if(typeof t.error==`string`)return t.error}return JSON.stringify(e)},$r=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function ei(e){if(!Tr(e))throw new rr(q(e),0);let t;try{t=await e.json()}catch(t){throw $r.includes(e.status)?new rr(e.statusText||`HTTP ${e.status}`,e.status):new N(q(t),t)}if($r.includes(e.status))throw new rr(q(t),e.status);let n,r=Kr(e);if(r&&r.getTime()>=Gn[`2024-01-01`].timestamp&&typeof t==`object`&&t&&typeof t.code==`string`?n=t.code:typeof t==`object`&&t&&typeof t.error_code==`string`&&(n=t.error_code),n){if(n===`weak_password`)throw new sr(q(t),e.status,t.weak_password?.reasons||[]);if(n===`session_not_found`)throw new F}else if(typeof t==`object`&&t&&typeof t.weak_password==`object`&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((e,t)=>e&&typeof t==`string`,!0))throw new sr(q(t),e.status,t.weak_password.reasons);throw new Jn(q(t),e.status||500,n)}let ti=(e,t,n,r)=>{let i={method:e,headers:t?.headers||{}};return e===`GET`?i:(i.headers=Object.assign({"Content-Type":`application/json;charset=UTF-8`},t?.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function J(e,t,n,r){let i=Object.assign({},r?.headers);i[Wn]||(i[Wn]=Gn[`2024-01-01`].name),r?.jwt&&(i.Authorization=`Bearer ${r.jwt}`);let a=r?.query??{};r?.redirectTo&&(a.redirect_to=r.redirectTo);let o=await ni(e,t,n+(Object.keys(a).length?`?`+new URLSearchParams(a).toString():``),{headers:i,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(o):{data:Object.assign({},o),error:null}}async function ni(e,t,n,r,i,a){let o=ti(t,r,i,a),s;try{s=await e(n,Object.assign({},o))}catch(e){throw new rr(q(e),0)}if(s.ok||await ei(s),r?.noResolveJson)return s;try{return await s.json()}catch(e){await ei(e)}}function Y(e){let t=null;si(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=br(e.expires_in)));let n=e.user??(typeof e?.id==`string`?e:null);return{data:{session:t,user:n},error:null}}function ri(e){let t=Y(e);return!t.error&&e.weak_password&&typeof e.weak_password==`object`&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message==`string`&&e.weak_password.reasons.reduce((e,t)=>e&&typeof t==`string`,!0)&&(t.data.weak_password=e.weak_password),t}function X(e){return{data:{user:e.user??e},error:null}}function ii(e){return{data:e,error:null}}function ai(e){let{action_link:n,email_otp:r,hashed_token:i,redirect_to:a,verification_type:o}=e,s=t(e,[`action_link`,`email_otp`,`hashed_token`,`redirect_to`,`verification_type`]);return{data:{properties:{action_link:n,email_otp:r,hashed_token:i,redirect_to:a,verification_type:o},user:Object.assign({},s)},error:null}}function oi(e){return e}function si(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}let ci=[`global`,`local`,`others`];var li=class{constructor({url:e=``,headers:t={},fetch:n,experimental:r}){this.url=e,this.headers=t,this.fetch=wr(n),this.experimental=r??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,t=ci[0]){if(ci.indexOf(t)<0)throw Error(`@supabase/auth-js: Parameter scope must be one of ${ci.join(`, `)}`);try{return await J(this.fetch,`POST`,`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(M(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await J(this.fetch,`POST`,`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:X})}catch(e){if(M(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:n}=e,r=t(e,[`options`]),i=Object.assign(Object.assign({},r),n);return`newEmail`in r&&(i.new_email=r?.newEmail,delete i.newEmail),await J(this.fetch,`POST`,`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:ai,redirectTo:n?.redirectTo})}catch(e){if(M(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await J(this.fetch,`POST`,`${this.url}/admin/users`,{body:e,headers:this.headers,xform:X})}catch(e){if(M(e))return{data:{user:null},error:e};throw e}}async listUsers(e){try{let t={nextPage:null,lastPage:0,total:0},n=await J(this.fetch,`GET`,`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(e?.page)?.toString()??``,per_page:(e?.perPage)?.toString()??``},xform:oi});if(n.error)throw n.error;let r=await n.json(),i=n.headers.get(`x-total-count`)??0,a=n.headers.get(`link`)?.split(`,`)??[];return a.length>0&&(a.forEach(e=>{let n=parseInt(e.split(`;`)[0].split(`=`)[1].substring(0,1)),r=JSON.parse(e.split(`;`)[1].split(`=`)[1]);t[`${r}Page`]=n}),t.total=parseInt(i)),{data:Object.assign(Object.assign({},r),t),error:null}}catch(e){if(M(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){G(e);try{return await J(this.fetch,`GET`,`${this.url}/admin/users/${e}`,{headers:this.headers,xform:X})}catch(e){if(M(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){G(e);try{return await J(this.fetch,`PUT`,`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:X})}catch(e){if(M(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){G(e);try{return await J(this.fetch,`DELETE`,`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:X})}catch(e){if(M(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){G(e.userId);try{let{data:t,error:n}=await J(this.fetch,`GET`,`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:n}}catch(e){if(M(e))return{data:null,error:e};throw e}}async _deleteFactor(e){G(e.userId),G(e.id);try{return{data:await J(this.fetch,`DELETE`,`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(M(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){try{let t={nextPage:null,lastPage:0,total:0},n=await J(this.fetch,`GET`,`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(e?.page)?.toString()??``,per_page:(e?.perPage)?.toString()??``},xform:oi});if(n.error)throw n.error;let r=await n.json(),i=n.headers.get(`x-total-count`)??0,a=n.headers.get(`link`)?.split(`,`)??[];return a.length>0&&(a.forEach(e=>{let n=parseInt(e.split(`;`)[0].split(`=`)[1].substring(0,1)),r=JSON.parse(e.split(`;`)[1].split(`=`)[1]);t[`${r}Page`]=n}),t.total=parseInt(i)),{data:Object.assign(Object.assign({},r),t),error:null}}catch(e){if(M(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await J(this.fetch,`POST`,`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await J(this.fetch,`GET`,`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{return await J(this.fetch,`PUT`,`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await J(this.fetch,`DELETE`,`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(M(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await J(this.fetch,`POST`,`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _listCustomProviders(e){try{let t={};return e?.type&&(t.type=e.type),await J(this.fetch,`GET`,`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:e=>({data:{providers:e?.providers??[]},error:null})})}catch(e){if(M(e))return{data:{providers:[]},error:e};throw e}}async _createCustomProvider(e){try{return await J(this.fetch,`POST`,`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _getCustomProvider(e){try{return await J(this.fetch,`GET`,`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _updateCustomProvider(e,t){try{return await J(this.fetch,`PUT`,`${this.url}/admin/custom-providers/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _deleteCustomProvider(e){try{return await J(this.fetch,`DELETE`,`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(M(e))return{data:null,error:e};throw e}}async _adminListPasskeys(e){K(this.experimental),G(e.userId);try{return await J(this.fetch,`GET`,`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(M(e))return{data:null,error:e};throw e}}async _adminDeletePasskey(e){K(this.experimental),G(e.userId),G(e.passkeyId);try{return await J(this.fetch,`DELETE`,`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(M(e))return{data:null,error:e};throw e}}};function ui(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}let Z={debug:!!(globalThis&&Sr()&&globalThis.localStorage&&globalThis.localStorage.getItem(`supabase.gotrue-js.locks.debug`)===`true`)};var di=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}},fi=class extends di{},pi=class extends di{};async function mi(e,t,n){Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquire lock`,e,t);let r=new globalThis.AbortController,i;t>0&&(i=setTimeout(()=>{r.abort(),Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock acquire timed out`,e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:`exclusive`,ifAvailable:!0}:{mode:`exclusive`,signal:r.signal},async r=>{if(r){clearTimeout(i),Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquired`,e,r.name);try{return await n()}finally{Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: released`,e,r.name)}}else if(t===0)throw Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: not immediately available`,e),new fi(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);else{if(Z.debug)try{let e=await globalThis.navigator.locks.query();console.log(`@supabase/gotrue-js: Navigator LockManager state`,JSON.stringify(e,null,` `))}catch(e){console.warn(`@supabase/gotrue-js: Error when querying Navigator LockManager state`,e)}return console.warn(`@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request`),clearTimeout(i),await n()}})}catch(a){if(t>0&&clearTimeout(i),typeof a==`object`&&a&&`name`in a&&a.name===`AbortError`&&t>0){if(r.signal.aborted)return Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock`,e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:`exclusive`,steal:!0},async t=>{if(t){Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: recovered (stolen)`,e,t.name);try{return await n()}finally{Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: released (stolen)`,e,t.name)}}else return console.warn(`@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true`),await n()}));throw Z.debug&&console.log(`@supabase/gotrue-js: navigatorLock: lock was stolen by another request`,e),new fi(`Lock "${e}" was released because another request stole it`)}throw a}}let hi={};async function gi(e,t,n){let r=hi[e]??Promise.resolve(),i=(async()=>{try{return await r,null}catch{return null}})(),a=(async()=>{let r=null;try{let n=t>=0?new Promise((n,i)=>{r=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${t}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),i(new pi(`Acquiring process lock with name "${e}" timed out`))},t)}):null;await Promise.race([i,n].filter(e=>e)),r!==null&&clearTimeout(r)}catch(e){if(r!==null&&clearTimeout(r),e instanceof di)throw e}return await n()})();return hi[e]=(async()=>{try{return await a}catch(e){if(e instanceof di){try{await r}catch{}return null}throw e}})(),await a}function _i(){if(typeof globalThis!=`object`)try{Object.defineProperty(Object.prototype,`__magic__`,{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<`u`&&(self.globalThis=self)}}function vi(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function yi(e){return parseInt(e,16)}function bi(e){let t=new TextEncoder().encode(e);return`0x`+Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}function xi(e){let{chainId:t,domain:n,expirationTime:r,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:s,resources:c,scheme:l,uri:u,version:d}=e;if(!Number.isInteger(t))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${t}`);if(!n)throw Error(`@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.`);if(a&&a.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!u)throw Error(`@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.`);if(d!==`1`)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(e.statement?.includes(` +`))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let f=vi(e.address),p=`${l?`${l}://${n}`:n} wants you to sign in with your Ethereum account:\n${f}\n\n${e.statement?`${e.statement}\n`:``}`,m=`URI: ${u}\nVersion: ${d}\nChain ID: ${t}${a?`\nNonce: ${a}`:``}\nIssued At: ${i.toISOString()}`;if(r&&(m+=`\nExpiration Time: ${r.toISOString()}`),o&&(m+=`\nNot Before: ${o.toISOString()}`),s&&(m+=`\nRequest ID: ${s}`),c){let e=` +Resources:`;for(let t of c){if(!t||typeof t!=`string`)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`\n- ${t}`}m+=e}return`${p}\n${m}`}var Q=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=r??(n instanceof Error?n.name:void 0)??`Unknown Error`,this.code=t}toJSON(){return{name:this.name,message:this.message,code:this.code}}},Si=class extends Q{constructor(e,t){super({code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:t,message:e}),this.name=`WebAuthnUnknownError`,this.originalError=t}};function Ci({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Q({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new Q({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new Q({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new Q({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new Q({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Q({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new Q({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Q({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(Ai(t)){if(n.rp.id!==t)return new Q({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else return new Q({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new Q({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new Q({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return new Q({message:`a Non-Webauthn related error has occurred`,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e})}function wi({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Q({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Q({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(Ai(t)){if(n.rpId!==t)return new Q({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else return new Q({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e})}else if(e.name===`UnknownError`)return new Q({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return new Q({message:`a Non-Webauthn related error has occurred`,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e})}let Ti=new class{createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}};function Ei(e){if(!e)throw Error(`Credential creation options are required`);if(typeof PublicKeyCredential<`u`&&`parseCreationOptionsFromJSON`in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON==`function`)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:n,user:r,excludeCredentials:i}=e,a=t(e,[`challenge`,`user`,`excludeCredentials`]),o=L(n).buffer,s=Object.assign(Object.assign({},r),{id:L(r.id).buffer}),c=Object.assign(Object.assign({},a),{challenge:o,user:s});if(i&&i.length>0){c.excludeCredentials=Array(i.length);for(let e=0;e0){o.allowCredentials=Array(r.length);for(let e=0;etypeof e==`object`&&!!e&&!Array.isArray(e),n=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),r={};for(let i of e)if(i)for(let e in i){let a=i[e];if(a!==void 0)if(Array.isArray(a))r[e]=a;else if(n(a))r[e]=a;else if(t(a)){let n=r[e];t(n)?r[e]=Ii(n,a):r[e]=Ii(a)}else r[e]=a}return r}function Li(e,t){return Ii(Pi,e,t||{})}function Ri(e,t){return Ii(Fi,e,t||{})}var zi=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:`webauthn`}))}async _challenge({factorId:e,webauthn:t,friendlyName:n,signal:r},i){try{let{data:a,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!a)return{data:null,error:o};let s=r??Ti.createNewAbortSignal();if(a.webauthn.type===`create`){let{user:e}=a.webauthn.credential_options.publicKey;if(!e.name){let t=n;if(t)e.name=`${e.id}:${t}`;else{let t=(await this.client.getUser()).data.user,n=t?.user_metadata?.name||t?.email||t?.id||`User`;e.name=`${e.id}:${n}`}}e.displayName||=e.name}switch(a.webauthn.type){case`create`:{let{data:t,error:n}=await Mi({publicKey:Li(a.webauthn.credential_options.publicKey,i?.create),signal:s});return t?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:t}},error:null}:{data:null,error:n}}case`request`:{let t=Ri(a.webauthn.credential_options.publicKey,i?.request),{data:n,error:r}=await Ni(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:t,signal:s}));return n?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}}}catch(e){return M(e)?{data:null,error:e}:{data:null,error:new N(`Unexpected error in challenge`,e)}}}async _verify({challengeId:e,factorId:t,webauthn:n}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:t=typeof window<`u`?window.location.hostname:void 0,rpOrigins:n=typeof window<`u`?[window.location.origin]:void 0,signal:r}={}},i){if(!t)return{data:null,error:new qn(`rpId is required for WebAuthn authentication`)};try{if(!ji())return{data:null,error:new N(`Browser does not support WebAuthn`,null)};let{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:n},signal:r},{request:i});if(!a)return{data:null,error:o};let{webauthn:s}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:s.type,rpId:t,rpOrigins:n,credential_response:s.credential_response}})}catch(e){return M(e)?{data:null,error:e}:{data:null,error:new N(`Unexpected error in authenticate`,e)}}}async _register({friendlyName:e,webauthn:{rpId:t=typeof window<`u`?window.location.hostname:void 0,rpOrigins:n=typeof window<`u`?[window.location.origin]:void 0,signal:r}={}},i){if(!t)return{data:null,error:new qn(`rpId is required for WebAuthn registration`)};try{if(!ji())return{data:null,error:new N(`Browser does not support WebAuthn`,null)};let{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(t=>t.data?.all.find(t=>t.factor_type===`webauthn`&&t.friendly_name===e&&t.status!==`unverified`)).then(e=>e?this.client.mfa.unenroll({factorId:e?.id}):void 0),{data:null,error:o};let{data:s,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:t,rpOrigins:n},signal:r},{create:i});return s?this._verify({factorId:a.id,challengeId:s.challengeId,webauthn:{rpId:t,rpOrigins:n,type:s.webauthn.type,credential_response:s.webauthn.credential_response}}):{data:null,error:c}}catch(e){return M(e)?{data:null,error:e}:{data:null,error:new N(`Unexpected error in register`,e)}}}};_i();let Bi={url:`http://localhost:9999`,storageKey:`supabase.auth.token`,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Un,flowType:`implicit`,debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},$={};var Vi=class e{get jwks(){return $[this.storageKey]?.jwks??{keys:[]}}set jwks(e){$[this.storageKey]=Object.assign(Object.assign({},$[this.storageKey]),{jwks:e})}get jwks_cached_at(){return $[this.storageKey]?.cachedAt??-(2**53-1)}set jwks_cached_at(e){$[this.storageKey]=Object.assign(Object.assign({},$[this.storageKey]),{cachedAt:e})}constructor(t){var n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;let r=Object.assign(Object.assign({},Bi),t);if(this.storageKey=r.storageKey,this.instanceID=e.nextInstanceID[this.storageKey]??0,e.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!r.debug,typeof r.debug==`function`&&(this.logger=r.debug),this.instanceID>0&&z()){let e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=r.persistSession,this.autoRefreshToken=r.autoRefreshToken,this.experimental=r.experimental??{},this.admin=new li({url:r.url,headers:r.headers,fetch:r.fetch,experimental:this.experimental}),this.url=r.url,this.headers=r.headers,this.fetch=wr(r.fetch),this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.hasCustomAuthorizationHeader=r.hasCustomAuthorizationHeader,this.throwOnError=r.throwOnError,this.lockAcquireTimeout=r.lockAcquireTimeout,r.lock!=null&&(this.lock=r.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=-(2**53-1)),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new zi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(r.storage?this.storage=r.storage:Sr()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ui(this.memoryStorage)),r.userStorage&&(this.userStorage=r.userStorage)):(this.memoryStorage={},this.storage=ui(this.memoryStorage)),z()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error(`Failed to create a new BroadcastChannel, multi-tab state changes will not be available`,e)}(n=this.broadcastChannel)==null||n.addEventListener(`message`,async e=>{this._debug(`received broadcast notification from other tab or client`,e),(e.data.event===`TOKEN_REFRESHED`||e.data.event===`SIGNED_IN`)&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug(`#broadcastChannel`,`error`,e)}})}r.skipAutoInitialize||this.initialize().catch(e=>{this._debug(`#initialize()`,`error`,e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Vn}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>this.lock==null?await this._initialize():await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))();let e=await this.initializePromise,t=this._pendingInitNotifications??[];this._pendingInitNotifications=null;for(let e of t)await this._notifyAllSubscribers(e.event,e.session,e.broadcast);return e}async _initialize(){try{let e={},t=`none`;if(z()&&(e=Cr(window.location.href),this._isImplicitGrantCallback(e)?t=`implicit`:await this._isPKCECallback(e)&&(t=`pkce`)),z()&&this.detectSessionInUrl&&t!==`none`){let{data:n,error:r}=await this._getSessionFromURL(e,t);if(r){if(this._debug(`#_initialize()`,`error detecting session from URL`,r),$n(r)){let e=r.details?.code;if(e===`identity_already_exists`||e===`identity_not_found`||e===`single_identity_not_deletable`)return{error:r}}return{error:r}}let{session:i,redirectType:a}=n;return this._debug(`#_initialize()`,`detected session in URL`,i,`redirect type`,a),await this._saveSession(i),setTimeout(async()=>{a===`recovery`?await this._notifyAllSubscribers(`PASSWORD_RECOVERY`,i):await this._notifyAllSubscribers(`SIGNED_IN`,i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return M(e)?this._returnResult({error:e}):this._returnResult({error:new N(`Unexpected error during initialization`,e)})}finally{await this._handleVisibilityChange(),this._debug(`#_initialize()`,`end`)}}async signInAnonymously(e){try{let{data:t,error:n}=await J(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,body:{data:e?.options?.data??{},gotrue_meta_security:{captcha_token:e?.options?.captchaToken}},xform:Y});if(n||!t)return this._returnResult({data:{user:null,session:null},error:n});let r=t.session,i=t.user;return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,r)),this._returnResult({data:{user:i,session:r},error:null})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){let t=null;try{let n;if(`email`in e){let{email:r,password:i,options:a}=e,o=null,s=null;this.flowType===`pkce`&&([o,s,t]=await this._getCodeChallengeAndMethod()),n=await J(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(a?.emailRedirectTo,t),body:{email:r,password:i,data:a?.data??{},gotrue_meta_security:{captcha_token:a?.captchaToken},code_challenge:o,code_challenge_method:s},xform:Y})}else if(`phone`in e){let{phone:t,password:r,options:i}=e;n=await J(this.fetch,`POST`,`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:r,data:i?.data??{},channel:i?.channel??`sms`,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:Y})}else throw new Zn(`You must provide either an email or phone number and a password`);let{data:r,error:i}=n;if(i||!r)return await W(this.storage,this.storageKey,t),this._returnResult({data:{user:null,session:null},error:i});let a=r.session,o=r.user;return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers(`SIGNED_IN`,a)),this._returnResult({data:{user:o,session:a},error:null})}catch(e){if(await W(this.storage,this.storageKey,t),M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if(`email`in e){let{email:n,password:r,options:i}=e;t=await J(this.fetch,`POST`,`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:n,password:r,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:ri})}else if(`phone`in e){let{phone:n,password:r,options:i}=e;t=await J(this.fetch,`POST`,`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:n,password:r,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:ri})}else throw new Zn(`You must provide either an email or phone number and a password`);let{data:n,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){let e=new I;return this._returnResult({data:{user:null,session:null},error:e})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers(`SIGNED_IN`,n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){return await this._handleProviderSignIn(e.provider,{redirectTo:e.options?.redirectTo,scopes:e.options?.scopes,queryParams:e.options?.queryParams,skipBrowserRedirect:e.options?.skipBrowserRedirect})}async exchangeCodeForSession(e,t){return await this.initializePromise,this.lock==null?this._exchangeCodeForSession(e,t):this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e,t))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case`ethereum`:return await this.signInWithEthereum(e);case`solana`:return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){let t,n;if(`message`in e)t=e.message,n=e.signature;else{let{chain:r,wallet:i,statement:a,options:o}=e,s;if(z())if(typeof i==`object`)s=i;else{let e=window;if(`ethereum`in e&&typeof e.ethereum==`object`&&`request`in e.ethereum&&typeof e.ethereum.request==`function`)s=e.ethereum;else throw Error(`@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.`)}else{if(typeof i!=`object`||!o?.url)throw Error(`@supabase/auth-js: Both wallet and url must be specified in non-browser environments.`);s=i}let c=new URL(o?.url??window.location.href),l=await s.request({method:`eth_requestAccounts`}).then(e=>e).catch(()=>{throw Error(`@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid`)});if(!l||l.length===0)throw Error(`@supabase/auth-js: No accounts available. Please ensure the wallet is connected.`);let u=vi(l[0]),d=o?.signInWithEthereum?.chainId;d||=yi(await s.request({method:`eth_chainId`})),t=xi({domain:c.host,address:u,statement:a,uri:c.href,version:`1`,chainId:d,nonce:o?.signInWithEthereum?.nonce,issuedAt:o?.signInWithEthereum?.issuedAt??new Date,expirationTime:o?.signInWithEthereum?.expirationTime,notBefore:o?.signInWithEthereum?.notBefore,requestId:o?.signInWithEthereum?.requestId,resources:o?.signInWithEthereum?.resources}),n=await s.request({method:`personal_sign`,params:[bi(t),u]})}try{let{data:r,error:i}=await J(this.fetch,`POST`,`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:`ethereum`,message:t,signature:n},e.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options?.captchaToken}}:null),xform:Y});if(i)throw i;if(!r||!r.session||!r.user){let e=new I;return this._returnResult({data:{user:null,session:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers(`SIGNED_IN`,r.session)),this._returnResult({data:Object.assign({},r),error:i})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){let t,n;if(`message`in e)t=e.message,n=e.signature;else{let{chain:r,wallet:i,statement:a,options:o}=e,s;if(z())if(typeof i==`object`)s=i;else{let e=window;if(`solana`in e&&typeof e.solana==`object`&&(`signIn`in e.solana&&typeof e.solana.signIn==`function`||`signMessage`in e.solana&&typeof e.solana.signMessage==`function`))s=e.solana;else throw Error(`@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.`)}else{if(typeof i!=`object`||!o?.url)throw Error(`@supabase/auth-js: Both wallet and url must be specified in non-browser environments.`);s=i}let c=new URL(o?.url??window.location.href);if(`signIn`in s&&s.signIn){let e=await s.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},o?.signInWithSolana),{version:`1`,domain:c.host,uri:c.href}),a?{statement:a}:null)),r;if(Array.isArray(e)&&e[0]&&typeof e[0]==`object`)r=e[0];else if(e&&typeof e==`object`&&`signedMessage`in e&&`signature`in e)r=e;else throw Error(`@supabase/auth-js: Wallet method signIn() returned unrecognized value`);if(`signedMessage`in r&&`signature`in r&&(typeof r.signedMessage==`string`||r.signedMessage instanceof Uint8Array)&&r.signature instanceof Uint8Array)t=typeof r.signedMessage==`string`?r.signedMessage:new TextDecoder().decode(r.signedMessage),n=r.signature;else throw Error(`@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields`)}else{if(!(`signMessage`in s)||typeof s.signMessage!=`function`||!(`publicKey`in s)||typeof s!=`object`||!s.publicKey||!(`toBase58`in s.publicKey)||typeof s.publicKey.toBase58!=`function`)throw Error(`@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API`);t=[`${c.host} wants you to sign in with your Solana account:`,s.publicKey.toBase58(),...a?[``,a,``]:[``],`Version: 1`,`URI: ${c.href}`,`Issued At: ${o?.signInWithSolana?.issuedAt??new Date().toISOString()}`,...o?.signInWithSolana?.notBefore?[`Not Before: ${o.signInWithSolana.notBefore}`]:[],...o?.signInWithSolana?.expirationTime?[`Expiration Time: ${o.signInWithSolana.expirationTime}`]:[],...o?.signInWithSolana?.chainId?[`Chain ID: ${o.signInWithSolana.chainId}`]:[],...o?.signInWithSolana?.nonce?[`Nonce: ${o.signInWithSolana.nonce}`]:[],...o?.signInWithSolana?.requestId?[`Request ID: ${o.signInWithSolana.requestId}`]:[],...o?.signInWithSolana?.resources?.length?[`Resources`,...o.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join(` +`);let e=await s.signMessage(new TextEncoder().encode(t),`utf8`);if(!e||!(e instanceof Uint8Array))throw Error(`@supabase/auth-js: Wallet signMessage() API returned an recognized value`);n=e}}try{let{data:r,error:i}=await J(this.fetch,`POST`,`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:`solana`,message:t,signature:R(n)},e.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options?.captchaToken}}:null),xform:Y});if(i)throw i;if(!r||!r.session||!r.user){let e=new I;return this._returnResult({data:{user:null,session:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers(`SIGNED_IN`,r.session)),this._returnResult({data:Object.assign({},r),error:i})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e,t){let n=t?.flowId!=null,r=n?Fr(t?.flowId):z()?Fr(Cr(window.location.href)[j]):null;n&&!r&&this._debug(`#_exchangeCodeForSession()`,`provided flowId is not a valid flow id`,t?.flowId);let{verifier:i,flowId:a}=n&&!r?{verifier:null,flowId:null}:await Vr(this.storage,this.storageKey,r),[o,s]=(i??``).split(`/`);try{if(!o&&this.flowType===`pkce`)throw new tr;let{data:t,error:n}=await J(this.fetch,`POST`,`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:o},xform:Y});if(await W(this.storage,this.storageKey,a),n)throw n;if(!t||!t.session||!t.user){let e=new I;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(s===`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:s??null}),error:n})}catch(e){if(await W(this.storage,this.storageKey,a),M(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:n,token:r,access_token:i,nonce:a}=e,{data:o,error:s}=await J(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:t?.captchaToken}},xform:Y});if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!o||!o.session||!o.user){let e=new I;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers(`SIGNED_IN`,o.session)),this._returnResult({data:o,error:s})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){let t=null;try{if(`email`in e){let{email:n,options:r}=e,i=null,a=null;this.flowType===`pkce`&&([i,a,t]=await this._getCodeChallengeAndMethod());let{error:o}=await J(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{email:n,data:r?.data??{},create_user:r?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:r?.captchaToken},code_challenge:i,code_challenge_method:a},redirectTo:this._maybeAppendFlowIdToRedirect(r?.emailRedirectTo,t)});return this._returnResult({data:{user:null,session:null},error:o})}if(`phone`in e){let{phone:t,options:n}=e,{data:r,error:i}=await J(this.fetch,`POST`,`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:n?.data??{},create_user:n?.shouldCreateUser??!0,gotrue_meta_security:{captcha_token:n?.captchaToken},channel:n?.channel??`sms`}});return this._returnResult({data:{user:null,session:null,messageId:r?.message_id},error:i})}throw new Zn(`You must provide either an email or phone number.`)}catch(e){if(await W(this.storage,this.storageKey,t),M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){try{let t,n;`options`in e&&(t=e.options?.redirectTo,n=e.options?.captchaToken);let{data:r,error:i}=await J(this.fetch,`POST`,`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:t,xform:Y});if(i)throw i;if(!r)throw Error(`An error occurred on token verification.`);let a=r.session,o=r.user;return a?.access_token&&(await this._saveSession(a),await this._notifyAllSubscribers(e.type==`recovery`?`PASSWORD_RECOVERY`:`SIGNED_IN`,a)),this._returnResult({data:{user:o,session:a},error:null})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){let t=null;try{let n=null,r=null;this.flowType===`pkce`&&([n,r,t]=await this._getCodeChallengeAndMethod());let i=await J(this.fetch,`POST`,`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},`providerId`in e?{provider_id:e.providerId}:null),`domain`in e?{domain:e.domain}:null),{redirect_to:this._maybeAppendFlowIdToRedirect(e.options?.redirectTo,t)}),e?.options?.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:n,code_challenge_method:r}),headers:this.headers,xform:ii});return i.data?.url&&z()&&!e.options?.skipBrowserRedirect&&window.location.assign(i.data.url),this._returnResult(i)}catch(e){if(await W(this.storage,this.storageKey,t),M(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,this.lock==null?await this._reauthenticate():await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new F;let{error:r}=await J(this.fetch,`GET`,`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){let t=null;try{let n=`${this.url}/resend`;if(`email`in e){let{email:r,type:i,options:a}=e,o=null,s=null;this.flowType===`pkce`&&([o,s,t]=await this._getCodeChallengeAndMethod());let{error:c}=await J(this.fetch,`POST`,n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:a?.captchaToken},code_challenge:o,code_challenge_method:s},redirectTo:this._maybeAppendFlowIdToRedirect(a?.emailRedirectTo,t)});return c&&await W(this.storage,this.storageKey,t),this._returnResult({data:{user:null,session:null},error:c})}else if(`phone`in e){let{phone:t,type:r,options:i}=e,{data:a,error:o}=await J(this.fetch,`POST`,n,{headers:this.headers,body:{phone:t,type:r,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a?.message_id},error:o})}throw new Zn(`You must provide either an email or phone number and a type`)}catch(e){if(await W(this.storage,this.storageKey,t),M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,this.lock==null?await this._useSession(async e=>e):await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug(`#_acquireLock`,`begin`,e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug(`#_acquireLock`,`lock acquired for storage key`,this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch{}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug(`#_acquireLock`,`lock released for storage key`,this.storageKey),this.lockAcquired=!1}})}finally{this._debug(`#_acquireLock`,`end`)}}async _useSession(e){this._debug(`#_useSession`,`begin`);try{return await e(await this.__loadSession())}finally{this._debug(`#_useSession`,`end`)}}async __loadSession(){this._debug(`#__loadSession()`,`begin`),this.lock!=null&&!this.lockAcquired&&this._debug(`#__loadSession()`,`used outside of an acquired lock!`,Error().stack);try{let e=null,t=await H(this.storage,this.storageKey);if(this._debug(`#getSession()`,`session from storage`,t),t!==null&&(this._isValidSession(t)?e=t:(this._debug(`#getSession()`,`session from storage is not valid`),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()Date.now()){let t=await H(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug(`#__loadSession()`,`end`)}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t;return t=this.lock==null?await this._getUser():await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await J(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:e,xform:X}):await this._useSession(async e=>{let{data:t,error:n}=e;if(n)throw n;return!t.session?.access_token&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new F}:await J(this.fetch,`GET`,`${this.url}/user`,{headers:this.headers,jwt:t.session?.access_token??void 0,xform:X})})}catch(e){if(M(e))return Xn(e)&&await this._removeSession(),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,this.lock==null?await this._updateUser(e,t):await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){let n=null;try{return await this._useSession(async r=>{let{data:i,error:a}=r;if(a)throw a;if(!i.session)throw new F;let o=i.session,s=null,c=null;this.flowType===`pkce`&&e.email!=null&&([s,c,n]=await this._getCodeChallengeAndMethod());let{data:l,error:u}=await J(this.fetch,`PUT`,`${this.url}/user`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(t?.emailRedirectTo,n),body:Object.assign(Object.assign({},e),{code_challenge:s,code_challenge_method:c}),jwt:o.access_token,xform:X});if(u)throw u;return o.user=l.user,await this._saveSession(o),await this._notifyAllSubscribers(`USER_UPDATED`,o),this._returnResult({data:{user:o.user},error:null})})}catch(e){if(await W(this.storage,this.storageKey,n),M(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,this.lock==null?await this._setSession(e):await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new F;let t=Date.now()/1e3,n=t,r=!0,i=null,{payload:a}=Dr(e.access_token);if(a.exp&&(n=a.exp,r=n<=t),r){let{data:t,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:r,error:a}=await this._getUser(e.access_token);if(a)return this._returnResult({data:{user:null,session:null},error:a});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:`bearer`,expires_in:n-t,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers(`SIGNED_IN`,i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if(M(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,this.lock==null?await this._refreshSession(e):await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{if(!e){let{data:n,error:r}=t;if(r)throw r;e=n.session??void 0}if(!e?.refresh_token)throw new F;let{data:n,error:r}=await this._callRefreshToken(e.refresh_token);return r?this._returnResult({data:{user:null,session:null},error:r}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){try{if(!z())throw new Qn(`No browser detected.`);if(e.error||e.error_description||e.error_code)throw new Qn(e.error_description||`Error in URL with unspecified error_description`,{error:e.error||`unspecified_error`,code:e.error_code||`unspecified_code`});switch(t){case`implicit`:if(this.flowType===`pkce`)throw new er(`Not a valid PKCE flow url.`);break;case`pkce`:if(this.flowType===`implicit`)throw new Qn(`Not a valid implicit grant flow url.`);break;default:}if(t===`pkce`){if(this._debug(`#_initialize()`,`begin`,`is PKCE flow`,!0),!e.code)throw new er(`No code detected.`);let{data:t,error:n}=await this._exchangeCodeForSession(e.code,{flowId:e[j]});if(n)throw n;let r=new URL(window.location.href);return r.searchParams.delete(`code`),r.searchParams.delete(j),window.history.replaceState(window.history.state,``,r.toString()),{data:{session:t.session,redirectType:t.redirectType??null},error:null}}let{provider_token:n,provider_refresh_token:r,access_token:i,refresh_token:a,expires_in:o,expires_at:s,token_type:c}=e;if(!i||!o||!a||!c)throw new Qn(`No session defined in URL`);let l=Math.round(Date.now()/1e3),u=parseInt(o),d=l+u;s&&(d=parseInt(s));let f=d-l;f*1e3<=A&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${u}s`);let p=d-u;l-p>=120?console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale`,p,d,l):l-p<0&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew`,p,d,l);let{data:m,error:h}=await this._getUser(i);if(h)throw h;let g={provider_token:n,provider_refresh_token:r,access_token:i,expires_in:u,expires_at:d,refresh_token:a,token_type:c,user:m.user};return window.location.hash=``,this._debug(`#_getSessionFromURL()`,`clearing window.location.hash`),this._returnResult({data:{session:g,redirectType:e.type},error:null})}catch(e){if(M(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl==`function`?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){if(!e.code)return!1;let t=Fr(e[j]);return t&&await H(this.storage,Lr(this.storageKey,t))?!0:!!await H(this.storage,`${this.storageKey}-code-verifier`)}async signOut(e={scope:`global`}){return await this.initializePromise,this.lock==null?await this._signOut(e):await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:`global`}){return await this._useSession(async t=>{let n=async()=>{await this._removeSession()},{data:r,error:i}=t;if(i&&!Xn(i))return this._returnResult({error:i});let a=r.session?.access_token;if(a){let{error:t}=await this.admin.signOut(a,e);if(t&&!(Yn(t)&&(t.status===404||t.status===401||t.status===403)||Xn(t)))return e!==`others`&&await n(),this._returnResult({error:t})}return e!==`others`&&await n(),this._returnResult({error:null})})}onAuthStateChange(e){let t=xr(),n={id:t,callback:e,unsubscribe:()=>{this._debug(`#unsubscribe()`,`state change callback with id removed`,t),this.stateChangeEmitters.delete(t)}};return this._debug(`#onAuthStateChange()`,`registered callback with id`,t),this.stateChangeEmitters.set(t,n),(async()=>{await this.initializePromise,this.lock==null?await this._emitInitialSession(t):await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{try{let{data:{session:n},error:r}=t;if(r)throw r;await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,n),this._debug(`INITIAL_SESSION`,`callback id`,e,`session`,n)}catch(t){await this.stateChangeEmitters.get(e)?.callback(`INITIAL_SESSION`,null),this._debug(`INITIAL_SESSION`,`callback id`,e,`error`,t),Xn(t)||ir(t)||Yn(t)&&(t.code===`refresh_token_not_found`||t.code===`refresh_token_already_used`||t.code===`session_expired`)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let n=null,r=null,i=null;this.flowType===`pkce`&&([n,r,i]=await this._getCodeChallengeAndMethod(!0));try{return await J(this.fetch,`POST`,`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(t.redirectTo,i)})}catch(e){if(await W(this.storage,this.storageKey,i),M(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){try{let{data:e,error:t}=await this.getUser();if(t)throw t;return this._returnResult({data:{identities:e.user.identities??[]},error:null})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return`token`in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){let t=null;try{let{data:n,error:r}=await this._useSession(async n=>{let{data:r,error:i}=n;if(i)throw i;let{url:a,flowId:o}=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:e.options?.redirectTo,scopes:e.options?.scopes,queryParams:e.options?.queryParams,skipBrowserRedirect:!0});return t=o,await J(this.fetch,`GET`,a,{headers:this.headers,jwt:r.session?.access_token??void 0})});if(r)throw r;return z()&&!e.options?.skipBrowserRedirect&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url,flowId:t},error:null})}catch(n){if(M(n))return this._returnResult({data:{provider:e.provider,url:null,flowId:t},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async t=>{try{let{error:n,data:{session:r}}=t;if(n)throw n;let{options:i,provider:a,token:o,access_token:s,nonce:c}=e,{data:l,error:u}=await J(this.fetch,`POST`,`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:r?.access_token??void 0,body:{provider:a,id_token:o,access_token:s,nonce:c,link_identity:!0,gotrue_meta_security:{captcha_token:i?.captchaToken}},xform:Y});return u?this._returnResult({data:{user:null,session:null},error:u}):!l||!l.session||!l.user?this._returnResult({data:{user:null,session:null},error:new I}):(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(`USER_UPDATED`,l.session)),this._returnResult({data:l,error:u}))}catch(e){if(await W(this.storage,this.storageKey,null),M(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{let{data:n,error:r}=t;if(r)throw r;return await J(this.fetch,`DELETE`,`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:n.session?.access_token??void 0})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken()`;this._debug(t,`begin`);try{let n=Date.now();return await kr(async n=>(n>0&&await Or(200*2**(n-1)),this._debug(t,`refreshing attempt`,n),await J(this.fetch,`POST`,`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Y})),(e,t)=>{let r=200*2**e;return t&&ir(t)&&Date.now()+r-nDate.now()?this._debug(r,`proactive refresh failed, access token still valid — preserving session`):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:n,expiresAt:Date.now()+6e4},(t=this.refreshingDeferred)==null||t.resolve(n),n}throw(n=this.refreshingDeferred)==null||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,`end`)}}async _notifyAllSubscribers(e,t,n=!0){if(this._pendingInitNotifications!==null&&n){this._pendingInitNotifications.push({event:e,session:t,broadcast:n});return}let r=`#_notifyAllSubscribers(${e})`;this._debug(r,`begin`,t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});let r=[],i=Array.from(this.stateChangeEmitters.values()).map(async n=>{try{await n.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),A);this.autoRefreshTicker=e,e&&typeof e==`object`&&typeof e.unref==`function`?e.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&typeof t==`object`&&typeof t.unref==`function`?t.unref():typeof Deno<`u`&&typeof Deno.unrefTimer==`function`&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug(`#_stopAutoRefresh()`);let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)==null||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug(`#_autoRefreshTokenTick()`,`begin`),this.lock!=null){try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug(`#_autoRefreshTokenTick()`,`no session`);return}let r=Math.floor((n.expires_at*1e3-e)/A);this._debug(`#_autoRefreshTokenTick()`,`access token expires in ${r} ticks, a tick lasts ${A}ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.refresh_token)})}catch(e){console.error(`Auto refresh tick failed with error. This is likely a transient error.`,e)}}finally{this._debug(`#_autoRefreshTokenTick()`,`end`)}})}catch(e){if(e instanceof di)this._debug(`auto refresh token tick lock not available`);else throw e}return}if(this.refreshingDeferred!==null){this._debug(`#_autoRefreshTokenTick()`,`refresh already in flight, skipping`);return}try{let e=Date.now();try{await this._useSession(async t=>{let{data:{session:n}}=t;if(!n||!n.refresh_token||!n.expires_at){this._debug(`#_autoRefreshTokenTick()`,`no session`);return}let r=Math.floor((n.expires_at*1e3-e)/A);this._debug(`#_autoRefreshTokenTick()`,`access token expires in ${r} ticks, a tick lasts ${A}ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.refresh_token)})}catch(e){console.error(`Auto refresh tick failed with error. This is likely a transient error.`,e)}}finally{this._debug(`#_autoRefreshTokenTick()`,`end`)}}async _handleVisibilityChange(){if(this._debug(`#_handleVisibilityChange()`),!z()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug(`#visibilityChangedCallback`,`error`,e)}},window==null||window.addEventListener(`visibilitychange`,this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error(`_handleVisibilityChange`,e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;if(this._debug(t,`visibilityState`,document.visibilityState),document.visibilityState===`visible`){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!==`visible`){this._debug(t,`acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting`);return}await this._recoverAndRefresh()});else{if(document.visibilityState!==`visible`){this._debug(t,`visibilityState is no longer visible, skipping recovery`);return}await this._recoverAndRefresh()}}else document.visibilityState===`hidden`&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){let r=n?.redirectTo,i=null,a=null,o=null;this.flowType===`pkce`&&([i,a,o]=await this._getCodeChallengeAndMethod(),r=this._maybeAppendFlowIdToRedirect(r,o));let s=[`provider=${encodeURIComponent(t)}`];if(r&&s.push(`redirect_to=${encodeURIComponent(r)}`),n?.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),i!=null&&a!=null){let e=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});s.push(e.toString())}if(n?.queryParams){let e=new URLSearchParams(n.queryParams);s.push(e.toString())}return n?.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),{url:`${e}?${s.join(`&`)}`,flowId:o}}_maybeAppendFlowIdToRedirect(e,t){return!e||!t||!this.experimental.appendPkceFlowIdToRedirects?e??void 0:Ur(e,t)}async _getCodeChallengeAndMethod(e=!1){return Wr(this.storage,this.storageKey,e,e=>this._debug(`#_getCodeChallengeAndMethod()`,`evicted oldest pending PKCE verifier slot`,e))}async _unenroll(e){try{return await this._useSession(async t=>{let{data:n,error:r}=t;return r?this._returnResult({data:null,error:r}):await J(this.fetch,`DELETE`,`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:n?.session?.access_token})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{let{data:n,error:r}=t;if(r)return this._returnResult({data:null,error:r});let i=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType===`phone`?{phone:e.phone}:e.factorType===`totp`?{issuer:e.issuer}:{}),{data:a,error:o}=await J(this.fetch,`POST`,`${this.url}/factors`,{body:i,headers:this.headers,jwt:n?.session?.access_token});return o?this._returnResult({data:null,error:o}):(e.factorType===`totp`&&a.type===`totp`&&a?.totp?.qr_code&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),this._returnResult({data:a,error:null}))})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){let t=async()=>{try{return await this._useSession(async t=>{let{data:n,error:r}=t;if(r)return this._returnResult({data:null,error:r});let i=Object.assign({challenge_id:e.challengeId},`webauthn`in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type===`create`?Oi(e.webauthn.credential_response):ki(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await J(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:n?.session?.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers(`MFA_CHALLENGE_VERIFIED`,a),this._returnResult({data:a,error:o}))})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}};return this.lock==null?t():this._acquireLock(this.lockAcquireTimeout,t)}async _challenge(e){let t=async()=>{try{return await this._useSession(async t=>{let{data:n,error:r}=t;if(r)return this._returnResult({data:null,error:r});let i=await J(this.fetch,`POST`,`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:n?.session?.access_token});if(i.error)return i;let{data:a}=i;if(a.type!==`webauthn`)return{data:a,error:null};switch(a.webauthn.type){case`create`:return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Ei(a.webauthn.credential_options.publicKey)})})}),error:null};case`request`:return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Di(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}};return this.lock==null?t():this._acquireLock(this.lockAcquireTimeout,t)}async _challengeAndVerify(e){let{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let n={all:[],phone:[],totp:[],webauthn:[]};for(let t of e?.factors??[])n.all.push(t),t.status===`verified`&&n[t.factor_type].push(t);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){if(e)try{let{payload:t}=Dr(e),n=null;t.aal&&(n=t.aal);let r=n,{data:{user:i},error:a}=await this.getUser(e);if(a)return this._returnResult({data:null,error:a});((i?.factors)?.filter(e=>e.status===`verified`)??[]).length>0&&(r=`aal2`);let o=t.amr||[];return{data:{currentLevel:n,nextLevel:r,currentAuthenticationMethods:o},error:null}}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:t},error:n}=await this.getSession();if(n)return this._returnResult({data:null,error:n});if(!t)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:r}=Dr(t.access_token),i=null;r.aal&&(i=r.aal);let a=i;(t.user.factors?.filter(e=>e.status===`verified`)??[]).length>0&&(a=`aal2`);let o=r.amr||[];return{data:{currentLevel:i,nextLevel:a,currentAuthenticationMethods:o},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await J(this.fetch,`GET`,`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new F})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new F});let a=await J(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`approve`},xform:e=>({data:e,error:null})});return a.data&&a.data.redirect_url&&z()&&!t?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{let{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new F});let a=await J(this.fetch,`POST`,`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:`deny`},xform:e=>({data:e,error:null})});return a.data&&a.data.redirect_url&&z()&&!t?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await J(this.fetch,`GET`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new F})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?(await J(this.fetch,`DELETE`,`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new F})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(t=>t.kid===e);if(n)return n;let r=Date.now();if(n=this.jwks.keys.find(t=>t.kid===e),n&&this.jwks_cached_at+6e5>r)return n;let{data:i,error:a}=await J(this.fetch,`GET`,`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,n=i.keys.find(t=>t.kid===e),!n)?null:n}async getClaims(e,t={}){try{let n=e;if(!n){let{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});n=e.session.access_token}let{header:r,payload:i,signature:a,raw:{header:o,payload:s}}=Dr(n);if(!t?.allowExpired)try{qr(i.exp)}catch(e){throw new lr(e instanceof Error?e.message:`JWT validation failed`)}let c=!r.alg||r.alg.startsWith(`HS`)||!r.kid||!(`crypto`in globalThis&&`subtle`in globalThis.crypto)?null:await this.fetchJwk(r.kid,t?.keys?{keys:t.keys}:t?.jwks);if(!c){let{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:i,header:r,signature:a},error:null}}let l=Jr(r.alg),u=await crypto.subtle.importKey(`jwk`,c,l,!0,[`verify`]);if(!await crypto.subtle.verify(l,u,a,yr(`${o}.${s}`)))throw new lr(`Invalid JWT signature`);return{data:{claims:i,header:r,signature:a},error:null}}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){K(this.experimental);try{if(!ji())return this._returnResult({data:null,error:new N(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:e?.options?.captchaToken}});if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:i}=await Ni({publicKey:Di(t.options),signal:e?.options?.signal??Ti.createNewAbortSignal()});if(i||!r)return this._returnResult({data:null,error:i??new N(`WebAuthn ceremony failed`,null)});let a=ki(r);return this._verifyPasskeyAuthentication({challengeId:t.challenge_id,credential:a})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){K(this.experimental);try{if(!ji())return this._returnResult({data:null,error:new N(`Browser does not support WebAuthn`,null)});let{data:t,error:n}=await this._startPasskeyRegistration();if(n||!t)return this._returnResult({data:null,error:n});let{data:r,error:i}=await Mi({publicKey:Ei(t.options),signal:e?.options?.signal??Ti.createNewAbortSignal()});if(i||!r)return this._returnResult({data:null,error:i??new N(`WebAuthn ceremony failed`,null)});let a=Oi(r);return this._verifyPasskeyRegistration({challengeId:t.challenge_id,credential:a})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){K(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new F});let{data:r,error:i}=await J(this.fetch,`POST`,`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){K(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new F});let{data:i,error:a}=await J(this.fetch,`POST`,`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){K(this.experimental);try{let{data:t,error:n}=await J(this.fetch,`POST`,`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:e?.options?.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:t,error:null})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){K(this.experimental);try{let{data:t,error:n}=await J(this.fetch,`POST`,`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Y});return n?this._returnResult({data:null,error:n}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers(`SIGNED_IN`,t.session)),this._returnResult({data:t,error:null}))}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){K(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!t)return this._returnResult({data:null,error:new F});let{data:r,error:i}=await J(this.fetch,`GET`,`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){K(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new F});let{data:i,error:a}=await J(this.fetch,`PATCH`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){K(this.experimental);try{return await this._useSession(async t=>{let{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new F});let{error:i}=await J(this.fetch,`DELETE`,`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if(M(e))return this._returnResult({data:null,error:e});throw e}}};Vi.nextInstanceID={};var Hi=Vi,Ui=li,Wi=Hi,Gi=class extends Wi{constructor(e){super(e)}},Ki=class{constructor(e,t,n){this.supabaseUrl=e,this.supabaseKey=t;let r=Bn(e);if(!t)throw Error(`supabaseKey is required.`);Mn(t),this.realtimeUrl=new URL(`realtime/v1`,r),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace(`http`,`ws`),this.authUrl=new URL(`auth/v1`,r),this.storageUrl=new URL(`storage/v1`,r),this.functionsUrl=new URL(`functions/v1`,r);let i=`sb-${r.hostname.split(`.`)[0]}-auth-token`,a={db:vn,realtime:bn,auth:{...yn,storageKey:i},global:_n,tracePropagation:xn},o=zn(n??{},a);this.settings=o,this.storageKey=o.auth.storageKey??``,this.headers=o.global.headers??{},o.accessToken?(this.accessToken=o.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(o.auth??{},this.headers,o.global.fetch),this.fetch=Nn(t,e,this._getSessionToken.bind(this),o.global.fetch,o.tracePropagation),this.functionsFetch=Nn(t,e,this._getSessionToken.bind(this),o.global.fetch,o.tracePropagation,{omitApiKeyAsBearer:!0}),this.realtime=this._initRealtimeClient({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch,...o.realtime}),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn(`Failed to set initial Realtime auth token:`,e)),this.rest=new le(new URL(`rest/v1`,r).href,{headers:this.headers,schema:o.db.schema,fetch:this.fetch,timeout:o.db.timeout,urlLengthLimit:o.db.urlLengthLimit,retry:o.db.retry}),this.storage=new pn(this.storageUrl.href,this.headers,this.fetch,n?.storage),o.accessToken||this._listenForAuthEvents()}get functions(){return new l(this.functionsUrl.href,{headers:this.headers,customFetch:this.functionsFetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getSessionToken(){if(this.accessToken)return await this.accessToken();let{data:e}=await this.auth.getSession();return e.session?.access_token??null}async _getAccessToken(){return await this._getSessionToken()??this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:a,flowType:o,lock:s,debug:c,throwOnError:l,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:f},p,m){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Gi({url:this.authUrl.href,headers:{...h,...p},storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,flowType:o,lock:s,debug:c,throwOnError:l,experimental:u,fetch:m,lockAcquireTimeout:d,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>e.toLowerCase()===`authorization`)})}_initRealtimeClient(e){return new mt(this.realtimeUrl.href,{...e,params:{apikey:this.supabaseKey,...e?.params}})}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,`CLIENT`,t?.access_token)})}_handleTokenChanged(e,t,n){(e===`TOKEN_REFRESHED`||e===`SIGNED_IN`||e===`INITIAL_SESSION`)&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e===`SIGNED_OUT`&&(this.realtime.setAuth(),t==`STORAGE`&&this.auth.signOut(),this.changedAccessToken=void 0)}};let qi=(e,t,n)=>new Ki(e,t,n);function Ji(){if(typeof window<`u`||globalThis.Deno!==void 0)return!1;let e=globalThis.process;if(!e)return!1;let t=e.version;if(t==null)return!1;let n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=20:!1}return Ji()&&console.warn(`⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715`),e.AuthAdminApi=Ui,e.AuthApiError=Jn,e.AuthClient=Wi,e.AuthError=qn,e.AuthImplicitGrantRedirectError=Qn,e.AuthInvalidCredentialsError=Zn,e.AuthInvalidJwtError=lr,e.AuthInvalidTokenResponseError=I,e.AuthPKCECodeVerifierMissingError=tr,e.AuthPKCEGrantCodeExchangeError=er,e.AuthRefreshDiscardedError=ar,e.AuthRetryableFetchError=rr,e.AuthSessionMissingError=F,e.AuthUnknownError=N,e.AuthWeakPasswordError=sr,e.CustomAuthError=P,Object.defineProperty(e,`FunctionRegion`,{enumerable:!0,get:function(){return c}}),e.FunctionsError=i,e.FunctionsFetchError=a,e.FunctionsHttpError=s,e.FunctionsRelayError=o,e.GoTrueAdminApi=li,e.GoTrueClient=Hi,e.NavigatorLockAcquireTimeoutError=fi,e.PostgrestError=p,e.REALTIME_CHANNEL_STATES=st,Object.defineProperty(e,`REALTIME_LISTEN_TYPES`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,`REALTIME_POSTGRES_CHANGES_LISTEN_EVENT`,{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,`REALTIME_PRESENCE_LISTEN_EVENTS`,{enumerable:!0,get:function(){return qe}}),Object.defineProperty(e,`REALTIME_SUBSCRIBE_STATES`,{enumerable:!0,get:function(){return E}}),e.RealtimeChannel=ct,e.RealtimeClient=mt,e.RealtimePostgresFilterBuilder=it,e.RealtimePresence=Je,e.SIGN_OUT_SCOPES=ci,e.StorageApiError=jt,e.SupabaseClient=Ki,e.WebSocketFactory=ue,e.createClient=qi,e.isAuthApiError=Yn,e.isAuthError=M,e.isAuthImplicitGrantRedirectError=$n,e.isAuthPKCECodeVerifierMissingError=nr,e.isAuthRefreshDiscardedError=or,e.isAuthRetryableFetchError=ir,e.isAuthSessionMissingError=Xn,e.isAuthWeakPasswordError=cr,e.lockInternals=Z,e.navigatorLock=mi,e.postgresChangesFilter=at,e.processLock=gi,e})({}); \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/migrations/README.md b/node_modules/@supabase/supabase-js/migrations/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a7b881682ddcfd928d998f8b518c873c93ccc422 --- /dev/null +++ b/node_modules/@supabase/supabase-js/migrations/README.md @@ -0,0 +1,25 @@ +# Migration notes for `@supabase/supabase-js` + +Each file in this directory describes one migration theme — what changed in `@supabase/supabase-js`, who is affected, and what callers need to do. + +Files are shipped with the npm package, so the migration notes you see here are pinned to the version of `@supabase/supabase-js` you have installed. Upgrading the package brings the relevant migration notes along with it. + +## How agents should use this directory + +When helping a developer upgrade `@supabase/supabase-js`: + +1. Read the migration files in `node_modules/@supabase/supabase-js/migrations/` for the version they have installed. +2. Cross-reference against the version they are upgrading to. +3. Apply the migration steps described in each relevant file. + +## How humans should use this directory + +Browse the files for the migration theme you care about. Each file is self-contained and explains its own scope, audience, and steps. + +## File naming + +One file per migration theme, named by topic rather than version (e.g. `.md`, kebab-case). A single version can ship multiple theme files; a single theme can span multiple versions. Each file documents its own `Since` / `Will require action by` version range internally. + +## Cross-cutting migration notes + +Migrations that span multiple Supabase packages (e.g. Node.js version drops, monorepo restructures) live in [`docs/MIGRATION.md`](../../../../docs/MIGRATION.md) at the repository root, not here. This directory is scoped to `@supabase/supabase-js` only. diff --git a/node_modules/@supabase/supabase-js/package.json b/node_modules/@supabase/supabase-js/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e8fa8c477651cb238cb47beb725c64896bd72a78 --- /dev/null +++ b/node_modules/@supabase/supabase-js/package.json @@ -0,0 +1,177 @@ +{ + "name": "@supabase/supabase-js", + "version": "2.112.3", + "description": "Isomorphic Javascript SDK for Supabase", + "keywords": [ + "javascript", + "typescript", + "supabase" + ], + "homepage": "https://github.com/supabase/supabase-js/tree/master/packages/core/supabase-js", + "bugs": "https://github.com/supabase/supabase-js/issues", + "license": "MIT", + "author": "Supabase", + "files": [ + "dist", + "src", + "migrations", + "AGENTS.md" + ], + "main": "dist/index.cjs", + "module": "dist/index.mjs", + "types": "dist/index.d.cts", + "exports": { + ".": { + "react-native": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + }, + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + }, + "./cors": { + "react-native": { + "types": "./dist/cors.d.cts", + "default": "./dist/cors.cjs" + }, + "import": { + "types": "./dist/cors.d.mts", + "default": "./dist/cors.mjs" + }, + "require": { + "types": "./dist/cors.d.cts", + "default": "./dist/cors.cjs" + } + }, + "./tracing": { + "react-native": { + "types": "./dist/tracing.d.cts", + "default": "./dist/tracing.cjs" + }, + "import": { + "types": "./dist/tracing.d.mts", + "default": "./dist/tracing.mjs" + }, + "require": { + "types": "./dist/tracing.d.cts", + "default": "./dist/tracing.cjs" + } + }, + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, + "sideEffects": [ + "./dist/tracing.cjs", + "./dist/tracing.mjs", + "./src/tracing.ts" + ], + "repository": { + "type": "git", + "url": "https://github.com/supabase/supabase-js.git", + "directory": "packages/core/supabase-js" + }, + "dependencies": { + "@supabase/auth-js": "2.112.3", + "@supabase/postgrest-js": "2.112.3", + "@supabase/functions-js": "2.112.3", + "@supabase/realtime-js": "2.112.3", + "@supabase/storage-js": "2.112.3" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + } + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.18.2", + "@jest/globals": "^30.0.0", + "@jest/types": "^30.0.0", + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/context-async-hooks": "^2.8.0", + "@opentelemetry/core": "^2.8.0", + "@opentelemetry/sdk-trace-node": "^2.8.0", + "@types/jest": "30.0.0", + "@types/jsonwebtoken": "^8.5.8", + "@types/node": "20.19.9", + "jest": "30.4.2", + "jsonwebtoken": "^9.0.0", + "jsr": "^0.13.5", + "puppeteer": "^24.9.0", + "ts-jest": "^29.4.9", + "tsd": "^0.33.0", + "tsdown": "^0.18.0", + "typedoc": "^0.27.9", + "typescript": "~5.8.3", + "@supabase/tracing": "0.0.0-automated" + }, + "jsdelivr": "dist/umd/supabase.js", + "unpkg": "dist/umd/supabase.js", + "nx": { + "targets": { + "test:integration:browser": { + "dependsOn": [ + { + "projects": [ + "storage-js" + ], + "target": "build" + } + ] + }, + "test:edge-functions": { + "dependsOn": [ + { + "projects": [ + "storage-js" + ], + "target": "build" + } + ] + } + } + }, + "engines": { + "node": ">=22.0.0" + }, + "scripts": { + "build": "tsdown", + "build:watch": "tsdown --watch", + "test": "npm run test:types && npm run test:run", + "test:all": "npm run test:types && npm run test:run && npm run test:integration && npm run test:integration:browser", + "test:run": "jest --runInBand --detectOpenHandles", + "test:unit": "jest --runInBand --detectOpenHandles test/unit", + "test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno|\\.[mc]js$\"", + "test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts", + "test:integration:browser": "deno test --allow-all --node-modules-dir=auto test/integration.browser.test.ts", + "test:edge-functions": "cd test/deno && npm run test:edge-functions", + "test:deno": "cd test/deno && npm run test", + "test:watch": "jest --watch --verbose false --silent false", + "test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test", + "test:bun": "cd test/integration/bun && bun install && bun test", + "test:expo": "cd test/integration/expo && npm test", + "test:next": "cd test/integration/next && npm test", + "test:types": "tsd --files test/types/index.test-d.ts && tsd --typings dist/cors.d.cts --files test/types/cors.test-d.ts && tsd --typings dist/tracing.d.cts --files test/types/tracing.test-d.ts && jsr publish --dry-run --allow-dirty", + "test:exports": "attw --pack . --ignore-rules no-resolution", + "test:esm": "node test/module-resolution.test.mjs && node test/module-resolution-cors.test.mjs && node test/module-resolution-tracing.test.mjs", + "test:cjs": "node test/module-resolution.test.cjs && node test/module-resolution-cors.test.cjs && node test/module-resolution-tracing.test.cjs", + "test:hermes-compat": "node test/bundle-hermes-compat.test.cjs", + "test:module-resolution": "npm run test:exports && npm run test:esm && npm run test:cjs && npm run test:hermes-compat", + "docs": "typedoc --options ../../../typedoc.base.mjs --entryPoints src/index.ts --entryPoints src/cors.ts --entryPoints src/tracing.ts --out docs/v2", + "docs:json": "typedoc --options ../../../typedoc.base.mjs --entryPoints src/index.ts --entryPoints src/cors.ts --entryPoints src/tracing.ts --json docs/v2/spec.json --excludeExternals", + "serve:coverage": "pnpm nx test:coverage supabase-js && pnpm dlx serve test/coverage", + "update:test-deps": "pnpm run update:test-deps:expo && pnpm run update:test-deps:next && pnpm run update:test-deps:deno && pnpm run update:test-deps:bun", + "update:test-deps:expo": "cd test/integration/expo && pnpm install --ignore-workspace", + "update:test-deps:next": "cd test/integration/next && pnpm install --ignore-workspace", + "update:test-deps:deno": "cd test/deno && pnpm install --ignore-workspace", + "update:test-deps:bun": "cd test/integration/bun && bun install" + } +} \ No newline at end of file diff --git a/node_modules/@supabase/supabase-js/src/SupabaseClient.ts b/node_modules/@supabase/supabase-js/src/SupabaseClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..992470da009030f40abeea726d52bfe16678f06c --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/SupabaseClient.ts @@ -0,0 +1,686 @@ +import type { AuthChangeEvent } from '@supabase/auth-js' +import { FunctionsClient } from '@supabase/functions-js' +import { + PostgrestClient, + type PostgrestFilterBuilder, + type PostgrestQueryBuilder, +} from '@supabase/postgrest-js' +import { + type RealtimeChannel, + type RealtimeChannelOptions, + RealtimeClient, + type RealtimeClientOptions, + type RealtimeRemoveChannelResponse, +} from '@supabase/realtime-js' +import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js' +import { + DEFAULT_AUTH_OPTIONS, + DEFAULT_DB_OPTIONS, + DEFAULT_GLOBAL_OPTIONS, + DEFAULT_REALTIME_OPTIONS, + DEFAULT_TRACE_PROPAGATION_OPTIONS, +} from './lib/constants' +import { checkApiKeyFormat, fetchWithAuth } from './lib/fetch' +import { + applySettingDefaults, + validateSupabaseUrl, + type ResolvedSupabaseClientOptions, +} from './lib/helpers' +import { SupabaseAuthClient } from './lib/SupabaseAuthClient' +import type { + Fetch, + GenericSchema, + SupabaseAuthClientOptions, + SupabaseClientOptions, +} from './lib/types' +import { GetRpcFunctionFilterBuilderByArgs } from './lib/rest/types/common/rpc' + +/** + * Supabase Client. + * + * An isomorphic Javascript client for interacting with Postgres. + */ +export default class SupabaseClient< + Database = any, + // The second type parameter is also used for specifying db_schema, so we + // support both cases. + // TODO: Allow setting db_schema from ClientOptions. + SchemaNameOrClientOptions extends + | (string & keyof Omit) + | { PostgrestVersion: string } = 'public' extends keyof Omit + ? 'public' + : string & keyof Omit, + SchemaName extends string & keyof Omit = + SchemaNameOrClientOptions extends string & keyof Omit + ? SchemaNameOrClientOptions + : 'public' extends keyof Omit + ? 'public' + : string & keyof Omit, '__InternalSupabase'>, + Schema extends Omit[SchemaName] extends GenericSchema + ? Omit[SchemaName] + : never = Omit[SchemaName] extends GenericSchema + ? Omit[SchemaName] + : never, + ClientOptions extends { PostgrestVersion: string } = SchemaNameOrClientOptions extends string & + keyof Omit + ? // If the version isn't explicitly set, look for it in the __InternalSupabase object to infer the right version + Database extends { __InternalSupabase: { PostgrestVersion: string } } + ? Database['__InternalSupabase'] + : // otherwise default to 12 + { PostgrestVersion: '12' } + : SchemaNameOrClientOptions extends { PostgrestVersion: string } + ? SchemaNameOrClientOptions + : never, +> { + /** + * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies. + */ + auth: SupabaseAuthClient + realtime: RealtimeClient + /** + * Supabase Storage allows you to manage user-generated content, such as photos or videos. + */ + storage: SupabaseStorageClient + + protected realtimeUrl: URL + protected authUrl: URL + protected storageUrl: URL + protected functionsUrl: URL + protected rest: PostgrestClient + protected storageKey: string + protected fetch?: Fetch + protected functionsFetch?: Fetch + protected changedAccessToken?: string + protected accessToken?: () => Promise + + protected headers: Record + protected settings?: ResolvedSupabaseClientOptions + + /** + * Create a new client for use in the browser. + * + * @category Initializing + * + * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard. + * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard. + * @param options Optional configuration for the client: + * - `db.schema` — You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase. + * - `auth.autoRefreshToken` — Set to `true` if you want to automatically refresh the token before expiring. + * - `auth.persistSession` — Set to `true` if you want to automatically save the user session into local storage. + * - `auth.detectSessionInUrl` — Set to `true` if you want to automatically detect OAuth grants in the URL and sign in the user. + * - `realtime` — Options passed along to the realtime-js constructor. + * - `storage` — Options passed along to the storage-js constructor. + * - `global.fetch` — A custom fetch implementation. + * - `global.headers` — Any additional headers to send with each network request. + * + * @example Creating a client + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Create a single supabase client for interacting with your database + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * ``` + * + * @example With a custom domain + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * // Use a custom domain as the supabase URL + * const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key') + * ``` + * + * @example With additional parameters + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const options = { + * db: { + * schema: 'public', + * }, + * auth: { + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: true + * }, + * global: { + * headers: { 'x-my-custom-header': 'my-app-name' }, + * }, + * } + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options) + * ``` + * + * @exampleDescription With custom schemas + * By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. + * Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API. + * + * Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. + * + * @example With custom schemas + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * // Provide a custom schema. Defaults to "public". + * db: { schema: 'other_schema' } + * }) + * ``` + * + * @exampleDescription Custom fetch implementation + * `supabase-js` uses the runtime's global `fetch` to make HTTP requests, + * but an alternative `fetch` implementation can be provided as an option. + * This is useful in environments where the global `fetch` is unavailable or where you want to customize request behavior. + * + * @example Custom fetch implementation + * ```js + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * global: { fetch: fetch.bind(globalThis) } + * }) + * ``` + * + * @exampleDescription React Native options with AsyncStorage + * For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth. + * + * @example React Native options with AsyncStorage + * ```js + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from "@react-native-async-storage/async-storage"; + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: AsyncStorage, + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @exampleDescription React Native options with Expo SecureStore + * If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore. + * The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode. + * A new 256-bit encryption key is generated using the `react-native-get-random-values` library. + * This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage. + * + * Please make sure that: + * - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date. + * - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs. + * E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed. + * - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities. + * + * @example React Native options with Expo SecureStore + * ```ts + * import 'react-native-url-polyfill/auto' + * import { createClient } from '@supabase/supabase-js' + * import AsyncStorage from '@react-native-async-storage/async-storage'; + * import * as SecureStore from 'expo-secure-store'; + * import * as aesjs from 'aes-js'; + * import 'react-native-get-random-values'; + * + * // As Expo's SecureStore does not support values larger than 2048 + * // bytes, an AES-256 key is generated and stored in SecureStore, while + * // it is used to encrypt/decrypt values stored in AsyncStorage. + * class LargeSecureStore { + * private async _encrypt(key: string, value: string) { + * const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8)); + * + * const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1)); + * const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value)); + * + * await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey)); + * + * return aesjs.utils.hex.fromBytes(encryptedBytes); + * } + * + * private async _decrypt(key: string, value: string) { + * const encryptionKeyHex = await SecureStore.getItemAsync(key); + * if (!encryptionKeyHex) { + * return encryptionKeyHex; + * } + * + * const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1)); + * const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value)); + * + * return aesjs.utils.utf8.fromBytes(decryptedBytes); + * } + * + * async getItem(key: string) { + * const encrypted = await AsyncStorage.getItem(key); + * if (!encrypted) { return encrypted; } + * + * return await this._decrypt(key, encrypted); + * } + * + * async removeItem(key: string) { + * await AsyncStorage.removeItem(key); + * await SecureStore.deleteItemAsync(key); + * } + * + * async setItem(key: string, value: string) { + * const encrypted = await this._encrypt(key, value); + * + * await AsyncStorage.setItem(key, encrypted); + * } + * } + * + * const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", { + * auth: { + * storage: new LargeSecureStore(), + * autoRefreshToken: true, + * persistSession: true, + * detectSessionInUrl: false, + * }, + * }); + * ``` + * + * @example With a database query + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * + * const { data } = await supabase.from('profiles').select('*') + * ``` + * + * @exampleDescription With OpenTelemetry tracing + * Opt in to W3C trace context propagation so the `trace_id` from your + * client-side spans is attached to Supabase requests and appears in API + * Gateway and Edge Function logs. Requires `@opentelemetry/api` to be + * installed in your application and the tracing runtime to be loaded via + * `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing). + * + * @example With OpenTelemetry tracing + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', { + * tracePropagation: true, + * }) + * + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Outgoing request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + */ + constructor( + protected supabaseUrl: string, + protected supabaseKey: string, + options?: SupabaseClientOptions + ) { + const baseUrl = validateSupabaseUrl(supabaseUrl) + if (!supabaseKey) throw new Error('supabaseKey is required.') + checkApiKeyFormat(supabaseKey) + + this.realtimeUrl = new URL('realtime/v1', baseUrl) + this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws') + this.authUrl = new URL('auth/v1', baseUrl) + this.storageUrl = new URL('storage/v1', baseUrl) + this.functionsUrl = new URL('functions/v1', baseUrl) + + // default storage key uses the supabase project ref as a namespace + const defaultStorageKey = `sb-${baseUrl.hostname.split('.')[0]}-auth-token` + const DEFAULTS = { + db: DEFAULT_DB_OPTIONS, + realtime: DEFAULT_REALTIME_OPTIONS, + auth: { ...DEFAULT_AUTH_OPTIONS, storageKey: defaultStorageKey }, + global: DEFAULT_GLOBAL_OPTIONS, + tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS, + } + + const settings = applySettingDefaults(options ?? {}, DEFAULTS) + this.settings = settings + + this.storageKey = settings.auth.storageKey ?? '' + this.headers = settings.global.headers ?? {} + + if (!settings.accessToken) { + this.auth = this._initSupabaseAuthClient( + settings.auth ?? {}, + this.headers, + settings.global.fetch + ) + } else { + this.accessToken = settings.accessToken + + this.auth = new Proxy({} as any, { + get: (_, prop) => { + throw new Error( + `@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String( + prop + )} is not possible` + ) + }, + }) + } + + // The fetch wrappers receive the raw session token (null when there is no session) and + // decide the `Authorization` fallback themselves, so the API-key fallback lives in one place. + this.fetch = fetchWithAuth( + supabaseKey, + supabaseUrl, + this._getSessionToken.bind(this), + settings.global.fetch, + settings.tracePropagation + ) + // Edge Functions use a dedicated fetch that never falls back to a new-format API key in + // the Authorization header (see `isNewApiKey` in ./lib/fetch). Other services use `this.fetch`. + this.functionsFetch = fetchWithAuth( + supabaseKey, + supabaseUrl, + this._getSessionToken.bind(this), + settings.global.fetch, + settings.tracePropagation, + { omitApiKeyAsBearer: true } + ) + this.realtime = this._initRealtimeClient({ + headers: this.headers, + accessToken: this._getAccessToken.bind(this), + fetch: this.fetch, + ...settings.realtime, + }) + if (this.accessToken) { + // Start auth immediately to avoid race condition with channel subscriptions + // Wrap Promise to avoid Firefox extension cross-context Promise access errors + Promise.resolve(this.accessToken()) + .then((token) => this.realtime.setAuth(token)) + .catch((e) => console.warn('Failed to set initial Realtime auth token:', e)) + } + + this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, { + headers: this.headers, + schema: settings.db.schema, + fetch: this.fetch, + timeout: settings.db.timeout, + urlLengthLimit: settings.db.urlLengthLimit, + retry: settings.db.retry, + }) + + this.storage = new SupabaseStorageClient( + this.storageUrl.href, + this.headers, + this.fetch, + options?.storage + ) + + if (!settings.accessToken) { + this._listenForAuthEvents() + } + } + + /** + * Supabase Functions allows you to deploy and invoke edge functions. + */ + get functions(): FunctionsClient { + return new FunctionsClient(this.functionsUrl.href, { + headers: this.headers, + customFetch: this.functionsFetch, + }) + } + + // NOTE: signatures must be kept in sync with PostgrestClient.from + from< + TableName extends string & keyof Schema['Tables'], + Table extends Schema['Tables'][TableName], + >(relation: TableName): PostgrestQueryBuilder + from( + relation: ViewName + ): PostgrestQueryBuilder + /** + * Perform a query on a table or a view. + * + * @param relation - The table or view name to query + */ + from(relation: string): PostgrestQueryBuilder { + return this.rest.from(relation) + } + + // NOTE: signatures must be kept in sync with PostgrestClient.schema + /** + * Select a schema to query or perform an function (rpc) call. + * + * The schema needs to be on the list of exposed schemas inside Supabase. + * + * @param schema - The schema to query + */ + schema>( + schema: DynamicSchema + ): PostgrestClient< + Database, + ClientOptions, + DynamicSchema, + Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any + > { + return this.rest.schema(schema) + } + + // NOTE: signatures must be kept in sync with PostgrestClient.rpc + /** + * Perform a function call. + * + * @param fn - The function name to call + * @param args - The arguments to pass to the function call + * @param options - Named parameters + * @param options.head - When set to `true`, `data` will not be returned. + * Useful if you only need the count. + * @param options.get - When set to `true`, the function will be called with + * read-only access mode. + * @param options.count - Count algorithm to use to count rows returned by the + * function. Only applicable for [set-returning + * functions](https://www.postgresql.org/docs/current/functions-srf.html). + * + * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the + * hood. + * + * `"planned"`: Approximated but fast count algorithm. Uses the Postgres + * statistics under the hood. + * + * `"estimated"`: Uses exact count for low numbers and planned count for high + * numbers. + */ + rpc< + FnName extends string & keyof Schema['Functions'], + Args extends Schema['Functions'][FnName]['Args'] = never, + FilterBuilder extends GetRpcFunctionFilterBuilderByArgs = + GetRpcFunctionFilterBuilderByArgs, + >( + fn: FnName, + args: Args = {} as Args, + options: { + head?: boolean + get?: boolean + count?: 'exact' | 'planned' | 'estimated' + } = { + head: false, + get: false, + count: undefined, + } + ): PostgrestFilterBuilder< + ClientOptions, + Schema, + FilterBuilder['Row'], + FilterBuilder['Result'], + FilterBuilder['RelationName'], + FilterBuilder['Relationships'], + 'RPC' + > { + return this.rest.rpc(fn, args, options) as unknown as PostgrestFilterBuilder< + ClientOptions, + Schema, + FilterBuilder['Row'], + FilterBuilder['Result'], + FilterBuilder['RelationName'], + FilterBuilder['Relationships'], + 'RPC' + > + } + + /** + * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. + * + * @param {string} name - The name of the Realtime channel. + * @param {Object} opts - The options to pass to the Realtime channel. + * + * @category Realtime + */ + channel(name: string, opts: RealtimeChannelOptions = { config: {} }): RealtimeChannel { + return this.realtime.channel(name, opts) + } + + /** + * Returns all Realtime channels. + * + * @category Realtime + * + * @example Get all channels + * ```js + * const channels = supabase.getChannels() + * ``` + */ + getChannels(): RealtimeChannel[] { + return this.realtime.getChannels() + } + + /** + * Unsubscribes and removes Realtime channel from Realtime client. + * + * @param {RealtimeChannel} channel - The name of the Realtime channel. + * + * + * @category Realtime + * + * @remarks + * - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Removes a channel + * ```js + * supabase.removeChannel(myChannel) + * ``` + */ + removeChannel(channel: RealtimeChannel): Promise { + return this.realtime.removeChannel(channel) + } + + /** + * Unsubscribes and removes all Realtime channels from Realtime client. + * + * @category Realtime + * + * @remarks + * - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. + * + * @example Remove all channels + * ```js + * supabase.removeAllChannels() + * ``` + */ + removeAllChannels(): Promise { + return this.realtime.removeAllChannels() + } + + /** + * The raw session token — the custom `accessToken` result or the signed-in user's JWT — + * or `null` when there is no session. Unlike {@link _getAccessToken} it does not fall back + * to `supabaseKey`, so callers can distinguish "no session" from "has session". + */ + private async _getSessionToken(): Promise { + if (this.accessToken) { + return await this.accessToken() + } + + const { data } = await this.auth.getSession() + + return data.session?.access_token ?? null + } + + private async _getAccessToken() { + return (await this._getSessionToken()) ?? this.supabaseKey + } + + private _initSupabaseAuthClient( + { + autoRefreshToken, + persistSession, + detectSessionInUrl, + storage, + userStorage, + storageKey, + flowType, + lock, + debug, + throwOnError, + experimental, + lockAcquireTimeout, + skipAutoInitialize, + }: SupabaseAuthClientOptions, + headers?: Record, + fetch?: Fetch + ) { + const authHeaders = { + Authorization: `Bearer ${this.supabaseKey}`, + apikey: `${this.supabaseKey}`, + } + return new SupabaseAuthClient({ + url: this.authUrl.href, + headers: { ...authHeaders, ...headers }, + storageKey: storageKey, + autoRefreshToken, + persistSession, + detectSessionInUrl, + storage, + userStorage, + flowType, + lock, + debug, + throwOnError, + experimental, + fetch, + lockAcquireTimeout, + skipAutoInitialize, + // auth checks if there is a custom authorizaiton header using this flag + // so it knows whether to return an error when getUser is called with no session + hasCustomAuthorizationHeader: Object.keys(this.headers).some( + (key) => key.toLowerCase() === 'authorization' + ), + }) + } + + private _initRealtimeClient(options: RealtimeClientOptions) { + return new RealtimeClient(this.realtimeUrl.href, { + ...options, + params: { ...{ apikey: this.supabaseKey }, ...options?.params }, + }) + } + + private _listenForAuthEvents() { + const data = this.auth.onAuthStateChange((event, session) => { + this._handleTokenChanged(event, 'CLIENT', session?.access_token) + }) + return data + } + + private _handleTokenChanged( + event: AuthChangeEvent, + source: 'CLIENT' | 'STORAGE', + token?: string + ) { + if ( + (event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN' || event === 'INITIAL_SESSION') && + this.changedAccessToken !== token + ) { + this.changedAccessToken = token + this.realtime.setAuth(token) + } else if (event === 'SIGNED_OUT') { + this.realtime.setAuth() + if (source == 'STORAGE') this.auth.signOut() + this.changedAccessToken = undefined + } + } +} diff --git a/node_modules/@supabase/supabase-js/src/cors.ts b/node_modules/@supabase/supabase-js/src/cors.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed4e99a4571f2d1fe3795f1a973a6c0f2969f78d --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/cors.ts @@ -0,0 +1,91 @@ +/** + * Canonical CORS configuration for Supabase Edge Functions + * + * This module exports CORS headers kept in sync with the headers the Supabase + * SDK sends. Using it in Edge Functions prevents CORS preflight errors when the + * SDK adds new headers — update SUPABASE_HEADERS whenever the SDK starts + * sending one (enforced by the unit tests). + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @module cors + */ + +/** + * All custom headers sent by the Supabase SDK. + * These headers need to be included in CORS configuration to prevent preflight failures. + * + * Headers: + * - authorization: Bearer token for authentication + * - x-client-info: Library version information + * - apikey: Project API key + * - content-type: Standard HTTP content type + * - x-retry-count: Retry attempt number sent by postgrest-js on retried requests + * - traceparent: W3C trace context sent when `tracePropagation` is enabled + * - tracestate: Vendor-specific trace data sent alongside traceparent + * - baggage: W3C baggage sent alongside traceparent + */ +const SUPABASE_HEADERS = [ + 'authorization', + 'x-client-info', + 'apikey', + 'content-type', + 'x-retry-count', + 'traceparent', + 'tracestate', + 'baggage', +].join(', ') + +/** + * All HTTP methods used by the Supabase SDK + */ +const SUPABASE_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'].join(', ') + +/** + * Type representing CORS headers as a record of header names to values + */ +export type CorsHeaders = Record + +/** + * Default CORS headers for Supabase Edge Functions. + * + * Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. + * Use this for simple CORS configurations with wildcard origin. + * + * @example Basic usage + * ```typescript + * import { corsHeaders } from '@supabase/supabase-js/cors' + * + * Deno.serve(async (req) => { + * if (req.method === 'OPTIONS') { + * return new Response('ok', { headers: corsHeaders }) + * } + * + * return new Response( + * JSON.stringify({ data: 'Hello' }), + * { headers: { ...corsHeaders, 'Content-Type': 'application/json' } } + * ) + * }) + * ``` + * + * @category Edge Functions + */ +export const corsHeaders: CorsHeaders = { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Headers': SUPABASE_HEADERS, + 'Access-Control-Allow-Methods': SUPABASE_METHODS, +} diff --git a/node_modules/@supabase/supabase-js/src/index.ts b/node_modules/@supabase/supabase-js/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..352cc73354b2148e7e601ee66bbaa8ed746cf6ec --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/index.ts @@ -0,0 +1,106 @@ +import SupabaseClient from './SupabaseClient' +import type { SupabaseClientOptions } from './lib/types' + +export * from '@supabase/auth-js' +export type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js' +export type { + PostgrestResponse, + PostgrestSingleResponse, + PostgrestMaybeSingleResponse, + PostgrestBuilder, + PostgrestFilterBuilder, + PostgrestTransformBuilder, + PostgrestQueryBuilder, +} from '@supabase/postgrest-js' +export { PostgrestError } from '@supabase/postgrest-js' +export { StorageApiError } from '@supabase/storage-js' +export type { FunctionInvokeOptions } from '@supabase/functions-js' +export { + FunctionsHttpError, + FunctionsFetchError, + FunctionsRelayError, + FunctionsError, + FunctionRegion, +} from '@supabase/functions-js' +export * from '@supabase/realtime-js' +export { default as SupabaseClient } from './SupabaseClient' +export type { + SupabaseClientOptions, + TracePropagationOptions, + QueryResult, + QueryData, + QueryError, + DatabaseWithoutInternals, +} from './lib/types' + +/** + * Creates a new Supabase Client. + * + * @example Creating a Supabase client + * ```ts + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key') + * const { data, error } = await supabase.from('profiles').select('*') + * ``` + */ +export const createClient = < + Database = any, + SchemaNameOrClientOptions extends + | (string & keyof Omit) + | { PostgrestVersion: string } = 'public' extends keyof Omit + ? 'public' + : string & keyof Omit, + SchemaName extends string & keyof Omit = + SchemaNameOrClientOptions extends string & keyof Omit + ? SchemaNameOrClientOptions + : 'public' extends keyof Omit + ? 'public' + : string & keyof Omit, '__InternalSupabase'>, +>( + supabaseUrl: string, + supabaseKey: string, + options?: SupabaseClientOptions +): SupabaseClient => { + return new SupabaseClient( + supabaseUrl, + supabaseKey, + options + ) +} + +// Check for Node.js <= 20 deprecation +function shouldShowDeprecationWarning(): boolean { + // Skip in browser and Deno environments + if (typeof window !== 'undefined' || (globalThis as any)['Deno'] !== undefined) { + return false + } + + // Skip if process is not available (e.g., Edge Runtime) + // Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings + const _process = (globalThis as any)['process'] + if (!_process) { + return false + } + + const processVersion = _process['version'] + if (processVersion === undefined || processVersion === null) { + return false + } + + const versionMatch = processVersion.match(/^v(\d+)\./) + if (!versionMatch) { + return false + } + + const majorVersion = parseInt(versionMatch[1], 10) + return majorVersion <= 20 +} + +if (shouldShowDeprecationWarning()) { + console.warn( + `⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` + + `Please upgrade to Node.js 22 or later. ` + + `For more information, visit: https://github.com/orgs/supabase/discussions/45715` + ) +} diff --git a/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts b/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebc36395d6ddf8bbc311eda244fc8e26d1718953 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/SupabaseAuthClient.ts @@ -0,0 +1,8 @@ +import { AuthClient } from '@supabase/auth-js' +import { SupabaseAuthClientOptions } from './types' + +export class SupabaseAuthClient extends AuthClient { + constructor(options: SupabaseAuthClientOptions) { + super(options) + } +} diff --git a/node_modules/@supabase/supabase-js/src/lib/constants.ts b/node_modules/@supabase/supabase-js/src/lib/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c194c8cb6489db78ed8cd9f98c5c48639e8e69c --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/constants.ts @@ -0,0 +1,52 @@ +// constants.ts +import { RealtimeClientOptions } from '@supabase/realtime-js' +import { SupabaseAuthClientOptions, TracePropagationOptions } from './types' +import { version } from './version' + +let JS_ENV = '' +let JS_RUNTIME_VERSION: string | undefined +// @ts-ignore +if (typeof Deno !== 'undefined') { + JS_ENV = 'deno' + // @ts-ignore + JS_RUNTIME_VERSION = Deno.version?.deno +} else if (typeof document !== 'undefined') { + JS_ENV = 'web' +} else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { + JS_ENV = 'react-native' +} else { + JS_ENV = 'node' + const _process = (globalThis as any)['process'] + JS_RUNTIME_VERSION = _process?.['version']?.replace(/^v/, '') +} + +const _runtimeMeta = [`runtime=${JS_ENV}`] +if (JS_RUNTIME_VERSION) { + _runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`) +} + +export const DEFAULT_HEADERS = { + 'X-Client-Info': `supabase-js/${version}; ${_runtimeMeta.join('; ')}`, +} + +export const DEFAULT_GLOBAL_OPTIONS = { + headers: DEFAULT_HEADERS, +} + +export const DEFAULT_DB_OPTIONS = { + schema: 'public', +} + +export const DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions = { + autoRefreshToken: true, + persistSession: true, + detectSessionInUrl: true, + flowType: 'implicit', +} + +export const DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions = {} + +export const DEFAULT_TRACE_PROPAGATION_OPTIONS: TracePropagationOptions = { + enabled: false, + respectSamplingDecision: true, +} diff --git a/node_modules/@supabase/supabase-js/src/lib/fetch.ts b/node_modules/@supabase/supabase-js/src/lib/fetch.ts new file mode 100644 index 0000000000000000000000000000000000000000..803f6948701fed3997ce7037d663c1b645cf3465 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/fetch.ts @@ -0,0 +1,206 @@ +import { + parseTraceParent, + shouldPropagateToTarget, + getDefaultPropagationTargets, + type TraceContext, + type TracePropagationTarget, +} from '@supabase/tracing' +import { getTraceContextExtractor } from './tracingRegistry' +import type { TracePropagationOptions } from './types' + +type Fetch = typeof fetch + +export const resolveFetch = (customFetch?: Fetch): Fetch => { + if (customFetch) { + return (...args: Parameters) => customFetch(...args) + } + return (...args: Parameters) => fetch(...args) +} + +export const resolveHeadersConstructor = () => { + return Headers +} + +/** + * New-format Supabase API keys (`sb_publishable_…` / `sb_secret_…`) are not JWTs and + * must never be sent as a Bearer token — they belong only in the `apikey` header. + * All other keys (legacy JWT keys, `sb_temp_…` temporary keys, unrecognized `sb_` + * subtypes) keep the Bearer fallback. + */ +const isNewApiKey = (key: string): boolean => + key.startsWith('sb_publishable_') || key.startsWith('sb_secret_') + +const TEMP_KEY_PREFIX = 'sb_temp_' + +const warnedKeySubtypes = new Set() + +/** + * Warn (once per subtype) when an `sb_` key isn't a subtype this SDK version recognizes. + * Never throws — the server, not the SDK, decides key validity. The key value is never + * included in the message. + */ +export const checkApiKeyFormat = (key: string): void => { + if (!key.startsWith('sb_') || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX)) { + return + } + const subtype = key.match(/^sb_[a-zA-Z0-9]+_/)?.[0] ?? 'unknown' + if (warnedKeySubtypes.has(subtype)) { + return + } + warnedKeySubtypes.add(subtype) + console.warn( + '@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed ' + + 'and send this key as-is; if you see authentication errors you may need to upgrade ' + + '@supabase/supabase-js to a version that recognizes this key type.' + ) +} + +export const fetchWithAuth = ( + supabaseKey: string, + supabaseUrl: string, + getAccessToken: () => Promise, + customFetch?: Fetch, + tracePropagationOptions?: TracePropagationOptions, + options?: { omitApiKeyAsBearer?: boolean } +): Fetch => { + const fetch = resolveFetch(customFetch) + const HeadersConstructor = resolveHeadersConstructor() + + // Pre-compute trace propagation state once. When disabled, the per-request + // path skips all tracing work with a single truthy check. + const traceEnabled = tracePropagationOptions?.enabled === true + const respectSampling = tracePropagationOptions?.respectSamplingDecision !== false + const traceTargets: TracePropagationTarget[] | null = traceEnabled + ? getDefaultPropagationTargets(supabaseUrl) + : null + + // Whether the API key may be used as the `Authorization` Bearer fallback when there is no + // session token. Disabled for Edge Functions with a new-format key (see `isNewApiKey`). + // Static per instance, so it is computed once here rather than on every request. + const allowKeyAsBearer = !(options?.omitApiKeyAsBearer && isNewApiKey(supabaseKey)) + + return async (input, init) => { + const realToken = await getAccessToken() + let headers = new HeadersConstructor(init?.headers) + + if (!headers.has('apikey')) { + headers.set('apikey', supabaseKey) + } + + if (!headers.has('Authorization')) { + const bearer = realToken ?? (allowKeyAsBearer ? supabaseKey : null) + if (bearer) { + headers.set('Authorization', `Bearer ${bearer}`) + } + } + + if (traceTargets) { + const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling) + + if (traceHeaders) { + if (traceHeaders.traceparent && !headers.has('traceparent')) { + headers.set('traceparent', traceHeaders.traceparent) + } + if (traceHeaders.tracestate && !headers.has('tracestate')) { + headers.set('tracestate', traceHeaders.tracestate) + } + if (traceHeaders.baggage && !headers.has('baggage')) { + headers.set('baggage', traceHeaders.baggage) + } + } + } + + return fetch(input, { ...init, headers }) + } +} + +let warnedMissingTracingRuntime = false +let warnedNonW3CPropagator = false + +/** + * For tests only. Resets the one-time missing-tracing-runtime warning. + * + * @internal + */ +export function _resetTracingRuntimeWarning(): void { + warnedMissingTracingRuntime = false +} + +/** + * For tests only. Resets the one-time non-W3C-propagator warning. + * + * @internal + */ +export function _resetNonW3CPropagatorWarning(): void { + warnedNonW3CPropagator = false +} + +function getTraceHeaders( + input: RequestInfo | URL, + targets: TracePropagationTarget[], + respectSampling: boolean +): TraceContext | null { + // Read the registry before the target check so the warning fires on the + // first request with tracing enabled, not only on Supabase-target ones. + // Reading per request (one globalThis property access) deliberately + // supports late registration: with ESM evaluation order, `createClient` + // can run in a module evaluated before the application entry point's + // `import '@supabase/supabase-js/tracing'`. + const extractTraceContext = getTraceContextExtractor() + + if (!extractTraceContext) { + if (!warnedMissingTracingRuntime) { + warnedMissingTracingRuntime = true + console.warn( + '@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, ' + + "so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at " + + 'your application entry point (requires the OpenTelemetry API package to be installed). ' + + 'The CDN/UMD build does not support trace propagation.' + ) + } + return null + } + + const targetUrl: string | URL = + typeof input === 'string' ? input : input instanceof URL ? input : input.url + + if (!shouldPropagateToTarget(targetUrl, targets)) { + return null + } + + const traceContext = extractTraceContext() + + if (!traceContext || !traceContext.traceparent) { + // An active propagator that writes vendor headers but no W3C + // `traceparent` (e.g. Sentry without `propagateTraceparent: true`) is + // otherwise indistinguishable from "no active trace" — warn once so the + // user learns why no trace headers are attached. An empty carrier means + // no active trace: normal, stay silent. + if (traceContext?.carrierKeys?.length && !warnedNonW3CPropagator) { + warnedNonW3CPropagator = true + const sentryHint = traceContext.carrierKeys.includes('sentry-trace') + ? ' Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.' + : ' Configure your tracing SDK to emit W3C trace context on outgoing requests.' + console.warn( + '@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its ' + + `propagator wrote [${traceContext.carrierKeys.join(', ')}] and no W3C traceparent header, ` + + 'so trace headers will not be attached.' + + sentryHint + ) + } + return null + } + + if (respectSampling) { + const parsed = parseTraceParent(traceContext.traceparent) + if (parsed && !parsed.isSampled) { + // Unsampled traces still carry `traceparent` so Supabase logs get a + // trace_id to correlate on; the flag stays `00`, so downstream tracing + // never records it as sampled. `tracestate` and `baggage` (the + // vendor/application data channels) are withheld on these requests. + return { traceparent: traceContext.traceparent } + } + } + + return traceContext +} diff --git a/node_modules/@supabase/supabase-js/src/lib/helpers.ts b/node_modules/@supabase/supabase-js/src/lib/helpers.ts new file mode 100644 index 0000000000000000000000000000000000000000..767190ec8921361f2f601ec87b471d9eadeb7565 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/helpers.ts @@ -0,0 +1,123 @@ +// helpers.ts +import { SupabaseClientOptions, TracePropagationOptions } from './types' + +function normalizeTracePropagation( + value: TracePropagationOptions | boolean | undefined +): TracePropagationOptions | undefined { + return typeof value === 'boolean' ? { enabled: value } : value +} + +export function uuid() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = (Math.random() * 16) | 0, + v = c == 'x' ? r : (r & 0x3) | 0x8 + return v.toString(16) + }) +} + +export function ensureTrailingSlash(url: string): string { + return url.endsWith('/') ? url : url + '/' +} + +export const isBrowser = () => typeof window !== 'undefined' + +export type ResolvedSupabaseClientOptions = Omit< + Required>, + 'tracePropagation' +> & { + tracePropagation: TracePropagationOptions +} + +export function applySettingDefaults< + Database = any, + SchemaName extends string & keyof Database = 'public' extends keyof Database + ? 'public' + : string & keyof Database, +>( + options: SupabaseClientOptions, + defaults: SupabaseClientOptions +): ResolvedSupabaseClientOptions { + const { + db: dbOptions, + auth: authOptions, + realtime: realtimeOptions, + global: globalOptions, + } = options + const { + db: DEFAULT_DB_OPTIONS, + auth: DEFAULT_AUTH_OPTIONS, + realtime: DEFAULT_REALTIME_OPTIONS, + global: DEFAULT_GLOBAL_OPTIONS, + } = defaults + + // Accept either a boolean shorthand or an options object on both sides. + const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation) + const DEFAULT_TRACE_PROPAGATION_OPTIONS = normalizeTracePropagation(defaults.tracePropagation) + + const result: ResolvedSupabaseClientOptions = { + db: { + ...DEFAULT_DB_OPTIONS, + ...dbOptions, + }, + auth: { + ...DEFAULT_AUTH_OPTIONS, + ...authOptions, + }, + realtime: { + ...DEFAULT_REALTIME_OPTIONS, + ...realtimeOptions, + }, + storage: {}, + global: { + ...DEFAULT_GLOBAL_OPTIONS, + ...globalOptions, + headers: { + ...(DEFAULT_GLOBAL_OPTIONS?.headers ?? {}), + ...(globalOptions?.headers ?? {}), + }, + }, + tracePropagation: { + enabled: + tracePropagationOptions?.enabled ?? DEFAULT_TRACE_PROPAGATION_OPTIONS?.enabled ?? false, + respectSamplingDecision: + tracePropagationOptions?.respectSamplingDecision ?? + DEFAULT_TRACE_PROPAGATION_OPTIONS?.respectSamplingDecision ?? + true, + }, + accessToken: async () => '', + } + + if (options.accessToken) { + result.accessToken = options.accessToken + } else { + // hack around Required<> + delete (result as any).accessToken + } + + return result +} + +/** + * Validates a Supabase client URL + * + * @param {string} supabaseUrl - The Supabase client URL string. + * @returns {URL} - The validated base URL. + * @throws {Error} + */ +export function validateSupabaseUrl(supabaseUrl: string): URL { + const trimmedUrl = supabaseUrl?.trim() + + if (!trimmedUrl) { + throw new Error('supabaseUrl is required.') + } + + if (!trimmedUrl.match(/^https?:\/\//i)) { + throw new Error('Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.') + } + + try { + return new URL(ensureTrailingSlash(trimmedUrl)) + } catch { + throw Error('Invalid supabaseUrl: Provided URL is malformed.') + } +} diff --git a/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts b/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts new file mode 100644 index 0000000000000000000000000000000000000000..02521e703e3af0c59e9b8a14c1bdce8adf095be0 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/rest/types/common/common.ts @@ -0,0 +1,93 @@ +/** + * AUTO-GENERATED FILE - DO NOT EDIT + * + * This file is automatically synchronized from @supabase/postgrest-js + * Source: packages/core/postgrest-js/src/types/common/ + * + * To update this file, modify the source in postgrest-js and run: + * pnpm run codegen + */ + +// Types that are shared between supabase-js and postgrest-js + +export type Fetch = typeof fetch + +/** + * Default number of retry attempts. + */ +export const DEFAULT_MAX_RETRIES = 3 + +/** + * Default exponential backoff delay function. + * Delays: 1s, 2s, 4s, 8s, ... (max 30s) + * + * @param attemptIndex - Zero-based index of the retry attempt + * @returns Delay in milliseconds before the next retry + */ +export const getRetryDelay = (attemptIndex: number): number => + Math.min(1000 * 2 ** attemptIndex, 30000) + +/** + * Status codes that are safe to retry. + * 520 = Cloudflare timeout/connection errors (transient) + * 503 = PostgREST schema cache not yet loaded (transient, signals retry via Retry-After header) + */ +export const RETRYABLE_STATUS_CODES = [520, 503] as const + +/** + * HTTP methods that are safe to retry (idempotent operations). + */ +export const RETRYABLE_METHODS = ['GET', 'HEAD', 'OPTIONS'] as const + +export type GenericRelationship = { + foreignKeyName: string + columns: string[] + isOneToOne?: boolean + referencedRelation: string + referencedColumns: string[] +} + +export type GenericTable = { + Row: Record + Insert: Record + Update: Record + Relationships: GenericRelationship[] +} + +export type GenericUpdatableView = { + Row: Record + Insert: Record + Update: Record + Relationships: GenericRelationship[] +} + +export type GenericNonUpdatableView = { + Row: Record + Relationships: GenericRelationship[] +} + +export type GenericView = GenericUpdatableView | GenericNonUpdatableView + +export type GenericSetofOption = { + isSetofReturn?: boolean | undefined + isOneToOne?: boolean | undefined + isNotNullable?: boolean | undefined + to: string + from: string +} + +export type GenericFunction = { + Args: Record | never + Returns: unknown + SetofOptions?: GenericSetofOption +} + +export type GenericSchema = { + Tables: Record + Views: Record + Functions: Record +} + +export type ClientServerOptions = { + PostgrestVersion?: string +} diff --git a/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts b/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts new file mode 100644 index 0000000000000000000000000000000000000000..57f81a63395ae6915bb4533ac33b77cdaafe209c --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/rest/types/common/rpc.ts @@ -0,0 +1,158 @@ +/** + * AUTO-GENERATED FILE - DO NOT EDIT + * + * This file is automatically synchronized from @supabase/postgrest-js + * Source: packages/core/postgrest-js/src/types/common/ + * + * To update this file, modify the source in postgrest-js and run: + * pnpm run codegen + */ + +import type { GenericFunction, GenericSchema, GenericSetofOption } from './common' + +// Functions matching utils +type IsMatchingArgs< + FnArgs extends GenericFunction['Args'], + PassedArgs extends GenericFunction['Args'], +> = [FnArgs] extends [Record] + ? PassedArgs extends Record + ? true + : false + : keyof PassedArgs extends keyof FnArgs + ? PassedArgs extends FnArgs + ? true + : false + : false + +type MatchingFunctionArgs< + Fn extends GenericFunction, + Args extends GenericFunction['Args'], +> = Fn extends { Args: infer A extends GenericFunction['Args'] } + ? IsMatchingArgs extends true + ? Fn + : never + : false + +type FindMatchingFunctionByArgs< + FnUnion, + Args extends GenericFunction['Args'], +> = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs : false + +// Types for working with database schemas +type TablesAndViews = Schema['Tables'] & Exclude + +// Utility types for working with unions +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void + ? I + : never + +type LastOf = + UnionToIntersection T : never> extends () => infer R ? R : never + +type IsAny = 0 extends 1 & T ? true : false + +type ExactMatch = [T] extends [S] ? ([S] extends [T] ? true : false) : false + +type ExtractExactFunction = Fns extends infer F + ? F extends GenericFunction + ? ExactMatch extends true + ? F + : never + : never + : never + +type IsNever = [T] extends [never] ? true : false + +type RpcFunctionNotFound = { + Row: any + Result: { + error: true + } & "Couldn't infer function definition matching provided arguments" + RelationName: FnName + Relationships: null +} + +type CrossSchemaError = { + error: true +} & `Function returns SETOF from a different schema ('${TableRef}'). Use .overrideTypes() to specify the return type explicitly.` + +export type GetRpcFunctionFilterBuilderByArgs< + Schema extends GenericSchema, + FnName extends string & keyof Schema['Functions'], + Args, +> = { + 0: Schema['Functions'][FnName] + // If the Args is exactly never (function call without any params) + 1: IsAny extends true + ? any + : IsNever extends true + ? // This is for retro compatibility, if the funcition is defined with an single return and an union of Args + // we fallback to the last function definition matched by name + IsNever> extends true + ? LastOf + : ExtractExactFunction + : Args extends Record + ? LastOf + : // Otherwise, we attempt to match with one of the function definition in the union based + // on the function arguments provided + Args extends GenericFunction['Args'] + ? // This is for retro compatibility, if the funcition is defined with an single return and an union of Args + // we fallback to the last function definition matched by name + IsNever< + LastOf> + > extends true + ? LastOf + : // Otherwise, we use the arguments based function definition narrowing to get the right value + LastOf> + : // If we can't find a matching function by args, we try to find one by function name + ExtractExactFunction extends GenericFunction + ? ExtractExactFunction + : any +}[1] extends infer Fn + ? // If we are dealing with an non-typed client everything is any + IsAny extends true + ? { Row: any; Result: any; RelationName: FnName; Relationships: null } + : // Otherwise, we use the arguments based function definition narrowing to get the right value + Fn extends GenericFunction + ? { + Row: Fn['SetofOptions'] extends GenericSetofOption + ? Fn['SetofOptions']['to'] extends keyof TablesAndViews + ? TablesAndViews[Fn['SetofOptions']['to']]['Row'] + : // Cross-schema fallback: use Returns type when table is not in current schema + Fn['Returns'] extends any[] + ? Fn['Returns'][number] extends Record + ? Fn['Returns'][number] + : CrossSchemaError + : Fn['Returns'] extends Record + ? Fn['Returns'] + : CrossSchemaError + : Fn['Returns'] extends any[] + ? Fn['Returns'][number] extends Record + ? Fn['Returns'][number] + : never + : Fn['Returns'] extends Record + ? Fn['Returns'] + : never + Result: Fn['SetofOptions'] extends GenericSetofOption + ? Fn['SetofOptions']['isSetofReturn'] extends true + ? Fn['SetofOptions']['isOneToOne'] extends true + ? Fn['Returns'][] + : Fn['Returns'] + : Fn['Returns'] + : Fn['Returns'] + RelationName: Fn['SetofOptions'] extends GenericSetofOption + ? Fn['SetofOptions']['to'] + : FnName + Relationships: Fn['SetofOptions'] extends GenericSetofOption + ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] + ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] + : Fn['SetofOptions']['to'] extends keyof Schema['Views'] + ? Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] + : null + : null + } + : // If we failed to find the function by argument, we still pass with any but also add an overridable + Fn extends false + ? RpcFunctionNotFound + : RpcFunctionNotFound + : RpcFunctionNotFound diff --git a/node_modules/@supabase/supabase-js/src/lib/tracingRegistry.ts b/node_modules/@supabase/supabase-js/src/lib/tracingRegistry.ts new file mode 100644 index 0000000000000000000000000000000000000000..5deb96ea3943a3de6cfeb749d26af0d6dfaa4699 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/tracingRegistry.ts @@ -0,0 +1,42 @@ +import type { TraceContextExtractor } from '@supabase/tracing' + +export type { TraceContextExtractor } + +// The extractor lives in a `Symbol.for()`-keyed slot on `globalThis` rather +// than a module-level variable. Bundlers and the ESM/CJS dual build can load +// this module more than once in a single application (e.g. the tracing +// subpath resolved to `dist/tracing.mjs` while the main entry resolves to +// `dist/index.cjs`) — separate module instances would each get their own +// variable, but they all share the global symbol registry. +// +// The symbol string is a de-facto stable contract: module-resolution tests +// read the slot directly, and changing it orphans registrations from other +// copies of this package in the same process. +const EXTRACTOR_KEY = Symbol.for('@supabase/supabase-js.traceContextExtractor') + +type ExtractorSlot = { [EXTRACTOR_KEY]?: TraceContextExtractor } + +/** + * Register the trace context extractor used by all Supabase clients in this + * process. Called by the `@supabase/supabase-js/tracing` subpath as an import + * side effect; the last registration wins. + */ +export function registerTraceContextExtractor(extractor: TraceContextExtractor): void { + ;(globalThis as ExtractorSlot)[EXTRACTOR_KEY] = extractor +} + +/** + * The currently registered trace context extractor, if any. + */ +export function getTraceContextExtractor(): TraceContextExtractor | undefined { + return (globalThis as ExtractorSlot)[EXTRACTOR_KEY] +} + +/** + * For tests only. Removes the registered extractor. + * + * @internal + */ +export function _unregisterTraceContextExtractor(): void { + delete (globalThis as ExtractorSlot)[EXTRACTOR_KEY] +} diff --git a/node_modules/@supabase/supabase-js/src/lib/types.ts b/node_modules/@supabase/supabase-js/src/lib/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecf389290fbfffa733ecb3321121ccd4abe72d90 --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/types.ts @@ -0,0 +1,344 @@ +import { GoTrueClientOptions } from '@supabase/auth-js' +import { RealtimeClientOptions } from '@supabase/realtime-js' +import { PostgrestError } from '@supabase/postgrest-js' +import type { StorageClientOptions } from '@supabase/storage-js' +import type { + GenericSchema, + GenericRelationship, + GenericTable, + GenericUpdatableView, + GenericNonUpdatableView, + GenericView, + GenericFunction, +} from './rest/types/common/common' +export type { + GenericSchema, + GenericRelationship, + GenericTable, + GenericUpdatableView, + GenericNonUpdatableView, + GenericView, + GenericFunction, +} + +export interface SupabaseAuthClientOptions extends GoTrueClientOptions {} + +export type Fetch = typeof fetch + +/** + * Configuration options for trace context propagation. + * + * Enables distributed tracing across Supabase services using W3C Trace Context + * and OpenTelemetry standards. When enabled, the SDK automatically attaches + * trace context headers (`traceparent`, `tracestate`, `baggage`) to outgoing + * requests to Supabase domains. The resulting `trace_id` appears in API + * Gateway and Edge Function logs, so logs forwarded through Log Drains can + * be correlated back to the originating client-side span. + * + * Requires two opt-in steps: install `@opentelemetry/api` in the consuming + * application, and load the tracing runtime with + * `import '@supabase/supabase-js/tracing'` at the application entry point. + * If the runtime is not loaded, the SDK logs a one-time warning and sends + * requests without trace headers; if there is no active context at request + * time, propagation silently no-ops. Not available via the CDN/UMD build. + * + * @example Enable with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + * + * @see https://www.w3.org/TR/trace-context/ + * @see https://opentelemetry.io/docs/concepts/context-propagation/ + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + */ +export interface TracePropagationOptions { + /** + * Enable trace propagation. Disabled by default. + * + * When enabled, automatically detects and propagates active trace context + * from the OpenTelemetry API to outgoing Supabase requests. Trace context + * is only propagated to Supabase domains (`*.supabase.co`, `*.supabase.in`, + * `localhost`) for security — third-party hosts never receive trace headers. + * + * @default false + * + * @example + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true }, + * }) + * ``` + */ + enabled?: boolean + + /** + * Respect upstream sampling decisions. + * + * When true (the default), requests whose upstream trace is not sampled + * (sampled flag = `0` in the `traceparent` header) carry only the + * `traceparent` header — the sampled flag is preserved, so downstream + * tracing never records them, while Supabase logs still get a `trace_id` + * to correlate on. The `tracestate` and `baggage` headers are withheld on + * these requests. + * + * Set to `false` to always propagate the full trace context + * (`traceparent`, `tracestate`, `baggage`) regardless of the sampling + * decision. + * + * @default true + * + * @example Always propagate the full context, ignore sampling + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + */ + respectSamplingDecision?: boolean +} + +export type SupabaseClientOptions = { + /** + * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`. + */ + db?: { + schema?: SchemaName + /** + * Optional timeout in milliseconds for PostgREST requests. + * When set, requests will automatically abort after this duration to prevent indefinite hangs. + * + * @example With timeout + * ```ts + * const supabase = createClient(url, key, { + * db: { timeout: 30000 } // 30 second timeout + * }) + * ``` + */ + timeout?: number + /** + * Maximum URL length in characters before warnings/errors are triggered. + * Defaults to 8000 characters. Used to provide helpful hints when URLs + * exceed server limits. + * + * @example With custom URL length limit + * ```ts + * const supabase = createClient(url, key, { + * db: { urlLengthLimit: 10000 } // Custom limit + * }) + * ``` + */ + urlLengthLimit?: number + /** + * Enable or disable automatic retries for transient PostgREST errors. + * Defaults to `true`. + */ + retry?: boolean + } + + auth?: { + /** + * Automatically refreshes the token for logged-in users. Defaults to true. + */ + autoRefreshToken?: boolean + /** + * Optional key name used for storing tokens in local storage. + */ + storageKey?: string + /** + * Whether to persist a logged-in session to storage. Defaults to true. + */ + persistSession?: boolean + /** + * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true. + * + * Can be set to a function to provide custom logic for determining if a URL contains + * a Supabase auth callback. The function receives the current URL and parsed parameters, + * and should return true if the URL should be processed as a Supabase auth callback. + * + * This is useful when your app uses other OAuth providers (e.g., Facebook Login) that + * also return access_token in the URL fragment, which would otherwise be incorrectly + * intercepted by Supabase Auth. + * + * @example With custom detection logic + * ```ts + * detectSessionInUrl: (url, params) => { + * // Ignore Facebook OAuth redirects + * if (url.pathname === '/facebook/redirect') return false + * // Use default detection for other URLs + * return Boolean(params.access_token || params.error_description) + * } + * ``` + */ + detectSessionInUrl?: boolean | ((url: URL, params: { [parameter: string]: string }) => boolean) + /** + * A storage provider. Used to store the logged-in session. + */ + storage?: SupabaseAuthClientOptions['storage'] + /** + * A storage provider to store the user profile separately from the session. + * Useful when you need to store the session information in cookies, + * without bloating the data with the redundant user object. + * + * @experimental + */ + userStorage?: SupabaseAuthClientOptions['userStorage'] + /** + * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications. + */ + flowType?: SupabaseAuthClientOptions['flowType'] + /** + * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library. + */ + debug?: SupabaseAuthClientOptions['debug'] + /** + * Provide your own locking mechanism based on the environment. By default + * the auth client coordinates refreshes itself and the server resolves + * cross-tab races. Passing a custom `lock` opts into a legacy path that + * wraps every auth operation in your supplied lock. + * + * @deprecated Custom locks still work in v2.x for backwards compatibility. + * The legacy lock path will be removed in v3 — drop this option from your + * `createClient` options before upgrading. + */ + lock?: SupabaseAuthClientOptions['lock'] + /** + * If there is an error with the query, throwOnError will reject the promise by + * throwing the error instead of returning it as part of a successful response. + */ + throwOnError?: SupabaseAuthClientOptions['throwOnError'] + /** + * Opt-in flags for experimental features. These APIs may change without + * notice and are disabled by default. + * + * @experimental + */ + experimental?: SupabaseAuthClientOptions['experimental'] + /** + * Maximum time in milliseconds to wait for acquiring the custom lock + * supplied via `lock`. Only consulted when a custom `lock` is passed. + * + * @default 5000 + * + * @deprecated Only used by the legacy lock path. Will be removed in v3 + * along with the `lock` option. + */ + lockAcquireTimeout?: SupabaseAuthClientOptions['lockAcquireTimeout'] + /** + * If true, skips automatic initialization in the auth client constructor. + * Useful for SSR contexts where initialization timing must be controlled to + * prevent race conditions with HTTP response generation. + * + * @default false + */ + skipAutoInitialize?: SupabaseAuthClientOptions['skipAutoInitialize'] + } + /** + * Options passed to the realtime-js instance + */ + realtime?: RealtimeClientOptions + storage?: StorageClientOptions + global?: { + /** + * A custom `fetch` implementation. + */ + fetch?: Fetch + /** + * Optional headers for initializing the client. + */ + headers?: Record + } + /** + * Optional function for using a third-party authentication system with + * Supabase. The function should return an access token or ID token (JWT) by + * obtaining it from the third-party auth SDK. Note that this + * function may be called concurrently and many times. Use memoization and + * locking techniques if this is not supported by the SDKs. + * + * When set, the `auth` namespace of the Supabase client cannot be used. + * Create another client if you wish to use Supabase Auth and third-party + * authentications concurrently in the same application. + */ + accessToken?: () => Promise + /** + * Enable OpenTelemetry / W3C trace context propagation to Supabase services. + * + * Disabled by default. Pass `true` for the common case (auto-detect an + * active OpenTelemetry context and inject `traceparent` / `tracestate` / + * `baggage` headers) or an object for fine-grained control. + * + * Requires `@opentelemetry/api` to be installed in your application AND + * the tracing runtime to be loaded with + * `import '@supabase/supabase-js/tracing'` at your application entry + * point. Without that import, the SDK logs a one-time warning and sends + * requests without trace headers. Not available via the CDN/UMD build. + * Trace headers are only attached to requests targeting Supabase domains, + * so third-party hosts called through a custom `fetch` are never tagged. + * + * The resulting `trace_id` appears in Supabase logs (API Gateway, Edge + * Functions), letting you correlate client-side spans with server-side + * log entries — including logs forwarded via Log Drains. + * + * @example Shorthand — opt in with defaults + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * ``` + * + * @example With an active OpenTelemetry span + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * import { trace } from '@opentelemetry/api' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * const tracer = trace.getTracer('my-app') + * + * await tracer.startActiveSpan('fetch-users', async (span) => { + * // Request carries the active trace context. + * const { data, error } = await supabase.from('users').select('*') + * span.end() + * }) + * ``` + * + * @example Advanced — always propagate, even for non-sampled traces + * ```ts + * import '@supabase/supabase-js/tracing' + * + * const supabase = createClient(url, key, { + * tracePropagation: { enabled: true, respectSamplingDecision: false }, + * }) + * ``` + * + * @see https://supabase.com/docs/guides/telemetry/client-side-tracing + * @see https://www.w3.org/TR/trace-context/ + */ + tracePropagation?: TracePropagationOptions | boolean +} + +/** + * Helper types for query results. + */ +export type QueryResult = T extends PromiseLike ? U : never +export type QueryData = T extends PromiseLike<{ data: infer U }> ? Exclude : never +export type QueryError = PostgrestError + +/** + * Strips internal Supabase metadata from Database types. + * Useful for libraries defining generic constraints on Database types. + * + * @example Stripping internal Supabase metadata + * ```typescript + * type CleanDB = DatabaseWithoutInternals + * ``` + */ +export type DatabaseWithoutInternals = Omit diff --git a/node_modules/@supabase/supabase-js/src/lib/version.ts b/node_modules/@supabase/supabase-js/src/lib/version.ts new file mode 100644 index 0000000000000000000000000000000000000000..728b243d9860d462498beea4f7212d24b085dddf --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/lib/version.ts @@ -0,0 +1,7 @@ +// Generated automatically during releases by scripts/update-version-files.ts +// This file provides runtime access to the package version for: +// - HTTP request headers (e.g., X-Client-Info header for API requests) +// - Debugging and support (identifying which version is running) +// - Telemetry and logging (version reporting in errors/analytics) +// - Ensuring build artifacts match the published package version +export const version = '2.112.3' diff --git a/node_modules/@supabase/supabase-js/src/tracing.ts b/node_modules/@supabase/supabase-js/src/tracing.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc0a15942444f05a96123473dbc4de76364acfef --- /dev/null +++ b/node_modules/@supabase/supabase-js/src/tracing.ts @@ -0,0 +1,26 @@ +/** + * Opt-in OpenTelemetry runtime for `tracePropagation`. + * + * Importing this module registers the OpenTelemetry trace context extractor + * used by every Supabase client in the process. It has no exports — the + * import itself is the opt-in: + * + * ```ts + * import '@supabase/supabase-js/tracing' + * import { createClient } from '@supabase/supabase-js' + * + * const supabase = createClient(url, key, { tracePropagation: true }) + * ``` + * + * Requires `@opentelemetry/api` to be installed — this module imports it + * directly, so bundlers include it and resolution fails loudly when it is + * missing. Without this import, enabling `tracePropagation` logs a one-time + * warning and requests are sent without trace headers. + * + * @module tracing + */ +import { propagation, context } from '@opentelemetry/api' +import { createTraceContextExtractor } from '@supabase/tracing' +import { registerTraceContextExtractor } from './lib/tracingRegistry' + +registerTraceContextExtractor(createTraceContextExtractor({ propagation, context })) diff --git a/node_modules/@swc/helpers/LICENSE b/node_modules/@swc/helpers/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6a08504909fe063aedf79b9113c240dec13858d5 --- /dev/null +++ b/node_modules/@swc/helpers/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2024 SWC contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/node_modules/@swc/helpers/_/_apply_decorated_descriptor/package.json b/node_modules/@swc/helpers/_/_apply_decorated_descriptor/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7d6b95480d48bdd780e19d3f377bbcfa4031cd1d --- /dev/null +++ b/node_modules/@swc/helpers/_/_apply_decorated_descriptor/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_apply_decorated_descriptor.cjs", + "module": "../../esm/_apply_decorated_descriptor.js" +} diff --git a/node_modules/@swc/helpers/_/_apply_decs_2203_r/package.json b/node_modules/@swc/helpers/_/_apply_decs_2203_r/package.json new file mode 100644 index 0000000000000000000000000000000000000000..80f208cbd79badcc60af095b86a4c49214a2ccd8 --- /dev/null +++ b/node_modules/@swc/helpers/_/_apply_decs_2203_r/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_apply_decs_2203_r.cjs", + "module": "../../esm/_apply_decs_2203_r.js" +} diff --git a/node_modules/@swc/helpers/_/_apply_decs_2311/package.json b/node_modules/@swc/helpers/_/_apply_decs_2311/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5ee50863b5ae6f9f201bba7d1df165abe3d49e59 --- /dev/null +++ b/node_modules/@swc/helpers/_/_apply_decs_2311/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_apply_decs_2311.cjs", + "module": "../../esm/_apply_decs_2311.js" +} diff --git a/node_modules/@swc/helpers/_/_array_like_to_array/package.json b/node_modules/@swc/helpers/_/_array_like_to_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..37bd07fb46740870a00a7f278e9c246f056281b4 --- /dev/null +++ b/node_modules/@swc/helpers/_/_array_like_to_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_array_like_to_array.cjs", + "module": "../../esm/_array_like_to_array.js" +} diff --git a/node_modules/@swc/helpers/_/_array_with_holes/package.json b/node_modules/@swc/helpers/_/_array_with_holes/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7f602bcb0c17f09b21edab35c80e46c39b15d334 --- /dev/null +++ b/node_modules/@swc/helpers/_/_array_with_holes/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_array_with_holes.cjs", + "module": "../../esm/_array_with_holes.js" +} diff --git a/node_modules/@swc/helpers/_/_array_without_holes/package.json b/node_modules/@swc/helpers/_/_array_without_holes/package.json new file mode 100644 index 0000000000000000000000000000000000000000..aeefbfce82e47a368e0f54b3d6213a8209bdfe29 --- /dev/null +++ b/node_modules/@swc/helpers/_/_array_without_holes/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_array_without_holes.cjs", + "module": "../../esm/_array_without_holes.js" +} diff --git a/node_modules/@swc/helpers/_/_assert_this_initialized/package.json b/node_modules/@swc/helpers/_/_assert_this_initialized/package.json new file mode 100644 index 0000000000000000000000000000000000000000..fab7d972f50cc6a823435803b3cc77d2848fe30a --- /dev/null +++ b/node_modules/@swc/helpers/_/_assert_this_initialized/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_assert_this_initialized.cjs", + "module": "../../esm/_assert_this_initialized.js" +} diff --git a/node_modules/@swc/helpers/_/_async_generator/package.json b/node_modules/@swc/helpers/_/_async_generator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6c3674070396578142f4b7397f7b71a757dfc6b1 --- /dev/null +++ b/node_modules/@swc/helpers/_/_async_generator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_async_generator.cjs", + "module": "../../esm/_async_generator.js" +} diff --git a/node_modules/@swc/helpers/_/_async_generator_delegate/package.json b/node_modules/@swc/helpers/_/_async_generator_delegate/package.json new file mode 100644 index 0000000000000000000000000000000000000000..aa2450536dd1f6cf136d186828957e08c86b3bcf --- /dev/null +++ b/node_modules/@swc/helpers/_/_async_generator_delegate/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_async_generator_delegate.cjs", + "module": "../../esm/_async_generator_delegate.js" +} diff --git a/node_modules/@swc/helpers/_/_async_iterator/package.json b/node_modules/@swc/helpers/_/_async_iterator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b87fa5cea85a0bad18548047c60bca7fb52791be --- /dev/null +++ b/node_modules/@swc/helpers/_/_async_iterator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_async_iterator.cjs", + "module": "../../esm/_async_iterator.js" +} diff --git a/node_modules/@swc/helpers/_/_async_to_generator/package.json b/node_modules/@swc/helpers/_/_async_to_generator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1bfa4159ce29259ae055a4d9fbf1065e9acb3b36 --- /dev/null +++ b/node_modules/@swc/helpers/_/_async_to_generator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_async_to_generator.cjs", + "module": "../../esm/_async_to_generator.js" +} diff --git a/node_modules/@swc/helpers/_/_await_async_generator/package.json b/node_modules/@swc/helpers/_/_await_async_generator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..62d48a7fd18164fc91334a86b32ce66bda0d61be --- /dev/null +++ b/node_modules/@swc/helpers/_/_await_async_generator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_await_async_generator.cjs", + "module": "../../esm/_await_async_generator.js" +} diff --git a/node_modules/@swc/helpers/_/_await_value/package.json b/node_modules/@swc/helpers/_/_await_value/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a0fe68d9381920eb2235da172ca16d317a32cc97 --- /dev/null +++ b/node_modules/@swc/helpers/_/_await_value/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_await_value.cjs", + "module": "../../esm/_await_value.js" +} diff --git a/node_modules/@swc/helpers/_/_call_super/package.json b/node_modules/@swc/helpers/_/_call_super/package.json new file mode 100644 index 0000000000000000000000000000000000000000..46cf64de5f5ab994f0ae6a16ada323e9dc6a5fc0 --- /dev/null +++ b/node_modules/@swc/helpers/_/_call_super/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_call_super.cjs", + "module": "../../esm/_call_super.js" +} diff --git a/node_modules/@swc/helpers/_/_check_private_redeclaration/package.json b/node_modules/@swc/helpers/_/_check_private_redeclaration/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4d8c7cf45dbf780756057068b5eadc31590c83a1 --- /dev/null +++ b/node_modules/@swc/helpers/_/_check_private_redeclaration/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_check_private_redeclaration.cjs", + "module": "../../esm/_check_private_redeclaration.js" +} diff --git a/node_modules/@swc/helpers/_/_class_apply_descriptor_destructure/package.json b/node_modules/@swc/helpers/_/_class_apply_descriptor_destructure/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8322bad688e7a3c2c5681d3165dc7b096c7c5365 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_apply_descriptor_destructure/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_apply_descriptor_destructure.cjs", + "module": "../../esm/_class_apply_descriptor_destructure.js" +} diff --git a/node_modules/@swc/helpers/_/_class_apply_descriptor_get/package.json b/node_modules/@swc/helpers/_/_class_apply_descriptor_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..eb0c92d235822f6a53240485690351c4b0d509bd --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_apply_descriptor_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_apply_descriptor_get.cjs", + "module": "../../esm/_class_apply_descriptor_get.js" +} diff --git a/node_modules/@swc/helpers/_/_class_apply_descriptor_set/package.json b/node_modules/@swc/helpers/_/_class_apply_descriptor_set/package.json new file mode 100644 index 0000000000000000000000000000000000000000..68de7559a8bd5f40ffcc820f2d7941c134f476af --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_apply_descriptor_set/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_apply_descriptor_set.cjs", + "module": "../../esm/_class_apply_descriptor_set.js" +} diff --git a/node_modules/@swc/helpers/_/_class_apply_descriptor_update/package.json b/node_modules/@swc/helpers/_/_class_apply_descriptor_update/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8b8a5c950cac00cfe702190360c46897291cead2 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_apply_descriptor_update/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_apply_descriptor_update.cjs", + "module": "../../esm/_class_apply_descriptor_update.js" +} diff --git a/node_modules/@swc/helpers/_/_class_call_check/package.json b/node_modules/@swc/helpers/_/_class_call_check/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69345d45a3d2109ec7a7287800ad851acfdf4d2f --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_call_check/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_call_check.cjs", + "module": "../../esm/_class_call_check.js" +} diff --git a/node_modules/@swc/helpers/_/_class_check_private_static_access/package.json b/node_modules/@swc/helpers/_/_class_check_private_static_access/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d69f9f582b7eb41f9e9ce1a91f3863b5193dc389 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_check_private_static_access/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_check_private_static_access.cjs", + "module": "../../esm/_class_check_private_static_access.js" +} diff --git a/node_modules/@swc/helpers/_/_class_check_private_static_field_descriptor/package.json b/node_modules/@swc/helpers/_/_class_check_private_static_field_descriptor/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8dd77c2ea094620cec8651217c8184b0a94d6e4f --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_check_private_static_field_descriptor/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_check_private_static_field_descriptor.cjs", + "module": "../../esm/_class_check_private_static_field_descriptor.js" +} diff --git a/node_modules/@swc/helpers/_/_class_extract_field_descriptor/package.json b/node_modules/@swc/helpers/_/_class_extract_field_descriptor/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c3965f11827fa127ea85468b708ac2d49a60228 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_extract_field_descriptor/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_extract_field_descriptor.cjs", + "module": "../../esm/_class_extract_field_descriptor.js" +} diff --git a/node_modules/@swc/helpers/_/_class_name_tdz_error/package.json b/node_modules/@swc/helpers/_/_class_name_tdz_error/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8ac4b5173776216baa114fc2d3b214ebb64cc3ef --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_name_tdz_error/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_name_tdz_error.cjs", + "module": "../../esm/_class_name_tdz_error.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_destructure/package.json b/node_modules/@swc/helpers/_/_class_private_field_destructure/package.json new file mode 100644 index 0000000000000000000000000000000000000000..044346e6db5af31a7a282dc476fdfef28a267e62 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_destructure/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_destructure.cjs", + "module": "../../esm/_class_private_field_destructure.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_get/package.json b/node_modules/@swc/helpers/_/_class_private_field_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4650d80f4e00d0559159eb749a05927b9df0cf5e --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_get.cjs", + "module": "../../esm/_class_private_field_get.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_init/package.json b/node_modules/@swc/helpers/_/_class_private_field_init/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8c57a74665c3a5c11a302d687e6e43b183651489 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_init/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_init.cjs", + "module": "../../esm/_class_private_field_init.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_loose_base/package.json b/node_modules/@swc/helpers/_/_class_private_field_loose_base/package.json new file mode 100644 index 0000000000000000000000000000000000000000..07df6d88ffdfb11ea91d9d4cb6af2c81e993624e --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_loose_base/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_loose_base.cjs", + "module": "../../esm/_class_private_field_loose_base.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_loose_key/package.json b/node_modules/@swc/helpers/_/_class_private_field_loose_key/package.json new file mode 100644 index 0000000000000000000000000000000000000000..abd74810347533b23fc10976d00e879fd2c6cabf --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_loose_key/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_loose_key.cjs", + "module": "../../esm/_class_private_field_loose_key.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_set/package.json b/node_modules/@swc/helpers/_/_class_private_field_set/package.json new file mode 100644 index 0000000000000000000000000000000000000000..477326e3d165050182b6586c7261c7019570a2a8 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_set/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_set.cjs", + "module": "../../esm/_class_private_field_set.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_field_update/package.json b/node_modules/@swc/helpers/_/_class_private_field_update/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ecb502fa6871a144922c6efa7354fc819863e2bd --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_field_update/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_field_update.cjs", + "module": "../../esm/_class_private_field_update.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_method_get/package.json b/node_modules/@swc/helpers/_/_class_private_method_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4d01b2ec39a30f4e4e04a841b449c95426982e01 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_method_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_method_get.cjs", + "module": "../../esm/_class_private_method_get.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_method_init/package.json b/node_modules/@swc/helpers/_/_class_private_method_init/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c9e406c91e841ef20b8a4a9c48d139f292c23b0 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_method_init/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_method_init.cjs", + "module": "../../esm/_class_private_method_init.js" +} diff --git a/node_modules/@swc/helpers/_/_class_private_method_set/package.json b/node_modules/@swc/helpers/_/_class_private_method_set/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bc842290ae57d66087862b1e37db6237776c1d63 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_private_method_set/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_private_method_set.cjs", + "module": "../../esm/_class_private_method_set.js" +} diff --git a/node_modules/@swc/helpers/_/_class_static_private_field_destructure/package.json b/node_modules/@swc/helpers/_/_class_static_private_field_destructure/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7cc7dc622c2bc306bdfd7edd8645f7482450a26d --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_static_private_field_destructure/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_static_private_field_destructure.cjs", + "module": "../../esm/_class_static_private_field_destructure.js" +} diff --git a/node_modules/@swc/helpers/_/_class_static_private_field_spec_get/package.json b/node_modules/@swc/helpers/_/_class_static_private_field_spec_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d626f6f2398950e44ada82e47fdf0ea70656f54d --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_static_private_field_spec_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_static_private_field_spec_get.cjs", + "module": "../../esm/_class_static_private_field_spec_get.js" +} diff --git a/node_modules/@swc/helpers/_/_class_static_private_field_spec_set/package.json b/node_modules/@swc/helpers/_/_class_static_private_field_spec_set/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7a4d0891d687276b051e0a0d60e18435a63fca8b --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_static_private_field_spec_set/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_static_private_field_spec_set.cjs", + "module": "../../esm/_class_static_private_field_spec_set.js" +} diff --git a/node_modules/@swc/helpers/_/_class_static_private_field_update/package.json b/node_modules/@swc/helpers/_/_class_static_private_field_update/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c10abd016298d8175735169752012628469f7919 --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_static_private_field_update/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_static_private_field_update.cjs", + "module": "../../esm/_class_static_private_field_update.js" +} diff --git a/node_modules/@swc/helpers/_/_class_static_private_method_get/package.json b/node_modules/@swc/helpers/_/_class_static_private_method_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1f4f139fa6f7480b1895bd83523d54c42e7fa6de --- /dev/null +++ b/node_modules/@swc/helpers/_/_class_static_private_method_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_class_static_private_method_get.cjs", + "module": "../../esm/_class_static_private_method_get.js" +} diff --git a/node_modules/@swc/helpers/_/_construct/package.json b/node_modules/@swc/helpers/_/_construct/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0eea254969d2076128ab827d889bbd37b7ad3df5 --- /dev/null +++ b/node_modules/@swc/helpers/_/_construct/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_construct.cjs", + "module": "../../esm/_construct.js" +} diff --git a/node_modules/@swc/helpers/_/_create_class/package.json b/node_modules/@swc/helpers/_/_create_class/package.json new file mode 100644 index 0000000000000000000000000000000000000000..191f7edbb0fd5185586e08ecfa578a6a48a371dd --- /dev/null +++ b/node_modules/@swc/helpers/_/_create_class/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_create_class.cjs", + "module": "../../esm/_create_class.js" +} diff --git a/node_modules/@swc/helpers/_/_create_for_of_iterator_helper_loose/package.json b/node_modules/@swc/helpers/_/_create_for_of_iterator_helper_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..68257867b6713208682dc7aac55b31e2c86f77a4 --- /dev/null +++ b/node_modules/@swc/helpers/_/_create_for_of_iterator_helper_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_create_for_of_iterator_helper_loose.cjs", + "module": "../../esm/_create_for_of_iterator_helper_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_create_super/package.json b/node_modules/@swc/helpers/_/_create_super/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3442b58a31d8074a7a915080cff438c8f164752f --- /dev/null +++ b/node_modules/@swc/helpers/_/_create_super/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_create_super.cjs", + "module": "../../esm/_create_super.js" +} diff --git a/node_modules/@swc/helpers/_/_decorate/package.json b/node_modules/@swc/helpers/_/_decorate/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d33cc5b3e89fe958a6207172d94cc41b1c0cea03 --- /dev/null +++ b/node_modules/@swc/helpers/_/_decorate/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_decorate.cjs", + "module": "../../esm/_decorate.js" +} diff --git a/node_modules/@swc/helpers/_/_defaults/package.json b/node_modules/@swc/helpers/_/_defaults/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e44774f07af4c64ae52092a470f92c7df07628fc --- /dev/null +++ b/node_modules/@swc/helpers/_/_defaults/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_defaults.cjs", + "module": "../../esm/_defaults.js" +} diff --git a/node_modules/@swc/helpers/_/_define_enumerable_properties/package.json b/node_modules/@swc/helpers/_/_define_enumerable_properties/package.json new file mode 100644 index 0000000000000000000000000000000000000000..63c488e00a2e7ffc1d8cfd4590786359013ce515 --- /dev/null +++ b/node_modules/@swc/helpers/_/_define_enumerable_properties/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_define_enumerable_properties.cjs", + "module": "../../esm/_define_enumerable_properties.js" +} diff --git a/node_modules/@swc/helpers/_/_define_property/package.json b/node_modules/@swc/helpers/_/_define_property/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ac05789cdbdc964c625c19c5b554ba29e009f09a --- /dev/null +++ b/node_modules/@swc/helpers/_/_define_property/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_define_property.cjs", + "module": "../../esm/_define_property.js" +} diff --git a/node_modules/@swc/helpers/_/_dispose/package.json b/node_modules/@swc/helpers/_/_dispose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a6e5f50538de7fd220e60580ace127cdd2763018 --- /dev/null +++ b/node_modules/@swc/helpers/_/_dispose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_dispose.cjs", + "module": "../../esm/_dispose.js" +} diff --git a/node_modules/@swc/helpers/_/_export_star/package.json b/node_modules/@swc/helpers/_/_export_star/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c47d22b81afbf460ef43841aff7e24849a6b4cab --- /dev/null +++ b/node_modules/@swc/helpers/_/_export_star/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_export_star.cjs", + "module": "../../esm/_export_star.js" +} diff --git a/node_modules/@swc/helpers/_/_extends/package.json b/node_modules/@swc/helpers/_/_extends/package.json new file mode 100644 index 0000000000000000000000000000000000000000..40fc9ac4e5caa0c73540e398e6ec87cc440e7678 --- /dev/null +++ b/node_modules/@swc/helpers/_/_extends/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_extends.cjs", + "module": "../../esm/_extends.js" +} diff --git a/node_modules/@swc/helpers/_/_get/package.json b/node_modules/@swc/helpers/_/_get/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f6cb810894cec7598d39718899d0ba793c24438a --- /dev/null +++ b/node_modules/@swc/helpers/_/_get/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_get.cjs", + "module": "../../esm/_get.js" +} diff --git a/node_modules/@swc/helpers/_/_get_prototype_of/package.json b/node_modules/@swc/helpers/_/_get_prototype_of/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c4ca8e69da6359d7e5c787cb6b3f8adac55241b --- /dev/null +++ b/node_modules/@swc/helpers/_/_get_prototype_of/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_get_prototype_of.cjs", + "module": "../../esm/_get_prototype_of.js" +} diff --git a/node_modules/@swc/helpers/_/_identity/package.json b/node_modules/@swc/helpers/_/_identity/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3b45f4c7f54ab66e426e642c664e262d70c533b8 --- /dev/null +++ b/node_modules/@swc/helpers/_/_identity/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_identity.cjs", + "module": "../../esm/_identity.js" +} diff --git a/node_modules/@swc/helpers/_/_inherits/package.json b/node_modules/@swc/helpers/_/_inherits/package.json new file mode 100644 index 0000000000000000000000000000000000000000..425da862f869c47eac122c0d87aca4ed2ae9b297 --- /dev/null +++ b/node_modules/@swc/helpers/_/_inherits/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_inherits.cjs", + "module": "../../esm/_inherits.js" +} diff --git a/node_modules/@swc/helpers/_/_inherits_loose/package.json b/node_modules/@swc/helpers/_/_inherits_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ffa67dc2eebc27997342e076f32cf704272c00f0 --- /dev/null +++ b/node_modules/@swc/helpers/_/_inherits_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_inherits_loose.cjs", + "module": "../../esm/_inherits_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_initializer_define_property/package.json b/node_modules/@swc/helpers/_/_initializer_define_property/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b65ad3b0bb1a6e5fcb00eee7027e87a382d03944 --- /dev/null +++ b/node_modules/@swc/helpers/_/_initializer_define_property/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_initializer_define_property.cjs", + "module": "../../esm/_initializer_define_property.js" +} diff --git a/node_modules/@swc/helpers/_/_initializer_warning_helper/package.json b/node_modules/@swc/helpers/_/_initializer_warning_helper/package.json new file mode 100644 index 0000000000000000000000000000000000000000..94653a8fa4a1e9adba9fad4639971b49fbf1f99c --- /dev/null +++ b/node_modules/@swc/helpers/_/_initializer_warning_helper/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_initializer_warning_helper.cjs", + "module": "../../esm/_initializer_warning_helper.js" +} diff --git a/node_modules/@swc/helpers/_/_instanceof/package.json b/node_modules/@swc/helpers/_/_instanceof/package.json new file mode 100644 index 0000000000000000000000000000000000000000..523c344756f57dc31267b281db90585812fb67d6 --- /dev/null +++ b/node_modules/@swc/helpers/_/_instanceof/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_instanceof.cjs", + "module": "../../esm/_instanceof.js" +} diff --git a/node_modules/@swc/helpers/_/_interop_require_default/package.json b/node_modules/@swc/helpers/_/_interop_require_default/package.json new file mode 100644 index 0000000000000000000000000000000000000000..70d438fc049238da365664c7b46b571a185f5de3 --- /dev/null +++ b/node_modules/@swc/helpers/_/_interop_require_default/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_interop_require_default.cjs", + "module": "../../esm/_interop_require_default.js" +} diff --git a/node_modules/@swc/helpers/_/_interop_require_wildcard/package.json b/node_modules/@swc/helpers/_/_interop_require_wildcard/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b3469a5d300c311a1860a9af55d7c4876b9777a8 --- /dev/null +++ b/node_modules/@swc/helpers/_/_interop_require_wildcard/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_interop_require_wildcard.cjs", + "module": "../../esm/_interop_require_wildcard.js" +} diff --git a/node_modules/@swc/helpers/_/_is_native_function/package.json b/node_modules/@swc/helpers/_/_is_native_function/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6380c813473098afa122f877d4560f29d177c873 --- /dev/null +++ b/node_modules/@swc/helpers/_/_is_native_function/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_is_native_function.cjs", + "module": "../../esm/_is_native_function.js" +} diff --git a/node_modules/@swc/helpers/_/_is_native_reflect_construct/package.json b/node_modules/@swc/helpers/_/_is_native_reflect_construct/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9aa84b0f88f89d9ddbb87238f65ec4fb06656984 --- /dev/null +++ b/node_modules/@swc/helpers/_/_is_native_reflect_construct/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_is_native_reflect_construct.cjs", + "module": "../../esm/_is_native_reflect_construct.js" +} diff --git a/node_modules/@swc/helpers/_/_iterable_to_array/package.json b/node_modules/@swc/helpers/_/_iterable_to_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7754bd48be4cd5a813d3a46e48c744196114d40d --- /dev/null +++ b/node_modules/@swc/helpers/_/_iterable_to_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_iterable_to_array.cjs", + "module": "../../esm/_iterable_to_array.js" +} diff --git a/node_modules/@swc/helpers/_/_iterable_to_array_limit/package.json b/node_modules/@swc/helpers/_/_iterable_to_array_limit/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a69c45e990e6ec16582aee609b83cf5c2335d21a --- /dev/null +++ b/node_modules/@swc/helpers/_/_iterable_to_array_limit/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_iterable_to_array_limit.cjs", + "module": "../../esm/_iterable_to_array_limit.js" +} diff --git a/node_modules/@swc/helpers/_/_iterable_to_array_limit_loose/package.json b/node_modules/@swc/helpers/_/_iterable_to_array_limit_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a4a392ebec00a3444c5a09dec1d0517c45d30a5c --- /dev/null +++ b/node_modules/@swc/helpers/_/_iterable_to_array_limit_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_iterable_to_array_limit_loose.cjs", + "module": "../../esm/_iterable_to_array_limit_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_jsx/package.json b/node_modules/@swc/helpers/_/_jsx/package.json new file mode 100644 index 0000000000000000000000000000000000000000..be886148e532e1341df4490f88267f251c139440 --- /dev/null +++ b/node_modules/@swc/helpers/_/_jsx/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_jsx.cjs", + "module": "../../esm/_jsx.js" +} diff --git a/node_modules/@swc/helpers/_/_new_arrow_check/package.json b/node_modules/@swc/helpers/_/_new_arrow_check/package.json new file mode 100644 index 0000000000000000000000000000000000000000..df1d9eb740a87fc0e91045baed3e1c99125b9cfa --- /dev/null +++ b/node_modules/@swc/helpers/_/_new_arrow_check/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_new_arrow_check.cjs", + "module": "../../esm/_new_arrow_check.js" +} diff --git a/node_modules/@swc/helpers/_/_non_iterable_rest/package.json b/node_modules/@swc/helpers/_/_non_iterable_rest/package.json new file mode 100644 index 0000000000000000000000000000000000000000..43d3d3a23af6893c61a014c5c8bb2e3dc1db73b8 --- /dev/null +++ b/node_modules/@swc/helpers/_/_non_iterable_rest/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_non_iterable_rest.cjs", + "module": "../../esm/_non_iterable_rest.js" +} diff --git a/node_modules/@swc/helpers/_/_non_iterable_spread/package.json b/node_modules/@swc/helpers/_/_non_iterable_spread/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0df885d88ba1dfb13af3a5ed749a4c52b5d87465 --- /dev/null +++ b/node_modules/@swc/helpers/_/_non_iterable_spread/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_non_iterable_spread.cjs", + "module": "../../esm/_non_iterable_spread.js" +} diff --git a/node_modules/@swc/helpers/_/_object_destructuring_empty/package.json b/node_modules/@swc/helpers/_/_object_destructuring_empty/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b9e7f60c27ce1ddfad3d75fe10f2a542cff62312 --- /dev/null +++ b/node_modules/@swc/helpers/_/_object_destructuring_empty/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_object_destructuring_empty.cjs", + "module": "../../esm/_object_destructuring_empty.js" +} diff --git a/node_modules/@swc/helpers/_/_object_spread/package.json b/node_modules/@swc/helpers/_/_object_spread/package.json new file mode 100644 index 0000000000000000000000000000000000000000..79c030a7ede053d2e836ac8efafb581dce4a7e41 --- /dev/null +++ b/node_modules/@swc/helpers/_/_object_spread/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_object_spread.cjs", + "module": "../../esm/_object_spread.js" +} diff --git a/node_modules/@swc/helpers/_/_object_spread_props/package.json b/node_modules/@swc/helpers/_/_object_spread_props/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1fa988bcaab428a717fbbd205f383471c8ecdc5b --- /dev/null +++ b/node_modules/@swc/helpers/_/_object_spread_props/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_object_spread_props.cjs", + "module": "../../esm/_object_spread_props.js" +} diff --git a/node_modules/@swc/helpers/_/_object_without_properties/package.json b/node_modules/@swc/helpers/_/_object_without_properties/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5553145d1b3f3ed61a131cc7ae25f0fa720acf23 --- /dev/null +++ b/node_modules/@swc/helpers/_/_object_without_properties/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_object_without_properties.cjs", + "module": "../../esm/_object_without_properties.js" +} diff --git a/node_modules/@swc/helpers/_/_object_without_properties_loose/package.json b/node_modules/@swc/helpers/_/_object_without_properties_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8f08da9cd7e856f216a216a8515c3d1b5b2f2efd --- /dev/null +++ b/node_modules/@swc/helpers/_/_object_without_properties_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_object_without_properties_loose.cjs", + "module": "../../esm/_object_without_properties_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_overload_yield/package.json b/node_modules/@swc/helpers/_/_overload_yield/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3b09c3fd5191797817fb8c794b7e9f5696a59488 --- /dev/null +++ b/node_modules/@swc/helpers/_/_overload_yield/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_overload_yield.cjs", + "module": "../../esm/_overload_yield.js" +} diff --git a/node_modules/@swc/helpers/_/_possible_constructor_return/package.json b/node_modules/@swc/helpers/_/_possible_constructor_return/package.json new file mode 100644 index 0000000000000000000000000000000000000000..06256ff1c88216da98b08d4a20c38e636bf4f070 --- /dev/null +++ b/node_modules/@swc/helpers/_/_possible_constructor_return/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_possible_constructor_return.cjs", + "module": "../../esm/_possible_constructor_return.js" +} diff --git a/node_modules/@swc/helpers/_/_read_only_error/package.json b/node_modules/@swc/helpers/_/_read_only_error/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c724d5e1f0147400204ce65c6a8c3360d65c8f7f --- /dev/null +++ b/node_modules/@swc/helpers/_/_read_only_error/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_read_only_error.cjs", + "module": "../../esm/_read_only_error.js" +} diff --git a/node_modules/@swc/helpers/_/_set/package.json b/node_modules/@swc/helpers/_/_set/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c90145be2754569f9563bb96c0a229298c3dd2ef --- /dev/null +++ b/node_modules/@swc/helpers/_/_set/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_set.cjs", + "module": "../../esm/_set.js" +} diff --git a/node_modules/@swc/helpers/_/_set_prototype_of/package.json b/node_modules/@swc/helpers/_/_set_prototype_of/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d08cf843325826108afea40d9d05d9e3277ed3b6 --- /dev/null +++ b/node_modules/@swc/helpers/_/_set_prototype_of/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_set_prototype_of.cjs", + "module": "../../esm/_set_prototype_of.js" +} diff --git a/node_modules/@swc/helpers/_/_skip_first_generator_next/package.json b/node_modules/@swc/helpers/_/_skip_first_generator_next/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cc34934ef02f8fa90a1bc8b027088792c970417a --- /dev/null +++ b/node_modules/@swc/helpers/_/_skip_first_generator_next/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_skip_first_generator_next.cjs", + "module": "../../esm/_skip_first_generator_next.js" +} diff --git a/node_modules/@swc/helpers/_/_sliced_to_array/package.json b/node_modules/@swc/helpers/_/_sliced_to_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..52b4fbba82b4b1f43998cdab6975eca92edd476b --- /dev/null +++ b/node_modules/@swc/helpers/_/_sliced_to_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_sliced_to_array.cjs", + "module": "../../esm/_sliced_to_array.js" +} diff --git a/node_modules/@swc/helpers/_/_sliced_to_array_loose/package.json b/node_modules/@swc/helpers/_/_sliced_to_array_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ca2c35bce6b0363fff9f05b6fddb747d06b58d8b --- /dev/null +++ b/node_modules/@swc/helpers/_/_sliced_to_array_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_sliced_to_array_loose.cjs", + "module": "../../esm/_sliced_to_array_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_super_prop_base/package.json b/node_modules/@swc/helpers/_/_super_prop_base/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f6557ef5194f71683fd66017c15076ad0ed7b639 --- /dev/null +++ b/node_modules/@swc/helpers/_/_super_prop_base/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_super_prop_base.cjs", + "module": "../../esm/_super_prop_base.js" +} diff --git a/node_modules/@swc/helpers/_/_tagged_template_literal/package.json b/node_modules/@swc/helpers/_/_tagged_template_literal/package.json new file mode 100644 index 0000000000000000000000000000000000000000..63d2a40a505c657ac3da58056c336d28117603db --- /dev/null +++ b/node_modules/@swc/helpers/_/_tagged_template_literal/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_tagged_template_literal.cjs", + "module": "../../esm/_tagged_template_literal.js" +} diff --git a/node_modules/@swc/helpers/_/_tagged_template_literal_loose/package.json b/node_modules/@swc/helpers/_/_tagged_template_literal_loose/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6a45bd377b28b60f691edf10387fc5f5b8a7dc79 --- /dev/null +++ b/node_modules/@swc/helpers/_/_tagged_template_literal_loose/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_tagged_template_literal_loose.cjs", + "module": "../../esm/_tagged_template_literal_loose.js" +} diff --git a/node_modules/@swc/helpers/_/_throw/package.json b/node_modules/@swc/helpers/_/_throw/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1418ff4bac1a77ed10750c2852d68ed62922ad08 --- /dev/null +++ b/node_modules/@swc/helpers/_/_throw/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_throw.cjs", + "module": "../../esm/_throw.js" +} diff --git a/node_modules/@swc/helpers/_/_to_array/package.json b/node_modules/@swc/helpers/_/_to_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2c5ce50b4f27dd6ba8bbf0b87f8ad75f83de35ae --- /dev/null +++ b/node_modules/@swc/helpers/_/_to_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_to_array.cjs", + "module": "../../esm/_to_array.js" +} diff --git a/node_modules/@swc/helpers/_/_to_consumable_array/package.json b/node_modules/@swc/helpers/_/_to_consumable_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6424d11c3d1d5213af7e04aed1b51090d69518c2 --- /dev/null +++ b/node_modules/@swc/helpers/_/_to_consumable_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_to_consumable_array.cjs", + "module": "../../esm/_to_consumable_array.js" +} diff --git a/node_modules/@swc/helpers/_/_to_primitive/package.json b/node_modules/@swc/helpers/_/_to_primitive/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1ee625af22c6b2a8aa99bd3f333fa2ff2a023a18 --- /dev/null +++ b/node_modules/@swc/helpers/_/_to_primitive/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_to_primitive.cjs", + "module": "../../esm/_to_primitive.js" +} diff --git a/node_modules/@swc/helpers/_/_to_property_key/package.json b/node_modules/@swc/helpers/_/_to_property_key/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6f2e9a2d0ca11e91e5ce6bb6dd0f006772a6e050 --- /dev/null +++ b/node_modules/@swc/helpers/_/_to_property_key/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_to_property_key.cjs", + "module": "../../esm/_to_property_key.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_add_disposable_resource/package.json b/node_modules/@swc/helpers/_/_ts_add_disposable_resource/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8b20dac050ac6d9c9d3cb70889b89c192c297ab1 --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_add_disposable_resource/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_add_disposable_resource.cjs", + "module": "../../esm/_ts_add_disposable_resource.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_decorate/package.json b/node_modules/@swc/helpers/_/_ts_decorate/package.json new file mode 100644 index 0000000000000000000000000000000000000000..02279e9f058c7d01898c9d1d6336085c615be48e --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_decorate/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_decorate.cjs", + "module": "../../esm/_ts_decorate.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_dispose_resources/package.json b/node_modules/@swc/helpers/_/_ts_dispose_resources/package.json new file mode 100644 index 0000000000000000000000000000000000000000..47841c0cb606186b1a012788a9614874d504b5ca --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_dispose_resources/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_dispose_resources.cjs", + "module": "../../esm/_ts_dispose_resources.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_generator/package.json b/node_modules/@swc/helpers/_/_ts_generator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0dc9588c6636a46bcd3cfd9cc8d58ae6095224b2 --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_generator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_generator.cjs", + "module": "../../esm/_ts_generator.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_metadata/package.json b/node_modules/@swc/helpers/_/_ts_metadata/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d7c1f1c41d073768e5caaa7cacc9da0a7fbe1359 --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_metadata/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_metadata.cjs", + "module": "../../esm/_ts_metadata.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_param/package.json b/node_modules/@swc/helpers/_/_ts_param/package.json new file mode 100644 index 0000000000000000000000000000000000000000..18af8228115eb4e9344db9b503e60aa16a3ab62f --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_param/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_param.cjs", + "module": "../../esm/_ts_param.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_rewrite_relative_import_extension/package.json b/node_modules/@swc/helpers/_/_ts_rewrite_relative_import_extension/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cacd37a56a0664c7e01e3501284a3b21eeecba9d --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_rewrite_relative_import_extension/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_rewrite_relative_import_extension.cjs", + "module": "../../esm/_ts_rewrite_relative_import_extension.js" +} diff --git a/node_modules/@swc/helpers/_/_ts_values/package.json b/node_modules/@swc/helpers/_/_ts_values/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5fe6a464518d62b52966e986e075cb506f5f53dd --- /dev/null +++ b/node_modules/@swc/helpers/_/_ts_values/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_ts_values.cjs", + "module": "../../esm/_ts_values.js" +} diff --git a/node_modules/@swc/helpers/_/_type_of/package.json b/node_modules/@swc/helpers/_/_type_of/package.json new file mode 100644 index 0000000000000000000000000000000000000000..620eed9e1156c47b21bece91f6020de2232397ab --- /dev/null +++ b/node_modules/@swc/helpers/_/_type_of/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_type_of.cjs", + "module": "../../esm/_type_of.js" +} diff --git a/node_modules/@swc/helpers/_/_unsupported_iterable_to_array/package.json b/node_modules/@swc/helpers/_/_unsupported_iterable_to_array/package.json new file mode 100644 index 0000000000000000000000000000000000000000..54549be92f74eea76c232ce60e3f7f9665b2c00d --- /dev/null +++ b/node_modules/@swc/helpers/_/_unsupported_iterable_to_array/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_unsupported_iterable_to_array.cjs", + "module": "../../esm/_unsupported_iterable_to_array.js" +} diff --git a/node_modules/@swc/helpers/_/_update/package.json b/node_modules/@swc/helpers/_/_update/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f166b0cb93e26ce308745280adaf75eddf8814d9 --- /dev/null +++ b/node_modules/@swc/helpers/_/_update/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_update.cjs", + "module": "../../esm/_update.js" +} diff --git a/node_modules/@swc/helpers/_/_using/package.json b/node_modules/@swc/helpers/_/_using/package.json new file mode 100644 index 0000000000000000000000000000000000000000..444f980f0182633fda9bed8c4889bdcc920fc3e0 --- /dev/null +++ b/node_modules/@swc/helpers/_/_using/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_using.cjs", + "module": "../../esm/_using.js" +} diff --git a/node_modules/@swc/helpers/_/_using_ctx/package.json b/node_modules/@swc/helpers/_/_using_ctx/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b1aaebc9738c3cfa1b5884441229ac718fe10a7e --- /dev/null +++ b/node_modules/@swc/helpers/_/_using_ctx/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_using_ctx.cjs", + "module": "../../esm/_using_ctx.js" +} diff --git a/node_modules/@swc/helpers/_/_wrap_async_generator/package.json b/node_modules/@swc/helpers/_/_wrap_async_generator/package.json new file mode 100644 index 0000000000000000000000000000000000000000..774dcc1d16287c07ef298343559b6c42b0d6a499 --- /dev/null +++ b/node_modules/@swc/helpers/_/_wrap_async_generator/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_wrap_async_generator.cjs", + "module": "../../esm/_wrap_async_generator.js" +} diff --git a/node_modules/@swc/helpers/_/_wrap_native_super/package.json b/node_modules/@swc/helpers/_/_wrap_native_super/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ce559339de81537cbd22e3bb8670e8c25140dc30 --- /dev/null +++ b/node_modules/@swc/helpers/_/_wrap_native_super/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_wrap_native_super.cjs", + "module": "../../esm/_wrap_native_super.js" +} diff --git a/node_modules/@swc/helpers/_/_wrap_reg_exp/package.json b/node_modules/@swc/helpers/_/_wrap_reg_exp/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ab613974c524a3f9a1b9b4de91272379e77fcaf6 --- /dev/null +++ b/node_modules/@swc/helpers/_/_wrap_reg_exp/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_wrap_reg_exp.cjs", + "module": "../../esm/_wrap_reg_exp.js" +} diff --git a/node_modules/@swc/helpers/_/_write_only_error/package.json b/node_modules/@swc/helpers/_/_write_only_error/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1767535ae97f9d474d084b3fd7733666cea68686 --- /dev/null +++ b/node_modules/@swc/helpers/_/_write_only_error/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/_write_only_error.cjs", + "module": "../../esm/_write_only_error.js" +} diff --git a/node_modules/@swc/helpers/_/index/package.json b/node_modules/@swc/helpers/_/index/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b855fe7780481dde84a45ff2087a2abfaf36c2f3 --- /dev/null +++ b/node_modules/@swc/helpers/_/index/package.json @@ -0,0 +1,4 @@ +{ + "main": "../../cjs/index.cjs", + "module": "../../esm/index.js" +} diff --git a/node_modules/@swc/helpers/cjs/_apply_decorated_descriptor.cjs b/node_modules/@swc/helpers/cjs/_apply_decorated_descriptor.cjs new file mode 100644 index 0000000000000000000000000000000000000000..edd11861c695dc99e4b2a2edc47a90674c1985cd --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_apply_decorated_descriptor.cjs @@ -0,0 +1,35 @@ +"use strict"; + +function _apply_decorated_descriptor(target, property, decorators, descriptor, context) { + var desc = {}; + + Object["ke" + "ys"](descriptor).forEach(function(key) { + desc[key] = descriptor[key]; + }); + desc.enumerable = !!desc.enumerable; + desc.configurable = !!desc.configurable; + + if ("value" in desc || desc.initializer) desc.writable = true; + desc = decorators.slice().reverse().reduce(function(desc, decorator) { + return decorator ? decorator(target, property, desc) || desc : desc; + }, desc); + + var hasAccessor = Object.prototype.hasOwnProperty.call(desc, "get") || Object.prototype.hasOwnProperty.call(desc, "set"); + + if (context && desc.initializer !== void 0 && !hasAccessor) { + desc.value = desc.initializer ? desc.initializer.call(context) : void 0; + desc.initializer = undefined; + } + if (hasAccessor) { + delete desc.writable; + delete desc.initializer; + delete desc.value; + } + if (desc.initializer === void 0) { + Object["define" + "Property"](target, property, desc); + desc = null; + } + + return desc; +} +exports._ = _apply_decorated_descriptor; diff --git a/node_modules/@swc/helpers/cjs/_apply_decs_2203_r.cjs b/node_modules/@swc/helpers/cjs/_apply_decs_2203_r.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6dc4b81a1c633eba7a3999db75bd22051958accc --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_apply_decs_2203_r.cjs @@ -0,0 +1,574 @@ +"use strict"; + +/* @minVersion 7.20.0 */ + +/** + Enums are used in this file, but not assigned to vars to avoid non-hoistable values + + CONSTRUCTOR = 0; + PUBLIC = 1; + PRIVATE = 2; + + FIELD = 0; + ACCESSOR = 1; + METHOD = 2; + GETTER = 3; + SETTER = 4; + + STATIC = 5; + + CLASS = 10; // only used in assertValidReturnValue +*/ + +function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) { + function createAddInitializerMethod(initializers, decoratorFinishedRef) { + return function addInitializer(initializer) { + assertNotFinished(decoratorFinishedRef, "addInitializer"); + assertCallable(initializer, "An initializer"); + initializers.push(initializer); + }; + } + + function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) { + var kindStr; + + switch (kind) { + case 1 /* ACCESSOR */: + kindStr = "accessor"; + break; + case 2 /* METHOD */: + kindStr = "method"; + break; + case 3 /* GETTER */: + kindStr = "getter"; + break; + case 4 /* SETTER */: + kindStr = "setter"; + break; + default: + kindStr = "field"; + } + + var ctx = { kind: kindStr, name: isPrivate ? "#" + name : name, static: isStatic, private: isPrivate, metadata: metadata }; + + var decoratorFinishedRef = { v: false }; + + ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef); + + var get, set; + if (kind === 0 /* FIELD */) { + if (isPrivate) { + get = desc.get; + set = desc.set; + } else { + get = function() { + return this[name]; + }; + set = function(v) { + this[name] = v; + }; + } + } else if (kind === 2 /* METHOD */) { + get = function() { + return desc.value; + }; + } else { + // replace with values that will go through the final getter and setter + if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) { + get = function() { + return desc.get.call(this); + }; + } + + if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) { + set = function(v) { + desc.set.call(this, v); + }; + } + } + + if (get) { + var originalGet = get; + get = function(target) { + if (arguments.length === 0) { + target = this; + } + return originalGet.call(target); + }; + } + + if (set) { + var originalSet = set; + set = function(target, value) { + if (arguments.length === 1) { + value = target; + target = this; + } + return originalSet.call(target, value); + }; + } + + if (isPrivate) { + ctx.access = get && set ? { get: get, set: set } : get ? { get: get } : { set: set }; + } else { + var has = function(target) { + return name in target; + }; + ctx.access = get && set ? { has: has, get: get, set: set } : get ? { has: has, get: get } : { has: has, set: set }; + } + + var newValue = dec(value, ctx); + decoratorFinishedRef.v = true; + return newValue; + } + + function assertNotFinished(decoratorFinishedRef, fnName) { + if (decoratorFinishedRef.v) { + throw new Error("attempted to call " + fnName + " after decoration was finished"); + } + } + + function assertCallable(fn, hint) { + if (typeof fn !== "function") { + throw new TypeError(hint + " must be a function"); + } + } + + function assertValidReturnValue(kind, value) { + var type = typeof value; + + if (kind === 1 /* ACCESSOR */) { + if (type !== "object" || value === null) { + throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + } + if (value.get !== undefined) { + assertCallable(value.get, "accessor.get"); + } + if (value.set !== undefined) { + assertCallable(value.set, "accessor.set"); + } + if (value.init !== undefined) { + assertCallable(value.init, "accessor.init"); + } + } else if (type !== "function") { + var hint; + if (kind === 0 /* FIELD */) { + hint = "field"; + } else if (kind === 10 /* CLASS */) { + hint = "class"; + } else { + hint = "method"; + } + throw new TypeError(hint + " decorators must return a function or void 0"); + } + } + + function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) { + var decs = decInfo[0]; + + var desc, init, value; + + if (isPrivate) { + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + desc = { get: decInfo[3], set: decInfo[4] }; + } else if (kind === 3 /* GETTER */) { + desc = { get: decInfo[3] }; + } else if (kind === 4 /* SETTER */) { + desc = { set: decInfo[3] }; + } else { + desc = { value: decInfo[3] }; + } + } else if (kind !== 0 /* FIELD */) { + desc = Object.getOwnPropertyDescriptor(base, name); + } + + if (kind === 1 /* ACCESSOR */) { + value = { get: desc.get, set: desc.set }; + } else if (kind === 2 /* METHOD */) { + value = desc.value; + } else if (kind === 3 /* GETTER */) { + value = desc.get; + } else if (kind === 4 /* SETTER */) { + value = desc.set; + } + + var newValue, get, set; + + if (typeof decs === "function") { + newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value); + + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + + if (kind === 0 /* FIELD */) { + init = newValue; + } else if (kind === 1 /* ACCESSOR */) { + init = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; + } else { + value = newValue; + } + } + } else { + for (var i = decs.length - 1; i >= 0; i--) { + var dec = decs[i]; + + newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value); + + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + var newInit; + + if (kind === 0 /* FIELD */) { + newInit = newValue; + } else if (kind === 1 /* ACCESSOR */) { + newInit = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; + } else { + value = newValue; + } + + if (newInit !== void 0) { + if (init === void 0) { + init = newInit; + } else if (typeof init === "function") { + init = [init, newInit]; + } else { + init.push(newInit); + } + } + } + } + } + + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + if (init === void 0) { + // If the initializer was void 0, sub in a dummy initializer + init = function(instance, init) { + return init; + }; + } else if (typeof init !== "function") { + var ownInitializers = init; + + init = function(instance, init) { + var value = init; + + for (var i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); + + return value; + }; + } else { + var originalInitializer = init; + + init = function(instance, init) { + return originalInitializer.call(instance, init); + }; + } + + ret.push(init); + } + + if (kind !== 0 /* FIELD */) { + if (kind === 1 /* ACCESSOR */) { + desc.get = value.get; + desc.set = value.set; + } else if (kind === 2 /* METHOD */) { + desc.value = value; + } else if (kind === 3 /* GETTER */) { + desc.get = value; + } else if (kind === 4 /* SETTER */) { + desc.set = value; + } + + if (isPrivate) { + if (kind === 1 /* ACCESSOR */) { + ret.push(function(instance, args) { + return value.get.call(instance, args); + }); + ret.push(function(instance, args) { + return value.set.call(instance, args); + }); + } else if (kind === 2 /* METHOD */) { + ret.push(value); + } else { + ret.push(function(instance, args) { + return value.call(instance, args); + }); + } + } else { + Object.defineProperty(base, name, desc); + } + } + } + + function applyMemberDecs(Class, decInfos, metadata) { + var ret = []; + var protoInitializers; + var staticInitializers; + + var existingProtoNonFields = new Map(); + var existingStaticNonFields = new Map(); + + for (var i = 0; i < decInfos.length; i++) { + var decInfo = decInfos[i]; + + // skip computed property names + if (!Array.isArray(decInfo)) continue; + + var kind = decInfo[1]; + var name = decInfo[2]; + var isPrivate = decInfo.length > 3; + + var isStatic = kind >= 5; /* STATIC */ + var base; + var initializers; + + if (isStatic) { + base = Class; + kind = kind - 5 /* STATIC */; + // initialize staticInitializers when we see a non-field static member + staticInitializers = staticInitializers || []; + initializers = staticInitializers; + } else { + base = Class.prototype; + // initialize protoInitializers when we see a non-field member + protoInitializers = protoInitializers || []; + initializers = protoInitializers; + } + + if (kind !== 0 /* FIELD */ && !isPrivate) { + var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields; + + var existingKind = existingNonFields.get(name) || 0; + + if (existingKind === true || (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ || (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */) { + throw new Error( + "Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + + name + ); + } else if (!existingKind && kind > 2 /* METHOD */) { + existingNonFields.set(name, kind); + } else { + existingNonFields.set(name, true); + } + } + + applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata); + } + + pushInitializers(ret, protoInitializers); + pushInitializers(ret, staticInitializers); + return ret; + } + + function pushInitializers(ret, initializers) { + if (initializers) { + ret.push(function(instance) { + for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); + return instance; + }); + } + } + + function applyClassDecs(targetClass, classDecs, metadata) { + if (classDecs.length > 0) { + var initializers = []; + var newClass = targetClass; + var name = targetClass.name; + + for (var i = classDecs.length - 1; i >= 0; i--) { + var decoratorFinishedRef = { v: false }; + + var nextNewClass = classDecs[i](newClass, { kind: "class", name: name, addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef), metadata }); + decoratorFinishedRef.v = true; + + if (nextNewClass !== undefined) { + assertValidReturnValue(10, /* CLASS */ nextNewClass); + newClass = nextNewClass; + } + } + + return [defineMetadata(newClass, metadata), function() { + for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); + }]; + } + // The transformer will not emit assignment when there are no class decorators, + // so we don't have to return an empty array here. + } + + function defineMetadata(Class, metadata) { + return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: true, enumerable: true, value: metadata }); + } + + /** + Basic usage: + + applyDecs( + Class, + [ + // member decorators + [ + dec, // dec or array of decs + 0, // kind of value being decorated + 'prop', // name of public prop on class containing the value being decorated, + '#p', // the name of the private property (if is private, void 0 otherwise), + ] + ], + [ + // class decorators + dec1, dec2 + ] + ) + ``` + + Fully transpiled example: + + ```js + @dec + class Class { + @dec + a = 123; + + @dec + #a = 123; + + @dec + @dec2 + accessor b = 123; + + @dec + accessor #b = 123; + + @dec + c() { console.log('c'); } + + @dec + #c() { console.log('privC'); } + + @dec + get d() { console.log('d'); } + + @dec + get #d() { console.log('privD'); } + + @dec + set e(v) { console.log('e'); } + + @dec + set #e(v) { console.log('privE'); } + } + + + // becomes + let initializeInstance; + let initializeClass; + + let initA; + let initPrivA; + + let initB; + let initPrivB, getPrivB, setPrivB; + + let privC; + let privD; + let privE; + + let Class; + class _Class { + static { + let ret = applyDecs( + this, + [ + [dec, 0, 'a'], + [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[dec, dec2], 1, 'b'], + [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [dec, 2, 'c'], + [dec, 2, 'c', () => console.log('privC')], + [dec, 3, 'd'], + [dec, 3, 'd', () => console.log('privD')], + [dec, 4, 'e'], + [dec, 4, 'e', () => console.log('privE')], + ], + [ + dec + ] + ) + + initA = ret[0]; + + initPrivA = ret[1]; + + initB = ret[2]; + + initPrivB = ret[3]; + getPrivB = ret[4]; + setPrivB = ret[5]; + + privC = ret[6]; + + privD = ret[7]; + + privE = ret[8]; + + initializeInstance = ret[9]; + + Class = ret[10] + + initializeClass = ret[11]; + } + + a = (initializeInstance(this), initA(this, 123)); + + #a = initPrivA(this, 123); + + #bData = initB(this, 123); + get b() { return this.#bData } + set b(v) { this.#bData = v } + + #privBData = initPrivB(this, 123); + get #b() { return getPrivB(this); } + set #b(v) { setPrivB(this, v); } + + c() { console.log('c'); } + + #c(...args) { return privC(this, ...args) } + + get d() { console.log('d'); } + + get #d() { return privD(this); } + + set e(v) { console.log('e'); } + + set #e(v) { privE(this, v); } + } + + initializeClass(Class); + */ + + exports._ = _apply_decs_2203_r = function(targetClass, memberDecs, classDecs, parentClass) { + if (parentClass !== void 0) { + var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")]; + } + var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata); + var e = applyMemberDecs(targetClass, memberDecs, metadata); + if (!classDecs.length) defineMetadata(targetClass, metadata); + return { + e: e, + // Lazily apply class decorations so that member init locals can be properly bound. + get c() { + return applyClassDecs(targetClass, classDecs, metadata); + } + }; + }; + + return _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass); +} + +exports._ = _apply_decs_2203_r; diff --git a/node_modules/@swc/helpers/cjs/_apply_decs_2311.cjs b/node_modules/@swc/helpers/cjs/_apply_decs_2311.cjs new file mode 100644 index 0000000000000000000000000000000000000000..e1713e0419006327d57e4a0d74646b1b499ff830 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_apply_decs_2311.cjs @@ -0,0 +1,346 @@ +"use strict"; + +/* @minVersion 7.24.0 */ + +function toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) { + return input; + } + + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") { + return res; + } + throw new TypeError("@@toPrimitive must return a primitive value."); + } + + return (hint === "string" ? String : Number)(input); +} + +function toPropertyKey(arg) { + var key = toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); +} + +function checkInRHS(value) { + if (Object(value) !== value) { + throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null")); + } + + return value; +} + +function setFunctionName(fn, name, prefix) { + if (typeof name === "symbol") { + name = name.description; + name = name ? "[" + name + "]" : ""; + } + + try { + Object.defineProperty(fn, "name", { configurable: true, value: prefix ? prefix + " " + name : name }); + } catch (_) {} + + return fn; +} + +/** + kind bit layout + + FIELD = 0 + ACCESSOR = 1 + METHOD = 2 + GETTER = 3 + SETTER = 4 + CLASS = 5 + + STATIC = 8 + DECORATORS_HAVE_THIS = 16 +*/ +function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) { + var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata"); + var defineProperty = Object.defineProperty; + var create = Object.create; + var metadata; + var existingNonFields = [create(null), create(null)]; + var hasClassDecs = classDecs.length; + var _; + + function createRunInitializers(initializers, useStaticThis, hasValue) { + return function(thisArg, value) { + if (useStaticThis) { + value = thisArg; + thisArg = targetClass; + } + + for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []); + + return hasValue ? value : thisArg; + }; + } + + function assertCallable(fn, hint1, hint2, throwUndefined) { + if (typeof fn !== "function") { + if (throwUndefined || fn !== void 0) { + throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined")); + } + } + + return fn; + } + + function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) { + function assertInstanceIfPrivate(target) { + if (!hasPrivateBrand(target)) { + throw new TypeError("Attempted to access private element on non-instance"); + } + } + + var decs = [].concat(decInfo[0]); + var decVal = decInfo[3]; + var isClass = !ret; + + var isAccessor = kind === 1; + var isGetter = kind === 3; + var isSetter = kind === 4; + var isMethod = kind === 2; + + function bindPropCall(name, useStaticThis, before) { + return function(_this, value) { + if (useStaticThis) { + value = _this; + _this = Class; + } + + if (before) { + before(_this); + } + + return desc[name].call(_this, value); + }; + } + + var desc = {}; + var init = []; + var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value"; + + if (!isClass) { + if (isPrivate) { + if (isField || isAccessor) { + desc = { + get: setFunctionName( + function() { + return decVal(this); + }, + name, + "get" + ), + set: function(value) { + decInfo[4](this, value); + } + }; + } else { + desc[key] = decVal; + } + + if (!isField) { + setFunctionName(desc[key], name, isMethod ? "" : key); + } + } else if (!isField) { + desc = Object.getOwnPropertyDescriptor(Class, name); + } + + if (!isField && !isPrivate) { + _ = existingNonFields[+isStatic][name]; + if (_ && (_ ^ kind) !== 7) { + throw new Error("Decorating two elements with the same name (" + desc[key].name + ") is not supported yet"); + } + + existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind; + } + } + + var newValue = Class; + + for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) { + var dec = assertCallable(decs[i], "A decorator", "be", true); + var decThis = decoratorsHaveThis ? decs[i - 1] : void 0; + + var decoratorFinishedRef = {}; + var ctx = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][kind], + name: name, + metadata: metadata, + addInitializer: function(decoratorFinishedRef, initializer) { + if (decoratorFinishedRef.v) { + throw new TypeError("attempted to call addInitializer after decoration was finished"); + } + assertCallable(initializer, "An initializer", "be", true); + initializers.push(initializer); + } + .bind(null, decoratorFinishedRef) + }; + + if (isClass) { + _ = dec.call(decThis, newValue, ctx); + decoratorFinishedRef.v = 1; + + if (assertCallable(_, "class decorators", "return")) { + newValue = _; + } + continue; + } + + ctx.static = isStatic; + ctx.private = isPrivate; + _ = ctx.access = { + has: isPrivate ? hasPrivateBrand.bind() : function(target) { + return name in target; + } + }; + + if (!isSetter) { + _.get = isPrivate + ? isMethod + ? function(_this) { + assertInstanceIfPrivate(_this); + return desc.value; + } + : bindPropCall("get", 0, assertInstanceIfPrivate) + : function(target) { + return target[name]; + }; + } + + if (!isMethod && !isGetter) { + _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) { + target[name] = value; + }; + } + + newValue = dec.call(decThis, isAccessor ? { get: desc.get, set: desc.set } : desc[key], ctx); + + decoratorFinishedRef.v = 1; + + if (isAccessor) { + if (typeof newValue === "object" && newValue) { + if ((_ = assertCallable(newValue.get, "accessor.get"))) { + desc.get = _; + } + if ((_ = assertCallable(newValue.set, "accessor.set"))) { + desc.set = _; + } + if ((_ = assertCallable(newValue.init, "accessor.init"))) { + init.unshift(_); + } + } else if (newValue !== void 0) { + throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); + } + } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) { + if (isField) { + init.unshift(newValue); + } else { + desc[key] = newValue; + } + } + } + + if (kind < 2) { + ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0)); + } + + if (!isField && !isClass) { + if (isPrivate) { + if (isAccessor) { + ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic)); + } else { + ret.push(isMethod ? desc[key] : assertCallable.call.bind(desc[key])); + } + } else { + defineProperty(Class, name, desc); + } + } + + return newValue; + } + + function applyMemberDecs() { + var ret = []; + var protoInitializers; + var staticInitializers; + + var pushInitializers = function(initializers) { + if (initializers) { + ret.push(createRunInitializers(initializers)); + } + }; + + var applyMemberDecsOfKind = function(isStatic, isField) { + for (var i = 0; i < memberDecs.length; i++) { + var decInfo = memberDecs[i]; + var kind = decInfo[1]; + var kindOnly = kind & 7; + + if ((kind & 8) == isStatic && !kindOnly == isField) { + var name = decInfo[2]; + var isPrivate = !!decInfo[3]; + var decoratorsHaveThis = kind & 16; + + applyDec( + isStatic ? targetClass : targetClass.prototype, + decInfo, + decoratorsHaveThis, + isPrivate ? "#" + name : toPropertyKey(name), + kindOnly, + kindOnly < 2 ? [] : isStatic ? (staticInitializers = staticInitializers || []) : (protoInitializers = protoInitializers || []), + ret, + !!isStatic, + isPrivate, + isField, + isStatic && isPrivate + ? function(_) { + return checkInRHS(_) === targetClass; + } + : instanceBrand + ); + } + } + }; + + applyMemberDecsOfKind(8, 0); + applyMemberDecsOfKind(0, 0); + applyMemberDecsOfKind(8, 1); + applyMemberDecsOfKind(0, 1); + + pushInitializers(protoInitializers); + pushInitializers(staticInitializers); + + return ret; + } + + function defineMetadata(Class) { + return defineProperty(Class, symbolMetadata, { configurable: true, enumerable: true, value: metadata }); + } + + if (parentClass !== undefined) { + metadata = parentClass[symbolMetadata]; + } + metadata = create(metadata == null ? null : metadata); + + _ = applyMemberDecs(); + + if (!hasClassDecs) { + defineMetadata(targetClass); + } + + return { + e: _, + get c() { + var initializers = []; + return (hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)]); + } + }; +} + +exports._ = _apply_decs_2311; diff --git a/node_modules/@swc/helpers/cjs/_array_like_to_array.cjs b/node_modules/@swc/helpers/cjs/_array_like_to_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..0f7d69d9e76e7ca53d41f29f4a3d864e1e335249 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_array_like_to_array.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _array_like_to_array(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} +exports._ = _array_like_to_array; diff --git a/node_modules/@swc/helpers/cjs/_array_with_holes.cjs b/node_modules/@swc/helpers/cjs/_array_with_holes.cjs new file mode 100644 index 0000000000000000000000000000000000000000..42f4e1b26973086051c1467889140adc791025b0 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_array_with_holes.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _array_with_holes(arr) { + if (Array.isArray(arr)) return arr; +} +exports._ = _array_with_holes; diff --git a/node_modules/@swc/helpers/cjs/_array_without_holes.cjs b/node_modules/@swc/helpers/cjs/_array_without_holes.cjs new file mode 100644 index 0000000000000000000000000000000000000000..7b3f62339149e229e028447506364d661ce60851 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_array_without_holes.cjs @@ -0,0 +1,8 @@ +"use strict"; + +var _array_like_to_array = require("./_array_like_to_array.cjs"); + +function _array_without_holes(arr) { + if (Array.isArray(arr)) return _array_like_to_array._(arr); +} +exports._ = _array_without_holes; diff --git a/node_modules/@swc/helpers/cjs/_assert_this_initialized.cjs b/node_modules/@swc/helpers/cjs/_assert_this_initialized.cjs new file mode 100644 index 0000000000000000000000000000000000000000..e7e220c7cbb9fc0338030bb6aeb46611bf888bde --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_assert_this_initialized.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _assert_this_initialized(self) { + if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + + return self; +} +exports._ = _assert_this_initialized; diff --git a/node_modules/@swc/helpers/cjs/_async_generator.cjs b/node_modules/@swc/helpers/cjs/_async_generator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..fa82617eed2285852cf9ca7208a9a6a8e6c20ece --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_async_generator.cjs @@ -0,0 +1,76 @@ +"use strict"; + +var _overload_yield = require("./_overload_yield.cjs"); + +function _async_generator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function(resolve, reject) { + var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; + if (back) back = back.next = request; + else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + var overloaded = value instanceof _overload_yield._; + Promise.resolve(overloaded ? value.v : value).then(function(arg) { + if (overloaded) { + var nextKey = key === "return" ? "return" : "next"; + if (!value.k || arg.done) return resume(nextKey, arg); + else arg = gen[nextKey](arg).value; + } + settle(result.done ? "return" : "normal", arg); + }, function(err) { + resume("throw", err); + }); + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ value: value, done: true }); + break; + case "throw": + front.reject(value); + break; + default: + front.resolve({ value: value, done: false }); + break; + } + front = front.next; + if (front) resume(front.key, front.arg); + else back = null; + } + + this._invoke = send; + + if (typeof gen.return !== "function") this.return = undefined; +} + +_async_generator.prototype[(typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"] = function() { + return this; +}; + +_async_generator.prototype.next = function(arg) { + return this._invoke("next", arg); +}; + +_async_generator.prototype.throw = function(arg) { + return this._invoke("throw", arg); +}; + +_async_generator.prototype.return = function(arg) { + return this._invoke("return", arg); +}; +exports._ = _async_generator; diff --git a/node_modules/@swc/helpers/cjs/_async_generator_delegate.cjs b/node_modules/@swc/helpers/cjs/_async_generator_delegate.cjs new file mode 100644 index 0000000000000000000000000000000000000000..1010df05ff20d1fa7503865736d2990ff7fe225b --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_async_generator_delegate.cjs @@ -0,0 +1,53 @@ +"use strict"; + +var _overload_yield = require("./_overload_yield.cjs"); + +function _async_generator_delegate(inner) { + var iter = {}, waiting = false; + + function pump(key, value) { + waiting = true; + value = new Promise(function(resolve) { + resolve(inner[key](value)); + }); + + return { done: false, value: new _overload_yield._(value, /* kind: delegate */ 1) }; + } + + iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function() { + return this; + }; + + iter.next = function(value) { + if (waiting) { + waiting = false; + + return value; + } + + return pump("next", value); + }; + + if (typeof inner.throw === "function") { + iter.throw = function(value) { + if (waiting) { + waiting = false; + throw value; + } + + return pump("throw", value); + }; + } + if (typeof inner.return === "function") { + iter.return = function(value) { + if (waiting) { + waiting = false; + return value; + } + return pump("return", value); + }; + } + + return iter; +} +exports._ = _async_generator_delegate; diff --git a/node_modules/@swc/helpers/cjs/_async_iterator.cjs b/node_modules/@swc/helpers/cjs/_async_iterator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..aef72537fc79b10c0abfd1f157479bb5b9a60b79 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_async_iterator.cjs @@ -0,0 +1,46 @@ +"use strict"; + +function _async_iterator(iterable) { + var method, async, sync, retry = 2; + for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { + if (async && null != (method = iterable[async])) return method.call(iterable); + if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); + async = "@@asyncIterator", sync = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); +} +function AsyncFromSyncIterator(s) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + + var done = r.done; + + return Promise.resolve(r.value).then(function(value) { + return { value: value, done: done }; + }); + } + + return AsyncFromSyncIterator = function(s) { + this.s = s, this.n = s.next; + }, + AsyncFromSyncIterator.prototype = { + s: null, + n: null, + + next: function() { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + return: function(value) { + var ret = this.s.return; + + return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); + }, + throw: function(value) { + var thr = this.s.return; + + return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); + } + }, + new AsyncFromSyncIterator(s); +} +exports._ = _async_iterator; diff --git a/node_modules/@swc/helpers/cjs/_async_to_generator.cjs b/node_modules/@swc/helpers/cjs/_async_to_generator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..b838d476ab9a4bdbc251dfe0cc507436f894e025 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_async_to_generator.cjs @@ -0,0 +1,33 @@ +"use strict"; + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) resolve(value); + else Promise.resolve(value).then(_next, _throw); +} +function _async_to_generator(fn) { + return function() { + var self = this, args = arguments; + + return new Promise(function(resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; +} +exports._ = _async_to_generator; diff --git a/node_modules/@swc/helpers/cjs/_await_async_generator.cjs b/node_modules/@swc/helpers/cjs/_await_async_generator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..aa1dc7285f253015e577a7020c4ca58f5788b7dc --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_await_async_generator.cjs @@ -0,0 +1,8 @@ +"use strict"; + +var _overload_yield = require("./_overload_yield.cjs"); + +function _await_async_generator(value) { + return new _overload_yield._(value, /* kind: await */ 0); +} +exports._ = _await_async_generator; diff --git a/node_modules/@swc/helpers/cjs/_await_value.cjs b/node_modules/@swc/helpers/cjs/_await_value.cjs new file mode 100644 index 0000000000000000000000000000000000000000..f82ebcdeff69825b5194160feba0ead28d51a370 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_await_value.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _await_value(value) { + this.wrapped = value; +} +exports._ = _await_value; diff --git a/node_modules/@swc/helpers/cjs/_call_super.cjs b/node_modules/@swc/helpers/cjs/_call_super.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c4e773346f8921501978757c3be07ab1dabbee85 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_call_super.cjs @@ -0,0 +1,19 @@ +"use strict"; + +var _get_prototype_of = require("./_get_prototype_of.cjs"); +var _is_native_reflect_construct = require("./_is_native_reflect_construct.cjs"); +var _possible_constructor_return = require("./_possible_constructor_return.cjs"); + +function _call_super(_this, derived, args) { + // Super + derived = _get_prototype_of._(derived); + return _possible_constructor_return._( + _this, + _is_native_reflect_construct._() + // NOTE: This doesn't work if this.__proto__.constructor has been modified. + ? Reflect.construct(derived, args || [], _get_prototype_of._(_this).constructor) + : derived.apply(_this, args) + ); +} + +exports._ = _call_super; diff --git a/node_modules/@swc/helpers/cjs/_check_private_redeclaration.cjs b/node_modules/@swc/helpers/cjs/_check_private_redeclaration.cjs new file mode 100644 index 0000000000000000000000000000000000000000..40390b827ea1a1424be0563a7d2458ec3882f8f5 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_check_private_redeclaration.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _check_private_redeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError("Cannot initialize the same private elements twice on an object"); + } +} +exports._ = _check_private_redeclaration; diff --git a/node_modules/@swc/helpers/cjs/_class_apply_descriptor_destructure.cjs b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_destructure.cjs new file mode 100644 index 0000000000000000000000000000000000000000..874289ff45ebebe15edcd6a3d3e8b0d1cf8041bf --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_destructure.cjs @@ -0,0 +1,25 @@ +"use strict"; + +function _class_apply_descriptor_destructure(receiver, descriptor) { + if (descriptor.set) { + if (!("__destrObj" in descriptor)) { + descriptor.__destrObj = { + set value(v) { + descriptor.set.call(receiver, v); + } + }; + } + + return descriptor.__destrObj; + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + + return descriptor; + } +} +exports._ = _class_apply_descriptor_destructure; diff --git a/node_modules/@swc/helpers/cjs/_class_apply_descriptor_get.cjs b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..b9a3f78edbc750ca32f238512ee5ab52effa5c86 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_get.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _class_apply_descriptor_get(receiver, descriptor) { + if (descriptor.get) return descriptor.get.call(receiver); + + return descriptor.value; +} +exports._ = _class_apply_descriptor_get; diff --git a/node_modules/@swc/helpers/cjs/_class_apply_descriptor_set.cjs b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_set.cjs new file mode 100644 index 0000000000000000000000000000000000000000..bcd2c75d877154d17a1261a5e6c8e70d68a85196 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_set.cjs @@ -0,0 +1,15 @@ +"use strict"; + +function _class_apply_descriptor_set(receiver, descriptor, value) { + if (descriptor.set) descriptor.set.call(receiver, value); + else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + descriptor.value = value; + } +} +exports._ = _class_apply_descriptor_set; diff --git a/node_modules/@swc/helpers/cjs/_class_apply_descriptor_update.cjs b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_update.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2c3e40fb9e8eb04c7f8b86f59ed83aad19ab4e48 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_apply_descriptor_update.cjs @@ -0,0 +1,30 @@ +"use strict"; + +function _class_apply_descriptor_update(receiver, descriptor) { + if (descriptor.set) { + if (!descriptor.get) throw new TypeError("attempted to read set only private field"); + + if (!("__destrWrapper" in descriptor)) { + descriptor.__destrWrapper = { + set value(v) { + descriptor.set.call(receiver, v); + }, + get value() { + return descriptor.get.call(receiver); + } + }; + } + + return descriptor.__destrWrapper; + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + + return descriptor; + } +} +exports._ = _class_apply_descriptor_update; diff --git a/node_modules/@swc/helpers/cjs/_class_call_check.cjs b/node_modules/@swc/helpers/cjs/_class_call_check.cjs new file mode 100644 index 0000000000000000000000000000000000000000..7d41f0d71fc3c9d2c481c0d9a2e7fff8009c03ae --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_call_check.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _class_call_check(instance, Constructor) { + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); +} +exports._ = _class_call_check; diff --git a/node_modules/@swc/helpers/cjs/_class_check_private_static_access.cjs b/node_modules/@swc/helpers/cjs/_class_check_private_static_access.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9adf4d4ba443f6bbe6b1279caade992b4050a669 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_check_private_static_access.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _class_check_private_static_access(receiver, classConstructor) { + if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); +} +exports._ = _class_check_private_static_access; diff --git a/node_modules/@swc/helpers/cjs/_class_check_private_static_field_descriptor.cjs b/node_modules/@swc/helpers/cjs/_class_check_private_static_field_descriptor.cjs new file mode 100644 index 0000000000000000000000000000000000000000..e73dce11590c9d2af02b2ec5fd9018c28250131e --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_check_private_static_field_descriptor.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _class_check_private_static_field_descriptor(descriptor, action) { + if (descriptor === undefined) { + throw new TypeError("attempted to " + action + " private static field before its declaration"); + } +} +exports._ = _class_check_private_static_field_descriptor; diff --git a/node_modules/@swc/helpers/cjs/_class_extract_field_descriptor.cjs b/node_modules/@swc/helpers/cjs/_class_extract_field_descriptor.cjs new file mode 100644 index 0000000000000000000000000000000000000000..16e5106b7f97cce089a840880c6e4b8c5562f3a3 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_extract_field_descriptor.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _class_extract_field_descriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance"); + + return privateMap.get(receiver); +} +exports._ = _class_extract_field_descriptor; diff --git a/node_modules/@swc/helpers/cjs/_class_name_tdz_error.cjs b/node_modules/@swc/helpers/cjs/_class_name_tdz_error.cjs new file mode 100644 index 0000000000000000000000000000000000000000..0bdcdd4f154de0d7aa3ac33515eb06f5f9b2bb6b --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_name_tdz_error.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _class_name_tdz_error(name) { + throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); +} +exports._ = _class_name_tdz_error; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_destructure.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_destructure.cjs new file mode 100644 index 0000000000000000000000000000000000000000..21a35f73f4f994af6777b399fb512feb6308fd05 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_destructure.cjs @@ -0,0 +1,10 @@ +"use strict"; + +var _class_apply_descriptor_destructure = require("./_class_apply_descriptor_destructure.cjs"); +var _class_extract_field_descriptor = require("./_class_extract_field_descriptor.cjs"); + +function _class_private_field_destructure(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor._(receiver, privateMap, "set"); + return _class_apply_descriptor_destructure._(receiver, descriptor); +} +exports._ = _class_private_field_destructure; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_get.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..8a23b3461c983de7cb4ffa683c230672fd038aa4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_get.cjs @@ -0,0 +1,10 @@ +"use strict"; + +var _class_apply_descriptor_get = require("./_class_apply_descriptor_get.cjs"); +var _class_extract_field_descriptor = require("./_class_extract_field_descriptor.cjs"); + +function _class_private_field_get(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor._(receiver, privateMap, "get"); + return _class_apply_descriptor_get._(receiver, descriptor); +} +exports._ = _class_private_field_get; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_init.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_init.cjs new file mode 100644 index 0000000000000000000000000000000000000000..0b208a0054987a298be54889920743ec370eb364 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_init.cjs @@ -0,0 +1,9 @@ +"use strict"; + +var _check_private_redeclaration = require("./_check_private_redeclaration.cjs"); + +function _class_private_field_init(obj, privateMap, value) { + _check_private_redeclaration._(obj, privateMap); + privateMap.set(obj, value); +} +exports._ = _class_private_field_init; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_loose_base.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_loose_base.cjs new file mode 100644 index 0000000000000000000000000000000000000000..cb0ba0623c29dd134b8a7379c098b1aa6d647086 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_loose_base.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _class_private_field_loose_base(receiver, privateKey) { + if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { + throw new TypeError("attempted to use private field on non-instance"); + } + + return receiver; +} +exports._ = _class_private_field_loose_base; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_loose_key.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_loose_key.cjs new file mode 100644 index 0000000000000000000000000000000000000000..8301830c0ac352909c9dd07c1b335ccec009eb2d --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_loose_key.cjs @@ -0,0 +1,8 @@ +"use strict"; + +var id = 0; + +function _class_private_field_loose_key(name) { + return "__private_" + id++ + "_" + name; +} +exports._ = _class_private_field_loose_key; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_set.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_set.cjs new file mode 100644 index 0000000000000000000000000000000000000000..317e878b64c0b63ee1e132a6b11a08cf5da34f04 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_set.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _class_apply_descriptor_set = require("./_class_apply_descriptor_set.cjs"); +var _class_extract_field_descriptor = require("./_class_extract_field_descriptor.cjs"); + +function _class_private_field_set(receiver, privateMap, value) { + var descriptor = _class_extract_field_descriptor._(receiver, privateMap, "set"); + _class_apply_descriptor_set._(receiver, descriptor, value); + return value; +} +exports._ = _class_private_field_set; diff --git a/node_modules/@swc/helpers/cjs/_class_private_field_update.cjs b/node_modules/@swc/helpers/cjs/_class_private_field_update.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2e713fa4f457d1c7756ad8ef9f46b82d04dbd7be --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_field_update.cjs @@ -0,0 +1,10 @@ +"use strict"; + +var _class_apply_descriptor_update = require("./_class_apply_descriptor_update.cjs"); +var _class_extract_field_descriptor = require("./_class_extract_field_descriptor.cjs"); + +function _class_private_field_update(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor._(receiver, privateMap, "update"); + return _class_apply_descriptor_update._(receiver, descriptor); +} +exports._ = _class_private_field_update; diff --git a/node_modules/@swc/helpers/cjs/_class_private_method_get.cjs b/node_modules/@swc/helpers/cjs/_class_private_method_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..b5ee8b4f4d4c030819c37ae1613eefb79b32bf61 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_method_get.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _class_private_method_get(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); + + return fn; +} +exports._ = _class_private_method_get; diff --git a/node_modules/@swc/helpers/cjs/_class_private_method_init.cjs b/node_modules/@swc/helpers/cjs/_class_private_method_init.cjs new file mode 100644 index 0000000000000000000000000000000000000000..1d84b51fce13c9c0b330df607c65e0f3565c384d --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_method_init.cjs @@ -0,0 +1,9 @@ +"use strict"; + +var _check_private_redeclaration = require("./_check_private_redeclaration.cjs"); + +function _class_private_method_init(obj, privateSet) { + _check_private_redeclaration._(obj, privateSet); + privateSet.add(obj); +} +exports._ = _class_private_method_init; diff --git a/node_modules/@swc/helpers/cjs/_class_private_method_set.cjs b/node_modules/@swc/helpers/cjs/_class_private_method_set.cjs new file mode 100644 index 0000000000000000000000000000000000000000..db06178e306efe294c7cb0a759f2827e46222ca4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_private_method_set.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _class_private_method_set() { + throw new TypeError("attempted to reassign private method"); +} +exports._ = _class_private_method_set; diff --git a/node_modules/@swc/helpers/cjs/_class_static_private_field_destructure.cjs b/node_modules/@swc/helpers/cjs/_class_static_private_field_destructure.cjs new file mode 100644 index 0000000000000000000000000000000000000000..512a2e38962e6702a2dcf27496e1e7c2610eff1b --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_static_private_field_destructure.cjs @@ -0,0 +1,13 @@ +"use strict"; + +var _class_apply_descriptor_destructure = require("./_class_apply_descriptor_destructure.cjs"); +var _class_check_private_static_access = require("./_class_check_private_static_access.cjs"); +var _class_check_private_static_field_descriptor = require("./_class_check_private_static_field_descriptor.cjs"); + +function _class_static_private_field_destructure(receiver, classConstructor, descriptor) { + _class_check_private_static_access._(receiver, classConstructor); + _class_check_private_static_field_descriptor._(descriptor, "set"); + + return _class_apply_descriptor_destructure._(receiver, descriptor); +} +exports._ = _class_static_private_field_destructure; diff --git a/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_get.cjs b/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..43a1f0d00b5c67f2f56097090c53193708e54d51 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_get.cjs @@ -0,0 +1,13 @@ +"use strict"; + +var _class_apply_descriptor_get = require("./_class_apply_descriptor_get.cjs"); +var _class_check_private_static_access = require("./_class_check_private_static_access.cjs"); +var _class_check_private_static_field_descriptor = require("./_class_check_private_static_field_descriptor.cjs"); + +function _class_static_private_field_spec_get(receiver, classConstructor, descriptor) { + _class_check_private_static_access._(receiver, classConstructor); + _class_check_private_static_field_descriptor._(descriptor, "get"); + + return _class_apply_descriptor_get._(receiver, descriptor); +} +exports._ = _class_static_private_field_spec_get; diff --git a/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_set.cjs b/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_set.cjs new file mode 100644 index 0000000000000000000000000000000000000000..93a69822241d8dfbaab83be35950410a57abc9de --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_static_private_field_spec_set.cjs @@ -0,0 +1,14 @@ +"use strict"; + +var _class_apply_descriptor_set = require("./_class_apply_descriptor_set.cjs"); +var _class_check_private_static_access = require("./_class_check_private_static_access.cjs"); +var _class_check_private_static_field_descriptor = require("./_class_check_private_static_field_descriptor.cjs"); + +function _class_static_private_field_spec_set(receiver, classConstructor, descriptor, value) { + _class_check_private_static_access._(receiver, classConstructor); + _class_check_private_static_field_descriptor._(descriptor, "set"); + _class_apply_descriptor_set._(receiver, descriptor, value); + + return value; +} +exports._ = _class_static_private_field_spec_set; diff --git a/node_modules/@swc/helpers/cjs/_class_static_private_field_update.cjs b/node_modules/@swc/helpers/cjs/_class_static_private_field_update.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c8ae667865aaeae12336e3e448cecd32aa4ea577 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_static_private_field_update.cjs @@ -0,0 +1,13 @@ +"use strict"; + +var _class_apply_descriptor_update = require("./_class_apply_descriptor_update.cjs"); +var _class_check_private_static_access = require("./_class_check_private_static_access.cjs"); +var _class_check_private_static_field_descriptor = require("./_class_check_private_static_field_descriptor.cjs"); + +function _class_static_private_field_update(receiver, classConstructor, descriptor) { + _class_check_private_static_access._(receiver, classConstructor); + _class_check_private_static_field_descriptor._(descriptor, "update"); + + return _class_apply_descriptor_update._(receiver, descriptor); +} +exports._ = _class_static_private_field_update; diff --git a/node_modules/@swc/helpers/cjs/_class_static_private_method_get.cjs b/node_modules/@swc/helpers/cjs/_class_static_private_method_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..3c1506faf5566397df5adcd2b288d9637987ab0f --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_class_static_private_method_get.cjs @@ -0,0 +1,10 @@ +"use strict"; + +var _class_check_private_static_access = require("./_class_check_private_static_access.cjs"); + +function _class_static_private_method_get(receiver, classConstructor, method) { + _class_check_private_static_access._(receiver, classConstructor); + + return method; +} +exports._ = _class_static_private_method_get; diff --git a/node_modules/@swc/helpers/cjs/_construct.cjs b/node_modules/@swc/helpers/cjs/_construct.cjs new file mode 100644 index 0000000000000000000000000000000000000000..cfd7277d374b269699f54237b495d07bdd1002be --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_construct.cjs @@ -0,0 +1,22 @@ +"use strict"; + +var _is_native_reflect_construct = require("./_is_native_reflect_construct.cjs"); +var _set_prototype_of = require("./_set_prototype_of.cjs"); +function _construct(Parent, args, Class) { + if (_is_native_reflect_construct._()) exports._ = _construct = Reflect.construct; + else { + exports._ = _construct = function construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + + if (Class) _set_prototype_of._(instance, Class.prototype); + + return instance; + }; + } + + return _construct.apply(null, arguments); +} +exports._ = _construct; diff --git a/node_modules/@swc/helpers/cjs/_create_class.cjs b/node_modules/@swc/helpers/cjs/_create_class.cjs new file mode 100644 index 0000000000000000000000000000000000000000..1c3fe74a53de887653482cc9801317f3b455fe75 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_create_class.cjs @@ -0,0 +1,20 @@ +"use strict"; + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + + if ("value" in descriptor) descriptor.writable = true; + + Object.defineProperty(target, descriptor.key, descriptor); + } +} +function _create_class(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + + return Constructor; +} +exports._ = _create_class; diff --git a/node_modules/@swc/helpers/cjs/_create_for_of_iterator_helper_loose.cjs b/node_modules/@swc/helpers/cjs/_create_for_of_iterator_helper_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9a5042d3419ab752053858715c3b07dfda0d5225 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_create_for_of_iterator_helper_loose.cjs @@ -0,0 +1,24 @@ +"use strict"; + +var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs"); + +function _create_for_of_iterator_helper_loose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + + if (it) return (it = it.call(o)).next.bind(it); + // Fallback for engines without symbol support + if (Array.isArray(o) || (it = _unsupported_iterable_to_array._(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + + var i = 0; + + return function() { + if (i >= o.length) return { done: true }; + + return { done: false, value: o[i++] }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +exports._ = _create_for_of_iterator_helper_loose; diff --git a/node_modules/@swc/helpers/cjs/_create_super.cjs b/node_modules/@swc/helpers/cjs/_create_super.cjs new file mode 100644 index 0000000000000000000000000000000000000000..dc7f3cbd6ed02332a120373ffb8acfbb677fdbef --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_create_super.cjs @@ -0,0 +1,23 @@ +"use strict"; + +var _get_prototype_of = require("./_get_prototype_of.cjs"); +var _is_native_reflect_construct = require("./_is_native_reflect_construct.cjs"); +var _possible_constructor_return = require("./_possible_constructor_return.cjs"); + +function _create_super(Derived) { + var hasNativeReflectConstruct = _is_native_reflect_construct._(); + + return function _createSuperInternal() { + var Super = _get_prototype_of._(Derived), result; + + if (hasNativeReflectConstruct) { + var NewTarget = _get_prototype_of._(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possible_constructor_return._(this, result); + }; +} +exports._ = _create_super; diff --git a/node_modules/@swc/helpers/cjs/_decorate.cjs b/node_modules/@swc/helpers/cjs/_decorate.cjs new file mode 100644 index 0000000000000000000000000000000000000000..13b171dacd19eb2db3e8c394510c3358c8a041f5 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_decorate.cjs @@ -0,0 +1,270 @@ +"use strict"; + +var _to_array = require("./_to_array.cjs"); +var _to_property_key = require("./_to_property_key.cjs"); +var _type_of = require("./_type_of.cjs"); + +function _decorate(decorators, factory, superClass) { + var r = factory(function initialize(O) { + _initializeInstanceElements(O, decorated.elements); + }, superClass); + var decorated = _decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); + _initializeClassElements(r.F, decorated.elements); + + return _runClassFinishers(r.F, decorated.finishers); +} + +function _createElementDescriptor(def) { + var key = _to_property_key._(def.key); + var descriptor; + + if (def.kind === "method") { + descriptor = { value: def.value, writable: true, configurable: true, enumerable: false }; + Object.defineProperty(def.value, "name", { value: _type_of._(key) === "symbol" ? "" : key, configurable: true }); + } else if (def.kind === "get") descriptor = { get: def.value, configurable: true, enumerable: false }; + else if (def.kind === "set") descriptor = { set: def.value, configurable: true, enumerable: false }; + else if (def.kind === "field") descriptor = { configurable: true, writable: true, enumerable: true }; + + var element = { kind: def.kind === "field" ? "field" : "method", key: key, placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", descriptor: descriptor }; + + if (def.decorators) element.decorators = def.decorators; + + if (def.kind === "field") element.initializer = def.value; + + return element; +} +function _coalesceGetterSetter(element, other) { + if (element.descriptor.get !== undefined) other.descriptor.get = element.descriptor.get; + else other.descriptor.set = element.descriptor.set; +} +function _coalesceClassElements(elements) { + var newElements = []; + var isSameElement = function isSameElement(other) { + return other.kind === "method" && other.key === element.key && other.placement === element.placement; + }; + + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + var other; + + if (element.kind === "method" && (other = newElements.find(isSameElement))) { + if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { + if (_hasDecorators(element) || _hasDecorators(other)) { + throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); + } + other.descriptor = element.descriptor; + } else { + if (_hasDecorators(element)) { + if (_hasDecorators(other)) { + throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); + } + other.decorators = element.decorators; + } + _coalesceGetterSetter(element, other); + } + } else { + newElements.push(element); + } + } + + return newElements; +} +function _hasDecorators(element) { + return element.decorators && element.decorators.length; +} +function _isDataDescriptor(desc) { + return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); +} +function _initializeClassElements(F, elements) { + var proto = F.prototype; + ["method", "field"].forEach(function(kind) { + elements.forEach(function(element) { + var placement = element.placement; + if (element.kind === kind && (placement === "static" || placement === "prototype")) { + var receiver = placement === "static" ? F : proto; + _defineClassElement(receiver, element); + } + }); + }); +} +function _initializeInstanceElements(O, elements) { + ["method", "field"].forEach(function(kind) { + elements.forEach(function(element) { + if (element.kind === kind && element.placement === "own") _defineClassElement(O, element); + }); + }); +} +function _defineClassElement(receiver, element) { + var descriptor = element.descriptor; + if (element.kind === "field") { + var initializer = element.initializer; + descriptor = { enumerable: descriptor.enumerable, writable: descriptor.writable, configurable: descriptor.configurable, value: initializer === void 0 ? void 0 : initializer.call(receiver) }; + } + Object.defineProperty(receiver, element.key, descriptor); +} +function _decorateClass(elements, decorators) { + var newElements = []; + var finishers = []; + var placements = { static: [], prototype: [], own: [] }; + elements.forEach(function(element) { + _addElementPlacement(element, placements); + }); + elements.forEach(function(element) { + if (!_hasDecorators(element)) return newElements.push(element); + var elementFinishersExtras = _decorateElement(element, placements); + newElements.push(elementFinishersExtras.element); + newElements.push.apply(newElements, elementFinishersExtras.extras); + finishers.push.apply(finishers, elementFinishersExtras.finishers); + }); + if (!decorators) return { elements: newElements, finishers: finishers }; + var result = _decorateConstructor(newElements, decorators); + finishers.push.apply(finishers, result.finishers); + result.finishers = finishers; + + return result; +} +function _addElementPlacement(element, placements, silent) { + var keys = placements[element.placement]; + if (!silent && keys.indexOf(element.key) !== -1) throw new TypeError("Duplicated element (" + element.key + ")"); + keys.push(element.key); +} +function _decorateElement(element, placements) { + var extras = []; + var finishers = []; + for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { + var keys = placements[element.placement]; + keys.splice(keys.indexOf(element.key), 1); + var elementObject = _fromElementDescriptor(element); + var elementFinisherExtras = _toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); + element = elementFinisherExtras.element; + _addElementPlacement(element, placements); + if (elementFinisherExtras.finisher) finishers.push(elementFinisherExtras.finisher); + var newExtras = elementFinisherExtras.extras; + if (newExtras) { + for (var j = 0; j < newExtras.length; j++) _addElementPlacement(newExtras[j], placements); + extras.push.apply(extras, newExtras); + } + } + + return { element: element, finishers: finishers, extras: extras }; +} +function _decorateConstructor(elements, decorators) { + var finishers = []; + for (var i = decorators.length - 1; i >= 0; i--) { + var obj = _fromClassDescriptor(elements); + var elementsAndFinisher = _toClassDescriptor((0, decorators[i])(obj) || obj); + if (elementsAndFinisher.finisher !== undefined) finishers.push(elementsAndFinisher.finisher); + if (elementsAndFinisher.elements !== undefined) { + elements = elementsAndFinisher.elements; + for (var j = 0; j < elements.length - 1; j++) { + for (var k = j + 1; k < elements.length; k++) { + if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { + throw new TypeError("Duplicated element (" + elements[j].key + ")"); + } + } + } + } + } + + return { elements: elements, finishers: finishers }; +} +function _fromElementDescriptor(element) { + var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor }; + var desc = { value: "Descriptor", configurable: true }; + Object.defineProperty(obj, Symbol.toStringTag, desc); + if (element.kind === "field") obj.initializer = element.initializer; + + return obj; +} +function _toElementDescriptors(elementObjects) { + if (elementObjects === undefined) return; + + return _to_array._(elementObjects).map(function(elementObject) { + var element = _toElementDescriptor(elementObject); + _disallowProperty(elementObject, "finisher", "An element descriptor"); + _disallowProperty(elementObject, "extras", "An element descriptor"); + + return element; + }); +} +function _toElementDescriptor(elementObject) { + var kind = String(elementObject.kind); + if (kind !== "method" && kind !== "field") { + throw new TypeError("An element descriptor's .kind property must be either \"method\" or" + " \"field\", but a decorator created an element descriptor with" + " .kind \"" + kind + "\""); + } + var key = _to_property_key._(elementObject.key); + var placement = String(elementObject.placement); + if (placement !== "static" && placement !== "prototype" && placement !== "own") { + throw new TypeError( + "An element descriptor's .placement property must be one of \"static\"," + + " \"prototype\" or \"own\", but a decorator created an element descriptor" + + " with .placement \"" + + placement + + "\"" + ); + } + var descriptor = elementObject.descriptor; + _disallowProperty(elementObject, "elements", "An element descriptor"); + var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) }; + if (kind !== "field") _disallowProperty(elementObject, "initializer", "A method descriptor"); + else { + _disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); + _disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); + _disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); + element.initializer = elementObject.initializer; + } + + return element; +} +function _toElementFinisherExtras(elementObject) { + var element = _toElementDescriptor(elementObject); + var finisher = _optionalCallableProperty(elementObject, "finisher"); + var extras = _toElementDescriptors(elementObject.extras); + + return { element: element, finisher: finisher, extras: extras }; +} +function _fromClassDescriptor(elements) { + var obj = { kind: "class", elements: elements.map(_fromElementDescriptor) }; + var desc = { value: "Descriptor", configurable: true }; + Object.defineProperty(obj, Symbol.toStringTag, desc); + + return obj; +} +function _toClassDescriptor(obj) { + var kind = String(obj.kind); + if (kind !== "class") { + throw new TypeError("A class descriptor's .kind property must be \"class\", but a decorator" + " created a class descriptor with .kind \"" + kind + "\""); + } + _disallowProperty(obj, "key", "A class descriptor"); + _disallowProperty(obj, "placement", "A class descriptor"); + _disallowProperty(obj, "descriptor", "A class descriptor"); + _disallowProperty(obj, "initializer", "A class descriptor"); + _disallowProperty(obj, "extras", "A class descriptor"); + var finisher = _optionalCallableProperty(obj, "finisher"); + var elements = _toElementDescriptors(obj.elements); + + return { elements: elements, finisher: finisher }; +} +function _disallowProperty(obj, name, objectType) { + if (obj[name] !== undefined) throw new TypeError(objectType + " can't have a ." + name + " property."); +} +function _optionalCallableProperty(obj, name) { + var value = obj[name]; + if (value !== undefined && typeof value !== "function") { + throw new TypeError("Expected '" + name + "' to be a function"); + } + + return value; +} +function _runClassFinishers(constructor, finishers) { + for (var i = 0; i < finishers.length; i++) { + var newConstructor = (0, finishers[i])(constructor); + if (newConstructor !== undefined) { + if (typeof newConstructor !== "function") throw new TypeError("Finishers must return a constructor."); + constructor = newConstructor; + } + } + + return constructor; +} +exports._ = _decorate; diff --git a/node_modules/@swc/helpers/cjs/_defaults.cjs b/node_modules/@swc/helpers/cjs/_defaults.cjs new file mode 100644 index 0000000000000000000000000000000000000000..eb832e9b24b118062ef36ab70a9011529bde1254 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_defaults.cjs @@ -0,0 +1,15 @@ +"use strict"; + +function _defaults(obj, defaults) { + var keys = Object.getOwnPropertyNames(defaults); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = Object.getOwnPropertyDescriptor(defaults, key); + + if (value && value.configurable && obj[key] === undefined) Object.defineProperty(obj, key, value); + } + + return obj; +} +exports._ = _defaults; diff --git a/node_modules/@swc/helpers/cjs/_define_enumerable_properties.cjs b/node_modules/@swc/helpers/cjs/_define_enumerable_properties.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6c4c3343bde30f02f7703a8b4b42835bef67416e --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_define_enumerable_properties.cjs @@ -0,0 +1,26 @@ +"use strict"; + +function _define_enumerable_properties(obj, descs) { + for (var key in descs) { + var desc = descs[key]; + desc.configurable = desc.enumerable = true; + + if ("value" in desc) desc.writable = true; + + Object.defineProperty(obj, key, desc); + } + + if (Object.getOwnPropertySymbols) { + var objectSymbols = Object.getOwnPropertySymbols(descs); + for (var i = 0; i < objectSymbols.length; i++) { + var sym = objectSymbols[i]; + var desc = descs[sym]; + desc.configurable = desc.enumerable = true; + if ("value" in desc) desc.writable = true; + Object.defineProperty(obj, sym, desc); + } + } + + return obj; +} +exports._ = _define_enumerable_properties; diff --git a/node_modules/@swc/helpers/cjs/_define_property.cjs b/node_modules/@swc/helpers/cjs/_define_property.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9063d6e99599c50b49fc5826b0777ba93c896598 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_define_property.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _define_property(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); + } else obj[key] = value; + + return obj; +} +exports._ = _define_property; diff --git a/node_modules/@swc/helpers/cjs/_dispose.cjs b/node_modules/@swc/helpers/cjs/_dispose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..84ec384aaac7f9c9e681d46bee9acd42dd29cad6 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_dispose.cjs @@ -0,0 +1,43 @@ +"use strict"; + +/* @minVersion 7.22.0 */ +function dispose_SuppressedError(error, suppressed) { + if (typeof SuppressedError !== "undefined") { + // eslint-disable-next-line no-undef + dispose_SuppressedError = SuppressedError; + } else { + dispose_SuppressedError = function SuppressedError(error, suppressed) { + this.suppressed = suppressed; + this.error = error; + this.stack = new Error().stack; + }; + dispose_SuppressedError.prototype = Object.create(Error.prototype, { constructor: { value: dispose_SuppressedError, writable: true, configurable: true } }); + } + return new dispose_SuppressedError(error, suppressed); +} + +function _dispose(stack, error, hasError) { + function next() { + while (stack.length > 0) { + try { + var r = stack.pop(); + var p = r.d.call(r.v); + if (r.a) return Promise.resolve(p).then(next, err); + } catch (e) { + return err(e); + } + } + if (hasError) throw error; + } + + function err(e) { + error = hasError ? new dispose_SuppressedError(e, error) : e; + hasError = true; + + return next(); + } + + return next(); +} + +exports._ = _dispose; diff --git a/node_modules/@swc/helpers/cjs/_export_star.cjs b/node_modules/@swc/helpers/cjs/_export_star.cjs new file mode 100644 index 0000000000000000000000000000000000000000..51af20b9e994163af66aaf53cf58dfa7663e72f8 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_export_star.cjs @@ -0,0 +1,17 @@ +"use strict"; + +function _export_star(from, to) { + Object.keys(from).forEach(function(k) { + if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { + Object.defineProperty(to, k, { + enumerable: true, + get: function() { + return from[k]; + } + }); + } + }); + + return from; +} +exports._ = _export_star; diff --git a/node_modules/@swc/helpers/cjs/_extends.cjs b/node_modules/@swc/helpers/cjs/_extends.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2bb159299b872f6e1a6dafa3e7ca18000a90c186 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_extends.cjs @@ -0,0 +1,15 @@ +"use strict"; + +function _extends() { + exports._ = _extends = Object.assign || function assign(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + + return target; + }; + + return _extends.apply(this, arguments); +} +exports._ = _extends; diff --git a/node_modules/@swc/helpers/cjs/_get.cjs b/node_modules/@swc/helpers/cjs/_get.cjs new file mode 100644 index 0000000000000000000000000000000000000000..1c5bfcd0044b2c43c1ef7d45b7a292471453cc1f --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_get.cjs @@ -0,0 +1,23 @@ +"use strict"; + +var _super_prop_base = require("./_super_prop_base.cjs"); + +function _get(target, property, receiver) { + if (typeof Reflect !== "undefined" && Reflect.get) exports._ = _get = Reflect.get; + else { + exports._ = _get = function get(target, property, receiver) { + var base = _super_prop_base._(target, property); + + if (!base) return; + + var desc = Object.getOwnPropertyDescriptor(base, property); + + if (desc.get) return desc.get.call(receiver || target); + + return desc.value; + }; + } + + return _get(target, property, receiver || target); +} +exports._ = _get; diff --git a/node_modules/@swc/helpers/cjs/_get_prototype_of.cjs b/node_modules/@swc/helpers/cjs/_get_prototype_of.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6ef956a17db6a42b9af3afd266d8691a010ea7b0 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_get_prototype_of.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _get_prototype_of(o) { + exports._ = _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + + return _get_prototype_of(o); +} +exports._ = _get_prototype_of; diff --git a/node_modules/@swc/helpers/cjs/_identity.cjs b/node_modules/@swc/helpers/cjs/_identity.cjs new file mode 100644 index 0000000000000000000000000000000000000000..aab1b0da75eb0d834eb113a4c90d43932140d5c4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_identity.cjs @@ -0,0 +1,7 @@ +"use strict"; + +function _identity(x) { + return x; +} + +exports._ = _identity; diff --git a/node_modules/@swc/helpers/cjs/_inherits.cjs b/node_modules/@swc/helpers/cjs/_inherits.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c803df5ff37af9225c61961cedaa1ef4dae77d22 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_inherits.cjs @@ -0,0 +1,14 @@ +"use strict"; + +var _set_prototype_of = require("./_set_prototype_of.cjs"); + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); + + if (superClass) _set_prototype_of._(subClass, superClass); +} +exports._ = _inherits; diff --git a/node_modules/@swc/helpers/cjs/_inherits_loose.cjs b/node_modules/@swc/helpers/cjs/_inherits_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..30f35415852b0c2caf116ea045b2d882e4b0dda4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_inherits_loose.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _inherits_loose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} +exports._ = _inherits_loose; diff --git a/node_modules/@swc/helpers/cjs/_initializer_define_property.cjs b/node_modules/@swc/helpers/cjs/_initializer_define_property.cjs new file mode 100644 index 0000000000000000000000000000000000000000..ac28e5d83ae73e680072ebbca9c061beb1975ab1 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_initializer_define_property.cjs @@ -0,0 +1,13 @@ +"use strict"; + +function _initializer_define_property(target, property, descriptor, context) { + if (!descriptor) return; + + Object.defineProperty(target, property, { + enumerable: descriptor.enumerable, + configurable: descriptor.configurable, + writable: descriptor.writable, + value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 + }); +} +exports._ = _initializer_define_property; diff --git a/node_modules/@swc/helpers/cjs/_initializer_warning_helper.cjs b/node_modules/@swc/helpers/cjs/_initializer_warning_helper.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2c333dbb3f7ec41ffb18ec14efc62452ddbabc2a --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_initializer_warning_helper.cjs @@ -0,0 +1,11 @@ +"use strict"; + +function _initializer_warning_helper(descriptor, context) { + throw new Error( + "Decorating class property failed. Please ensure that " + + "proposal-class-properties is enabled and set to use loose mode. " + + "To use proposal-class-properties in spec mode with decorators, wait for " + + "the next major version of decorators in stage 2." + ); +} +exports._ = _initializer_warning_helper; diff --git a/node_modules/@swc/helpers/cjs/_instanceof.cjs b/node_modules/@swc/helpers/cjs/_instanceof.cjs new file mode 100644 index 0000000000000000000000000000000000000000..d213ddfdee4572852255b6841efaa5f4681998a5 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_instanceof.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _instanceof(left, right) { + "@swc/helpers - instanceof"; + + if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { + return !!right[Symbol.hasInstance](left); + } else return left instanceof right; +} +exports._ = _instanceof; diff --git a/node_modules/@swc/helpers/cjs/_interop_require_default.cjs b/node_modules/@swc/helpers/cjs/_interop_require_default.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c9e5240c07c154593baef4918909858ab4bf3cb7 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_interop_require_default.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} +exports._ = _interop_require_default; diff --git a/node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs b/node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9c2abcded61a6653b41a2cfece1c1397fc336619 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs @@ -0,0 +1,38 @@ +"use strict"; + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) return obj; + if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj }; + + var cache = _getRequireWildcardCache(nodeInterop); + + if (cache && cache.has(obj)) return cache.get(obj); + + var newObj = { __proto__: null }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + + for (var key in obj) { + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + } + + newObj.default = obj; + + if (cache) cache.set(obj, newObj); + + return newObj; +} +exports._ = _interop_require_wildcard; diff --git a/node_modules/@swc/helpers/cjs/_is_native_function.cjs b/node_modules/@swc/helpers/cjs/_is_native_function.cjs new file mode 100644 index 0000000000000000000000000000000000000000..920371163fef3dfac24eb5071a000fa851267055 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_is_native_function.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _is_native_function(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} +exports._ = _is_native_function; diff --git a/node_modules/@swc/helpers/cjs/_is_native_reflect_construct.cjs b/node_modules/@swc/helpers/cjs/_is_native_reflect_construct.cjs new file mode 100644 index 0000000000000000000000000000000000000000..42ea82f5a5b4f26255d6fdea9981943b2ae2e67b --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_is_native_reflect_construct.cjs @@ -0,0 +1,18 @@ +"use strict"; + +function _is_native_reflect_construct() { + // Since Reflect.construct can't be properly polyfilled, some + // implementations (e.g. core-js@2) don't set the correct internal slots. + // Those polyfills don't allow us to subclass built-ins, so we need to + // use our fallback implementation. + try { + // If the internal slots aren't set, this throws an error similar to + // TypeError: this is not a Boolean object. + var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); + } catch (_) {} + return (exports._ = _is_native_reflect_construct = function() { + return !!result; + })(); +} + +exports._ = _is_native_reflect_construct; diff --git a/node_modules/@swc/helpers/cjs/_iterable_to_array.cjs b/node_modules/@swc/helpers/cjs/_iterable_to_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..cc73cf5f044421344ca37d30819a69236e8b35a6 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_iterable_to_array.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _iterable_to_array(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) { + return Array.from(iter); + } +} +exports._ = _iterable_to_array; diff --git a/node_modules/@swc/helpers/cjs/_iterable_to_array_limit.cjs b/node_modules/@swc/helpers/cjs/_iterable_to_array_limit.cjs new file mode 100644 index 0000000000000000000000000000000000000000..634876bc7ab1d292ef58f75fd308f1cfc6d2d787 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_iterable_to_array_limit.cjs @@ -0,0 +1,31 @@ +"use strict"; + +function _iterable_to_array_limit(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} +exports._ = _iterable_to_array_limit; diff --git a/node_modules/@swc/helpers/cjs/_iterable_to_array_limit_loose.cjs b/node_modules/@swc/helpers/cjs/_iterable_to_array_limit_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..78ddf90baf79d65ddef6d78a39082ad9606b9e0a --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_iterable_to_array_limit_loose.cjs @@ -0,0 +1,17 @@ +"use strict"; + +function _iterable_to_array_limit_loose(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + + if (_i == null) return; + + var _arr = []; + + for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) { + _arr.push(_step.value); + if (i && _arr.length === i) break; + } + + return _arr; +} +exports._ = _iterable_to_array_limit_loose; diff --git a/node_modules/@swc/helpers/cjs/_jsx.cjs b/node_modules/@swc/helpers/cjs/_jsx.cjs new file mode 100644 index 0000000000000000000000000000000000000000..bf1a20b0a75541350287eaca450da98bd317c6d1 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_jsx.cjs @@ -0,0 +1,28 @@ +"use strict"; + +var REACT_ELEMENT_TYPE; +function _jsx(type, props, key, children) { + if (!REACT_ELEMENT_TYPE) { + REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; + } + + var defaultProps = type && type.defaultProps; + var childrenLength = arguments.length - 3; + + if (!props && childrenLength !== 0) props = { children: void 0 }; + if (props && defaultProps) { + for (var propName in defaultProps) { + if (props[propName] === void 0) props[propName] = defaultProps[propName]; + else if (!props) props = defaultProps || {}; + } + } + if (childrenLength === 1) props.children = children; + else if (childrenLength > 1) { + var childArray = new Array(childrenLength); + for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; + props.children = childArray; + } + + return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : "" + key, ref: null, props: props, _owner: null }; +} +exports._ = _jsx; diff --git a/node_modules/@swc/helpers/cjs/_new_arrow_check.cjs b/node_modules/@swc/helpers/cjs/_new_arrow_check.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2df59f9cfb0c08c8d75f3dc0e5eeab6218747c51 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_new_arrow_check.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _new_arrow_check(innerThis, boundThis) { + if (innerThis !== boundThis) throw new TypeError("Cannot instantiate an arrow function"); +} +exports._ = _new_arrow_check; diff --git a/node_modules/@swc/helpers/cjs/_non_iterable_rest.cjs b/node_modules/@swc/helpers/cjs/_non_iterable_rest.cjs new file mode 100644 index 0000000000000000000000000000000000000000..3baab4b6c8ccb85a52e1c619f14d549dbd75c0ea --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_non_iterable_rest.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _non_iterable_rest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +exports._ = _non_iterable_rest; diff --git a/node_modules/@swc/helpers/cjs/_non_iterable_spread.cjs b/node_modules/@swc/helpers/cjs/_non_iterable_spread.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c213de5586d0c8cf40f8f73edb7681c2f000ac2c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_non_iterable_spread.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _non_iterable_spread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +exports._ = _non_iterable_spread; diff --git a/node_modules/@swc/helpers/cjs/_object_destructuring_empty.cjs b/node_modules/@swc/helpers/cjs/_object_destructuring_empty.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c84fb6686f9dcdfde4af9c5a8837396badb00a9c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_object_destructuring_empty.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _object_destructuring_empty(o) { + if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o); + + return o; +} +exports._ = _object_destructuring_empty; diff --git a/node_modules/@swc/helpers/cjs/_object_spread.cjs b/node_modules/@swc/helpers/cjs/_object_spread.cjs new file mode 100644 index 0000000000000000000000000000000000000000..45cec7105d36b48d0a9c80a6a9b27282496393fd --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_object_spread.cjs @@ -0,0 +1,25 @@ +"use strict"; + +var _define_property = require("./_define_property.cjs"); + +function _object_spread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === "function") { + ownKeys = ownKeys.concat( + Object.getOwnPropertySymbols(source).filter(function(sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + }) + ); + } + + ownKeys.forEach(function(key) { + _define_property._(target, key, source[key]); + }); + } + + return target; +} +exports._ = _object_spread; diff --git a/node_modules/@swc/helpers/cjs/_object_spread_props.cjs b/node_modules/@swc/helpers/cjs/_object_spread_props.cjs new file mode 100644 index 0000000000000000000000000000000000000000..1c27f1c3a95d32f6ad730dc9889c63629a0b7377 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_object_spread_props.cjs @@ -0,0 +1,30 @@ +"use strict"; + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) { + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + keys.push.apply(keys, symbols); + } + + return keys; +} +function _object_spread_props(target, source) { + source = source != null ? source : {}; + + if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + else { + ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; +} +exports._ = _object_spread_props; diff --git a/node_modules/@swc/helpers/cjs/_object_without_properties.cjs b/node_modules/@swc/helpers/cjs/_object_without_properties.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6a801fd9df5351f5f3787d88500b82ead8f1e248 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_object_without_properties.cjs @@ -0,0 +1,35 @@ +"use strict"; + +var _object_without_properties_loose = require("./_object_without_properties_loose.cjs"); + +function _object_without_properties(source, excluded) { + if (source == null) return {}; + + var target = {}, sourceKeys, key, i; + if (typeof Reflect !== "undefined" && Reflect.ownKeys) { + sourceKeys = Reflect.ownKeys(Object(source)); + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + + return target; + } + + target = _object_without_properties_loose._(source, excluded); + if (Object.getOwnPropertySymbols) { + sourceKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +exports._ = _object_without_properties; diff --git a/node_modules/@swc/helpers/cjs/_object_without_properties_loose.cjs b/node_modules/@swc/helpers/cjs/_object_without_properties_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..71ae3526d6f2486ca881d7ff12b11e0af87963b7 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_object_without_properties_loose.cjs @@ -0,0 +1,16 @@ +"use strict"; + +function _object_without_properties_loose(source, excluded) { + if (source == null) return {}; + + var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + + return target; +} +exports._ = _object_without_properties_loose; diff --git a/node_modules/@swc/helpers/cjs/_overload_yield.cjs b/node_modules/@swc/helpers/cjs/_overload_yield.cjs new file mode 100644 index 0000000000000000000000000000000000000000..13ed17e4dbb180aecbbb956723d08c4593b6d048 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_overload_yield.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _overload_yield(value, /** 0: await 1: delegate */ kind) { + this.v = value; + this.k = kind; +} + +exports._ = _overload_yield; diff --git a/node_modules/@swc/helpers/cjs/_possible_constructor_return.cjs b/node_modules/@swc/helpers/cjs/_possible_constructor_return.cjs new file mode 100644 index 0000000000000000000000000000000000000000..fa040185b3d5e4f00202c9f64c3817d18814fa8c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_possible_constructor_return.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _assert_this_initialized = require("./_assert_this_initialized.cjs"); +var _type_of = require("./_type_of.cjs"); + +function _possible_constructor_return(self, call) { + if (call && (_type_of._(call) === "object" || typeof call === "function")) return call; + + return _assert_this_initialized._(self); +} +exports._ = _possible_constructor_return; diff --git a/node_modules/@swc/helpers/cjs/_read_only_error.cjs b/node_modules/@swc/helpers/cjs/_read_only_error.cjs new file mode 100644 index 0000000000000000000000000000000000000000..302cf5c70e53bd2a1fa71398c4e617afe8e9f5be --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_read_only_error.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _read_only_error(name) { + throw new TypeError("\"" + name + "\" is read-only"); +} +exports._ = _read_only_error; diff --git a/node_modules/@swc/helpers/cjs/_set.cjs b/node_modules/@swc/helpers/cjs/_set.cjs new file mode 100644 index 0000000000000000000000000000000000000000..adbf48487a1b1056c1927fb84d8ed741192ebdc8 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_set.cjs @@ -0,0 +1,44 @@ +"use strict"; + +var _define_property = require("./_define_property.cjs"); +var _super_prop_base = require("./_super_prop_base.cjs"); + +function set(target, property, value, receiver) { + if (typeof Reflect !== "undefined" && Reflect.set) set = Reflect.set; + else { + set = function set(target, property, value, receiver) { + var base = _super_prop_base._(target, property); + var desc; + if (base) { + desc = Object.getOwnPropertyDescriptor(base, property); + if (desc.set) { + desc.set.call(receiver, value); + + return true; + } else if (!desc.writable) { + return false; + } + } + desc = Object.getOwnPropertyDescriptor(receiver, property); + if (desc) { + if (!desc.writable) return false; + desc.value = value; + Object.defineProperty(receiver, property, desc); + } else { + _define_property._(receiver, property, value); + } + + return true; + }; + } + + return set(target, property, value, receiver); +} + +function _set(target, property, value, receiver, isStrict) { + var s = set(target, property, value, receiver || target); + if (!s && isStrict) throw new Error("failed to set property"); + + return value; +} +exports._ = _set; diff --git a/node_modules/@swc/helpers/cjs/_set_prototype_of.cjs b/node_modules/@swc/helpers/cjs/_set_prototype_of.cjs new file mode 100644 index 0000000000000000000000000000000000000000..acf501dbf761c21cee66cc5d60634d5b34264def --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_set_prototype_of.cjs @@ -0,0 +1,12 @@ +"use strict"; + +function _set_prototype_of(o, p) { + exports._ = _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { + o.__proto__ = p; + + return o; + }; + + return _set_prototype_of(o, p); +} +exports._ = _set_prototype_of; diff --git a/node_modules/@swc/helpers/cjs/_skip_first_generator_next.cjs b/node_modules/@swc/helpers/cjs/_skip_first_generator_next.cjs new file mode 100644 index 0000000000000000000000000000000000000000..e4c42543aa287d14de80e24252a09280a0049273 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_skip_first_generator_next.cjs @@ -0,0 +1,11 @@ +"use strict"; + +function _skip_first_generator_next(fn) { + return function() { + var it = fn.apply(this, arguments); + it.next(); + + return it; + }; +} +exports._ = _skip_first_generator_next; diff --git a/node_modules/@swc/helpers/cjs/_sliced_to_array.cjs b/node_modules/@swc/helpers/cjs/_sliced_to_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..e9fe47e83cbee35010173c2569bb1585d11fdbe6 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_sliced_to_array.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _array_with_holes = require("./_array_with_holes.cjs"); +var _iterable_to_array_limit = require("./_iterable_to_array_limit.cjs"); +var _non_iterable_rest = require("./_non_iterable_rest.cjs"); +var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs"); + +function _sliced_to_array(arr, i) { + return _array_with_holes._(arr) || _iterable_to_array_limit._(arr, i) || _unsupported_iterable_to_array._(arr, i) || _non_iterable_rest._(); +} +exports._ = _sliced_to_array; diff --git a/node_modules/@swc/helpers/cjs/_sliced_to_array_loose.cjs b/node_modules/@swc/helpers/cjs/_sliced_to_array_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..562dcaf9d4453037ada352f07a94e0e997034988 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_sliced_to_array_loose.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _array_with_holes = require("./_array_with_holes.cjs"); +var _iterable_to_array_limit_loose = require("./_iterable_to_array_limit_loose.cjs"); +var _non_iterable_rest = require("./_non_iterable_rest.cjs"); +var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs"); + +function _sliced_to_array_loose(arr, i) { + return _array_with_holes._(arr) || _iterable_to_array_limit_loose._(arr, i) || _unsupported_iterable_to_array._(arr, i) || _non_iterable_rest._(); +} +exports._ = _sliced_to_array_loose; diff --git a/node_modules/@swc/helpers/cjs/_super_prop_base.cjs b/node_modules/@swc/helpers/cjs/_super_prop_base.cjs new file mode 100644 index 0000000000000000000000000000000000000000..eaf3199a890b9c58b19beba04a337f8cb4b1e926 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_super_prop_base.cjs @@ -0,0 +1,13 @@ +"use strict"; + +var _get_prototype_of = require("./_get_prototype_of.cjs"); + +function _super_prop_base(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _get_prototype_of._(object); + if (object === null) break; + } + + return object; +} +exports._ = _super_prop_base; diff --git a/node_modules/@swc/helpers/cjs/_tagged_template_literal.cjs b/node_modules/@swc/helpers/cjs/_tagged_template_literal.cjs new file mode 100644 index 0000000000000000000000000000000000000000..89a579de132c358b3f2fd58a71a2b9ff5f3063b2 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_tagged_template_literal.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _tagged_template_literal(strings, raw) { + if (!raw) raw = strings.slice(0); + + return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); +} +exports._ = _tagged_template_literal; diff --git a/node_modules/@swc/helpers/cjs/_tagged_template_literal_loose.cjs b/node_modules/@swc/helpers/cjs/_tagged_template_literal_loose.cjs new file mode 100644 index 0000000000000000000000000000000000000000..48db14d47462231e12f26d9254d52cd192415f95 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_tagged_template_literal_loose.cjs @@ -0,0 +1,10 @@ +"use strict"; + +function _tagged_template_literal_loose(strings, raw) { + if (!raw) raw = strings.slice(0); + + strings.raw = raw; + + return strings; +} +exports._ = _tagged_template_literal_loose; diff --git a/node_modules/@swc/helpers/cjs/_throw.cjs b/node_modules/@swc/helpers/cjs/_throw.cjs new file mode 100644 index 0000000000000000000000000000000000000000..26f2e2ba018d0cf0f2cdb52c0b251bda9fcd3dbd --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_throw.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _throw(e) { + throw e; +} +exports._ = _throw; diff --git a/node_modules/@swc/helpers/cjs/_to_array.cjs b/node_modules/@swc/helpers/cjs/_to_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..0887dd4060760cab0714488c9b987da826b0b2bd --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_to_array.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _array_with_holes = require("./_array_with_holes.cjs"); +var _iterable_to_array = require("./_iterable_to_array.cjs"); +var _non_iterable_rest = require("./_non_iterable_rest.cjs"); +var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs"); + +function _to_array(arr) { + return _array_with_holes._(arr) || _iterable_to_array._(arr) || _unsupported_iterable_to_array._(arr) || _non_iterable_rest._(); +} +exports._ = _to_array; diff --git a/node_modules/@swc/helpers/cjs/_to_consumable_array.cjs b/node_modules/@swc/helpers/cjs/_to_consumable_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..85d19126b38d4ff60683b506f49575ccd8bbf113 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_to_consumable_array.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _array_without_holes = require("./_array_without_holes.cjs"); +var _iterable_to_array = require("./_iterable_to_array.cjs"); +var _non_iterable_spread = require("./_non_iterable_spread.cjs"); +var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs"); + +function _to_consumable_array(arr) { + return _array_without_holes._(arr) || _iterable_to_array._(arr) || _unsupported_iterable_to_array._(arr) || _non_iterable_spread._(); +} +exports._ = _to_consumable_array; diff --git a/node_modules/@swc/helpers/cjs/_to_primitive.cjs b/node_modules/@swc/helpers/cjs/_to_primitive.cjs new file mode 100644 index 0000000000000000000000000000000000000000..da357948eb267720dd80b6bc6fc421bcfe83efe3 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_to_primitive.cjs @@ -0,0 +1,18 @@ +"use strict"; + +var _type_of = require("./_type_of.cjs"); + +function _to_primitive(input, hint) { + if (_type_of._(input) !== "object" || input === null) return input; + + var prim = input[Symbol.toPrimitive]; + + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (_type_of._(res) !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + + return (hint === "string" ? String : Number)(input); +} +exports._ = _to_primitive; diff --git a/node_modules/@swc/helpers/cjs/_to_property_key.cjs b/node_modules/@swc/helpers/cjs/_to_property_key.cjs new file mode 100644 index 0000000000000000000000000000000000000000..86075ac1fe36b44caa437f7d25b2db9abad1b88c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_to_property_key.cjs @@ -0,0 +1,11 @@ +"use strict"; + +var _to_primitive = require("./_to_primitive.cjs"); +var _type_of = require("./_type_of.cjs"); + +function _to_property_key(arg) { + var key = _to_primitive._(arg, "string"); + + return _type_of._(key) === "symbol" ? key : String(key); +} +exports._ = _to_property_key; diff --git a/node_modules/@swc/helpers/cjs/_ts_add_disposable_resource.cjs b/node_modules/@swc/helpers/cjs/_ts_add_disposable_resource.cjs new file mode 100644 index 0000000000000000000000000000000000000000..24848ca7cfea22633ec3539b67fb3d20390b7580 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_add_disposable_resource.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__addDisposableResource; diff --git a/node_modules/@swc/helpers/cjs/_ts_decorate.cjs b/node_modules/@swc/helpers/cjs/_ts_decorate.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9abfbda567683316b489f3bee0e549f0d36ba0e1 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_decorate.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__decorate; diff --git a/node_modules/@swc/helpers/cjs/_ts_dispose_resources.cjs b/node_modules/@swc/helpers/cjs/_ts_dispose_resources.cjs new file mode 100644 index 0000000000000000000000000000000000000000..4ad32f10d3b66719e8f0045b5d71ce7cacb07ee9 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_dispose_resources.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__disposeResources; diff --git a/node_modules/@swc/helpers/cjs/_ts_generator.cjs b/node_modules/@swc/helpers/cjs/_ts_generator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..ee376ab63783489a2d4626a55b8718a641171b9c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_generator.cjs @@ -0,0 +1,31 @@ +"use strict"; + +function _ts_generator(thisArg, body) { + var f, y, t, _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty; + return d(g, "next", { value: verb(0) }), d(g, "throw", { value: verb(1) }), d(g, "return", { value: verb(2) }), typeof Symbol === "function" && d(g, Symbol.iterator, { value: function () { return this; } }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +exports._ = _ts_generator; diff --git a/node_modules/@swc/helpers/cjs/_ts_metadata.cjs b/node_modules/@swc/helpers/cjs/_ts_metadata.cjs new file mode 100644 index 0000000000000000000000000000000000000000..d39e6e4142f75e71b49cac326ed3b56d042f8653 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_metadata.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__metadata; diff --git a/node_modules/@swc/helpers/cjs/_ts_param.cjs b/node_modules/@swc/helpers/cjs/_ts_param.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6e2dca6eb22386c3885055d133d141275b0290d4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_param.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__param; diff --git a/node_modules/@swc/helpers/cjs/_ts_rewrite_relative_import_extension.cjs b/node_modules/@swc/helpers/cjs/_ts_rewrite_relative_import_extension.cjs new file mode 100644 index 0000000000000000000000000000000000000000..ce42e88e323113ab1fb852c54428b105af5c8ae2 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_rewrite_relative_import_extension.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__rewriteRelativeImportExtension; diff --git a/node_modules/@swc/helpers/cjs/_ts_values.cjs b/node_modules/@swc/helpers/cjs/_ts_values.cjs new file mode 100644 index 0000000000000000000000000000000000000000..0696a1f4c19ccc0e955f2ff1f7e935e0f7abc3ff --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_ts_values.cjs @@ -0,0 +1,3 @@ +"use strict"; + +exports._ = require("tslib").__values; diff --git a/node_modules/@swc/helpers/cjs/_type_of.cjs b/node_modules/@swc/helpers/cjs/_type_of.cjs new file mode 100644 index 0000000000000000000000000000000000000000..2749e8e747ac65d61b3c3f6c74a0f39eadf61d29 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_type_of.cjs @@ -0,0 +1,8 @@ +"use strict"; + +function _type_of(obj) { + "@swc/helpers - typeof"; + + return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; +} +exports._ = _type_of; diff --git a/node_modules/@swc/helpers/cjs/_unsupported_iterable_to_array.cjs b/node_modules/@swc/helpers/cjs/_unsupported_iterable_to_array.cjs new file mode 100644 index 0000000000000000000000000000000000000000..a1765e15272ba0e4ce695a8ed1c11bff0d69882c --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_unsupported_iterable_to_array.cjs @@ -0,0 +1,15 @@ +"use strict"; + +var _array_like_to_array = require("./_array_like_to_array.cjs"); + +function _unsupported_iterable_to_array(o, minLen) { + if (!o) return; + if (typeof o === "string") return _array_like_to_array._(o, minLen); + + var n = Object.prototype.toString.call(o).slice(8, -1); + + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array._(o, minLen); +} +exports._ = _unsupported_iterable_to_array; diff --git a/node_modules/@swc/helpers/cjs/_update.cjs b/node_modules/@swc/helpers/cjs/_update.cjs new file mode 100644 index 0000000000000000000000000000000000000000..abb90f34e9ac6c366fba56351914941cec7ab440 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_update.cjs @@ -0,0 +1,16 @@ +"use strict"; + +var _get = require("./_get.cjs"); +var _set = require("./_set.cjs"); + +function _update(target, property, receiver, isStrict) { + return { + get _() { + return _get._(target, property, receiver); + }, + set _(value) { + _set._(target, property, value, receiver, isStrict); + } + }; +} +exports._ = _update; diff --git a/node_modules/@swc/helpers/cjs/_using.cjs b/node_modules/@swc/helpers/cjs/_using.cjs new file mode 100644 index 0000000000000000000000000000000000000000..903837e715d5e030bf36184d64da7db430667c1d --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_using.cjs @@ -0,0 +1,24 @@ +"use strict"; + +/* @minVersion 7.22.0 */ + +function _using(stack, value, isAwait) { + if (value === null || value === void 0) return value; + if (Object(value) !== value) { + throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + } + // core-js-pure uses Symbol.for for polyfilling well-known symbols + if (isAwait) { + var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")]; + } + if (dispose === null || dispose === void 0) { + dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")]; + } + if (typeof dispose !== "function") { + throw new TypeError(`Property [Symbol.dispose] is not a function.`); + } + stack.push({ v: value, d: dispose, a: isAwait }); + return value; +} + +exports._ = _using; diff --git a/node_modules/@swc/helpers/cjs/_using_ctx.cjs b/node_modules/@swc/helpers/cjs/_using_ctx.cjs new file mode 100644 index 0000000000000000000000000000000000000000..9c8d3fb4756ef8a59f35c195bb1cbd569dcc41c1 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_using_ctx.cjs @@ -0,0 +1,75 @@ +"use strict"; + +function _using_ctx() { + var _disposeSuppressedError = typeof SuppressedError === "function" + // eslint-disable-next-line no-undef + ? SuppressedError + : (function(error, suppressed) { + var err = new Error(); + err.name = "SuppressedError"; + err.suppressed = suppressed; + err.error = error; + return err; + }), + empty = {}, + stack = []; + function using(isAwait, value) { + if (value != null) { + if (Object(value) !== value) { + throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + } + // core-js-pure uses Symbol.for for polyfilling well-known symbols + if (isAwait) { + var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")]; + } + if (dispose == null) { + dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")]; + } + if (typeof dispose !== "function") { + throw new TypeError(`Property [Symbol.dispose] is not a function.`); + } + stack.push({ v: value, d: dispose, a: isAwait }); + } else if (isAwait) { + // provide the nullish `value` as `d` for minification gain + stack.push({ d: value, a: isAwait }); + } + return value; + } + return { + // error + e: empty, + // using + u: using.bind(null, false), + // await using + a: using.bind(null, true), + // dispose + d: function() { + var error = this.e; + + function next() { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + while ((resource = stack.pop())) { + try { + var resource, disposalResult = resource.d && resource.d.call(resource.v); + if (resource.a) { + return Promise.resolve(disposalResult).then(next, err); + } + } catch (e) { + return err(e); + } + } + if (error !== empty) throw error; + } + + function err(e) { + error = error !== empty ? new _disposeSuppressedError(e, error) : e; + + return next(); + } + + return next(); + } + }; +} + +exports._ = _using_ctx; diff --git a/node_modules/@swc/helpers/cjs/_wrap_async_generator.cjs b/node_modules/@swc/helpers/cjs/_wrap_async_generator.cjs new file mode 100644 index 0000000000000000000000000000000000000000..09adf255bb16cc5b98ded429e7bf649df8a45213 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_wrap_async_generator.cjs @@ -0,0 +1,10 @@ +"use strict"; + +var _async_generator = require("./_async_generator.cjs"); + +function _wrap_async_generator(fn) { + return function() { + return new _async_generator._(fn.apply(this, arguments)); + }; +} +exports._ = _wrap_async_generator; diff --git a/node_modules/@swc/helpers/cjs/_wrap_native_super.cjs b/node_modules/@swc/helpers/cjs/_wrap_native_super.cjs new file mode 100644 index 0000000000000000000000000000000000000000..6babaefdc47044ba97be92e16ac1b5b7828cc855 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_wrap_native_super.cjs @@ -0,0 +1,28 @@ +"use strict"; + +var _construct = require("./_construct.cjs"); +var _get_prototype_of = require("./_get_prototype_of.cjs"); +var _is_native_function = require("./_is_native_function.cjs"); +var _set_prototype_of = require("./_set_prototype_of.cjs"); + +function _wrap_native_super(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + exports._ = _wrap_native_super = function(Class) { + if (Class === null || !_is_native_function._(Class)) return Class; + if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function"); + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct._(Class, arguments, _get_prototype_of._(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); + + return _set_prototype_of._(Wrapper, Class); + }; + + return _wrap_native_super(Class); +} +exports._ = _wrap_native_super; diff --git a/node_modules/@swc/helpers/cjs/_wrap_reg_exp.cjs b/node_modules/@swc/helpers/cjs/_wrap_reg_exp.cjs new file mode 100644 index 0000000000000000000000000000000000000000..75cd96e872c03cf6c3bf431c97c445e22168bf1f --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_wrap_reg_exp.cjs @@ -0,0 +1,84 @@ +"use strict"; + +var _inherits = require("./_inherits.cjs"); +var _set_prototype_of = require("./_set_prototype_of.cjs"); + +function _wrap_reg_exp(re, groups, source) { + exports._ = _wrap_reg_exp = function(re, groups, source) { + return new WrappedRegExp(re, undefined, groups, source); + }; + var _super = RegExp.prototype; + var _groups = new WeakMap(); + var _sources = new WeakMap(); + var _native_source = Object.getOwnPropertyDescriptor(_super, "source").get; + function WrappedRegExp(re, flags, groups, source) { + var _re = new RegExp(re, flags); + _groups.set(_re, groups || _groups.get(re)); + _sources.set(_re, source !== undefined ? source : _sources.get(re)); + return _set_prototype_of._(_re, WrappedRegExp.prototype); + } + _inherits._(WrappedRegExp, RegExp); + Object.defineProperty(WrappedRegExp.prototype, "source", { + configurable: true, + get: function() { + var source = _sources.get(this); + if (source !== undefined) { + try { + new RegExp(source, this.flags); + return source; + } catch (_) {} + } + return _native_source.call(this); + } + }); + WrappedRegExp.prototype.exec = function(str) { + var result = _super.exec.call(this, str); + if (result) { + result.groups = buildGroups(result, this); + var indices = result.indices; + if (indices) indices.groups = buildGroups(indices, this); + } + return result; + }; + WrappedRegExp.prototype[Symbol.replace] = function(str, substitution) { + if (typeof substitution === "string") { + var groups = _groups.get(this); + return _super[Symbol.replace].call( + this, + str, + substitution.replace(/\$<([^>]+)>/g, function(_, name) { + var group = groups ? groups[name] : undefined; + if (group === undefined) return ""; + return "$" + (Array.isArray(group) ? group.join("$") : group); + }) + ); + } + if (typeof substitution === "function") { + var _this = this; + return _super[Symbol.replace].call(this, str, function() { + var args = arguments; + if (typeof args[args.length - 1] !== "object") { + args = [].slice.call(args); + args.push(buildGroups(args, _this)); + } + return substitution.apply(this, args); + }); + } + return _super[Symbol.replace].call(this, str, substitution); + }; + function buildGroups(result, re) { + var g = _groups.get(re); + return Object.keys(g).reduce(function(groups, name) { + var i = g[name]; + if (typeof i === "number") groups[name] = result[i]; + else { + var k = 0; + while (result[i[k]] === undefined && k + 1 < i.length) k++; + groups[name] = result[i[k]]; + } + return groups; + }, Object.create(null)); + } + return _wrap_reg_exp.apply(this, arguments); +} +exports._ = _wrap_reg_exp; diff --git a/node_modules/@swc/helpers/cjs/_write_only_error.cjs b/node_modules/@swc/helpers/cjs/_write_only_error.cjs new file mode 100644 index 0000000000000000000000000000000000000000..799fc3a5851d975a4b5c42d8d61145597f63d476 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/_write_only_error.cjs @@ -0,0 +1,6 @@ +"use strict"; + +function _write_only_error(name) { + throw new TypeError("\"" + name + "\" is write-only"); +} +exports._ = _write_only_error; diff --git a/node_modules/@swc/helpers/cjs/index.cjs b/node_modules/@swc/helpers/cjs/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..f4dde29a7d50c9da75b5c2f28d20acfafbcf5db4 --- /dev/null +++ b/node_modules/@swc/helpers/cjs/index.cjs @@ -0,0 +1,439 @@ +"use strict"; + +/* This file is automatically generated and should not be manually edited. */ +/* To modify this file, please run the `npm run build` command instead. */ + +0 && (module.exports = { + /* @Annotate_start: the CommonJS named exports for ESM import in node */ + _apply_decorated_descriptor: null, + _apply_decs_2203_r: null, + _apply_decs_2311: null, + _array_like_to_array: null, + _array_with_holes: null, + _array_without_holes: null, + _assert_this_initialized: null, + _async_generator: null, + _async_generator_delegate: null, + _async_iterator: null, + _async_to_generator: null, + _await_async_generator: null, + _await_value: null, + _call_super: null, + _check_private_redeclaration: null, + _class_apply_descriptor_destructure: null, + _class_apply_descriptor_get: null, + _class_apply_descriptor_set: null, + _class_apply_descriptor_update: null, + _class_call_check: null, + _class_check_private_static_access: null, + _class_check_private_static_field_descriptor: null, + _class_extract_field_descriptor: null, + _class_name_tdz_error: null, + _class_private_field_destructure: null, + _class_private_field_get: null, + _class_private_field_init: null, + _class_private_field_loose_base: null, + _class_private_field_loose_key: null, + _class_private_field_set: null, + _class_private_field_update: null, + _class_private_method_get: null, + _class_private_method_init: null, + _class_private_method_set: null, + _class_static_private_field_destructure: null, + _class_static_private_field_spec_get: null, + _class_static_private_field_spec_set: null, + _class_static_private_field_update: null, + _class_static_private_method_get: null, + _construct: null, + _create_class: null, + _create_for_of_iterator_helper_loose: null, + _create_super: null, + _decorate: null, + _defaults: null, + _define_enumerable_properties: null, + _define_property: null, + _dispose: null, + _export_star: null, + _extends: null, + _get: null, + _get_prototype_of: null, + _identity: null, + _inherits: null, + _inherits_loose: null, + _initializer_define_property: null, + _initializer_warning_helper: null, + _instanceof: null, + _interop_require_default: null, + _interop_require_wildcard: null, + _is_native_function: null, + _is_native_reflect_construct: null, + _iterable_to_array: null, + _iterable_to_array_limit: null, + _iterable_to_array_limit_loose: null, + _jsx: null, + _new_arrow_check: null, + _non_iterable_rest: null, + _non_iterable_spread: null, + _object_destructuring_empty: null, + _object_spread: null, + _object_spread_props: null, + _object_without_properties: null, + _object_without_properties_loose: null, + _overload_yield: null, + _possible_constructor_return: null, + _read_only_error: null, + _set: null, + _set_prototype_of: null, + _skip_first_generator_next: null, + _sliced_to_array: null, + _sliced_to_array_loose: null, + _super_prop_base: null, + _tagged_template_literal: null, + _tagged_template_literal_loose: null, + _throw: null, + _to_array: null, + _to_consumable_array: null, + _to_primitive: null, + _to_property_key: null, + _ts_add_disposable_resource: null, + _ts_decorate: null, + _ts_dispose_resources: null, + _ts_generator: null, + _ts_metadata: null, + _ts_param: null, + _ts_rewrite_relative_import_extension: null, + _ts_values: null, + _type_of: null, + _unsupported_iterable_to_array: null, + _update: null, + _using: null, + _using_ctx: null, + _wrap_async_generator: null, + _wrap_native_super: null, + _wrap_reg_exp: null, + _write_only_error: null + /* @Annotate_end */ +}); +module.exports = { + get _apply_decorated_descriptor() { + return require("./_apply_decorated_descriptor.cjs")._; + }, + get _apply_decs_2203_r() { + return require("./_apply_decs_2203_r.cjs")._; + }, + get _apply_decs_2311() { + return require("./_apply_decs_2311.cjs")._; + }, + get _array_like_to_array() { + return require("./_array_like_to_array.cjs")._; + }, + get _array_with_holes() { + return require("./_array_with_holes.cjs")._; + }, + get _array_without_holes() { + return require("./_array_without_holes.cjs")._; + }, + get _assert_this_initialized() { + return require("./_assert_this_initialized.cjs")._; + }, + get _async_generator() { + return require("./_async_generator.cjs")._; + }, + get _async_generator_delegate() { + return require("./_async_generator_delegate.cjs")._; + }, + get _async_iterator() { + return require("./_async_iterator.cjs")._; + }, + get _async_to_generator() { + return require("./_async_to_generator.cjs")._; + }, + get _await_async_generator() { + return require("./_await_async_generator.cjs")._; + }, + get _await_value() { + return require("./_await_value.cjs")._; + }, + get _call_super() { + return require("./_call_super.cjs")._; + }, + get _check_private_redeclaration() { + return require("./_check_private_redeclaration.cjs")._; + }, + get _class_apply_descriptor_destructure() { + return require("./_class_apply_descriptor_destructure.cjs")._; + }, + get _class_apply_descriptor_get() { + return require("./_class_apply_descriptor_get.cjs")._; + }, + get _class_apply_descriptor_set() { + return require("./_class_apply_descriptor_set.cjs")._; + }, + get _class_apply_descriptor_update() { + return require("./_class_apply_descriptor_update.cjs")._; + }, + get _class_call_check() { + return require("./_class_call_check.cjs")._; + }, + get _class_check_private_static_access() { + return require("./_class_check_private_static_access.cjs")._; + }, + get _class_check_private_static_field_descriptor() { + return require("./_class_check_private_static_field_descriptor.cjs")._; + }, + get _class_extract_field_descriptor() { + return require("./_class_extract_field_descriptor.cjs")._; + }, + get _class_name_tdz_error() { + return require("./_class_name_tdz_error.cjs")._; + }, + get _class_private_field_destructure() { + return require("./_class_private_field_destructure.cjs")._; + }, + get _class_private_field_get() { + return require("./_class_private_field_get.cjs")._; + }, + get _class_private_field_init() { + return require("./_class_private_field_init.cjs")._; + }, + get _class_private_field_loose_base() { + return require("./_class_private_field_loose_base.cjs")._; + }, + get _class_private_field_loose_key() { + return require("./_class_private_field_loose_key.cjs")._; + }, + get _class_private_field_set() { + return require("./_class_private_field_set.cjs")._; + }, + get _class_private_field_update() { + return require("./_class_private_field_update.cjs")._; + }, + get _class_private_method_get() { + return require("./_class_private_method_get.cjs")._; + }, + get _class_private_method_init() { + return require("./_class_private_method_init.cjs")._; + }, + get _class_private_method_set() { + return require("./_class_private_method_set.cjs")._; + }, + get _class_static_private_field_destructure() { + return require("./_class_static_private_field_destructure.cjs")._; + }, + get _class_static_private_field_spec_get() { + return require("./_class_static_private_field_spec_get.cjs")._; + }, + get _class_static_private_field_spec_set() { + return require("./_class_static_private_field_spec_set.cjs")._; + }, + get _class_static_private_field_update() { + return require("./_class_static_private_field_update.cjs")._; + }, + get _class_static_private_method_get() { + return require("./_class_static_private_method_get.cjs")._; + }, + get _construct() { + return require("./_construct.cjs")._; + }, + get _create_class() { + return require("./_create_class.cjs")._; + }, + get _create_for_of_iterator_helper_loose() { + return require("./_create_for_of_iterator_helper_loose.cjs")._; + }, + get _create_super() { + return require("./_create_super.cjs")._; + }, + get _decorate() { + return require("./_decorate.cjs")._; + }, + get _defaults() { + return require("./_defaults.cjs")._; + }, + get _define_enumerable_properties() { + return require("./_define_enumerable_properties.cjs")._; + }, + get _define_property() { + return require("./_define_property.cjs")._; + }, + get _dispose() { + return require("./_dispose.cjs")._; + }, + get _export_star() { + return require("./_export_star.cjs")._; + }, + get _extends() { + return require("./_extends.cjs")._; + }, + get _get() { + return require("./_get.cjs")._; + }, + get _get_prototype_of() { + return require("./_get_prototype_of.cjs")._; + }, + get _identity() { + return require("./_identity.cjs")._; + }, + get _inherits() { + return require("./_inherits.cjs")._; + }, + get _inherits_loose() { + return require("./_inherits_loose.cjs")._; + }, + get _initializer_define_property() { + return require("./_initializer_define_property.cjs")._; + }, + get _initializer_warning_helper() { + return require("./_initializer_warning_helper.cjs")._; + }, + get _instanceof() { + return require("./_instanceof.cjs")._; + }, + get _interop_require_default() { + return require("./_interop_require_default.cjs")._; + }, + get _interop_require_wildcard() { + return require("./_interop_require_wildcard.cjs")._; + }, + get _is_native_function() { + return require("./_is_native_function.cjs")._; + }, + get _is_native_reflect_construct() { + return require("./_is_native_reflect_construct.cjs")._; + }, + get _iterable_to_array() { + return require("./_iterable_to_array.cjs")._; + }, + get _iterable_to_array_limit() { + return require("./_iterable_to_array_limit.cjs")._; + }, + get _iterable_to_array_limit_loose() { + return require("./_iterable_to_array_limit_loose.cjs")._; + }, + get _jsx() { + return require("./_jsx.cjs")._; + }, + get _new_arrow_check() { + return require("./_new_arrow_check.cjs")._; + }, + get _non_iterable_rest() { + return require("./_non_iterable_rest.cjs")._; + }, + get _non_iterable_spread() { + return require("./_non_iterable_spread.cjs")._; + }, + get _object_destructuring_empty() { + return require("./_object_destructuring_empty.cjs")._; + }, + get _object_spread() { + return require("./_object_spread.cjs")._; + }, + get _object_spread_props() { + return require("./_object_spread_props.cjs")._; + }, + get _object_without_properties() { + return require("./_object_without_properties.cjs")._; + }, + get _object_without_properties_loose() { + return require("./_object_without_properties_loose.cjs")._; + }, + get _overload_yield() { + return require("./_overload_yield.cjs")._; + }, + get _possible_constructor_return() { + return require("./_possible_constructor_return.cjs")._; + }, + get _read_only_error() { + return require("./_read_only_error.cjs")._; + }, + get _set() { + return require("./_set.cjs")._; + }, + get _set_prototype_of() { + return require("./_set_prototype_of.cjs")._; + }, + get _skip_first_generator_next() { + return require("./_skip_first_generator_next.cjs")._; + }, + get _sliced_to_array() { + return require("./_sliced_to_array.cjs")._; + }, + get _sliced_to_array_loose() { + return require("./_sliced_to_array_loose.cjs")._; + }, + get _super_prop_base() { + return require("./_super_prop_base.cjs")._; + }, + get _tagged_template_literal() { + return require("./_tagged_template_literal.cjs")._; + }, + get _tagged_template_literal_loose() { + return require("./_tagged_template_literal_loose.cjs")._; + }, + get _throw() { + return require("./_throw.cjs")._; + }, + get _to_array() { + return require("./_to_array.cjs")._; + }, + get _to_consumable_array() { + return require("./_to_consumable_array.cjs")._; + }, + get _to_primitive() { + return require("./_to_primitive.cjs")._; + }, + get _to_property_key() { + return require("./_to_property_key.cjs")._; + }, + get _ts_add_disposable_resource() { + return require("./_ts_add_disposable_resource.cjs")._; + }, + get _ts_decorate() { + return require("./_ts_decorate.cjs")._; + }, + get _ts_dispose_resources() { + return require("./_ts_dispose_resources.cjs")._; + }, + get _ts_generator() { + return require("./_ts_generator.cjs")._; + }, + get _ts_metadata() { + return require("./_ts_metadata.cjs")._; + }, + get _ts_param() { + return require("./_ts_param.cjs")._; + }, + get _ts_rewrite_relative_import_extension() { + return require("./_ts_rewrite_relative_import_extension.cjs")._; + }, + get _ts_values() { + return require("./_ts_values.cjs")._; + }, + get _type_of() { + return require("./_type_of.cjs")._; + }, + get _unsupported_iterable_to_array() { + return require("./_unsupported_iterable_to_array.cjs")._; + }, + get _update() { + return require("./_update.cjs")._; + }, + get _using() { + return require("./_using.cjs")._; + }, + get _using_ctx() { + return require("./_using_ctx.cjs")._; + }, + get _wrap_async_generator() { + return require("./_wrap_async_generator.cjs")._; + }, + get _wrap_native_super() { + return require("./_wrap_native_super.cjs")._; + }, + get _wrap_reg_exp() { + return require("./_wrap_reg_exp.cjs")._; + }, + get _write_only_error() { + return require("./_write_only_error.cjs")._; + } +}; diff --git a/node_modules/@swc/helpers/esm/_apply_decorated_descriptor.js b/node_modules/@swc/helpers/esm/_apply_decorated_descriptor.js new file mode 100644 index 0000000000000000000000000000000000000000..671db1fb9df3808f32f44503c358c08a304eecfc --- /dev/null +++ b/node_modules/@swc/helpers/esm/_apply_decorated_descriptor.js @@ -0,0 +1,33 @@ +function _apply_decorated_descriptor(target, property, decorators, descriptor, context) { + var desc = {}; + + Object["ke" + "ys"](descriptor).forEach(function(key) { + desc[key] = descriptor[key]; + }); + desc.enumerable = !!desc.enumerable; + desc.configurable = !!desc.configurable; + + if ("value" in desc || desc.initializer) desc.writable = true; + desc = decorators.slice().reverse().reduce(function(desc, decorator) { + return decorator ? decorator(target, property, desc) || desc : desc; + }, desc); + + var hasAccessor = Object.prototype.hasOwnProperty.call(desc, "get") || Object.prototype.hasOwnProperty.call(desc, "set"); + + if (context && desc.initializer !== void 0 && !hasAccessor) { + desc.value = desc.initializer ? desc.initializer.call(context) : void 0; + desc.initializer = undefined; + } + if (hasAccessor) { + delete desc.writable; + delete desc.initializer; + delete desc.value; + } + if (desc.initializer === void 0) { + Object["define" + "Property"](target, property, desc); + desc = null; + } + + return desc; +} +export { _apply_decorated_descriptor as _ }; diff --git a/node_modules/@swc/helpers/esm/_apply_decs_2203_r.js b/node_modules/@swc/helpers/esm/_apply_decs_2203_r.js new file mode 100644 index 0000000000000000000000000000000000000000..6b64002ae3d8534ab509e43dbb576ea4f6ce2213 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_apply_decs_2203_r.js @@ -0,0 +1,572 @@ +/* @minVersion 7.20.0 */ + +/** + Enums are used in this file, but not assigned to vars to avoid non-hoistable values + + CONSTRUCTOR = 0; + PUBLIC = 1; + PRIVATE = 2; + + FIELD = 0; + ACCESSOR = 1; + METHOD = 2; + GETTER = 3; + SETTER = 4; + + STATIC = 5; + + CLASS = 10; // only used in assertValidReturnValue +*/ + +function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) { + function createAddInitializerMethod(initializers, decoratorFinishedRef) { + return function addInitializer(initializer) { + assertNotFinished(decoratorFinishedRef, "addInitializer"); + assertCallable(initializer, "An initializer"); + initializers.push(initializer); + }; + } + + function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) { + var kindStr; + + switch (kind) { + case 1 /* ACCESSOR */: + kindStr = "accessor"; + break; + case 2 /* METHOD */: + kindStr = "method"; + break; + case 3 /* GETTER */: + kindStr = "getter"; + break; + case 4 /* SETTER */: + kindStr = "setter"; + break; + default: + kindStr = "field"; + } + + var ctx = { kind: kindStr, name: isPrivate ? "#" + name : name, static: isStatic, private: isPrivate, metadata: metadata }; + + var decoratorFinishedRef = { v: false }; + + ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef); + + var get, set; + if (kind === 0 /* FIELD */) { + if (isPrivate) { + get = desc.get; + set = desc.set; + } else { + get = function() { + return this[name]; + }; + set = function(v) { + this[name] = v; + }; + } + } else if (kind === 2 /* METHOD */) { + get = function() { + return desc.value; + }; + } else { + // replace with values that will go through the final getter and setter + if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) { + get = function() { + return desc.get.call(this); + }; + } + + if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) { + set = function(v) { + desc.set.call(this, v); + }; + } + } + + if (get) { + var originalGet = get; + get = function(target) { + if (arguments.length === 0) { + target = this; + } + return originalGet.call(target); + }; + } + + if (set) { + var originalSet = set; + set = function(target, value) { + if (arguments.length === 1) { + value = target; + target = this; + } + return originalSet.call(target, value); + }; + } + + if (isPrivate) { + ctx.access = get && set ? { get: get, set: set } : get ? { get: get } : { set: set }; + } else { + var has = function(target) { + return name in target; + }; + ctx.access = get && set ? { has: has, get: get, set: set } : get ? { has: has, get: get } : { has: has, set: set }; + } + + var newValue = dec(value, ctx); + decoratorFinishedRef.v = true; + return newValue; + } + + function assertNotFinished(decoratorFinishedRef, fnName) { + if (decoratorFinishedRef.v) { + throw new Error("attempted to call " + fnName + " after decoration was finished"); + } + } + + function assertCallable(fn, hint) { + if (typeof fn !== "function") { + throw new TypeError(hint + " must be a function"); + } + } + + function assertValidReturnValue(kind, value) { + var type = typeof value; + + if (kind === 1 /* ACCESSOR */) { + if (type !== "object" || value === null) { + throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); + } + if (value.get !== undefined) { + assertCallable(value.get, "accessor.get"); + } + if (value.set !== undefined) { + assertCallable(value.set, "accessor.set"); + } + if (value.init !== undefined) { + assertCallable(value.init, "accessor.init"); + } + } else if (type !== "function") { + var hint; + if (kind === 0 /* FIELD */) { + hint = "field"; + } else if (kind === 10 /* CLASS */) { + hint = "class"; + } else { + hint = "method"; + } + throw new TypeError(hint + " decorators must return a function or void 0"); + } + } + + function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) { + var decs = decInfo[0]; + + var desc, init, value; + + if (isPrivate) { + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + desc = { get: decInfo[3], set: decInfo[4] }; + } else if (kind === 3 /* GETTER */) { + desc = { get: decInfo[3] }; + } else if (kind === 4 /* SETTER */) { + desc = { set: decInfo[3] }; + } else { + desc = { value: decInfo[3] }; + } + } else if (kind !== 0 /* FIELD */) { + desc = Object.getOwnPropertyDescriptor(base, name); + } + + if (kind === 1 /* ACCESSOR */) { + value = { get: desc.get, set: desc.set }; + } else if (kind === 2 /* METHOD */) { + value = desc.value; + } else if (kind === 3 /* GETTER */) { + value = desc.get; + } else if (kind === 4 /* SETTER */) { + value = desc.set; + } + + var newValue, get, set; + + if (typeof decs === "function") { + newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value); + + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + + if (kind === 0 /* FIELD */) { + init = newValue; + } else if (kind === 1 /* ACCESSOR */) { + init = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; + } else { + value = newValue; + } + } + } else { + for (var i = decs.length - 1; i >= 0; i--) { + var dec = decs[i]; + + newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value); + + if (newValue !== void 0) { + assertValidReturnValue(kind, newValue); + var newInit; + + if (kind === 0 /* FIELD */) { + newInit = newValue; + } else if (kind === 1 /* ACCESSOR */) { + newInit = newValue.init; + get = newValue.get || value.get; + set = newValue.set || value.set; + + value = { get: get, set: set }; + } else { + value = newValue; + } + + if (newInit !== void 0) { + if (init === void 0) { + init = newInit; + } else if (typeof init === "function") { + init = [init, newInit]; + } else { + init.push(newInit); + } + } + } + } + } + + if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) { + if (init === void 0) { + // If the initializer was void 0, sub in a dummy initializer + init = function(instance, init) { + return init; + }; + } else if (typeof init !== "function") { + var ownInitializers = init; + + init = function(instance, init) { + var value = init; + + for (var i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); + + return value; + }; + } else { + var originalInitializer = init; + + init = function(instance, init) { + return originalInitializer.call(instance, init); + }; + } + + ret.push(init); + } + + if (kind !== 0 /* FIELD */) { + if (kind === 1 /* ACCESSOR */) { + desc.get = value.get; + desc.set = value.set; + } else if (kind === 2 /* METHOD */) { + desc.value = value; + } else if (kind === 3 /* GETTER */) { + desc.get = value; + } else if (kind === 4 /* SETTER */) { + desc.set = value; + } + + if (isPrivate) { + if (kind === 1 /* ACCESSOR */) { + ret.push(function(instance, args) { + return value.get.call(instance, args); + }); + ret.push(function(instance, args) { + return value.set.call(instance, args); + }); + } else if (kind === 2 /* METHOD */) { + ret.push(value); + } else { + ret.push(function(instance, args) { + return value.call(instance, args); + }); + } + } else { + Object.defineProperty(base, name, desc); + } + } + } + + function applyMemberDecs(Class, decInfos, metadata) { + var ret = []; + var protoInitializers; + var staticInitializers; + + var existingProtoNonFields = new Map(); + var existingStaticNonFields = new Map(); + + for (var i = 0; i < decInfos.length; i++) { + var decInfo = decInfos[i]; + + // skip computed property names + if (!Array.isArray(decInfo)) continue; + + var kind = decInfo[1]; + var name = decInfo[2]; + var isPrivate = decInfo.length > 3; + + var isStatic = kind >= 5; /* STATIC */ + var base; + var initializers; + + if (isStatic) { + base = Class; + kind = kind - 5 /* STATIC */; + // initialize staticInitializers when we see a non-field static member + staticInitializers = staticInitializers || []; + initializers = staticInitializers; + } else { + base = Class.prototype; + // initialize protoInitializers when we see a non-field member + protoInitializers = protoInitializers || []; + initializers = protoInitializers; + } + + if (kind !== 0 /* FIELD */ && !isPrivate) { + var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields; + + var existingKind = existingNonFields.get(name) || 0; + + if (existingKind === true || (existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ || (existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */) { + throw new Error( + "Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + + name + ); + } else if (!existingKind && kind > 2 /* METHOD */) { + existingNonFields.set(name, kind); + } else { + existingNonFields.set(name, true); + } + } + + applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata); + } + + pushInitializers(ret, protoInitializers); + pushInitializers(ret, staticInitializers); + return ret; + } + + function pushInitializers(ret, initializers) { + if (initializers) { + ret.push(function(instance) { + for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); + return instance; + }); + } + } + + function applyClassDecs(targetClass, classDecs, metadata) { + if (classDecs.length > 0) { + var initializers = []; + var newClass = targetClass; + var name = targetClass.name; + + for (var i = classDecs.length - 1; i >= 0; i--) { + var decoratorFinishedRef = { v: false }; + + var nextNewClass = classDecs[i](newClass, { kind: "class", name: name, addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef), metadata }); + decoratorFinishedRef.v = true; + + if (nextNewClass !== undefined) { + assertValidReturnValue(10, /* CLASS */ nextNewClass); + newClass = nextNewClass; + } + } + + return [defineMetadata(newClass, metadata), function() { + for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); + }]; + } + // The transformer will not emit assignment when there are no class decorators, + // so we don't have to return an empty array here. + } + + function defineMetadata(Class, metadata) { + return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: true, enumerable: true, value: metadata }); + } + + /** + Basic usage: + + applyDecs( + Class, + [ + // member decorators + [ + dec, // dec or array of decs + 0, // kind of value being decorated + 'prop', // name of public prop on class containing the value being decorated, + '#p', // the name of the private property (if is private, void 0 otherwise), + ] + ], + [ + // class decorators + dec1, dec2 + ] + ) + ``` + + Fully transpiled example: + + ```js + @dec + class Class { + @dec + a = 123; + + @dec + #a = 123; + + @dec + @dec2 + accessor b = 123; + + @dec + accessor #b = 123; + + @dec + c() { console.log('c'); } + + @dec + #c() { console.log('privC'); } + + @dec + get d() { console.log('d'); } + + @dec + get #d() { console.log('privD'); } + + @dec + set e(v) { console.log('e'); } + + @dec + set #e(v) { console.log('privE'); } + } + + + // becomes + let initializeInstance; + let initializeClass; + + let initA; + let initPrivA; + + let initB; + let initPrivB, getPrivB, setPrivB; + + let privC; + let privD; + let privE; + + let Class; + class _Class { + static { + let ret = applyDecs( + this, + [ + [dec, 0, 'a'], + [dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v], + [[dec, dec2], 1, 'b'], + [dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v], + [dec, 2, 'c'], + [dec, 2, 'c', () => console.log('privC')], + [dec, 3, 'd'], + [dec, 3, 'd', () => console.log('privD')], + [dec, 4, 'e'], + [dec, 4, 'e', () => console.log('privE')], + ], + [ + dec + ] + ) + + initA = ret[0]; + + initPrivA = ret[1]; + + initB = ret[2]; + + initPrivB = ret[3]; + getPrivB = ret[4]; + setPrivB = ret[5]; + + privC = ret[6]; + + privD = ret[7]; + + privE = ret[8]; + + initializeInstance = ret[9]; + + Class = ret[10] + + initializeClass = ret[11]; + } + + a = (initializeInstance(this), initA(this, 123)); + + #a = initPrivA(this, 123); + + #bData = initB(this, 123); + get b() { return this.#bData } + set b(v) { this.#bData = v } + + #privBData = initPrivB(this, 123); + get #b() { return getPrivB(this); } + set #b(v) { setPrivB(this, v); } + + c() { console.log('c'); } + + #c(...args) { return privC(this, ...args) } + + get d() { console.log('d'); } + + get #d() { return privD(this); } + + set e(v) { console.log('e'); } + + set #e(v) { privE(this, v); } + } + + initializeClass(Class); + */ + + _apply_decs_2203_r = function(targetClass, memberDecs, classDecs, parentClass) { + if (parentClass !== void 0) { + var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")]; + } + var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata); + var e = applyMemberDecs(targetClass, memberDecs, metadata); + if (!classDecs.length) defineMetadata(targetClass, metadata); + return { + e: e, + // Lazily apply class decorations so that member init locals can be properly bound. + get c() { + return applyClassDecs(targetClass, classDecs, metadata); + } + }; + }; + + return _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass); +} + +export { _apply_decs_2203_r as _ }; diff --git a/node_modules/@swc/helpers/esm/_apply_decs_2311.js b/node_modules/@swc/helpers/esm/_apply_decs_2311.js new file mode 100644 index 0000000000000000000000000000000000000000..d1b0c80943cef54d68945c08f94dd47c4e6b9fe7 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_apply_decs_2311.js @@ -0,0 +1,344 @@ +/* @minVersion 7.24.0 */ + +function toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) { + return input; + } + + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") { + return res; + } + throw new TypeError("@@toPrimitive must return a primitive value."); + } + + return (hint === "string" ? String : Number)(input); +} + +function toPropertyKey(arg) { + var key = toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); +} + +function checkInRHS(value) { + if (Object(value) !== value) { + throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null")); + } + + return value; +} + +function setFunctionName(fn, name, prefix) { + if (typeof name === "symbol") { + name = name.description; + name = name ? "[" + name + "]" : ""; + } + + try { + Object.defineProperty(fn, "name", { configurable: true, value: prefix ? prefix + " " + name : name }); + } catch (_) {} + + return fn; +} + +/** + kind bit layout + + FIELD = 0 + ACCESSOR = 1 + METHOD = 2 + GETTER = 3 + SETTER = 4 + CLASS = 5 + + STATIC = 8 + DECORATORS_HAVE_THIS = 16 +*/ +function _apply_decs_2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) { + var symbolMetadata = Symbol.metadata || Symbol.for("Symbol.metadata"); + var defineProperty = Object.defineProperty; + var create = Object.create; + var metadata; + var existingNonFields = [create(null), create(null)]; + var hasClassDecs = classDecs.length; + var _; + + function createRunInitializers(initializers, useStaticThis, hasValue) { + return function(thisArg, value) { + if (useStaticThis) { + value = thisArg; + thisArg = targetClass; + } + + for (var i = 0; i < initializers.length; i++) value = initializers[i].apply(thisArg, hasValue ? [value] : []); + + return hasValue ? value : thisArg; + }; + } + + function assertCallable(fn, hint1, hint2, throwUndefined) { + if (typeof fn !== "function") { + if (throwUndefined || fn !== void 0) { + throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined")); + } + } + + return fn; + } + + function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) { + function assertInstanceIfPrivate(target) { + if (!hasPrivateBrand(target)) { + throw new TypeError("Attempted to access private element on non-instance"); + } + } + + var decs = [].concat(decInfo[0]); + var decVal = decInfo[3]; + var isClass = !ret; + + var isAccessor = kind === 1; + var isGetter = kind === 3; + var isSetter = kind === 4; + var isMethod = kind === 2; + + function bindPropCall(name, useStaticThis, before) { + return function(_this, value) { + if (useStaticThis) { + value = _this; + _this = Class; + } + + if (before) { + before(_this); + } + + return desc[name].call(_this, value); + }; + } + + var desc = {}; + var init = []; + var key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value"; + + if (!isClass) { + if (isPrivate) { + if (isField || isAccessor) { + desc = { + get: setFunctionName( + function() { + return decVal(this); + }, + name, + "get" + ), + set: function(value) { + decInfo[4](this, value); + } + }; + } else { + desc[key] = decVal; + } + + if (!isField) { + setFunctionName(desc[key], name, isMethod ? "" : key); + } + } else if (!isField) { + desc = Object.getOwnPropertyDescriptor(Class, name); + } + + if (!isField && !isPrivate) { + _ = existingNonFields[+isStatic][name]; + if (_ && (_ ^ kind) !== 7) { + throw new Error("Decorating two elements with the same name (" + desc[key].name + ") is not supported yet"); + } + + existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind; + } + } + + var newValue = Class; + + for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) { + var dec = assertCallable(decs[i], "A decorator", "be", true); + var decThis = decoratorsHaveThis ? decs[i - 1] : void 0; + + var decoratorFinishedRef = {}; + var ctx = { + kind: ["field", "accessor", "method", "getter", "setter", "class"][kind], + name: name, + metadata: metadata, + addInitializer: function(decoratorFinishedRef, initializer) { + if (decoratorFinishedRef.v) { + throw new TypeError("attempted to call addInitializer after decoration was finished"); + } + assertCallable(initializer, "An initializer", "be", true); + initializers.push(initializer); + } + .bind(null, decoratorFinishedRef) + }; + + if (isClass) { + _ = dec.call(decThis, newValue, ctx); + decoratorFinishedRef.v = 1; + + if (assertCallable(_, "class decorators", "return")) { + newValue = _; + } + continue; + } + + ctx.static = isStatic; + ctx.private = isPrivate; + _ = ctx.access = { + has: isPrivate ? hasPrivateBrand.bind() : function(target) { + return name in target; + } + }; + + if (!isSetter) { + _.get = isPrivate + ? isMethod + ? function(_this) { + assertInstanceIfPrivate(_this); + return desc.value; + } + : bindPropCall("get", 0, assertInstanceIfPrivate) + : function(target) { + return target[name]; + }; + } + + if (!isMethod && !isGetter) { + _.set = isPrivate ? bindPropCall("set", 0, assertInstanceIfPrivate) : function(target, value) { + target[name] = value; + }; + } + + newValue = dec.call(decThis, isAccessor ? { get: desc.get, set: desc.set } : desc[key], ctx); + + decoratorFinishedRef.v = 1; + + if (isAccessor) { + if (typeof newValue === "object" && newValue) { + if ((_ = assertCallable(newValue.get, "accessor.get"))) { + desc.get = _; + } + if ((_ = assertCallable(newValue.set, "accessor.set"))) { + desc.set = _; + } + if ((_ = assertCallable(newValue.init, "accessor.init"))) { + init.unshift(_); + } + } else if (newValue !== void 0) { + throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); + } + } else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) { + if (isField) { + init.unshift(newValue); + } else { + desc[key] = newValue; + } + } + } + + if (kind < 2) { + ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0)); + } + + if (!isField && !isClass) { + if (isPrivate) { + if (isAccessor) { + ret.splice(-1, 0, bindPropCall("get", isStatic), bindPropCall("set", isStatic)); + } else { + ret.push(isMethod ? desc[key] : assertCallable.call.bind(desc[key])); + } + } else { + defineProperty(Class, name, desc); + } + } + + return newValue; + } + + function applyMemberDecs() { + var ret = []; + var protoInitializers; + var staticInitializers; + + var pushInitializers = function(initializers) { + if (initializers) { + ret.push(createRunInitializers(initializers)); + } + }; + + var applyMemberDecsOfKind = function(isStatic, isField) { + for (var i = 0; i < memberDecs.length; i++) { + var decInfo = memberDecs[i]; + var kind = decInfo[1]; + var kindOnly = kind & 7; + + if ((kind & 8) == isStatic && !kindOnly == isField) { + var name = decInfo[2]; + var isPrivate = !!decInfo[3]; + var decoratorsHaveThis = kind & 16; + + applyDec( + isStatic ? targetClass : targetClass.prototype, + decInfo, + decoratorsHaveThis, + isPrivate ? "#" + name : toPropertyKey(name), + kindOnly, + kindOnly < 2 ? [] : isStatic ? (staticInitializers = staticInitializers || []) : (protoInitializers = protoInitializers || []), + ret, + !!isStatic, + isPrivate, + isField, + isStatic && isPrivate + ? function(_) { + return checkInRHS(_) === targetClass; + } + : instanceBrand + ); + } + } + }; + + applyMemberDecsOfKind(8, 0); + applyMemberDecsOfKind(0, 0); + applyMemberDecsOfKind(8, 1); + applyMemberDecsOfKind(0, 1); + + pushInitializers(protoInitializers); + pushInitializers(staticInitializers); + + return ret; + } + + function defineMetadata(Class) { + return defineProperty(Class, symbolMetadata, { configurable: true, enumerable: true, value: metadata }); + } + + if (parentClass !== undefined) { + metadata = parentClass[symbolMetadata]; + } + metadata = create(metadata == null ? null : metadata); + + _ = applyMemberDecs(); + + if (!hasClassDecs) { + defineMetadata(targetClass); + } + + return { + e: _, + get c() { + var initializers = []; + return (hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)]); + } + }; +} + +export { _apply_decs_2311 as _ }; diff --git a/node_modules/@swc/helpers/esm/_array_like_to_array.js b/node_modules/@swc/helpers/esm/_array_like_to_array.js new file mode 100644 index 0000000000000000000000000000000000000000..eb80534d6f49d7f019cf76feb156c14f6079a643 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_array_like_to_array.js @@ -0,0 +1,8 @@ +function _array_like_to_array(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} +export { _array_like_to_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_array_with_holes.js b/node_modules/@swc/helpers/esm/_array_with_holes.js new file mode 100644 index 0000000000000000000000000000000000000000..2532c929d0f531129c8597f08933cf00faad8ed7 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_array_with_holes.js @@ -0,0 +1,4 @@ +function _array_with_holes(arr) { + if (Array.isArray(arr)) return arr; +} +export { _array_with_holes as _ }; diff --git a/node_modules/@swc/helpers/esm/_array_without_holes.js b/node_modules/@swc/helpers/esm/_array_without_holes.js new file mode 100644 index 0000000000000000000000000000000000000000..cbdbc3222af81004fc0340df98436b9c2e360b76 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_array_without_holes.js @@ -0,0 +1,6 @@ +import { _ as _array_like_to_array } from "./_array_like_to_array.js"; + +function _array_without_holes(arr) { + if (Array.isArray(arr)) return _array_like_to_array(arr); +} +export { _array_without_holes as _ }; diff --git a/node_modules/@swc/helpers/esm/_assert_this_initialized.js b/node_modules/@swc/helpers/esm/_assert_this_initialized.js new file mode 100644 index 0000000000000000000000000000000000000000..0e2830a3ff96ffd43fc14ca94de2f688ddbe468a --- /dev/null +++ b/node_modules/@swc/helpers/esm/_assert_this_initialized.js @@ -0,0 +1,6 @@ +function _assert_this_initialized(self) { + if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + + return self; +} +export { _assert_this_initialized as _ }; diff --git a/node_modules/@swc/helpers/esm/_async_generator.js b/node_modules/@swc/helpers/esm/_async_generator.js new file mode 100644 index 0000000000000000000000000000000000000000..6e90a55fad67c35b8fb5750f4186ec2467b2313a --- /dev/null +++ b/node_modules/@swc/helpers/esm/_async_generator.js @@ -0,0 +1,74 @@ +import { _ as _overload_yield } from "./_overload_yield.js"; + +function _async_generator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function(resolve, reject) { + var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; + if (back) back = back.next = request; + else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + var overloaded = value instanceof _overload_yield; + Promise.resolve(overloaded ? value.v : value).then(function(arg) { + if (overloaded) { + var nextKey = key === "return" ? "return" : "next"; + if (!value.k || arg.done) return resume(nextKey, arg); + else arg = gen[nextKey](arg).value; + } + settle(result.done ? "return" : "normal", arg); + }, function(err) { + resume("throw", err); + }); + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ value: value, done: true }); + break; + case "throw": + front.reject(value); + break; + default: + front.resolve({ value: value, done: false }); + break; + } + front = front.next; + if (front) resume(front.key, front.arg); + else back = null; + } + + this._invoke = send; + + if (typeof gen.return !== "function") this.return = undefined; +} + +_async_generator.prototype[(typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"] = function() { + return this; +}; + +_async_generator.prototype.next = function(arg) { + return this._invoke("next", arg); +}; + +_async_generator.prototype.throw = function(arg) { + return this._invoke("throw", arg); +}; + +_async_generator.prototype.return = function(arg) { + return this._invoke("return", arg); +}; +export { _async_generator as _ }; diff --git a/node_modules/@swc/helpers/esm/_async_generator_delegate.js b/node_modules/@swc/helpers/esm/_async_generator_delegate.js new file mode 100644 index 0000000000000000000000000000000000000000..eb19f8821b7fe83fe4625eb09ad5a22476d2cc0b --- /dev/null +++ b/node_modules/@swc/helpers/esm/_async_generator_delegate.js @@ -0,0 +1,51 @@ +import { _ as _overload_yield } from "./_overload_yield.js"; + +function _async_generator_delegate(inner) { + var iter = {}, waiting = false; + + function pump(key, value) { + waiting = true; + value = new Promise(function(resolve) { + resolve(inner[key](value)); + }); + + return { done: false, value: new _overload_yield(value, /* kind: delegate */ 1) }; + } + + iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function() { + return this; + }; + + iter.next = function(value) { + if (waiting) { + waiting = false; + + return value; + } + + return pump("next", value); + }; + + if (typeof inner.throw === "function") { + iter.throw = function(value) { + if (waiting) { + waiting = false; + throw value; + } + + return pump("throw", value); + }; + } + if (typeof inner.return === "function") { + iter.return = function(value) { + if (waiting) { + waiting = false; + return value; + } + return pump("return", value); + }; + } + + return iter; +} +export { _async_generator_delegate as _ }; diff --git a/node_modules/@swc/helpers/esm/_async_iterator.js b/node_modules/@swc/helpers/esm/_async_iterator.js new file mode 100644 index 0000000000000000000000000000000000000000..b7ffe4cc732a210d45532432bacd1ea059747e38 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_async_iterator.js @@ -0,0 +1,44 @@ +function _async_iterator(iterable) { + var method, async, sync, retry = 2; + for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { + if (async && null != (method = iterable[async])) return method.call(iterable); + if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); + async = "@@asyncIterator", sync = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); +} +function AsyncFromSyncIterator(s) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + + var done = r.done; + + return Promise.resolve(r.value).then(function(value) { + return { value: value, done: done }; + }); + } + + return AsyncFromSyncIterator = function(s) { + this.s = s, this.n = s.next; + }, + AsyncFromSyncIterator.prototype = { + s: null, + n: null, + + next: function() { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + return: function(value) { + var ret = this.s.return; + + return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); + }, + throw: function(value) { + var thr = this.s.return; + + return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); + } + }, + new AsyncFromSyncIterator(s); +} +export { _async_iterator as _ }; diff --git a/node_modules/@swc/helpers/esm/_async_to_generator.js b/node_modules/@swc/helpers/esm/_async_to_generator.js new file mode 100644 index 0000000000000000000000000000000000000000..2fcf6ee883d12b1de673cc0b820939b50ae1b63f --- /dev/null +++ b/node_modules/@swc/helpers/esm/_async_to_generator.js @@ -0,0 +1,31 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) resolve(value); + else Promise.resolve(value).then(_next, _throw); +} +function _async_to_generator(fn) { + return function() { + var self = this, args = arguments; + + return new Promise(function(resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; +} +export { _async_to_generator as _ }; diff --git a/node_modules/@swc/helpers/esm/_await_async_generator.js b/node_modules/@swc/helpers/esm/_await_async_generator.js new file mode 100644 index 0000000000000000000000000000000000000000..b72716cbdadafab0951dd3aa6e3dc28752ef3603 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_await_async_generator.js @@ -0,0 +1,6 @@ +import { _ as _overload_yield } from "./_overload_yield.js"; + +function _await_async_generator(value) { + return new _overload_yield(value, /* kind: await */ 0); +} +export { _await_async_generator as _ }; diff --git a/node_modules/@swc/helpers/esm/_await_value.js b/node_modules/@swc/helpers/esm/_await_value.js new file mode 100644 index 0000000000000000000000000000000000000000..33a09128522c1a6e3958375eb204fa2d509cb5b0 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_await_value.js @@ -0,0 +1,4 @@ +function _await_value(value) { + this.wrapped = value; +} +export { _await_value as _ }; diff --git a/node_modules/@swc/helpers/esm/_call_super.js b/node_modules/@swc/helpers/esm/_call_super.js new file mode 100644 index 0000000000000000000000000000000000000000..f569d6270c36acfc3c708752dfc2a43dd042257c --- /dev/null +++ b/node_modules/@swc/helpers/esm/_call_super.js @@ -0,0 +1,17 @@ +import { _ as _get_prototype_of } from "./_get_prototype_of.js"; +import { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js"; +import { _ as _possible_constructor_return } from "./_possible_constructor_return.js"; + +function _call_super(_this, derived, args) { + // Super + derived = _get_prototype_of(derived); + return _possible_constructor_return( + _this, + _is_native_reflect_construct() + // NOTE: This doesn't work if this.__proto__.constructor has been modified. + ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) + : derived.apply(_this, args) + ); +} + +export { _call_super as _ }; diff --git a/node_modules/@swc/helpers/esm/_check_private_redeclaration.js b/node_modules/@swc/helpers/esm/_check_private_redeclaration.js new file mode 100644 index 0000000000000000000000000000000000000000..21e96da1a44c80b3a68c708b89cfb54f6e70122f --- /dev/null +++ b/node_modules/@swc/helpers/esm/_check_private_redeclaration.js @@ -0,0 +1,6 @@ +function _check_private_redeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError("Cannot initialize the same private elements twice on an object"); + } +} +export { _check_private_redeclaration as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_apply_descriptor_destructure.js b/node_modules/@swc/helpers/esm/_class_apply_descriptor_destructure.js new file mode 100644 index 0000000000000000000000000000000000000000..9bf79ee8b0d5dd7b54930c1f3ac55b81fa337aaa --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_apply_descriptor_destructure.js @@ -0,0 +1,23 @@ +function _class_apply_descriptor_destructure(receiver, descriptor) { + if (descriptor.set) { + if (!("__destrObj" in descriptor)) { + descriptor.__destrObj = { + set value(v) { + descriptor.set.call(receiver, v); + } + }; + } + + return descriptor.__destrObj; + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + + return descriptor; + } +} +export { _class_apply_descriptor_destructure as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js b/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js new file mode 100644 index 0000000000000000000000000000000000000000..15c6f2389719bcfc77bb03e6ce48e7839a4dee02 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js @@ -0,0 +1,6 @@ +function _class_apply_descriptor_get(receiver, descriptor) { + if (descriptor.get) return descriptor.get.call(receiver); + + return descriptor.value; +} +export { _class_apply_descriptor_get as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js b/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js new file mode 100644 index 0000000000000000000000000000000000000000..75091e1053bb95059ef1f3d92d58212f36b2fdd2 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js @@ -0,0 +1,13 @@ +function _class_apply_descriptor_set(receiver, descriptor, value) { + if (descriptor.set) descriptor.set.call(receiver, value); + else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + descriptor.value = value; + } +} +export { _class_apply_descriptor_set as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_apply_descriptor_update.js b/node_modules/@swc/helpers/esm/_class_apply_descriptor_update.js new file mode 100644 index 0000000000000000000000000000000000000000..adf62fb73c159d106abe7e855d1be0a2cc345ae2 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_apply_descriptor_update.js @@ -0,0 +1,28 @@ +function _class_apply_descriptor_update(receiver, descriptor) { + if (descriptor.set) { + if (!descriptor.get) throw new TypeError("attempted to read set only private field"); + + if (!("__destrWrapper" in descriptor)) { + descriptor.__destrWrapper = { + set value(v) { + descriptor.set.call(receiver, v); + }, + get value() { + return descriptor.get.call(receiver); + } + }; + } + + return descriptor.__destrWrapper; + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + + return descriptor; + } +} +export { _class_apply_descriptor_update as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_call_check.js b/node_modules/@swc/helpers/esm/_class_call_check.js new file mode 100644 index 0000000000000000000000000000000000000000..f0caf9e3178dde12cddc511c13537fe05afe682c --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_call_check.js @@ -0,0 +1,4 @@ +function _class_call_check(instance, Constructor) { + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); +} +export { _class_call_check as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_check_private_static_access.js b/node_modules/@swc/helpers/esm/_class_check_private_static_access.js new file mode 100644 index 0000000000000000000000000000000000000000..380f1d9bcba22a0b884f110a649cd30ec5068355 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_check_private_static_access.js @@ -0,0 +1,4 @@ +function _class_check_private_static_access(receiver, classConstructor) { + if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance"); +} +export { _class_check_private_static_access as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_check_private_static_field_descriptor.js b/node_modules/@swc/helpers/esm/_class_check_private_static_field_descriptor.js new file mode 100644 index 0000000000000000000000000000000000000000..a6a0a7fd6ae7894ddf48adfb1a332d87c96e3e7f --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_check_private_static_field_descriptor.js @@ -0,0 +1,6 @@ +function _class_check_private_static_field_descriptor(descriptor, action) { + if (descriptor === undefined) { + throw new TypeError("attempted to " + action + " private static field before its declaration"); + } +} +export { _class_check_private_static_field_descriptor as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js b/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js new file mode 100644 index 0000000000000000000000000000000000000000..44ca9e7fbc38b787afb195a10f92092a82b5efef --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js @@ -0,0 +1,6 @@ +function _class_extract_field_descriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance"); + + return privateMap.get(receiver); +} +export { _class_extract_field_descriptor as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_name_tdz_error.js b/node_modules/@swc/helpers/esm/_class_name_tdz_error.js new file mode 100644 index 0000000000000000000000000000000000000000..7014c58d99d313ac658e29f3e90944610643fb70 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_name_tdz_error.js @@ -0,0 +1,4 @@ +function _class_name_tdz_error(name) { + throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); +} +export { _class_name_tdz_error as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_destructure.js b/node_modules/@swc/helpers/esm/_class_private_field_destructure.js new file mode 100644 index 0000000000000000000000000000000000000000..5c624330fee0a0c5eb73240498ae78bc019523e0 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_destructure.js @@ -0,0 +1,8 @@ +import { _ as _class_apply_descriptor_destructure } from "./_class_apply_descriptor_destructure.js"; +import { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js"; + +function _class_private_field_destructure(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set"); + return _class_apply_descriptor_destructure(receiver, descriptor); +} +export { _class_private_field_destructure as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_get.js b/node_modules/@swc/helpers/esm/_class_private_field_get.js new file mode 100644 index 0000000000000000000000000000000000000000..078d320a5e9674865ae0e385200a989b3f297752 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_get.js @@ -0,0 +1,8 @@ +import { _ as _class_apply_descriptor_get } from "./_class_apply_descriptor_get.js"; +import { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js"; + +function _class_private_field_get(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get"); + return _class_apply_descriptor_get(receiver, descriptor); +} +export { _class_private_field_get as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_init.js b/node_modules/@swc/helpers/esm/_class_private_field_init.js new file mode 100644 index 0000000000000000000000000000000000000000..3daa81a52643636429ac74afdb25093a01ad2d54 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_init.js @@ -0,0 +1,7 @@ +import { _ as _check_private_redeclaration } from "./_check_private_redeclaration.js"; + +function _class_private_field_init(obj, privateMap, value) { + _check_private_redeclaration(obj, privateMap); + privateMap.set(obj, value); +} +export { _class_private_field_init as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_loose_base.js b/node_modules/@swc/helpers/esm/_class_private_field_loose_base.js new file mode 100644 index 0000000000000000000000000000000000000000..92f4c0729615b45bd27a074830eccf8d9f03ebbd --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_loose_base.js @@ -0,0 +1,8 @@ +function _class_private_field_loose_base(receiver, privateKey) { + if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { + throw new TypeError("attempted to use private field on non-instance"); + } + + return receiver; +} +export { _class_private_field_loose_base as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_loose_key.js b/node_modules/@swc/helpers/esm/_class_private_field_loose_key.js new file mode 100644 index 0000000000000000000000000000000000000000..83e89e7d6e92587fd8d4bf89cc0c1bb67352b6da --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_loose_key.js @@ -0,0 +1,6 @@ +var id = 0; + +function _class_private_field_loose_key(name) { + return "__private_" + id++ + "_" + name; +} +export { _class_private_field_loose_key as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_set.js b/node_modules/@swc/helpers/esm/_class_private_field_set.js new file mode 100644 index 0000000000000000000000000000000000000000..7640b8ea6be6db74c9e0c17cb72084dfef20eeb1 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_set.js @@ -0,0 +1,9 @@ +import { _ as _class_apply_descriptor_set } from "./_class_apply_descriptor_set.js"; +import { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js"; + +function _class_private_field_set(receiver, privateMap, value) { + var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set"); + _class_apply_descriptor_set(receiver, descriptor, value); + return value; +} +export { _class_private_field_set as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_field_update.js b/node_modules/@swc/helpers/esm/_class_private_field_update.js new file mode 100644 index 0000000000000000000000000000000000000000..d758a17e42e3a1340569bf21cb594578c44f511c --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_field_update.js @@ -0,0 +1,8 @@ +import { _ as _class_apply_descriptor_update } from "./_class_apply_descriptor_update.js"; +import { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js"; + +function _class_private_field_update(receiver, privateMap) { + var descriptor = _class_extract_field_descriptor(receiver, privateMap, "update"); + return _class_apply_descriptor_update(receiver, descriptor); +} +export { _class_private_field_update as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_method_get.js b/node_modules/@swc/helpers/esm/_class_private_method_get.js new file mode 100644 index 0000000000000000000000000000000000000000..c9d6946fcb2ff4ab321eb95d057f8e4024994ba4 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_method_get.js @@ -0,0 +1,6 @@ +function _class_private_method_get(receiver, privateSet, fn) { + if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance"); + + return fn; +} +export { _class_private_method_get as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_method_init.js b/node_modules/@swc/helpers/esm/_class_private_method_init.js new file mode 100644 index 0000000000000000000000000000000000000000..f2f4eda710b9f4144d0f17a0e82a5bf3a81ef781 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_method_init.js @@ -0,0 +1,7 @@ +import { _ as _check_private_redeclaration } from "./_check_private_redeclaration.js"; + +function _class_private_method_init(obj, privateSet) { + _check_private_redeclaration(obj, privateSet); + privateSet.add(obj); +} +export { _class_private_method_init as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_private_method_set.js b/node_modules/@swc/helpers/esm/_class_private_method_set.js new file mode 100644 index 0000000000000000000000000000000000000000..98e3be1ca2b2c09f1326800f4fd601de8943607c --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_private_method_set.js @@ -0,0 +1,4 @@ +function _class_private_method_set() { + throw new TypeError("attempted to reassign private method"); +} +export { _class_private_method_set as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_static_private_field_destructure.js b/node_modules/@swc/helpers/esm/_class_static_private_field_destructure.js new file mode 100644 index 0000000000000000000000000000000000000000..1aea463503a55d7f47263ff213febb507f8d0cf8 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_static_private_field_destructure.js @@ -0,0 +1,11 @@ +import { _ as _class_apply_descriptor_destructure } from "./_class_apply_descriptor_destructure.js"; +import { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; +import { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js"; + +function _class_static_private_field_destructure(receiver, classConstructor, descriptor) { + _class_check_private_static_access(receiver, classConstructor); + _class_check_private_static_field_descriptor(descriptor, "set"); + + return _class_apply_descriptor_destructure(receiver, descriptor); +} +export { _class_static_private_field_destructure as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_static_private_field_spec_get.js b/node_modules/@swc/helpers/esm/_class_static_private_field_spec_get.js new file mode 100644 index 0000000000000000000000000000000000000000..128476cbabad2619fd9214acb1a473a24ce49e1a --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_static_private_field_spec_get.js @@ -0,0 +1,11 @@ +import { _ as _class_apply_descriptor_get } from "./_class_apply_descriptor_get.js"; +import { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; +import { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js"; + +function _class_static_private_field_spec_get(receiver, classConstructor, descriptor) { + _class_check_private_static_access(receiver, classConstructor); + _class_check_private_static_field_descriptor(descriptor, "get"); + + return _class_apply_descriptor_get(receiver, descriptor); +} +export { _class_static_private_field_spec_get as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_static_private_field_spec_set.js b/node_modules/@swc/helpers/esm/_class_static_private_field_spec_set.js new file mode 100644 index 0000000000000000000000000000000000000000..0137ff7f88dc4d07c7b4fe69b81cc68794e9beec --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_static_private_field_spec_set.js @@ -0,0 +1,12 @@ +import { _ as _class_apply_descriptor_set } from "./_class_apply_descriptor_set.js"; +import { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; +import { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js"; + +function _class_static_private_field_spec_set(receiver, classConstructor, descriptor, value) { + _class_check_private_static_access(receiver, classConstructor); + _class_check_private_static_field_descriptor(descriptor, "set"); + _class_apply_descriptor_set(receiver, descriptor, value); + + return value; +} +export { _class_static_private_field_spec_set as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_static_private_field_update.js b/node_modules/@swc/helpers/esm/_class_static_private_field_update.js new file mode 100644 index 0000000000000000000000000000000000000000..d53d66aed9f9a252d55c368884c552e3ca0fbe7d --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_static_private_field_update.js @@ -0,0 +1,11 @@ +import { _ as _class_apply_descriptor_update } from "./_class_apply_descriptor_update.js"; +import { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; +import { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js"; + +function _class_static_private_field_update(receiver, classConstructor, descriptor) { + _class_check_private_static_access(receiver, classConstructor); + _class_check_private_static_field_descriptor(descriptor, "update"); + + return _class_apply_descriptor_update(receiver, descriptor); +} +export { _class_static_private_field_update as _ }; diff --git a/node_modules/@swc/helpers/esm/_class_static_private_method_get.js b/node_modules/@swc/helpers/esm/_class_static_private_method_get.js new file mode 100644 index 0000000000000000000000000000000000000000..d9309f4d9264e5fcad844d337131a2e861700744 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_class_static_private_method_get.js @@ -0,0 +1,8 @@ +import { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; + +function _class_static_private_method_get(receiver, classConstructor, method) { + _class_check_private_static_access(receiver, classConstructor); + + return method; +} +export { _class_static_private_method_get as _ }; diff --git a/node_modules/@swc/helpers/esm/_construct.js b/node_modules/@swc/helpers/esm/_construct.js new file mode 100644 index 0000000000000000000000000000000000000000..affce786612fe47cebe9bca0e9ad2f9502fcb248 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_construct.js @@ -0,0 +1,20 @@ +import { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js"; +import { _ as _set_prototype_of } from "./_set_prototype_of.js"; +function _construct(Parent, args, Class) { + if (_is_native_reflect_construct()) _construct = Reflect.construct; + else { + _construct = function construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + + if (Class) _set_prototype_of(instance, Class.prototype); + + return instance; + }; + } + + return _construct.apply(null, arguments); +} +export { _construct as _ }; diff --git a/node_modules/@swc/helpers/esm/_create_class.js b/node_modules/@swc/helpers/esm/_create_class.js new file mode 100644 index 0000000000000000000000000000000000000000..f251d98bc64f6ccf67fe4e41876948f8209d1f21 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_create_class.js @@ -0,0 +1,18 @@ +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + + if ("value" in descriptor) descriptor.writable = true; + + Object.defineProperty(target, descriptor.key, descriptor); + } +} +function _create_class(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + + return Constructor; +} +export { _create_class as _ }; diff --git a/node_modules/@swc/helpers/esm/_create_for_of_iterator_helper_loose.js b/node_modules/@swc/helpers/esm/_create_for_of_iterator_helper_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..d848f09d1e8144ded2502de2bbdbbf56c8e54af1 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_create_for_of_iterator_helper_loose.js @@ -0,0 +1,22 @@ +import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; + +function _create_for_of_iterator_helper_loose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + + if (it) return (it = it.call(o)).next.bind(it); + // Fallback for engines without symbol support + if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + + var i = 0; + + return function() { + if (i >= o.length) return { done: true }; + + return { done: false, value: o[i++] }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _create_for_of_iterator_helper_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_create_super.js b/node_modules/@swc/helpers/esm/_create_super.js new file mode 100644 index 0000000000000000000000000000000000000000..09b3ec024b965a715b7ede1f1b29f05d2ae1e655 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_create_super.js @@ -0,0 +1,21 @@ +import { _ as _get_prototype_of } from "./_get_prototype_of.js"; +import { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js"; +import { _ as _possible_constructor_return } from "./_possible_constructor_return.js"; + +function _create_super(Derived) { + var hasNativeReflectConstruct = _is_native_reflect_construct(); + + return function _createSuperInternal() { + var Super = _get_prototype_of(Derived), result; + + if (hasNativeReflectConstruct) { + var NewTarget = _get_prototype_of(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possible_constructor_return(this, result); + }; +} +export { _create_super as _ }; diff --git a/node_modules/@swc/helpers/esm/_decorate.js b/node_modules/@swc/helpers/esm/_decorate.js new file mode 100644 index 0000000000000000000000000000000000000000..7131a6dc1a9c73d3470e1ebab981da88731b74a3 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_decorate.js @@ -0,0 +1,268 @@ +import { _ as _to_array } from "./_to_array.js"; +import { _ as _to_property_key } from "./_to_property_key.js"; +import { _ as _type_of } from "./_type_of.js"; + +function _decorate(decorators, factory, superClass) { + var r = factory(function initialize(O) { + _initializeInstanceElements(O, decorated.elements); + }, superClass); + var decorated = _decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); + _initializeClassElements(r.F, decorated.elements); + + return _runClassFinishers(r.F, decorated.finishers); +} + +function _createElementDescriptor(def) { + var key = _to_property_key(def.key); + var descriptor; + + if (def.kind === "method") { + descriptor = { value: def.value, writable: true, configurable: true, enumerable: false }; + Object.defineProperty(def.value, "name", { value: _type_of(key) === "symbol" ? "" : key, configurable: true }); + } else if (def.kind === "get") descriptor = { get: def.value, configurable: true, enumerable: false }; + else if (def.kind === "set") descriptor = { set: def.value, configurable: true, enumerable: false }; + else if (def.kind === "field") descriptor = { configurable: true, writable: true, enumerable: true }; + + var element = { kind: def.kind === "field" ? "field" : "method", key: key, placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype", descriptor: descriptor }; + + if (def.decorators) element.decorators = def.decorators; + + if (def.kind === "field") element.initializer = def.value; + + return element; +} +function _coalesceGetterSetter(element, other) { + if (element.descriptor.get !== undefined) other.descriptor.get = element.descriptor.get; + else other.descriptor.set = element.descriptor.set; +} +function _coalesceClassElements(elements) { + var newElements = []; + var isSameElement = function isSameElement(other) { + return other.kind === "method" && other.key === element.key && other.placement === element.placement; + }; + + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + var other; + + if (element.kind === "method" && (other = newElements.find(isSameElement))) { + if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { + if (_hasDecorators(element) || _hasDecorators(other)) { + throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); + } + other.descriptor = element.descriptor; + } else { + if (_hasDecorators(element)) { + if (_hasDecorators(other)) { + throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); + } + other.decorators = element.decorators; + } + _coalesceGetterSetter(element, other); + } + } else { + newElements.push(element); + } + } + + return newElements; +} +function _hasDecorators(element) { + return element.decorators && element.decorators.length; +} +function _isDataDescriptor(desc) { + return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); +} +function _initializeClassElements(F, elements) { + var proto = F.prototype; + ["method", "field"].forEach(function(kind) { + elements.forEach(function(element) { + var placement = element.placement; + if (element.kind === kind && (placement === "static" || placement === "prototype")) { + var receiver = placement === "static" ? F : proto; + _defineClassElement(receiver, element); + } + }); + }); +} +function _initializeInstanceElements(O, elements) { + ["method", "field"].forEach(function(kind) { + elements.forEach(function(element) { + if (element.kind === kind && element.placement === "own") _defineClassElement(O, element); + }); + }); +} +function _defineClassElement(receiver, element) { + var descriptor = element.descriptor; + if (element.kind === "field") { + var initializer = element.initializer; + descriptor = { enumerable: descriptor.enumerable, writable: descriptor.writable, configurable: descriptor.configurable, value: initializer === void 0 ? void 0 : initializer.call(receiver) }; + } + Object.defineProperty(receiver, element.key, descriptor); +} +function _decorateClass(elements, decorators) { + var newElements = []; + var finishers = []; + var placements = { static: [], prototype: [], own: [] }; + elements.forEach(function(element) { + _addElementPlacement(element, placements); + }); + elements.forEach(function(element) { + if (!_hasDecorators(element)) return newElements.push(element); + var elementFinishersExtras = _decorateElement(element, placements); + newElements.push(elementFinishersExtras.element); + newElements.push.apply(newElements, elementFinishersExtras.extras); + finishers.push.apply(finishers, elementFinishersExtras.finishers); + }); + if (!decorators) return { elements: newElements, finishers: finishers }; + var result = _decorateConstructor(newElements, decorators); + finishers.push.apply(finishers, result.finishers); + result.finishers = finishers; + + return result; +} +function _addElementPlacement(element, placements, silent) { + var keys = placements[element.placement]; + if (!silent && keys.indexOf(element.key) !== -1) throw new TypeError("Duplicated element (" + element.key + ")"); + keys.push(element.key); +} +function _decorateElement(element, placements) { + var extras = []; + var finishers = []; + for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { + var keys = placements[element.placement]; + keys.splice(keys.indexOf(element.key), 1); + var elementObject = _fromElementDescriptor(element); + var elementFinisherExtras = _toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); + element = elementFinisherExtras.element; + _addElementPlacement(element, placements); + if (elementFinisherExtras.finisher) finishers.push(elementFinisherExtras.finisher); + var newExtras = elementFinisherExtras.extras; + if (newExtras) { + for (var j = 0; j < newExtras.length; j++) _addElementPlacement(newExtras[j], placements); + extras.push.apply(extras, newExtras); + } + } + + return { element: element, finishers: finishers, extras: extras }; +} +function _decorateConstructor(elements, decorators) { + var finishers = []; + for (var i = decorators.length - 1; i >= 0; i--) { + var obj = _fromClassDescriptor(elements); + var elementsAndFinisher = _toClassDescriptor((0, decorators[i])(obj) || obj); + if (elementsAndFinisher.finisher !== undefined) finishers.push(elementsAndFinisher.finisher); + if (elementsAndFinisher.elements !== undefined) { + elements = elementsAndFinisher.elements; + for (var j = 0; j < elements.length - 1; j++) { + for (var k = j + 1; k < elements.length; k++) { + if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { + throw new TypeError("Duplicated element (" + elements[j].key + ")"); + } + } + } + } + } + + return { elements: elements, finishers: finishers }; +} +function _fromElementDescriptor(element) { + var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor }; + var desc = { value: "Descriptor", configurable: true }; + Object.defineProperty(obj, Symbol.toStringTag, desc); + if (element.kind === "field") obj.initializer = element.initializer; + + return obj; +} +function _toElementDescriptors(elementObjects) { + if (elementObjects === undefined) return; + + return _to_array(elementObjects).map(function(elementObject) { + var element = _toElementDescriptor(elementObject); + _disallowProperty(elementObject, "finisher", "An element descriptor"); + _disallowProperty(elementObject, "extras", "An element descriptor"); + + return element; + }); +} +function _toElementDescriptor(elementObject) { + var kind = String(elementObject.kind); + if (kind !== "method" && kind !== "field") { + throw new TypeError("An element descriptor's .kind property must be either \"method\" or" + " \"field\", but a decorator created an element descriptor with" + " .kind \"" + kind + "\""); + } + var key = _to_property_key(elementObject.key); + var placement = String(elementObject.placement); + if (placement !== "static" && placement !== "prototype" && placement !== "own") { + throw new TypeError( + "An element descriptor's .placement property must be one of \"static\"," + + " \"prototype\" or \"own\", but a decorator created an element descriptor" + + " with .placement \"" + + placement + + "\"" + ); + } + var descriptor = elementObject.descriptor; + _disallowProperty(elementObject, "elements", "An element descriptor"); + var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) }; + if (kind !== "field") _disallowProperty(elementObject, "initializer", "A method descriptor"); + else { + _disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); + _disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); + _disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); + element.initializer = elementObject.initializer; + } + + return element; +} +function _toElementFinisherExtras(elementObject) { + var element = _toElementDescriptor(elementObject); + var finisher = _optionalCallableProperty(elementObject, "finisher"); + var extras = _toElementDescriptors(elementObject.extras); + + return { element: element, finisher: finisher, extras: extras }; +} +function _fromClassDescriptor(elements) { + var obj = { kind: "class", elements: elements.map(_fromElementDescriptor) }; + var desc = { value: "Descriptor", configurable: true }; + Object.defineProperty(obj, Symbol.toStringTag, desc); + + return obj; +} +function _toClassDescriptor(obj) { + var kind = String(obj.kind); + if (kind !== "class") { + throw new TypeError("A class descriptor's .kind property must be \"class\", but a decorator" + " created a class descriptor with .kind \"" + kind + "\""); + } + _disallowProperty(obj, "key", "A class descriptor"); + _disallowProperty(obj, "placement", "A class descriptor"); + _disallowProperty(obj, "descriptor", "A class descriptor"); + _disallowProperty(obj, "initializer", "A class descriptor"); + _disallowProperty(obj, "extras", "A class descriptor"); + var finisher = _optionalCallableProperty(obj, "finisher"); + var elements = _toElementDescriptors(obj.elements); + + return { elements: elements, finisher: finisher }; +} +function _disallowProperty(obj, name, objectType) { + if (obj[name] !== undefined) throw new TypeError(objectType + " can't have a ." + name + " property."); +} +function _optionalCallableProperty(obj, name) { + var value = obj[name]; + if (value !== undefined && typeof value !== "function") { + throw new TypeError("Expected '" + name + "' to be a function"); + } + + return value; +} +function _runClassFinishers(constructor, finishers) { + for (var i = 0; i < finishers.length; i++) { + var newConstructor = (0, finishers[i])(constructor); + if (newConstructor !== undefined) { + if (typeof newConstructor !== "function") throw new TypeError("Finishers must return a constructor."); + constructor = newConstructor; + } + } + + return constructor; +} +export { _decorate as _ }; diff --git a/node_modules/@swc/helpers/esm/_defaults.js b/node_modules/@swc/helpers/esm/_defaults.js new file mode 100644 index 0000000000000000000000000000000000000000..de0bc0cbce96200cb9709553d2a3e31198c9ee89 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_defaults.js @@ -0,0 +1,13 @@ +function _defaults(obj, defaults) { + var keys = Object.getOwnPropertyNames(defaults); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = Object.getOwnPropertyDescriptor(defaults, key); + + if (value && value.configurable && obj[key] === undefined) Object.defineProperty(obj, key, value); + } + + return obj; +} +export { _defaults as _ }; diff --git a/node_modules/@swc/helpers/esm/_define_enumerable_properties.js b/node_modules/@swc/helpers/esm/_define_enumerable_properties.js new file mode 100644 index 0000000000000000000000000000000000000000..7e184ef6973396c6beda4287bbb977d6ac59100c --- /dev/null +++ b/node_modules/@swc/helpers/esm/_define_enumerable_properties.js @@ -0,0 +1,24 @@ +function _define_enumerable_properties(obj, descs) { + for (var key in descs) { + var desc = descs[key]; + desc.configurable = desc.enumerable = true; + + if ("value" in desc) desc.writable = true; + + Object.defineProperty(obj, key, desc); + } + + if (Object.getOwnPropertySymbols) { + var objectSymbols = Object.getOwnPropertySymbols(descs); + for (var i = 0; i < objectSymbols.length; i++) { + var sym = objectSymbols[i]; + var desc = descs[sym]; + desc.configurable = desc.enumerable = true; + if ("value" in desc) desc.writable = true; + Object.defineProperty(obj, sym, desc); + } + } + + return obj; +} +export { _define_enumerable_properties as _ }; diff --git a/node_modules/@swc/helpers/esm/_define_property.js b/node_modules/@swc/helpers/esm/_define_property.js new file mode 100644 index 0000000000000000000000000000000000000000..fe259f2a5e3b088a56f02439f2a282e42da82231 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_define_property.js @@ -0,0 +1,8 @@ +function _define_property(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); + } else obj[key] = value; + + return obj; +} +export { _define_property as _ }; diff --git a/node_modules/@swc/helpers/esm/_dispose.js b/node_modules/@swc/helpers/esm/_dispose.js new file mode 100644 index 0000000000000000000000000000000000000000..97b816276baf80988d4e9a3dca27d539548f05c8 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_dispose.js @@ -0,0 +1,41 @@ +/* @minVersion 7.22.0 */ +function dispose_SuppressedError(error, suppressed) { + if (typeof SuppressedError !== "undefined") { + // eslint-disable-next-line no-undef + dispose_SuppressedError = SuppressedError; + } else { + dispose_SuppressedError = function SuppressedError(error, suppressed) { + this.suppressed = suppressed; + this.error = error; + this.stack = new Error().stack; + }; + dispose_SuppressedError.prototype = Object.create(Error.prototype, { constructor: { value: dispose_SuppressedError, writable: true, configurable: true } }); + } + return new dispose_SuppressedError(error, suppressed); +} + +function _dispose(stack, error, hasError) { + function next() { + while (stack.length > 0) { + try { + var r = stack.pop(); + var p = r.d.call(r.v); + if (r.a) return Promise.resolve(p).then(next, err); + } catch (e) { + return err(e); + } + } + if (hasError) throw error; + } + + function err(e) { + error = hasError ? new dispose_SuppressedError(e, error) : e; + hasError = true; + + return next(); + } + + return next(); +} + +export { _dispose as _ }; diff --git a/node_modules/@swc/helpers/esm/_export_star.js b/node_modules/@swc/helpers/esm/_export_star.js new file mode 100644 index 0000000000000000000000000000000000000000..98789f732c4d852ac6dc1d017dd07dba914066dc --- /dev/null +++ b/node_modules/@swc/helpers/esm/_export_star.js @@ -0,0 +1,15 @@ +function _export_star(from, to) { + Object.keys(from).forEach(function(k) { + if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { + Object.defineProperty(to, k, { + enumerable: true, + get: function() { + return from[k]; + } + }); + } + }); + + return from; +} +export { _export_star as _ }; diff --git a/node_modules/@swc/helpers/esm/_extends.js b/node_modules/@swc/helpers/esm/_extends.js new file mode 100644 index 0000000000000000000000000000000000000000..7baa58ee45c735a305b73134cb4956795d17aef0 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_extends.js @@ -0,0 +1,13 @@ +function _extends() { + _extends = Object.assign || function assign(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + + return target; + }; + + return _extends.apply(this, arguments); +} +export { _extends as _ }; diff --git a/node_modules/@swc/helpers/esm/_get.js b/node_modules/@swc/helpers/esm/_get.js new file mode 100644 index 0000000000000000000000000000000000000000..0d5fd28157c0ebc6df5276e1231e7b7d2cc3551f --- /dev/null +++ b/node_modules/@swc/helpers/esm/_get.js @@ -0,0 +1,21 @@ +import { _ as _super_prop_base } from "./_super_prop_base.js"; + +function _get(target, property, receiver) { + if (typeof Reflect !== "undefined" && Reflect.get) _get = Reflect.get; + else { + _get = function get(target, property, receiver) { + var base = _super_prop_base(target, property); + + if (!base) return; + + var desc = Object.getOwnPropertyDescriptor(base, property); + + if (desc.get) return desc.get.call(receiver || target); + + return desc.value; + }; + } + + return _get(target, property, receiver || target); +} +export { _get as _ }; diff --git a/node_modules/@swc/helpers/esm/_get_prototype_of.js b/node_modules/@swc/helpers/esm/_get_prototype_of.js new file mode 100644 index 0000000000000000000000000000000000000000..951dd01d2996418f5b143a4e1aa241368d68330f --- /dev/null +++ b/node_modules/@swc/helpers/esm/_get_prototype_of.js @@ -0,0 +1,8 @@ +function _get_prototype_of(o) { + _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + + return _get_prototype_of(o); +} +export { _get_prototype_of as _ }; diff --git a/node_modules/@swc/helpers/esm/_identity.js b/node_modules/@swc/helpers/esm/_identity.js new file mode 100644 index 0000000000000000000000000000000000000000..9af20108a23cc8e8a53ffd938abf2a503f8089ff --- /dev/null +++ b/node_modules/@swc/helpers/esm/_identity.js @@ -0,0 +1,5 @@ +function _identity(x) { + return x; +} + +export { _identity as _ }; diff --git a/node_modules/@swc/helpers/esm/_inherits.js b/node_modules/@swc/helpers/esm/_inherits.js new file mode 100644 index 0000000000000000000000000000000000000000..563d0d25fd705539ca9b6c21e993a4b1f9ec089b --- /dev/null +++ b/node_modules/@swc/helpers/esm/_inherits.js @@ -0,0 +1,12 @@ +import { _ as _set_prototype_of } from "./_set_prototype_of.js"; + +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); + + if (superClass) _set_prototype_of(subClass, superClass); +} +export { _inherits as _ }; diff --git a/node_modules/@swc/helpers/esm/_inherits_loose.js b/node_modules/@swc/helpers/esm/_inherits_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..d222f69fc6064fad2d216b37d6c5bfa1cab61db8 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_inherits_loose.js @@ -0,0 +1,6 @@ +function _inherits_loose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} +export { _inherits_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_initializer_define_property.js b/node_modules/@swc/helpers/esm/_initializer_define_property.js new file mode 100644 index 0000000000000000000000000000000000000000..396946028ea216baa1e8352d7eaf8ba8573eb0d4 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_initializer_define_property.js @@ -0,0 +1,11 @@ +function _initializer_define_property(target, property, descriptor, context) { + if (!descriptor) return; + + Object.defineProperty(target, property, { + enumerable: descriptor.enumerable, + configurable: descriptor.configurable, + writable: descriptor.writable, + value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 + }); +} +export { _initializer_define_property as _ }; diff --git a/node_modules/@swc/helpers/esm/_initializer_warning_helper.js b/node_modules/@swc/helpers/esm/_initializer_warning_helper.js new file mode 100644 index 0000000000000000000000000000000000000000..2590876ef35969021d554d06d0fa947a95842572 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_initializer_warning_helper.js @@ -0,0 +1,9 @@ +function _initializer_warning_helper(descriptor, context) { + throw new Error( + "Decorating class property failed. Please ensure that " + + "proposal-class-properties is enabled and set to use loose mode. " + + "To use proposal-class-properties in spec mode with decorators, wait for " + + "the next major version of decorators in stage 2." + ); +} +export { _initializer_warning_helper as _ }; diff --git a/node_modules/@swc/helpers/esm/_instanceof.js b/node_modules/@swc/helpers/esm/_instanceof.js new file mode 100644 index 0000000000000000000000000000000000000000..153d076f31de6ddac32318718925320fc1463835 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_instanceof.js @@ -0,0 +1,8 @@ +function _instanceof(left, right) { + "@swc/helpers - instanceof"; + + if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { + return !!right[Symbol.hasInstance](left); + } else return left instanceof right; +} +export { _instanceof as _ }; diff --git a/node_modules/@swc/helpers/esm/_interop_require_default.js b/node_modules/@swc/helpers/esm/_interop_require_default.js new file mode 100644 index 0000000000000000000000000000000000000000..12458929e47122d60e870bbe19af56522a3bf106 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_interop_require_default.js @@ -0,0 +1,4 @@ +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} +export { _interop_require_default as _ }; diff --git a/node_modules/@swc/helpers/esm/_interop_require_wildcard.js b/node_modules/@swc/helpers/esm/_interop_require_wildcard.js new file mode 100644 index 0000000000000000000000000000000000000000..fd78233b3d31e0df33707646b175a74eddb872ec --- /dev/null +++ b/node_modules/@swc/helpers/esm/_interop_require_wildcard.js @@ -0,0 +1,36 @@ +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + + return (_getRequireWildcardCache = function(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} +function _interop_require_wildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) return obj; + if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj }; + + var cache = _getRequireWildcardCache(nodeInterop); + + if (cache && cache.has(obj)) return cache.get(obj); + + var newObj = { __proto__: null }; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + + for (var key in obj) { + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + } + + newObj.default = obj; + + if (cache) cache.set(obj, newObj); + + return newObj; +} +export { _interop_require_wildcard as _ }; diff --git a/node_modules/@swc/helpers/esm/_is_native_function.js b/node_modules/@swc/helpers/esm/_is_native_function.js new file mode 100644 index 0000000000000000000000000000000000000000..c7cf198731b57e5a3604e114f26e40acf9fda9f9 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_is_native_function.js @@ -0,0 +1,4 @@ +function _is_native_function(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} +export { _is_native_function as _ }; diff --git a/node_modules/@swc/helpers/esm/_is_native_reflect_construct.js b/node_modules/@swc/helpers/esm/_is_native_reflect_construct.js new file mode 100644 index 0000000000000000000000000000000000000000..af04603219bbe74a961e2d97e755121f504b5562 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_is_native_reflect_construct.js @@ -0,0 +1,16 @@ +function _is_native_reflect_construct() { + // Since Reflect.construct can't be properly polyfilled, some + // implementations (e.g. core-js@2) don't set the correct internal slots. + // Those polyfills don't allow us to subclass built-ins, so we need to + // use our fallback implementation. + try { + // If the internal slots aren't set, this throws an error similar to + // TypeError: this is not a Boolean object. + var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); + } catch (_) {} + return (_is_native_reflect_construct = function() { + return !!result; + })(); +} + +export { _is_native_reflect_construct as _ }; diff --git a/node_modules/@swc/helpers/esm/_iterable_to_array.js b/node_modules/@swc/helpers/esm/_iterable_to_array.js new file mode 100644 index 0000000000000000000000000000000000000000..e44dfb002305add6b2023deeae15bb9b6f9e6924 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_iterable_to_array.js @@ -0,0 +1,6 @@ +function _iterable_to_array(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) { + return Array.from(iter); + } +} +export { _iterable_to_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_iterable_to_array_limit.js b/node_modules/@swc/helpers/esm/_iterable_to_array_limit.js new file mode 100644 index 0000000000000000000000000000000000000000..1ce2bc94b3654416919ceb097987202861b1fdd3 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_iterable_to_array_limit.js @@ -0,0 +1,29 @@ +function _iterable_to_array_limit(arr, i) { + var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; + + if (_i == null) return; + + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + + try { + for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} +export { _iterable_to_array_limit as _ }; diff --git a/node_modules/@swc/helpers/esm/_iterable_to_array_limit_loose.js b/node_modules/@swc/helpers/esm/_iterable_to_array_limit_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..2369e8b6858d5703212d76599cc73c1b05cce98a --- /dev/null +++ b/node_modules/@swc/helpers/esm/_iterable_to_array_limit_loose.js @@ -0,0 +1,15 @@ +function _iterable_to_array_limit_loose(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + + if (_i == null) return; + + var _arr = []; + + for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) { + _arr.push(_step.value); + if (i && _arr.length === i) break; + } + + return _arr; +} +export { _iterable_to_array_limit_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_jsx.js b/node_modules/@swc/helpers/esm/_jsx.js new file mode 100644 index 0000000000000000000000000000000000000000..0695535c02077402a4c60ee231de9730583886d4 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_jsx.js @@ -0,0 +1,26 @@ +var REACT_ELEMENT_TYPE; +function _jsx(type, props, key, children) { + if (!REACT_ELEMENT_TYPE) { + REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; + } + + var defaultProps = type && type.defaultProps; + var childrenLength = arguments.length - 3; + + if (!props && childrenLength !== 0) props = { children: void 0 }; + if (props && defaultProps) { + for (var propName in defaultProps) { + if (props[propName] === void 0) props[propName] = defaultProps[propName]; + else if (!props) props = defaultProps || {}; + } + } + if (childrenLength === 1) props.children = children; + else if (childrenLength > 1) { + var childArray = new Array(childrenLength); + for (var i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; + props.children = childArray; + } + + return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : "" + key, ref: null, props: props, _owner: null }; +} +export { _jsx as _ }; diff --git a/node_modules/@swc/helpers/esm/_new_arrow_check.js b/node_modules/@swc/helpers/esm/_new_arrow_check.js new file mode 100644 index 0000000000000000000000000000000000000000..0651b3c550d2d12e6855b84167015dd2b1d86e17 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_new_arrow_check.js @@ -0,0 +1,4 @@ +function _new_arrow_check(innerThis, boundThis) { + if (innerThis !== boundThis) throw new TypeError("Cannot instantiate an arrow function"); +} +export { _new_arrow_check as _ }; diff --git a/node_modules/@swc/helpers/esm/_non_iterable_rest.js b/node_modules/@swc/helpers/esm/_non_iterable_rest.js new file mode 100644 index 0000000000000000000000000000000000000000..b41d9c237199d2441241083fbacce824805d1e56 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_non_iterable_rest.js @@ -0,0 +1,4 @@ +function _non_iterable_rest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _non_iterable_rest as _ }; diff --git a/node_modules/@swc/helpers/esm/_non_iterable_spread.js b/node_modules/@swc/helpers/esm/_non_iterable_spread.js new file mode 100644 index 0000000000000000000000000000000000000000..fd7b50e72a3e57ff9b44167297c23e36a1e181e4 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_non_iterable_spread.js @@ -0,0 +1,4 @@ +function _non_iterable_spread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +export { _non_iterable_spread as _ }; diff --git a/node_modules/@swc/helpers/esm/_object_destructuring_empty.js b/node_modules/@swc/helpers/esm/_object_destructuring_empty.js new file mode 100644 index 0000000000000000000000000000000000000000..97a6dd750cfd9e740dbd02ef5fb3a9158fb2cb4d --- /dev/null +++ b/node_modules/@swc/helpers/esm/_object_destructuring_empty.js @@ -0,0 +1,6 @@ +function _object_destructuring_empty(o) { + if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o); + + return o; +} +export { _object_destructuring_empty as _ }; diff --git a/node_modules/@swc/helpers/esm/_object_spread.js b/node_modules/@swc/helpers/esm/_object_spread.js new file mode 100644 index 0000000000000000000000000000000000000000..a71c747f5d857a1d7776c14469350fd2f6a30dc1 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_object_spread.js @@ -0,0 +1,23 @@ +import { _ as _define_property } from "./_define_property.js"; + +function _object_spread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === "function") { + ownKeys = ownKeys.concat( + Object.getOwnPropertySymbols(source).filter(function(sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + }) + ); + } + + ownKeys.forEach(function(key) { + _define_property(target, key, source[key]); + }); + } + + return target; +} +export { _object_spread as _ }; diff --git a/node_modules/@swc/helpers/esm/_object_spread_props.js b/node_modules/@swc/helpers/esm/_object_spread_props.js new file mode 100644 index 0000000000000000000000000000000000000000..88593ee348d78afedbd90c5a69f79b5e668de247 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_object_spread_props.js @@ -0,0 +1,28 @@ +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) { + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + keys.push.apply(keys, symbols); + } + + return keys; +} +function _object_spread_props(target, source) { + source = source != null ? source : {}; + + if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + else { + ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; +} +export { _object_spread_props as _ }; diff --git a/node_modules/@swc/helpers/esm/_object_without_properties.js b/node_modules/@swc/helpers/esm/_object_without_properties.js new file mode 100644 index 0000000000000000000000000000000000000000..0f22b51c230edb1b18a105824bc6f188f58fdf91 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_object_without_properties.js @@ -0,0 +1,33 @@ +import { _ as _object_without_properties_loose } from "./_object_without_properties_loose.js"; + +function _object_without_properties(source, excluded) { + if (source == null) return {}; + + var target = {}, sourceKeys, key, i; + if (typeof Reflect !== "undefined" && Reflect.ownKeys) { + sourceKeys = Reflect.ownKeys(Object(source)); + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + + return target; + } + + target = _object_without_properties_loose(source, excluded); + if (Object.getOwnPropertySymbols) { + sourceKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +export { _object_without_properties as _ }; diff --git a/node_modules/@swc/helpers/esm/_object_without_properties_loose.js b/node_modules/@swc/helpers/esm/_object_without_properties_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..1cf60718b407da785ad86d27036cf65e25ee1c57 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_object_without_properties_loose.js @@ -0,0 +1,14 @@ +function _object_without_properties_loose(source, excluded) { + if (source == null) return {}; + + var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + + return target; +} +export { _object_without_properties_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_overload_yield.js b/node_modules/@swc/helpers/esm/_overload_yield.js new file mode 100644 index 0000000000000000000000000000000000000000..17260d1559c053a8cd716dc02a2a848787d5ce0d --- /dev/null +++ b/node_modules/@swc/helpers/esm/_overload_yield.js @@ -0,0 +1,6 @@ +function _overload_yield(value, /** 0: await 1: delegate */ kind) { + this.v = value; + this.k = kind; +} + +export { _overload_yield as _ }; diff --git a/node_modules/@swc/helpers/esm/_possible_constructor_return.js b/node_modules/@swc/helpers/esm/_possible_constructor_return.js new file mode 100644 index 0000000000000000000000000000000000000000..b07f39070b46bc30a040454b5951fd9c11c7f06d --- /dev/null +++ b/node_modules/@swc/helpers/esm/_possible_constructor_return.js @@ -0,0 +1,9 @@ +import { _ as _assert_this_initialized } from "./_assert_this_initialized.js"; +import { _ as _type_of } from "./_type_of.js"; + +function _possible_constructor_return(self, call) { + if (call && (_type_of(call) === "object" || typeof call === "function")) return call; + + return _assert_this_initialized(self); +} +export { _possible_constructor_return as _ }; diff --git a/node_modules/@swc/helpers/esm/_read_only_error.js b/node_modules/@swc/helpers/esm/_read_only_error.js new file mode 100644 index 0000000000000000000000000000000000000000..4b63ee3ea3bd8ecd51b09a4e3c2a3694c8db01cd --- /dev/null +++ b/node_modules/@swc/helpers/esm/_read_only_error.js @@ -0,0 +1,4 @@ +function _read_only_error(name) { + throw new TypeError("\"" + name + "\" is read-only"); +} +export { _read_only_error as _ }; diff --git a/node_modules/@swc/helpers/esm/_set.js b/node_modules/@swc/helpers/esm/_set.js new file mode 100644 index 0000000000000000000000000000000000000000..15dc2f1b6eb0a05f8d15f7c5bfcda6cb12488c20 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_set.js @@ -0,0 +1,42 @@ +import { _ as _define_property } from "./_define_property.js"; +import { _ as _super_prop_base } from "./_super_prop_base.js"; + +function set(target, property, value, receiver) { + if (typeof Reflect !== "undefined" && Reflect.set) set = Reflect.set; + else { + set = function set(target, property, value, receiver) { + var base = _super_prop_base(target, property); + var desc; + if (base) { + desc = Object.getOwnPropertyDescriptor(base, property); + if (desc.set) { + desc.set.call(receiver, value); + + return true; + } else if (!desc.writable) { + return false; + } + } + desc = Object.getOwnPropertyDescriptor(receiver, property); + if (desc) { + if (!desc.writable) return false; + desc.value = value; + Object.defineProperty(receiver, property, desc); + } else { + _define_property(receiver, property, value); + } + + return true; + }; + } + + return set(target, property, value, receiver); +} + +function _set(target, property, value, receiver, isStrict) { + var s = set(target, property, value, receiver || target); + if (!s && isStrict) throw new Error("failed to set property"); + + return value; +} +export { _set as _ }; diff --git a/node_modules/@swc/helpers/esm/_set_prototype_of.js b/node_modules/@swc/helpers/esm/_set_prototype_of.js new file mode 100644 index 0000000000000000000000000000000000000000..6a1f4df4183e6be4c3108f86e7d49d39c702dd00 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_set_prototype_of.js @@ -0,0 +1,10 @@ +function _set_prototype_of(o, p) { + _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { + o.__proto__ = p; + + return o; + }; + + return _set_prototype_of(o, p); +} +export { _set_prototype_of as _ }; diff --git a/node_modules/@swc/helpers/esm/_skip_first_generator_next.js b/node_modules/@swc/helpers/esm/_skip_first_generator_next.js new file mode 100644 index 0000000000000000000000000000000000000000..1ccf48901c343fff5e854081f5529af64d04a7ca --- /dev/null +++ b/node_modules/@swc/helpers/esm/_skip_first_generator_next.js @@ -0,0 +1,9 @@ +function _skip_first_generator_next(fn) { + return function() { + var it = fn.apply(this, arguments); + it.next(); + + return it; + }; +} +export { _skip_first_generator_next as _ }; diff --git a/node_modules/@swc/helpers/esm/_sliced_to_array.js b/node_modules/@swc/helpers/esm/_sliced_to_array.js new file mode 100644 index 0000000000000000000000000000000000000000..750c3019fb108e78759f797a64d9f1bc05d42aad --- /dev/null +++ b/node_modules/@swc/helpers/esm/_sliced_to_array.js @@ -0,0 +1,9 @@ +import { _ as _array_with_holes } from "./_array_with_holes.js"; +import { _ as _iterable_to_array_limit } from "./_iterable_to_array_limit.js"; +import { _ as _non_iterable_rest } from "./_non_iterable_rest.js"; +import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; + +function _sliced_to_array(arr, i) { + return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); +} +export { _sliced_to_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_sliced_to_array_loose.js b/node_modules/@swc/helpers/esm/_sliced_to_array_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..859de45d8cb2e470a81133baccf1e0b6eed59d7e --- /dev/null +++ b/node_modules/@swc/helpers/esm/_sliced_to_array_loose.js @@ -0,0 +1,9 @@ +import { _ as _array_with_holes } from "./_array_with_holes.js"; +import { _ as _iterable_to_array_limit_loose } from "./_iterable_to_array_limit_loose.js"; +import { _ as _non_iterable_rest } from "./_non_iterable_rest.js"; +import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; + +function _sliced_to_array_loose(arr, i) { + return _array_with_holes(arr) || _iterable_to_array_limit_loose(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); +} +export { _sliced_to_array_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_super_prop_base.js b/node_modules/@swc/helpers/esm/_super_prop_base.js new file mode 100644 index 0000000000000000000000000000000000000000..47dec411f2300277c10b3956bd491c09e0a3b260 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_super_prop_base.js @@ -0,0 +1,11 @@ +import { _ as _get_prototype_of } from "./_get_prototype_of.js"; + +function _super_prop_base(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _get_prototype_of(object); + if (object === null) break; + } + + return object; +} +export { _super_prop_base as _ }; diff --git a/node_modules/@swc/helpers/esm/_tagged_template_literal.js b/node_modules/@swc/helpers/esm/_tagged_template_literal.js new file mode 100644 index 0000000000000000000000000000000000000000..429cc779826de902444fa7704b4cee9db070cb18 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_tagged_template_literal.js @@ -0,0 +1,6 @@ +function _tagged_template_literal(strings, raw) { + if (!raw) raw = strings.slice(0); + + return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); +} +export { _tagged_template_literal as _ }; diff --git a/node_modules/@swc/helpers/esm/_tagged_template_literal_loose.js b/node_modules/@swc/helpers/esm/_tagged_template_literal_loose.js new file mode 100644 index 0000000000000000000000000000000000000000..1fbb61e6dc1c253eff4d3b45ea9224c6493119c7 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_tagged_template_literal_loose.js @@ -0,0 +1,8 @@ +function _tagged_template_literal_loose(strings, raw) { + if (!raw) raw = strings.slice(0); + + strings.raw = raw; + + return strings; +} +export { _tagged_template_literal_loose as _ }; diff --git a/node_modules/@swc/helpers/esm/_throw.js b/node_modules/@swc/helpers/esm/_throw.js new file mode 100644 index 0000000000000000000000000000000000000000..5de41f16fcbea51c2873849ff26fb1d66c337fe9 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_throw.js @@ -0,0 +1,4 @@ +function _throw(e) { + throw e; +} +export { _throw as _ }; diff --git a/node_modules/@swc/helpers/esm/_to_array.js b/node_modules/@swc/helpers/esm/_to_array.js new file mode 100644 index 0000000000000000000000000000000000000000..7451fb2a14d5f123995b93f3183fdba27d2ae1eb --- /dev/null +++ b/node_modules/@swc/helpers/esm/_to_array.js @@ -0,0 +1,9 @@ +import { _ as _array_with_holes } from "./_array_with_holes.js"; +import { _ as _iterable_to_array } from "./_iterable_to_array.js"; +import { _ as _non_iterable_rest } from "./_non_iterable_rest.js"; +import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; + +function _to_array(arr) { + return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest(); +} +export { _to_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_to_consumable_array.js b/node_modules/@swc/helpers/esm/_to_consumable_array.js new file mode 100644 index 0000000000000000000000000000000000000000..048ad6e25a2a1560535d380c0d2784a842e504b0 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_to_consumable_array.js @@ -0,0 +1,9 @@ +import { _ as _array_without_holes } from "./_array_without_holes.js"; +import { _ as _iterable_to_array } from "./_iterable_to_array.js"; +import { _ as _non_iterable_spread } from "./_non_iterable_spread.js"; +import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; + +function _to_consumable_array(arr) { + return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); +} +export { _to_consumable_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_to_primitive.js b/node_modules/@swc/helpers/esm/_to_primitive.js new file mode 100644 index 0000000000000000000000000000000000000000..7c8e4255c85a580cfbf8e0bea1c389bab23d3b04 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_to_primitive.js @@ -0,0 +1,16 @@ +import { _ as _type_of } from "./_type_of.js"; + +function _to_primitive(input, hint) { + if (_type_of(input) !== "object" || input === null) return input; + + var prim = input[Symbol.toPrimitive]; + + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (_type_of(res) !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + + return (hint === "string" ? String : Number)(input); +} +export { _to_primitive as _ }; diff --git a/node_modules/@swc/helpers/esm/_to_property_key.js b/node_modules/@swc/helpers/esm/_to_property_key.js new file mode 100644 index 0000000000000000000000000000000000000000..b6f8d38ee92fa467ea4cba14649cd500f7b57511 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_to_property_key.js @@ -0,0 +1,9 @@ +import { _ as _to_primitive } from "./_to_primitive.js"; +import { _ as _type_of } from "./_type_of.js"; + +function _to_property_key(arg) { + var key = _to_primitive(arg, "string"); + + return _type_of(key) === "symbol" ? key : String(key); +} +export { _to_property_key as _ }; diff --git a/node_modules/@swc/helpers/esm/_ts_add_disposable_resource.js b/node_modules/@swc/helpers/esm/_ts_add_disposable_resource.js new file mode 100644 index 0000000000000000000000000000000000000000..62fd1cb30bdc5fe7819b5a49f890ff45967a6ad1 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_add_disposable_resource.js @@ -0,0 +1 @@ +export { __addDisposableResource as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_decorate.js b/node_modules/@swc/helpers/esm/_ts_decorate.js new file mode 100644 index 0000000000000000000000000000000000000000..8e0e46e62025ad7e6b49043d51ad9761007fff49 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_decorate.js @@ -0,0 +1 @@ +export { __decorate as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_dispose_resources.js b/node_modules/@swc/helpers/esm/_ts_dispose_resources.js new file mode 100644 index 0000000000000000000000000000000000000000..5d06d4a5f87e34549d24dcba49041d6e3b75a7be --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_dispose_resources.js @@ -0,0 +1 @@ +export { __disposeResources as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_generator.js b/node_modules/@swc/helpers/esm/_ts_generator.js new file mode 100644 index 0000000000000000000000000000000000000000..6b7741299b064f3584e97d9eb750a1a8003e92f8 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_generator.js @@ -0,0 +1,29 @@ +function _ts_generator(thisArg, body) { + var f, y, t, _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty; + return d(g, "next", { value: verb(0) }), d(g, "throw", { value: verb(1) }), d(g, "return", { value: verb(2) }), typeof Symbol === "function" && d(g, Symbol.iterator, { value: function () { return this; } }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export { _ts_generator as _ }; diff --git a/node_modules/@swc/helpers/esm/_ts_metadata.js b/node_modules/@swc/helpers/esm/_ts_metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..0aa522ed4b456c69033b8e32497149c4fa944980 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_metadata.js @@ -0,0 +1 @@ +export { __metadata as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_param.js b/node_modules/@swc/helpers/esm/_ts_param.js new file mode 100644 index 0000000000000000000000000000000000000000..f332a40307e16380c0e936f72ae0e44f68860fed --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_param.js @@ -0,0 +1 @@ +export { __param as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_rewrite_relative_import_extension.js b/node_modules/@swc/helpers/esm/_ts_rewrite_relative_import_extension.js new file mode 100644 index 0000000000000000000000000000000000000000..0c7c5b80acd5aef2847d9639e228394a4ce57ade --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_rewrite_relative_import_extension.js @@ -0,0 +1 @@ +export { __rewriteRelativeImportExtension as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_ts_values.js b/node_modules/@swc/helpers/esm/_ts_values.js new file mode 100644 index 0000000000000000000000000000000000000000..298fd4b5929ff6f161fab818f0d246ed79fea4ea --- /dev/null +++ b/node_modules/@swc/helpers/esm/_ts_values.js @@ -0,0 +1 @@ +export { __values as _ } from "tslib"; diff --git a/node_modules/@swc/helpers/esm/_type_of.js b/node_modules/@swc/helpers/esm/_type_of.js new file mode 100644 index 0000000000000000000000000000000000000000..dc7b859bcc389d28a2188c50b0ee02b33c459008 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_type_of.js @@ -0,0 +1,6 @@ +function _type_of(obj) { + "@swc/helpers - typeof"; + + return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; +} +export { _type_of as _ }; diff --git a/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js b/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js new file mode 100644 index 0000000000000000000000000000000000000000..47ce85815c87f1d32e574ee7891adc765c5d9315 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_unsupported_iterable_to_array.js @@ -0,0 +1,13 @@ +import { _ as _array_like_to_array } from "./_array_like_to_array.js"; + +function _unsupported_iterable_to_array(o, minLen) { + if (!o) return; + if (typeof o === "string") return _array_like_to_array(o, minLen); + + var n = Object.prototype.toString.call(o).slice(8, -1); + + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); +} +export { _unsupported_iterable_to_array as _ }; diff --git a/node_modules/@swc/helpers/esm/_update.js b/node_modules/@swc/helpers/esm/_update.js new file mode 100644 index 0000000000000000000000000000000000000000..86a7d688bc8ebf6fa1195d501ef99aec0ceee12b --- /dev/null +++ b/node_modules/@swc/helpers/esm/_update.js @@ -0,0 +1,14 @@ +import { _ as _get } from "./_get.js"; +import { _ as _set } from "./_set.js"; + +function _update(target, property, receiver, isStrict) { + return { + get _() { + return _get(target, property, receiver); + }, + set _(value) { + _set(target, property, value, receiver, isStrict); + } + }; +} +export { _update as _ }; diff --git a/node_modules/@swc/helpers/esm/_using.js b/node_modules/@swc/helpers/esm/_using.js new file mode 100644 index 0000000000000000000000000000000000000000..b46fe691c4af6d882b4b0d0a587b8d2e00f31815 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_using.js @@ -0,0 +1,22 @@ +/* @minVersion 7.22.0 */ + +function _using(stack, value, isAwait) { + if (value === null || value === void 0) return value; + if (Object(value) !== value) { + throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + } + // core-js-pure uses Symbol.for for polyfilling well-known symbols + if (isAwait) { + var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")]; + } + if (dispose === null || dispose === void 0) { + dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")]; + } + if (typeof dispose !== "function") { + throw new TypeError(`Property [Symbol.dispose] is not a function.`); + } + stack.push({ v: value, d: dispose, a: isAwait }); + return value; +} + +export { _using as _ }; diff --git a/node_modules/@swc/helpers/esm/_using_ctx.js b/node_modules/@swc/helpers/esm/_using_ctx.js new file mode 100644 index 0000000000000000000000000000000000000000..23c0d76d9ef0fb9c05d6ec48e2b523b9657edde2 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_using_ctx.js @@ -0,0 +1,73 @@ +function _using_ctx() { + var _disposeSuppressedError = typeof SuppressedError === "function" + // eslint-disable-next-line no-undef + ? SuppressedError + : (function(error, suppressed) { + var err = new Error(); + err.name = "SuppressedError"; + err.suppressed = suppressed; + err.error = error; + return err; + }), + empty = {}, + stack = []; + function using(isAwait, value) { + if (value != null) { + if (Object(value) !== value) { + throw new TypeError("using declarations can only be used with objects, functions, null, or undefined."); + } + // core-js-pure uses Symbol.for for polyfilling well-known symbols + if (isAwait) { + var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")]; + } + if (dispose == null) { + dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")]; + } + if (typeof dispose !== "function") { + throw new TypeError(`Property [Symbol.dispose] is not a function.`); + } + stack.push({ v: value, d: dispose, a: isAwait }); + } else if (isAwait) { + // provide the nullish `value` as `d` for minification gain + stack.push({ d: value, a: isAwait }); + } + return value; + } + return { + // error + e: empty, + // using + u: using.bind(null, false), + // await using + a: using.bind(null, true), + // dispose + d: function() { + var error = this.e; + + function next() { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + while ((resource = stack.pop())) { + try { + var resource, disposalResult = resource.d && resource.d.call(resource.v); + if (resource.a) { + return Promise.resolve(disposalResult).then(next, err); + } + } catch (e) { + return err(e); + } + } + if (error !== empty) throw error; + } + + function err(e) { + error = error !== empty ? new _disposeSuppressedError(e, error) : e; + + return next(); + } + + return next(); + } + }; +} + +export { _using_ctx as _ }; diff --git a/node_modules/@swc/helpers/esm/_wrap_async_generator.js b/node_modules/@swc/helpers/esm/_wrap_async_generator.js new file mode 100644 index 0000000000000000000000000000000000000000..b95574033fa3738d2d6d7c6888eee760c366a8b9 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_wrap_async_generator.js @@ -0,0 +1,8 @@ +import { _ as _async_generator } from "./_async_generator.js"; + +function _wrap_async_generator(fn) { + return function() { + return new _async_generator(fn.apply(this, arguments)); + }; +} +export { _wrap_async_generator as _ }; diff --git a/node_modules/@swc/helpers/esm/_wrap_native_super.js b/node_modules/@swc/helpers/esm/_wrap_native_super.js new file mode 100644 index 0000000000000000000000000000000000000000..e942eb5d67c7a65c254fabfcfbb9204a385970bc --- /dev/null +++ b/node_modules/@swc/helpers/esm/_wrap_native_super.js @@ -0,0 +1,26 @@ +import { _ as _construct } from "./_construct.js"; +import { _ as _get_prototype_of } from "./_get_prototype_of.js"; +import { _ as _is_native_function } from "./_is_native_function.js"; +import { _ as _set_prototype_of } from "./_set_prototype_of.js"; + +function _wrap_native_super(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrap_native_super = function(Class) { + if (Class === null || !_is_native_function(Class)) return Class; + if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function"); + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _get_prototype_of(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); + + return _set_prototype_of(Wrapper, Class); + }; + + return _wrap_native_super(Class); +} +export { _wrap_native_super as _ }; diff --git a/node_modules/@swc/helpers/esm/_wrap_reg_exp.js b/node_modules/@swc/helpers/esm/_wrap_reg_exp.js new file mode 100644 index 0000000000000000000000000000000000000000..1cd0e2814b118e667dcf2b4a3f7de982e2b25fe2 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_wrap_reg_exp.js @@ -0,0 +1,82 @@ +import { _ as _inherits } from "./_inherits.js"; +import { _ as _set_prototype_of } from "./_set_prototype_of.js"; + +function _wrap_reg_exp(re, groups, source) { + _wrap_reg_exp = function(re, groups, source) { + return new WrappedRegExp(re, undefined, groups, source); + }; + var _super = RegExp.prototype; + var _groups = new WeakMap(); + var _sources = new WeakMap(); + var _native_source = Object.getOwnPropertyDescriptor(_super, "source").get; + function WrappedRegExp(re, flags, groups, source) { + var _re = new RegExp(re, flags); + _groups.set(_re, groups || _groups.get(re)); + _sources.set(_re, source !== undefined ? source : _sources.get(re)); + return _set_prototype_of(_re, WrappedRegExp.prototype); + } + _inherits(WrappedRegExp, RegExp); + Object.defineProperty(WrappedRegExp.prototype, "source", { + configurable: true, + get: function() { + var source = _sources.get(this); + if (source !== undefined) { + try { + new RegExp(source, this.flags); + return source; + } catch (_) {} + } + return _native_source.call(this); + } + }); + WrappedRegExp.prototype.exec = function(str) { + var result = _super.exec.call(this, str); + if (result) { + result.groups = buildGroups(result, this); + var indices = result.indices; + if (indices) indices.groups = buildGroups(indices, this); + } + return result; + }; + WrappedRegExp.prototype[Symbol.replace] = function(str, substitution) { + if (typeof substitution === "string") { + var groups = _groups.get(this); + return _super[Symbol.replace].call( + this, + str, + substitution.replace(/\$<([^>]+)>/g, function(_, name) { + var group = groups ? groups[name] : undefined; + if (group === undefined) return ""; + return "$" + (Array.isArray(group) ? group.join("$") : group); + }) + ); + } + if (typeof substitution === "function") { + var _this = this; + return _super[Symbol.replace].call(this, str, function() { + var args = arguments; + if (typeof args[args.length - 1] !== "object") { + args = [].slice.call(args); + args.push(buildGroups(args, _this)); + } + return substitution.apply(this, args); + }); + } + return _super[Symbol.replace].call(this, str, substitution); + }; + function buildGroups(result, re) { + var g = _groups.get(re); + return Object.keys(g).reduce(function(groups, name) { + var i = g[name]; + if (typeof i === "number") groups[name] = result[i]; + else { + var k = 0; + while (result[i[k]] === undefined && k + 1 < i.length) k++; + groups[name] = result[i[k]]; + } + return groups; + }, Object.create(null)); + } + return _wrap_reg_exp.apply(this, arguments); +} +export { _wrap_reg_exp as _ }; diff --git a/node_modules/@swc/helpers/esm/_write_only_error.js b/node_modules/@swc/helpers/esm/_write_only_error.js new file mode 100644 index 0000000000000000000000000000000000000000..87c24aa07782aa268c6cd6bddaab94113d8c4c74 --- /dev/null +++ b/node_modules/@swc/helpers/esm/_write_only_error.js @@ -0,0 +1,4 @@ +function _write_only_error(name) { + throw new TypeError("\"" + name + "\" is write-only"); +} +export { _write_only_error as _ }; diff --git a/node_modules/@swc/helpers/esm/index.js b/node_modules/@swc/helpers/esm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..426a6fd854ec75bf99710f5716b0dfae16a8eb83 --- /dev/null +++ b/node_modules/@swc/helpers/esm/index.js @@ -0,0 +1,110 @@ +/* This file is automatically generated and should not be manually edited. */ +/* To modify this file, please run the `npm run build` command instead. */ + +export { _ as _apply_decorated_descriptor } from "./_apply_decorated_descriptor.js"; +export { _ as _apply_decs_2203_r } from "./_apply_decs_2203_r.js"; +export { _ as _apply_decs_2311 } from "./_apply_decs_2311.js"; +export { _ as _array_like_to_array } from "./_array_like_to_array.js"; +export { _ as _array_with_holes } from "./_array_with_holes.js"; +export { _ as _array_without_holes } from "./_array_without_holes.js"; +export { _ as _assert_this_initialized } from "./_assert_this_initialized.js"; +export { _ as _async_generator } from "./_async_generator.js"; +export { _ as _async_generator_delegate } from "./_async_generator_delegate.js"; +export { _ as _async_iterator } from "./_async_iterator.js"; +export { _ as _async_to_generator } from "./_async_to_generator.js"; +export { _ as _await_async_generator } from "./_await_async_generator.js"; +export { _ as _await_value } from "./_await_value.js"; +export { _ as _call_super } from "./_call_super.js"; +export { _ as _check_private_redeclaration } from "./_check_private_redeclaration.js"; +export { _ as _class_apply_descriptor_destructure } from "./_class_apply_descriptor_destructure.js"; +export { _ as _class_apply_descriptor_get } from "./_class_apply_descriptor_get.js"; +export { _ as _class_apply_descriptor_set } from "./_class_apply_descriptor_set.js"; +export { _ as _class_apply_descriptor_update } from "./_class_apply_descriptor_update.js"; +export { _ as _class_call_check } from "./_class_call_check.js"; +export { _ as _class_check_private_static_access } from "./_class_check_private_static_access.js"; +export { _ as _class_check_private_static_field_descriptor } from "./_class_check_private_static_field_descriptor.js"; +export { _ as _class_extract_field_descriptor } from "./_class_extract_field_descriptor.js"; +export { _ as _class_name_tdz_error } from "./_class_name_tdz_error.js"; +export { _ as _class_private_field_destructure } from "./_class_private_field_destructure.js"; +export { _ as _class_private_field_get } from "./_class_private_field_get.js"; +export { _ as _class_private_field_init } from "./_class_private_field_init.js"; +export { _ as _class_private_field_loose_base } from "./_class_private_field_loose_base.js"; +export { _ as _class_private_field_loose_key } from "./_class_private_field_loose_key.js"; +export { _ as _class_private_field_set } from "./_class_private_field_set.js"; +export { _ as _class_private_field_update } from "./_class_private_field_update.js"; +export { _ as _class_private_method_get } from "./_class_private_method_get.js"; +export { _ as _class_private_method_init } from "./_class_private_method_init.js"; +export { _ as _class_private_method_set } from "./_class_private_method_set.js"; +export { _ as _class_static_private_field_destructure } from "./_class_static_private_field_destructure.js"; +export { _ as _class_static_private_field_spec_get } from "./_class_static_private_field_spec_get.js"; +export { _ as _class_static_private_field_spec_set } from "./_class_static_private_field_spec_set.js"; +export { _ as _class_static_private_field_update } from "./_class_static_private_field_update.js"; +export { _ as _class_static_private_method_get } from "./_class_static_private_method_get.js"; +export { _ as _construct } from "./_construct.js"; +export { _ as _create_class } from "./_create_class.js"; +export { _ as _create_for_of_iterator_helper_loose } from "./_create_for_of_iterator_helper_loose.js"; +export { _ as _create_super } from "./_create_super.js"; +export { _ as _decorate } from "./_decorate.js"; +export { _ as _defaults } from "./_defaults.js"; +export { _ as _define_enumerable_properties } from "./_define_enumerable_properties.js"; +export { _ as _define_property } from "./_define_property.js"; +export { _ as _dispose } from "./_dispose.js"; +export { _ as _export_star } from "./_export_star.js"; +export { _ as _extends } from "./_extends.js"; +export { _ as _get } from "./_get.js"; +export { _ as _get_prototype_of } from "./_get_prototype_of.js"; +export { _ as _identity } from "./_identity.js"; +export { _ as _inherits } from "./_inherits.js"; +export { _ as _inherits_loose } from "./_inherits_loose.js"; +export { _ as _initializer_define_property } from "./_initializer_define_property.js"; +export { _ as _initializer_warning_helper } from "./_initializer_warning_helper.js"; +export { _ as _instanceof } from "./_instanceof.js"; +export { _ as _interop_require_default } from "./_interop_require_default.js"; +export { _ as _interop_require_wildcard } from "./_interop_require_wildcard.js"; +export { _ as _is_native_function } from "./_is_native_function.js"; +export { _ as _is_native_reflect_construct } from "./_is_native_reflect_construct.js"; +export { _ as _iterable_to_array } from "./_iterable_to_array.js"; +export { _ as _iterable_to_array_limit } from "./_iterable_to_array_limit.js"; +export { _ as _iterable_to_array_limit_loose } from "./_iterable_to_array_limit_loose.js"; +export { _ as _jsx } from "./_jsx.js"; +export { _ as _new_arrow_check } from "./_new_arrow_check.js"; +export { _ as _non_iterable_rest } from "./_non_iterable_rest.js"; +export { _ as _non_iterable_spread } from "./_non_iterable_spread.js"; +export { _ as _object_destructuring_empty } from "./_object_destructuring_empty.js"; +export { _ as _object_spread } from "./_object_spread.js"; +export { _ as _object_spread_props } from "./_object_spread_props.js"; +export { _ as _object_without_properties } from "./_object_without_properties.js"; +export { _ as _object_without_properties_loose } from "./_object_without_properties_loose.js"; +export { _ as _overload_yield } from "./_overload_yield.js"; +export { _ as _possible_constructor_return } from "./_possible_constructor_return.js"; +export { _ as _read_only_error } from "./_read_only_error.js"; +export { _ as _set } from "./_set.js"; +export { _ as _set_prototype_of } from "./_set_prototype_of.js"; +export { _ as _skip_first_generator_next } from "./_skip_first_generator_next.js"; +export { _ as _sliced_to_array } from "./_sliced_to_array.js"; +export { _ as _sliced_to_array_loose } from "./_sliced_to_array_loose.js"; +export { _ as _super_prop_base } from "./_super_prop_base.js"; +export { _ as _tagged_template_literal } from "./_tagged_template_literal.js"; +export { _ as _tagged_template_literal_loose } from "./_tagged_template_literal_loose.js"; +export { _ as _throw } from "./_throw.js"; +export { _ as _to_array } from "./_to_array.js"; +export { _ as _to_consumable_array } from "./_to_consumable_array.js"; +export { _ as _to_primitive } from "./_to_primitive.js"; +export { _ as _to_property_key } from "./_to_property_key.js"; +export { _ as _ts_add_disposable_resource } from "./_ts_add_disposable_resource.js"; +export { _ as _ts_decorate } from "./_ts_decorate.js"; +export { _ as _ts_dispose_resources } from "./_ts_dispose_resources.js"; +export { _ as _ts_generator } from "./_ts_generator.js"; +export { _ as _ts_metadata } from "./_ts_metadata.js"; +export { _ as _ts_param } from "./_ts_param.js"; +export { _ as _ts_rewrite_relative_import_extension } from "./_ts_rewrite_relative_import_extension.js"; +export { _ as _ts_values } from "./_ts_values.js"; +export { _ as _type_of } from "./_type_of.js"; +export { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js"; +export { _ as _update } from "./_update.js"; +export { _ as _using } from "./_using.js"; +export { _ as _using_ctx } from "./_using_ctx.js"; +export { _ as _wrap_async_generator } from "./_wrap_async_generator.js"; +export { _ as _wrap_native_super } from "./_wrap_native_super.js"; +export { _ as _wrap_reg_exp } from "./_wrap_reg_exp.js"; +export { _ as _write_only_error } from "./_write_only_error.js"; diff --git a/node_modules/@swc/helpers/package.json b/node_modules/@swc/helpers/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4143eed153dfd37adac0d6ecc4c52d5619f2d92b --- /dev/null +++ b/node_modules/@swc/helpers/package.json @@ -0,0 +1,705 @@ +{ + "name": "@swc/helpers", + "version": "0.5.23", + "description": "External helpers for the swc project.", + "module": "esm/index.js", + "main": "cjs/index.cjs", + "sideEffects": false, + "repository": { + "type": "git", + "url": "git+https://github.com/swc-project/swc.git", + "directory": "packages/helpers" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "keywords": [ + "swc", + "helpers" + ], + "author": "강동윤 ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/swc-project/swc/issues" + }, + "homepage": "https://swc.rs", + "type": "module", + "devDependencies": { + "@ast-grep/napi": "^0.40.3", + "dprint": "^0.35.3", + "zx": "^7.2.1" + }, + "dependencies": { + "tslib": "^2.8.0" + }, + "exports": { + "./package.json": "./package.json", + "./esm/*": "./esm/*", + "./cjs/*": "./cjs/*", + "./src/*": "./src/*", + ".": { + "module-sync": "./esm/index.js", + "webpack": "./esm/index.js", + "import": "./esm/index.js", + "default": "./cjs/index.cjs" + }, + "./_": { + "module-sync": "./esm/index.js", + "webpack": "./esm/index.js", + "import": "./esm/index.js", + "default": "./cjs/index.cjs" + }, + "./_/_apply_decorated_descriptor": { + "module-sync": "./esm/_apply_decorated_descriptor.js", + "webpack": "./esm/_apply_decorated_descriptor.js", + "import": "./esm/_apply_decorated_descriptor.js", + "default": "./cjs/_apply_decorated_descriptor.cjs" + }, + "./_/_apply_decs_2203_r": { + "module-sync": "./esm/_apply_decs_2203_r.js", + "webpack": "./esm/_apply_decs_2203_r.js", + "import": "./esm/_apply_decs_2203_r.js", + "default": "./cjs/_apply_decs_2203_r.cjs" + }, + "./_/_apply_decs_2311": { + "module-sync": "./esm/_apply_decs_2311.js", + "webpack": "./esm/_apply_decs_2311.js", + "import": "./esm/_apply_decs_2311.js", + "default": "./cjs/_apply_decs_2311.cjs" + }, + "./_/_array_like_to_array": { + "module-sync": "./esm/_array_like_to_array.js", + "webpack": "./esm/_array_like_to_array.js", + "import": "./esm/_array_like_to_array.js", + "default": "./cjs/_array_like_to_array.cjs" + }, + "./_/_array_with_holes": { + "module-sync": "./esm/_array_with_holes.js", + "webpack": "./esm/_array_with_holes.js", + "import": "./esm/_array_with_holes.js", + "default": "./cjs/_array_with_holes.cjs" + }, + "./_/_array_without_holes": { + "module-sync": "./esm/_array_without_holes.js", + "webpack": "./esm/_array_without_holes.js", + "import": "./esm/_array_without_holes.js", + "default": "./cjs/_array_without_holes.cjs" + }, + "./_/_assert_this_initialized": { + "module-sync": "./esm/_assert_this_initialized.js", + "webpack": "./esm/_assert_this_initialized.js", + "import": "./esm/_assert_this_initialized.js", + "default": "./cjs/_assert_this_initialized.cjs" + }, + "./_/_async_generator": { + "module-sync": "./esm/_async_generator.js", + "webpack": "./esm/_async_generator.js", + "import": "./esm/_async_generator.js", + "default": "./cjs/_async_generator.cjs" + }, + "./_/_async_generator_delegate": { + "module-sync": "./esm/_async_generator_delegate.js", + "webpack": "./esm/_async_generator_delegate.js", + "import": "./esm/_async_generator_delegate.js", + "default": "./cjs/_async_generator_delegate.cjs" + }, + "./_/_async_iterator": { + "module-sync": "./esm/_async_iterator.js", + "webpack": "./esm/_async_iterator.js", + "import": "./esm/_async_iterator.js", + "default": "./cjs/_async_iterator.cjs" + }, + "./_/_async_to_generator": { + "module-sync": "./esm/_async_to_generator.js", + "webpack": "./esm/_async_to_generator.js", + "import": "./esm/_async_to_generator.js", + "default": "./cjs/_async_to_generator.cjs" + }, + "./_/_await_async_generator": { + "module-sync": "./esm/_await_async_generator.js", + "webpack": "./esm/_await_async_generator.js", + "import": "./esm/_await_async_generator.js", + "default": "./cjs/_await_async_generator.cjs" + }, + "./_/_await_value": { + "module-sync": "./esm/_await_value.js", + "webpack": "./esm/_await_value.js", + "import": "./esm/_await_value.js", + "default": "./cjs/_await_value.cjs" + }, + "./_/_call_super": { + "module-sync": "./esm/_call_super.js", + "webpack": "./esm/_call_super.js", + "import": "./esm/_call_super.js", + "default": "./cjs/_call_super.cjs" + }, + "./_/_check_private_redeclaration": { + "module-sync": "./esm/_check_private_redeclaration.js", + "webpack": "./esm/_check_private_redeclaration.js", + "import": "./esm/_check_private_redeclaration.js", + "default": "./cjs/_check_private_redeclaration.cjs" + }, + "./_/_class_apply_descriptor_destructure": { + "module-sync": "./esm/_class_apply_descriptor_destructure.js", + "webpack": "./esm/_class_apply_descriptor_destructure.js", + "import": "./esm/_class_apply_descriptor_destructure.js", + "default": "./cjs/_class_apply_descriptor_destructure.cjs" + }, + "./_/_class_apply_descriptor_get": { + "module-sync": "./esm/_class_apply_descriptor_get.js", + "webpack": "./esm/_class_apply_descriptor_get.js", + "import": "./esm/_class_apply_descriptor_get.js", + "default": "./cjs/_class_apply_descriptor_get.cjs" + }, + "./_/_class_apply_descriptor_set": { + "module-sync": "./esm/_class_apply_descriptor_set.js", + "webpack": "./esm/_class_apply_descriptor_set.js", + "import": "./esm/_class_apply_descriptor_set.js", + "default": "./cjs/_class_apply_descriptor_set.cjs" + }, + "./_/_class_apply_descriptor_update": { + "module-sync": "./esm/_class_apply_descriptor_update.js", + "webpack": "./esm/_class_apply_descriptor_update.js", + "import": "./esm/_class_apply_descriptor_update.js", + "default": "./cjs/_class_apply_descriptor_update.cjs" + }, + "./_/_class_call_check": { + "module-sync": "./esm/_class_call_check.js", + "webpack": "./esm/_class_call_check.js", + "import": "./esm/_class_call_check.js", + "default": "./cjs/_class_call_check.cjs" + }, + "./_/_class_check_private_static_access": { + "module-sync": "./esm/_class_check_private_static_access.js", + "webpack": "./esm/_class_check_private_static_access.js", + "import": "./esm/_class_check_private_static_access.js", + "default": "./cjs/_class_check_private_static_access.cjs" + }, + "./_/_class_check_private_static_field_descriptor": { + "module-sync": "./esm/_class_check_private_static_field_descriptor.js", + "webpack": "./esm/_class_check_private_static_field_descriptor.js", + "import": "./esm/_class_check_private_static_field_descriptor.js", + "default": "./cjs/_class_check_private_static_field_descriptor.cjs" + }, + "./_/_class_extract_field_descriptor": { + "module-sync": "./esm/_class_extract_field_descriptor.js", + "webpack": "./esm/_class_extract_field_descriptor.js", + "import": "./esm/_class_extract_field_descriptor.js", + "default": "./cjs/_class_extract_field_descriptor.cjs" + }, + "./_/_class_name_tdz_error": { + "module-sync": "./esm/_class_name_tdz_error.js", + "webpack": "./esm/_class_name_tdz_error.js", + "import": "./esm/_class_name_tdz_error.js", + "default": "./cjs/_class_name_tdz_error.cjs" + }, + "./_/_class_private_field_destructure": { + "module-sync": "./esm/_class_private_field_destructure.js", + "webpack": "./esm/_class_private_field_destructure.js", + "import": "./esm/_class_private_field_destructure.js", + "default": "./cjs/_class_private_field_destructure.cjs" + }, + "./_/_class_private_field_get": { + "module-sync": "./esm/_class_private_field_get.js", + "webpack": "./esm/_class_private_field_get.js", + "import": "./esm/_class_private_field_get.js", + "default": "./cjs/_class_private_field_get.cjs" + }, + "./_/_class_private_field_init": { + "module-sync": "./esm/_class_private_field_init.js", + "webpack": "./esm/_class_private_field_init.js", + "import": "./esm/_class_private_field_init.js", + "default": "./cjs/_class_private_field_init.cjs" + }, + "./_/_class_private_field_loose_base": { + "module-sync": "./esm/_class_private_field_loose_base.js", + "webpack": "./esm/_class_private_field_loose_base.js", + "import": "./esm/_class_private_field_loose_base.js", + "default": "./cjs/_class_private_field_loose_base.cjs" + }, + "./_/_class_private_field_loose_key": { + "module-sync": "./esm/_class_private_field_loose_key.js", + "webpack": "./esm/_class_private_field_loose_key.js", + "import": "./esm/_class_private_field_loose_key.js", + "default": "./cjs/_class_private_field_loose_key.cjs" + }, + "./_/_class_private_field_set": { + "module-sync": "./esm/_class_private_field_set.js", + "webpack": "./esm/_class_private_field_set.js", + "import": "./esm/_class_private_field_set.js", + "default": "./cjs/_class_private_field_set.cjs" + }, + "./_/_class_private_field_update": { + "module-sync": "./esm/_class_private_field_update.js", + "webpack": "./esm/_class_private_field_update.js", + "import": "./esm/_class_private_field_update.js", + "default": "./cjs/_class_private_field_update.cjs" + }, + "./_/_class_private_method_get": { + "module-sync": "./esm/_class_private_method_get.js", + "webpack": "./esm/_class_private_method_get.js", + "import": "./esm/_class_private_method_get.js", + "default": "./cjs/_class_private_method_get.cjs" + }, + "./_/_class_private_method_init": { + "module-sync": "./esm/_class_private_method_init.js", + "webpack": "./esm/_class_private_method_init.js", + "import": "./esm/_class_private_method_init.js", + "default": "./cjs/_class_private_method_init.cjs" + }, + "./_/_class_private_method_set": { + "module-sync": "./esm/_class_private_method_set.js", + "webpack": "./esm/_class_private_method_set.js", + "import": "./esm/_class_private_method_set.js", + "default": "./cjs/_class_private_method_set.cjs" + }, + "./_/_class_static_private_field_destructure": { + "module-sync": "./esm/_class_static_private_field_destructure.js", + "webpack": "./esm/_class_static_private_field_destructure.js", + "import": "./esm/_class_static_private_field_destructure.js", + "default": "./cjs/_class_static_private_field_destructure.cjs" + }, + "./_/_class_static_private_field_spec_get": { + "module-sync": "./esm/_class_static_private_field_spec_get.js", + "webpack": "./esm/_class_static_private_field_spec_get.js", + "import": "./esm/_class_static_private_field_spec_get.js", + "default": "./cjs/_class_static_private_field_spec_get.cjs" + }, + "./_/_class_static_private_field_spec_set": { + "module-sync": "./esm/_class_static_private_field_spec_set.js", + "webpack": "./esm/_class_static_private_field_spec_set.js", + "import": "./esm/_class_static_private_field_spec_set.js", + "default": "./cjs/_class_static_private_field_spec_set.cjs" + }, + "./_/_class_static_private_field_update": { + "module-sync": "./esm/_class_static_private_field_update.js", + "webpack": "./esm/_class_static_private_field_update.js", + "import": "./esm/_class_static_private_field_update.js", + "default": "./cjs/_class_static_private_field_update.cjs" + }, + "./_/_class_static_private_method_get": { + "module-sync": "./esm/_class_static_private_method_get.js", + "webpack": "./esm/_class_static_private_method_get.js", + "import": "./esm/_class_static_private_method_get.js", + "default": "./cjs/_class_static_private_method_get.cjs" + }, + "./_/_construct": { + "module-sync": "./esm/_construct.js", + "webpack": "./esm/_construct.js", + "import": "./esm/_construct.js", + "default": "./cjs/_construct.cjs" + }, + "./_/_create_class": { + "module-sync": "./esm/_create_class.js", + "webpack": "./esm/_create_class.js", + "import": "./esm/_create_class.js", + "default": "./cjs/_create_class.cjs" + }, + "./_/_create_for_of_iterator_helper_loose": { + "module-sync": "./esm/_create_for_of_iterator_helper_loose.js", + "webpack": "./esm/_create_for_of_iterator_helper_loose.js", + "import": "./esm/_create_for_of_iterator_helper_loose.js", + "default": "./cjs/_create_for_of_iterator_helper_loose.cjs" + }, + "./_/_create_super": { + "module-sync": "./esm/_create_super.js", + "webpack": "./esm/_create_super.js", + "import": "./esm/_create_super.js", + "default": "./cjs/_create_super.cjs" + }, + "./_/_decorate": { + "module-sync": "./esm/_decorate.js", + "webpack": "./esm/_decorate.js", + "import": "./esm/_decorate.js", + "default": "./cjs/_decorate.cjs" + }, + "./_/_defaults": { + "module-sync": "./esm/_defaults.js", + "webpack": "./esm/_defaults.js", + "import": "./esm/_defaults.js", + "default": "./cjs/_defaults.cjs" + }, + "./_/_define_enumerable_properties": { + "module-sync": "./esm/_define_enumerable_properties.js", + "webpack": "./esm/_define_enumerable_properties.js", + "import": "./esm/_define_enumerable_properties.js", + "default": "./cjs/_define_enumerable_properties.cjs" + }, + "./_/_define_property": { + "module-sync": "./esm/_define_property.js", + "webpack": "./esm/_define_property.js", + "import": "./esm/_define_property.js", + "default": "./cjs/_define_property.cjs" + }, + "./_/_dispose": { + "module-sync": "./esm/_dispose.js", + "webpack": "./esm/_dispose.js", + "import": "./esm/_dispose.js", + "default": "./cjs/_dispose.cjs" + }, + "./_/_export_star": { + "module-sync": "./esm/_export_star.js", + "webpack": "./esm/_export_star.js", + "import": "./esm/_export_star.js", + "default": "./cjs/_export_star.cjs" + }, + "./_/_extends": { + "module-sync": "./esm/_extends.js", + "webpack": "./esm/_extends.js", + "import": "./esm/_extends.js", + "default": "./cjs/_extends.cjs" + }, + "./_/_get": { + "module-sync": "./esm/_get.js", + "webpack": "./esm/_get.js", + "import": "./esm/_get.js", + "default": "./cjs/_get.cjs" + }, + "./_/_get_prototype_of": { + "module-sync": "./esm/_get_prototype_of.js", + "webpack": "./esm/_get_prototype_of.js", + "import": "./esm/_get_prototype_of.js", + "default": "./cjs/_get_prototype_of.cjs" + }, + "./_/_identity": { + "module-sync": "./esm/_identity.js", + "webpack": "./esm/_identity.js", + "import": "./esm/_identity.js", + "default": "./cjs/_identity.cjs" + }, + "./_/_inherits": { + "module-sync": "./esm/_inherits.js", + "webpack": "./esm/_inherits.js", + "import": "./esm/_inherits.js", + "default": "./cjs/_inherits.cjs" + }, + "./_/_inherits_loose": { + "module-sync": "./esm/_inherits_loose.js", + "webpack": "./esm/_inherits_loose.js", + "import": "./esm/_inherits_loose.js", + "default": "./cjs/_inherits_loose.cjs" + }, + "./_/_initializer_define_property": { + "module-sync": "./esm/_initializer_define_property.js", + "webpack": "./esm/_initializer_define_property.js", + "import": "./esm/_initializer_define_property.js", + "default": "./cjs/_initializer_define_property.cjs" + }, + "./_/_initializer_warning_helper": { + "module-sync": "./esm/_initializer_warning_helper.js", + "webpack": "./esm/_initializer_warning_helper.js", + "import": "./esm/_initializer_warning_helper.js", + "default": "./cjs/_initializer_warning_helper.cjs" + }, + "./_/_instanceof": { + "module-sync": "./esm/_instanceof.js", + "webpack": "./esm/_instanceof.js", + "import": "./esm/_instanceof.js", + "default": "./cjs/_instanceof.cjs" + }, + "./_/_interop_require_default": { + "module-sync": "./esm/_interop_require_default.js", + "webpack": "./esm/_interop_require_default.js", + "import": "./esm/_interop_require_default.js", + "default": "./cjs/_interop_require_default.cjs" + }, + "./_/_interop_require_wildcard": { + "module-sync": "./esm/_interop_require_wildcard.js", + "webpack": "./esm/_interop_require_wildcard.js", + "import": "./esm/_interop_require_wildcard.js", + "default": "./cjs/_interop_require_wildcard.cjs" + }, + "./_/_is_native_function": { + "module-sync": "./esm/_is_native_function.js", + "webpack": "./esm/_is_native_function.js", + "import": "./esm/_is_native_function.js", + "default": "./cjs/_is_native_function.cjs" + }, + "./_/_is_native_reflect_construct": { + "module-sync": "./esm/_is_native_reflect_construct.js", + "webpack": "./esm/_is_native_reflect_construct.js", + "import": "./esm/_is_native_reflect_construct.js", + "default": "./cjs/_is_native_reflect_construct.cjs" + }, + "./_/_iterable_to_array": { + "module-sync": "./esm/_iterable_to_array.js", + "webpack": "./esm/_iterable_to_array.js", + "import": "./esm/_iterable_to_array.js", + "default": "./cjs/_iterable_to_array.cjs" + }, + "./_/_iterable_to_array_limit": { + "module-sync": "./esm/_iterable_to_array_limit.js", + "webpack": "./esm/_iterable_to_array_limit.js", + "import": "./esm/_iterable_to_array_limit.js", + "default": "./cjs/_iterable_to_array_limit.cjs" + }, + "./_/_iterable_to_array_limit_loose": { + "module-sync": "./esm/_iterable_to_array_limit_loose.js", + "webpack": "./esm/_iterable_to_array_limit_loose.js", + "import": "./esm/_iterable_to_array_limit_loose.js", + "default": "./cjs/_iterable_to_array_limit_loose.cjs" + }, + "./_/_jsx": { + "module-sync": "./esm/_jsx.js", + "webpack": "./esm/_jsx.js", + "import": "./esm/_jsx.js", + "default": "./cjs/_jsx.cjs" + }, + "./_/_new_arrow_check": { + "module-sync": "./esm/_new_arrow_check.js", + "webpack": "./esm/_new_arrow_check.js", + "import": "./esm/_new_arrow_check.js", + "default": "./cjs/_new_arrow_check.cjs" + }, + "./_/_non_iterable_rest": { + "module-sync": "./esm/_non_iterable_rest.js", + "webpack": "./esm/_non_iterable_rest.js", + "import": "./esm/_non_iterable_rest.js", + "default": "./cjs/_non_iterable_rest.cjs" + }, + "./_/_non_iterable_spread": { + "module-sync": "./esm/_non_iterable_spread.js", + "webpack": "./esm/_non_iterable_spread.js", + "import": "./esm/_non_iterable_spread.js", + "default": "./cjs/_non_iterable_spread.cjs" + }, + "./_/_object_destructuring_empty": { + "module-sync": "./esm/_object_destructuring_empty.js", + "webpack": "./esm/_object_destructuring_empty.js", + "import": "./esm/_object_destructuring_empty.js", + "default": "./cjs/_object_destructuring_empty.cjs" + }, + "./_/_object_spread": { + "module-sync": "./esm/_object_spread.js", + "webpack": "./esm/_object_spread.js", + "import": "./esm/_object_spread.js", + "default": "./cjs/_object_spread.cjs" + }, + "./_/_object_spread_props": { + "module-sync": "./esm/_object_spread_props.js", + "webpack": "./esm/_object_spread_props.js", + "import": "./esm/_object_spread_props.js", + "default": "./cjs/_object_spread_props.cjs" + }, + "./_/_object_without_properties": { + "module-sync": "./esm/_object_without_properties.js", + "webpack": "./esm/_object_without_properties.js", + "import": "./esm/_object_without_properties.js", + "default": "./cjs/_object_without_properties.cjs" + }, + "./_/_object_without_properties_loose": { + "module-sync": "./esm/_object_without_properties_loose.js", + "webpack": "./esm/_object_without_properties_loose.js", + "import": "./esm/_object_without_properties_loose.js", + "default": "./cjs/_object_without_properties_loose.cjs" + }, + "./_/_overload_yield": { + "module-sync": "./esm/_overload_yield.js", + "webpack": "./esm/_overload_yield.js", + "import": "./esm/_overload_yield.js", + "default": "./cjs/_overload_yield.cjs" + }, + "./_/_possible_constructor_return": { + "module-sync": "./esm/_possible_constructor_return.js", + "webpack": "./esm/_possible_constructor_return.js", + "import": "./esm/_possible_constructor_return.js", + "default": "./cjs/_possible_constructor_return.cjs" + }, + "./_/_read_only_error": { + "module-sync": "./esm/_read_only_error.js", + "webpack": "./esm/_read_only_error.js", + "import": "./esm/_read_only_error.js", + "default": "./cjs/_read_only_error.cjs" + }, + "./_/_set": { + "module-sync": "./esm/_set.js", + "webpack": "./esm/_set.js", + "import": "./esm/_set.js", + "default": "./cjs/_set.cjs" + }, + "./_/_set_prototype_of": { + "module-sync": "./esm/_set_prototype_of.js", + "webpack": "./esm/_set_prototype_of.js", + "import": "./esm/_set_prototype_of.js", + "default": "./cjs/_set_prototype_of.cjs" + }, + "./_/_skip_first_generator_next": { + "module-sync": "./esm/_skip_first_generator_next.js", + "webpack": "./esm/_skip_first_generator_next.js", + "import": "./esm/_skip_first_generator_next.js", + "default": "./cjs/_skip_first_generator_next.cjs" + }, + "./_/_sliced_to_array": { + "module-sync": "./esm/_sliced_to_array.js", + "webpack": "./esm/_sliced_to_array.js", + "import": "./esm/_sliced_to_array.js", + "default": "./cjs/_sliced_to_array.cjs" + }, + "./_/_sliced_to_array_loose": { + "module-sync": "./esm/_sliced_to_array_loose.js", + "webpack": "./esm/_sliced_to_array_loose.js", + "import": "./esm/_sliced_to_array_loose.js", + "default": "./cjs/_sliced_to_array_loose.cjs" + }, + "./_/_super_prop_base": { + "module-sync": "./esm/_super_prop_base.js", + "webpack": "./esm/_super_prop_base.js", + "import": "./esm/_super_prop_base.js", + "default": "./cjs/_super_prop_base.cjs" + }, + "./_/_tagged_template_literal": { + "module-sync": "./esm/_tagged_template_literal.js", + "webpack": "./esm/_tagged_template_literal.js", + "import": "./esm/_tagged_template_literal.js", + "default": "./cjs/_tagged_template_literal.cjs" + }, + "./_/_tagged_template_literal_loose": { + "module-sync": "./esm/_tagged_template_literal_loose.js", + "webpack": "./esm/_tagged_template_literal_loose.js", + "import": "./esm/_tagged_template_literal_loose.js", + "default": "./cjs/_tagged_template_literal_loose.cjs" + }, + "./_/_throw": { + "module-sync": "./esm/_throw.js", + "webpack": "./esm/_throw.js", + "import": "./esm/_throw.js", + "default": "./cjs/_throw.cjs" + }, + "./_/_to_array": { + "module-sync": "./esm/_to_array.js", + "webpack": "./esm/_to_array.js", + "import": "./esm/_to_array.js", + "default": "./cjs/_to_array.cjs" + }, + "./_/_to_consumable_array": { + "module-sync": "./esm/_to_consumable_array.js", + "webpack": "./esm/_to_consumable_array.js", + "import": "./esm/_to_consumable_array.js", + "default": "./cjs/_to_consumable_array.cjs" + }, + "./_/_to_primitive": { + "module-sync": "./esm/_to_primitive.js", + "webpack": "./esm/_to_primitive.js", + "import": "./esm/_to_primitive.js", + "default": "./cjs/_to_primitive.cjs" + }, + "./_/_to_property_key": { + "module-sync": "./esm/_to_property_key.js", + "webpack": "./esm/_to_property_key.js", + "import": "./esm/_to_property_key.js", + "default": "./cjs/_to_property_key.cjs" + }, + "./_/_ts_add_disposable_resource": { + "module-sync": "./esm/_ts_add_disposable_resource.js", + "webpack": "./esm/_ts_add_disposable_resource.js", + "import": "./esm/_ts_add_disposable_resource.js", + "default": "./cjs/_ts_add_disposable_resource.cjs" + }, + "./_/_ts_decorate": { + "module-sync": "./esm/_ts_decorate.js", + "webpack": "./esm/_ts_decorate.js", + "import": "./esm/_ts_decorate.js", + "default": "./cjs/_ts_decorate.cjs" + }, + "./_/_ts_dispose_resources": { + "module-sync": "./esm/_ts_dispose_resources.js", + "webpack": "./esm/_ts_dispose_resources.js", + "import": "./esm/_ts_dispose_resources.js", + "default": "./cjs/_ts_dispose_resources.cjs" + }, + "./_/_ts_generator": { + "module-sync": "./esm/_ts_generator.js", + "webpack": "./esm/_ts_generator.js", + "import": "./esm/_ts_generator.js", + "default": "./cjs/_ts_generator.cjs" + }, + "./_/_ts_metadata": { + "module-sync": "./esm/_ts_metadata.js", + "webpack": "./esm/_ts_metadata.js", + "import": "./esm/_ts_metadata.js", + "default": "./cjs/_ts_metadata.cjs" + }, + "./_/_ts_param": { + "module-sync": "./esm/_ts_param.js", + "webpack": "./esm/_ts_param.js", + "import": "./esm/_ts_param.js", + "default": "./cjs/_ts_param.cjs" + }, + "./_/_ts_rewrite_relative_import_extension": { + "module-sync": "./esm/_ts_rewrite_relative_import_extension.js", + "webpack": "./esm/_ts_rewrite_relative_import_extension.js", + "import": "./esm/_ts_rewrite_relative_import_extension.js", + "default": "./cjs/_ts_rewrite_relative_import_extension.cjs" + }, + "./_/_ts_values": { + "module-sync": "./esm/_ts_values.js", + "webpack": "./esm/_ts_values.js", + "import": "./esm/_ts_values.js", + "default": "./cjs/_ts_values.cjs" + }, + "./_/_type_of": { + "module-sync": "./esm/_type_of.js", + "webpack": "./esm/_type_of.js", + "import": "./esm/_type_of.js", + "default": "./cjs/_type_of.cjs" + }, + "./_/_unsupported_iterable_to_array": { + "module-sync": "./esm/_unsupported_iterable_to_array.js", + "webpack": "./esm/_unsupported_iterable_to_array.js", + "import": "./esm/_unsupported_iterable_to_array.js", + "default": "./cjs/_unsupported_iterable_to_array.cjs" + }, + "./_/_update": { + "module-sync": "./esm/_update.js", + "webpack": "./esm/_update.js", + "import": "./esm/_update.js", + "default": "./cjs/_update.cjs" + }, + "./_/_using": { + "module-sync": "./esm/_using.js", + "webpack": "./esm/_using.js", + "import": "./esm/_using.js", + "default": "./cjs/_using.cjs" + }, + "./_/_using_ctx": { + "module-sync": "./esm/_using_ctx.js", + "webpack": "./esm/_using_ctx.js", + "import": "./esm/_using_ctx.js", + "default": "./cjs/_using_ctx.cjs" + }, + "./_/_wrap_async_generator": { + "module-sync": "./esm/_wrap_async_generator.js", + "webpack": "./esm/_wrap_async_generator.js", + "import": "./esm/_wrap_async_generator.js", + "default": "./cjs/_wrap_async_generator.cjs" + }, + "./_/_wrap_native_super": { + "module-sync": "./esm/_wrap_native_super.js", + "webpack": "./esm/_wrap_native_super.js", + "import": "./esm/_wrap_native_super.js", + "default": "./cjs/_wrap_native_super.cjs" + }, + "./_/_wrap_reg_exp": { + "module-sync": "./esm/_wrap_reg_exp.js", + "webpack": "./esm/_wrap_reg_exp.js", + "import": "./esm/_wrap_reg_exp.js", + "default": "./cjs/_wrap_reg_exp.cjs" + }, + "./_/_write_only_error": { + "module-sync": "./esm/_write_only_error.js", + "webpack": "./esm/_write_only_error.js", + "import": "./esm/_write_only_error.js", + "default": "./cjs/_write_only_error.cjs" + }, + "./_/index": { + "module-sync": "./esm/index.js", + "webpack": "./esm/index.js", + "import": "./esm/index.js", + "default": "./cjs/index.cjs" + } + }, + "scripts": { + "build": "zx ./scripts/build.js" + } +} \ No newline at end of file diff --git a/node_modules/@swc/helpers/scripts/ast_grep.js b/node_modules/@swc/helpers/scripts/ast_grep.js new file mode 100644 index 0000000000000000000000000000000000000000..a7fea0a7d1a7d81bd6f5a6a7faeedc9f03d67b78 --- /dev/null +++ b/node_modules/@swc/helpers/scripts/ast_grep.js @@ -0,0 +1,218 @@ +import { parseFiles } from "@ast-grep/napi"; +import { chalk, fs, path } from "zx"; +import { errors } from "./errors.js"; +import { root } from "./utils.js"; + +/** + * @typedef {import("@ast-grep/napi").SgNode} SgNode + */ + +/** + * Prepend text to a node + * @param {SgNode} node + * @param {string} text + * @returns {import("@ast-grep/napi").Edit} + */ +function prepend(node, text) { + const index = node.range().start.index; + return { + startPos: index, + endPos: index, + insertedText: text, + }; +} + +export function ast_grep() { + const task_queue = []; + + const task = parseFiles([root("esm")], (err, tree) => { + const filename = path.basename(tree.filename(), ".js"); + if (filename === "index") { + return; + } + + const root_node = tree.root(); + const edits = []; + + edits.push(prepend(root_node, `"use strict";\n\n`)); + + // We have forked _ts_generator from tslib + if (filename.startsWith("_ts") && filename !== "_ts_generator") { + const match = root_node.find(`export { $NAME as _ } from "tslib"`); + if (match) { + const name = match.getMatch("NAME").text(); + edits.push( + match.replace(`exports._ = require("tslib").${name};`), + ); + task_queue.push( + fs.writeFile(root("cjs", `${filename}.cjs`), root_node.commitEdits(edits), { + encoding: "utf-8", + }), + ); + } else { + report_noexport(tree.filename()); + } + return; + } + + // rewrite export named function + const match = root_node.find({ + rule: { + kind: "export_statement", + pattern: "export { $FUNC as _ }", + }, + }); + + if (match) { + const func = match.getMatch("FUNC"); + const func_name = func.text(); + if (func_name !== filename) { + report_export_mismatch(tree.filename(), match); + } + + edits.push( + match.replace(`exports._ = ${func_name};`), + ); + + // since we match the { export x as _ } pattern, + // we need to find the assignment expression from the root + root_node + .findAll({ + rule: { + pattern: func_name, + kind: "identifier", + inside: { kind: "assignment_expression", field: "left" }, + }, + }) + .forEach((node) => { + edits.push( + prepend(node, `exports._ = `), + ); + }); + } else { + report_noexport(tree.filename()); + } + + // rewrite import + root_node + .findAll({ rule: { pattern: `import { _ as $BINDING } from "$SOURCE"` } }) + .forEach((match) => { + const import_binding = match.getMatch("BINDING").text(); + const import_source = match.getMatch("SOURCE").text(); + + const import_basename = path.basename(import_source, ".js"); + + if (import_binding !== import_basename) { + report_import_mismatch(tree.filename(), match); + } + + edits.push( + match.replace(`var ${import_binding} = require("./${import_binding}.cjs");`), + ); + + root_node + .findAll({ + rule: { + pattern: import_binding, + kind: "identifier", + inside: { + not: { + kind: "import_specifier", + }, + }, + }, + }) + .forEach((node) => { + edits.push( + node.replace(`${node.text()}._`), + ); + }); + }); + + task_queue.push( + fs.writeFile(root("cjs", `${filename}.cjs`), root_node.commitEdits(edits), { + encoding: "utf-8", + }), + ); + }); + + task_queue.push(task); + + return task_queue; +} + +/** + * @param {string} filename + * @param {SgNode} match + */ +function report_export_mismatch(filename, match) { + const func = match.getMatch("FUNC"); + const func_range = func.range(); + + const text = match.text().split("\n"); + const offset = func_range.start.line - match.range().start.line; + + text.splice( + offset + 1, + text.length, + chalk.red( + [ + " ".repeat(func_range.start.column), + "^".repeat(func_range.end.column - func_range.start.column), + ] + .join(""), + ), + ); + + errors.push( + [ + `${chalk.bold.red("error")}: mismatch exported function name.`, + "", + `${chalk.blue("-->")} ${filename}:${func_range.start.line + 1}:${func_range.start.column + 1}`, + "", + ...text, + "", + `${chalk.bold("note:")} The exported name should be the same as the filename.`, + "", + ] + .join("\n"), + ); +} + +/** + * @param {string} filename + * @param {SgNode} match + */ +function report_import_mismatch(filename, match) { + const binding_range = match.getMatch("BINDING").range(); + const source_range = match.getMatch("SOURCE").range(); + + errors.push( + [ + `${chalk.bold.red("error")}: mismatch imported binding name.`, + "", + `${chalk.blue("-->")} ${filename}:${match.range().start.line + 1}`, + "", + match.text(), + [ + " ".repeat(binding_range.start.column), + chalk.red("^".repeat(binding_range.end.column - binding_range.start.column)), + " ".repeat(source_range.start.column - binding_range.end.column), + chalk.blue("-".repeat(source_range.end.column - source_range.start.column)), + ] + .join(""), + `${chalk.bold("note:")} The imported binding name should be the same as the import source basename.`, + "", + ] + .join("\n"), + ); +} + +/** + * @param {string} filename + */ +function report_noexport(filename) { + errors.push( + [`${chalk.bold.red("error")}: exported name not found`, `${chalk.blue("-->")} ${filename}`].join("\n"), + ); +} diff --git a/node_modules/@swc/helpers/scripts/build.js b/node_modules/@swc/helpers/scripts/build.js new file mode 100644 index 0000000000000000000000000000000000000000..32005a8331e8477509bc150e1b7ef136b8bd1e01 --- /dev/null +++ b/node_modules/@swc/helpers/scripts/build.js @@ -0,0 +1,133 @@ +#!/usr/bin/env zx + +import { $, fs, glob } from "zx"; +import { ast_grep } from "./ast_grep.js"; +import { errors } from "./errors.js"; +import { root } from "./utils.js"; + +// clear generated content +await Promise.all([ + fs.remove(root("cjs")), + fs.remove(root("_")), + fs.remove(root("src")), +]); + +let modules = await glob("*.js", { cwd: root("esm") }); + +const task_queue = []; + +const NO_MODIFY = [ + "/* This file is automatically generated and should not be manually edited. */", + "/* To modify this file, please run the `npm run build` command instead. */", +]; + +// generate index.js +const indexESM = [...NO_MODIFY, ""]; + +const indexCJS = [`"use strict";`, "", ...NO_MODIFY, ""]; + +const cjs_export_list = []; +const cjs_module_lexer = []; + +const main_package_json = fs.readJSONSync(root("package.json")); + +main_package_json.exports = { + "./package.json": "./package.json", + "./esm/*": "./esm/*", + "./cjs/*": "./cjs/*", + "./src/*": "./src/*", + ".": { + "module-sync": "./esm/index.js", + webpack: "./esm/index.js", + import: "./esm/index.js", + default: "./cjs/index.cjs", + }, + "./_": { + "module-sync": "./esm/index.js", + webpack: "./esm/index.js", + import: "./esm/index.js", + default: "./cjs/index.cjs", + }, +}; + +modules.forEach((p) => { + const importBinding = p.slice(0, -3); + + main_package_json.exports[`./_/${importBinding}`] = { + "module-sync": `./esm/${importBinding}.js`, + webpack: `./esm/${importBinding}.js`, + import: `./esm/${importBinding}.js`, + default: `./cjs/${importBinding}.cjs`, + }; + + const alias_package = { + main: `../../cjs/${importBinding}.cjs`, + module: `../../esm/${importBinding}.js`, + }; + task_queue.push( + fs.outputJSON(root("_", importBinding, "package.json"), alias_package, { + encoding: "utf-8", + spaces: 4, + }), + ); + + if (importBinding === "index") { + return; + } + + task_queue.push( + fs.outputFile(root("src", `${importBinding}.mjs`), re_export_esm(importBinding), { + encoding: "utf-8", + }), + ); + + indexESM.push(`export { _ as ${importBinding} } from "./${importBinding}.js";`); + + cjs_module_lexer.push(`${importBinding}: null,`); + cjs_export_list.push(`get ${importBinding}() { + return require("./${importBinding}.cjs")._; + },`); +}); + +indexCJS.push( + `0 && (module.exports = {`, + "/* @Annotate_start: the CommonJS named exports for ESM import in node */", + ...cjs_module_lexer, + "/* @Annotate_end */", + `});`, + `module.exports = {`, + ...cjs_export_list, + `};`, +); + +task_queue.push( + fs.outputJSON(root("package.json"), main_package_json, { spaces: 4 }), + fs.outputFile(root("esm", "index.js"), indexESM.join("\n") + "\n", { + encoding: "utf-8", + }), + fs.outputFile(root("cjs", "index.cjs"), indexCJS.join("\n") + "\n", { + encoding: "utf-8", + }), + fs.outputFile(root("src", "index.mjs"), `export * from "../esm/index.js"`, { + encoding: "utf-8", + }), +); + +task_queue.push(...ast_grep()); + +await Promise.all(task_queue); + +if (errors.length > 0) { + errors.forEach((e) => { + console.error(e); + }); + process.exitCode = 1; +} else { + $.cwd = root("."); + await $`dprint fmt`; + await $`dprint fmt "scripts/*.js" -c scripts/.dprint.json`; +} + +function re_export_esm(importBinding) { + return `export { _ as default } from "../esm/${importBinding}.js"`; +} diff --git a/node_modules/@swc/helpers/scripts/errors.js b/node_modules/@swc/helpers/scripts/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..b5b3c15937ed8898692244cccea7240dcaae1ebb --- /dev/null +++ b/node_modules/@swc/helpers/scripts/errors.js @@ -0,0 +1 @@ +export const errors = []; diff --git a/node_modules/@swc/helpers/scripts/utils.js b/node_modules/@swc/helpers/scripts/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..479b100ce30bd88647aed1475be95fef2129e45f --- /dev/null +++ b/node_modules/@swc/helpers/scripts/utils.js @@ -0,0 +1,3 @@ +export function root(...p) { + return path.resolve(__dirname, "..", ...p); +} diff --git a/node_modules/@swc/helpers/src/_apply_decorated_descriptor.mjs b/node_modules/@swc/helpers/src/_apply_decorated_descriptor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e4839a154f839c83f9ad9e3caa3eb98acad12bc7 --- /dev/null +++ b/node_modules/@swc/helpers/src/_apply_decorated_descriptor.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_apply_decorated_descriptor.js"; diff --git a/node_modules/@swc/helpers/src/_apply_decs_2203_r.mjs b/node_modules/@swc/helpers/src/_apply_decs_2203_r.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c10cb5619351b9460f740db5a4811f09b15cbdf2 --- /dev/null +++ b/node_modules/@swc/helpers/src/_apply_decs_2203_r.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_apply_decs_2203_r.js"; diff --git a/node_modules/@swc/helpers/src/_apply_decs_2311.mjs b/node_modules/@swc/helpers/src/_apply_decs_2311.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b9aec565d3410891aa9af033c85a2907f4497c5f --- /dev/null +++ b/node_modules/@swc/helpers/src/_apply_decs_2311.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_apply_decs_2311.js"; diff --git a/node_modules/@swc/helpers/src/_array_like_to_array.mjs b/node_modules/@swc/helpers/src/_array_like_to_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7691b3201856cb14d8064c34ff6d4a356d79d972 --- /dev/null +++ b/node_modules/@swc/helpers/src/_array_like_to_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_array_like_to_array.js"; diff --git a/node_modules/@swc/helpers/src/_array_with_holes.mjs b/node_modules/@swc/helpers/src/_array_with_holes.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1a622996dd2107d07ccf6a97a3b46b21242c977d --- /dev/null +++ b/node_modules/@swc/helpers/src/_array_with_holes.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_array_with_holes.js"; diff --git a/node_modules/@swc/helpers/src/_array_without_holes.mjs b/node_modules/@swc/helpers/src/_array_without_holes.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ee2f265ee78d338cc2e4a42c5f766c3c6394323f --- /dev/null +++ b/node_modules/@swc/helpers/src/_array_without_holes.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_array_without_holes.js"; diff --git a/node_modules/@swc/helpers/src/_assert_this_initialized.mjs b/node_modules/@swc/helpers/src/_assert_this_initialized.mjs new file mode 100644 index 0000000000000000000000000000000000000000..36772535e42670f86bbb351b24ef5b402ef237de --- /dev/null +++ b/node_modules/@swc/helpers/src/_assert_this_initialized.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_assert_this_initialized.js"; diff --git a/node_modules/@swc/helpers/src/_async_generator.mjs b/node_modules/@swc/helpers/src/_async_generator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b3ced536baf839a663df32be644a3206c18c3bb8 --- /dev/null +++ b/node_modules/@swc/helpers/src/_async_generator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_async_generator.js"; diff --git a/node_modules/@swc/helpers/src/_async_generator_delegate.mjs b/node_modules/@swc/helpers/src/_async_generator_delegate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..29dd8b2230e90da9b8560d9ba238b3b1d9a3a221 --- /dev/null +++ b/node_modules/@swc/helpers/src/_async_generator_delegate.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_async_generator_delegate.js"; diff --git a/node_modules/@swc/helpers/src/_async_iterator.mjs b/node_modules/@swc/helpers/src/_async_iterator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d1300321c17bb8934c7e6cc42a559721ecb1c01b --- /dev/null +++ b/node_modules/@swc/helpers/src/_async_iterator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_async_iterator.js"; diff --git a/node_modules/@swc/helpers/src/_async_to_generator.mjs b/node_modules/@swc/helpers/src/_async_to_generator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..18adef559169baa84723edc8f954b70489badd1d --- /dev/null +++ b/node_modules/@swc/helpers/src/_async_to_generator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_async_to_generator.js"; diff --git a/node_modules/@swc/helpers/src/_await_async_generator.mjs b/node_modules/@swc/helpers/src/_await_async_generator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..da13a9fbdaca80544dae905cc12b77935706768f --- /dev/null +++ b/node_modules/@swc/helpers/src/_await_async_generator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_await_async_generator.js"; diff --git a/node_modules/@swc/helpers/src/_await_value.mjs b/node_modules/@swc/helpers/src/_await_value.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3c2416176d572acbb144c717c5a4b0ed05c43b13 --- /dev/null +++ b/node_modules/@swc/helpers/src/_await_value.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_await_value.js"; diff --git a/node_modules/@swc/helpers/src/_call_super.mjs b/node_modules/@swc/helpers/src/_call_super.mjs new file mode 100644 index 0000000000000000000000000000000000000000..da6071660c392fe04dda61a1aead8f8763db20c3 --- /dev/null +++ b/node_modules/@swc/helpers/src/_call_super.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_call_super.js"; diff --git a/node_modules/@swc/helpers/src/_check_private_redeclaration.mjs b/node_modules/@swc/helpers/src/_check_private_redeclaration.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7d78cfe173fc3eccb36c19126752a142c3ab046a --- /dev/null +++ b/node_modules/@swc/helpers/src/_check_private_redeclaration.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_check_private_redeclaration.js"; diff --git a/node_modules/@swc/helpers/src/_class_apply_descriptor_destructure.mjs b/node_modules/@swc/helpers/src/_class_apply_descriptor_destructure.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b606b53792b91b99a02af6d63c7c42dc0d0dbe0b --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_apply_descriptor_destructure.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_apply_descriptor_destructure.js"; diff --git a/node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs b/node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f888b6bef005107aef6ece6b311b532cadb0e908 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_apply_descriptor_get.js"; diff --git a/node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs b/node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fb0067998aa7817f7e3701802a61e5e9f274d3dd --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_apply_descriptor_set.js"; diff --git a/node_modules/@swc/helpers/src/_class_apply_descriptor_update.mjs b/node_modules/@swc/helpers/src/_class_apply_descriptor_update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e7a9915b2f9d7b0671716834e1d76141580fa2fa --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_apply_descriptor_update.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_apply_descriptor_update.js"; diff --git a/node_modules/@swc/helpers/src/_class_call_check.mjs b/node_modules/@swc/helpers/src/_class_call_check.mjs new file mode 100644 index 0000000000000000000000000000000000000000..220c3c81f0ff4d3e955d0d2fa929f75dde407543 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_call_check.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_call_check.js"; diff --git a/node_modules/@swc/helpers/src/_class_check_private_static_access.mjs b/node_modules/@swc/helpers/src/_class_check_private_static_access.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a52a4d8d6d109fba265e9e36a520532de81b1b67 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_check_private_static_access.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_check_private_static_access.js"; diff --git a/node_modules/@swc/helpers/src/_class_check_private_static_field_descriptor.mjs b/node_modules/@swc/helpers/src/_class_check_private_static_field_descriptor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cb8a623dc776747525ad601bd98ff874653eec18 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_check_private_static_field_descriptor.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_check_private_static_field_descriptor.js"; diff --git a/node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs b/node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7586ce8211cd95b0da1acf472fcacb0409574472 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_extract_field_descriptor.js"; diff --git a/node_modules/@swc/helpers/src/_class_name_tdz_error.mjs b/node_modules/@swc/helpers/src/_class_name_tdz_error.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c211d7fb5d51e41913d960f7bc689a032a3c595a --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_name_tdz_error.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_name_tdz_error.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_destructure.mjs b/node_modules/@swc/helpers/src/_class_private_field_destructure.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b06b763f8bdc824e2ea0c24de0760201eb3dbb9e --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_destructure.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_destructure.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_get.mjs b/node_modules/@swc/helpers/src/_class_private_field_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1f8854a81cd2c9ecc4aac02e58498eb1a78e59cb --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_get.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_init.mjs b/node_modules/@swc/helpers/src/_class_private_field_init.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48d4d17b93a515e39518a58f00adeca0c724fd58 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_init.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_init.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_loose_base.mjs b/node_modules/@swc/helpers/src/_class_private_field_loose_base.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a10b033f37bb151dbaa031a375c1e9b72b816337 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_loose_base.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_loose_base.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_loose_key.mjs b/node_modules/@swc/helpers/src/_class_private_field_loose_key.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6e80fd9835d817043f1e7c7a8c44ba8ccdb7018b --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_loose_key.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_loose_key.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_set.mjs b/node_modules/@swc/helpers/src/_class_private_field_set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cb54a1be34aebb9df26979d96db4980bb81f1ace --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_set.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_set.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_field_update.mjs b/node_modules/@swc/helpers/src/_class_private_field_update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c5f0c633e0ee9d8b3cbe49fc51ed1be62b3551ad --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_field_update.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_field_update.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_method_get.mjs b/node_modules/@swc/helpers/src/_class_private_method_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9f5248a53d824b6f0fbf0b1c57b6cd46c89b05d6 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_method_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_method_get.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_method_init.mjs b/node_modules/@swc/helpers/src/_class_private_method_init.mjs new file mode 100644 index 0000000000000000000000000000000000000000..afce453b890ae1fd887e3920a5203507c6c28677 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_method_init.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_method_init.js"; diff --git a/node_modules/@swc/helpers/src/_class_private_method_set.mjs b/node_modules/@swc/helpers/src/_class_private_method_set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..327252dae17c7e4e2348081595b5af7ad9b41fca --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_private_method_set.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_private_method_set.js"; diff --git a/node_modules/@swc/helpers/src/_class_static_private_field_destructure.mjs b/node_modules/@swc/helpers/src/_class_static_private_field_destructure.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c35376d2dc8eee18ddcb3b322d423734172a70dc --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_static_private_field_destructure.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_static_private_field_destructure.js"; diff --git a/node_modules/@swc/helpers/src/_class_static_private_field_spec_get.mjs b/node_modules/@swc/helpers/src/_class_static_private_field_spec_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0cc7854d6e0a5e2d8d46b06a9213eec6652ecec2 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_static_private_field_spec_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_static_private_field_spec_get.js"; diff --git a/node_modules/@swc/helpers/src/_class_static_private_field_spec_set.mjs b/node_modules/@swc/helpers/src/_class_static_private_field_spec_set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..208cf9730a3c2265dccf8e9c42a6feace7fa1fb6 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_static_private_field_spec_set.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_static_private_field_spec_set.js"; diff --git a/node_modules/@swc/helpers/src/_class_static_private_field_update.mjs b/node_modules/@swc/helpers/src/_class_static_private_field_update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..87e043817674aa712f46736b85e2c27fd8835908 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_static_private_field_update.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_static_private_field_update.js"; diff --git a/node_modules/@swc/helpers/src/_class_static_private_method_get.mjs b/node_modules/@swc/helpers/src/_class_static_private_method_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2241a1a84a2863cbd974e94efd5647703bfa0bf9 --- /dev/null +++ b/node_modules/@swc/helpers/src/_class_static_private_method_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_class_static_private_method_get.js"; diff --git a/node_modules/@swc/helpers/src/_construct.mjs b/node_modules/@swc/helpers/src/_construct.mjs new file mode 100644 index 0000000000000000000000000000000000000000..54acb64d632828fb35c0273bdb7427262a79a9f5 --- /dev/null +++ b/node_modules/@swc/helpers/src/_construct.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_construct.js"; diff --git a/node_modules/@swc/helpers/src/_create_class.mjs b/node_modules/@swc/helpers/src/_create_class.mjs new file mode 100644 index 0000000000000000000000000000000000000000..78c2af2273b8198e611978bec75b3e27b9912f89 --- /dev/null +++ b/node_modules/@swc/helpers/src/_create_class.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_create_class.js"; diff --git a/node_modules/@swc/helpers/src/_create_for_of_iterator_helper_loose.mjs b/node_modules/@swc/helpers/src/_create_for_of_iterator_helper_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..303e056c5a26660873b4566d546bb02785207213 --- /dev/null +++ b/node_modules/@swc/helpers/src/_create_for_of_iterator_helper_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_create_for_of_iterator_helper_loose.js"; diff --git a/node_modules/@swc/helpers/src/_create_super.mjs b/node_modules/@swc/helpers/src/_create_super.mjs new file mode 100644 index 0000000000000000000000000000000000000000..44a06bfe18eaa069c86c7b2c85d482a155f06a12 --- /dev/null +++ b/node_modules/@swc/helpers/src/_create_super.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_create_super.js"; diff --git a/node_modules/@swc/helpers/src/_decorate.mjs b/node_modules/@swc/helpers/src/_decorate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..087899164b69fef93291302e293475dde067c99e --- /dev/null +++ b/node_modules/@swc/helpers/src/_decorate.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_decorate.js"; diff --git a/node_modules/@swc/helpers/src/_defaults.mjs b/node_modules/@swc/helpers/src/_defaults.mjs new file mode 100644 index 0000000000000000000000000000000000000000..624e68460fb3ea1e0fafae83db5dfc40a448ecf6 --- /dev/null +++ b/node_modules/@swc/helpers/src/_defaults.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_defaults.js"; diff --git a/node_modules/@swc/helpers/src/_define_enumerable_properties.mjs b/node_modules/@swc/helpers/src/_define_enumerable_properties.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b6a87fc8db4d396bbf555c31fd319693b0e2f1ce --- /dev/null +++ b/node_modules/@swc/helpers/src/_define_enumerable_properties.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_define_enumerable_properties.js"; diff --git a/node_modules/@swc/helpers/src/_define_property.mjs b/node_modules/@swc/helpers/src/_define_property.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b60b2c824d6438cddd671ac08e21777adf1917ef --- /dev/null +++ b/node_modules/@swc/helpers/src/_define_property.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_define_property.js"; diff --git a/node_modules/@swc/helpers/src/_dispose.mjs b/node_modules/@swc/helpers/src/_dispose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2f217e87221b1bed86ef2014d60ca9cdd5f8f023 --- /dev/null +++ b/node_modules/@swc/helpers/src/_dispose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_dispose.js"; diff --git a/node_modules/@swc/helpers/src/_export_star.mjs b/node_modules/@swc/helpers/src/_export_star.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c7011c2f61a7f4173912a29a62bd7109cf089ca8 --- /dev/null +++ b/node_modules/@swc/helpers/src/_export_star.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_export_star.js"; diff --git a/node_modules/@swc/helpers/src/_extends.mjs b/node_modules/@swc/helpers/src/_extends.mjs new file mode 100644 index 0000000000000000000000000000000000000000..804a28bab3d1cd3e01dfc065af3afd40214ed08d --- /dev/null +++ b/node_modules/@swc/helpers/src/_extends.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_extends.js"; diff --git a/node_modules/@swc/helpers/src/_get.mjs b/node_modules/@swc/helpers/src/_get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fae4b22b5279e24a7c15ae631a7f4b56fa759784 --- /dev/null +++ b/node_modules/@swc/helpers/src/_get.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_get.js"; diff --git a/node_modules/@swc/helpers/src/_get_prototype_of.mjs b/node_modules/@swc/helpers/src/_get_prototype_of.mjs new file mode 100644 index 0000000000000000000000000000000000000000..57e820cebb170ec6831f6c73dd137a7a10e4a783 --- /dev/null +++ b/node_modules/@swc/helpers/src/_get_prototype_of.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_get_prototype_of.js"; diff --git a/node_modules/@swc/helpers/src/_identity.mjs b/node_modules/@swc/helpers/src/_identity.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5ab4a08a7e7207e27cfcc921940a069757d73e8e --- /dev/null +++ b/node_modules/@swc/helpers/src/_identity.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_identity.js"; diff --git a/node_modules/@swc/helpers/src/_inherits.mjs b/node_modules/@swc/helpers/src/_inherits.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d5e3767700736ad2a5305d6138ca93d9bb704d2c --- /dev/null +++ b/node_modules/@swc/helpers/src/_inherits.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_inherits.js"; diff --git a/node_modules/@swc/helpers/src/_inherits_loose.mjs b/node_modules/@swc/helpers/src/_inherits_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4f5187d98db0c35363d36e5ffaaaf049ea04f673 --- /dev/null +++ b/node_modules/@swc/helpers/src/_inherits_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_inherits_loose.js"; diff --git a/node_modules/@swc/helpers/src/_initializer_define_property.mjs b/node_modules/@swc/helpers/src/_initializer_define_property.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fa0a3b8e2e1de0caef9b8d9f42e711a1b743ca89 --- /dev/null +++ b/node_modules/@swc/helpers/src/_initializer_define_property.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_initializer_define_property.js"; diff --git a/node_modules/@swc/helpers/src/_initializer_warning_helper.mjs b/node_modules/@swc/helpers/src/_initializer_warning_helper.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f9251ab5bb30a1d403daf2c1297a065b22dd2bcb --- /dev/null +++ b/node_modules/@swc/helpers/src/_initializer_warning_helper.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_initializer_warning_helper.js"; diff --git a/node_modules/@swc/helpers/src/_instanceof.mjs b/node_modules/@swc/helpers/src/_instanceof.mjs new file mode 100644 index 0000000000000000000000000000000000000000..609f78692e0778dacf43f68178b5680800535ce5 --- /dev/null +++ b/node_modules/@swc/helpers/src/_instanceof.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_instanceof.js"; diff --git a/node_modules/@swc/helpers/src/_interop_require_default.mjs b/node_modules/@swc/helpers/src/_interop_require_default.mjs new file mode 100644 index 0000000000000000000000000000000000000000..454ce7154f35618f3d90529075a33705c1ec252c --- /dev/null +++ b/node_modules/@swc/helpers/src/_interop_require_default.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_interop_require_default.js"; diff --git a/node_modules/@swc/helpers/src/_interop_require_wildcard.mjs b/node_modules/@swc/helpers/src/_interop_require_wildcard.mjs new file mode 100644 index 0000000000000000000000000000000000000000..07f7a7ed50d966a913b170c51e2788fcd2303a3b --- /dev/null +++ b/node_modules/@swc/helpers/src/_interop_require_wildcard.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_interop_require_wildcard.js"; diff --git a/node_modules/@swc/helpers/src/_is_native_function.mjs b/node_modules/@swc/helpers/src/_is_native_function.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8bacb3ab51baf5b97c00041a13b8941f36398175 --- /dev/null +++ b/node_modules/@swc/helpers/src/_is_native_function.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_is_native_function.js"; diff --git a/node_modules/@swc/helpers/src/_is_native_reflect_construct.mjs b/node_modules/@swc/helpers/src/_is_native_reflect_construct.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7c0394d9c46319c4cc90b44ac782f0eb40ce3a0c --- /dev/null +++ b/node_modules/@swc/helpers/src/_is_native_reflect_construct.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_is_native_reflect_construct.js"; diff --git a/node_modules/@swc/helpers/src/_iterable_to_array.mjs b/node_modules/@swc/helpers/src/_iterable_to_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4baf94afb72d4e69c75859c799c435fa319380f4 --- /dev/null +++ b/node_modules/@swc/helpers/src/_iterable_to_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_iterable_to_array.js"; diff --git a/node_modules/@swc/helpers/src/_iterable_to_array_limit.mjs b/node_modules/@swc/helpers/src/_iterable_to_array_limit.mjs new file mode 100644 index 0000000000000000000000000000000000000000..45f70f503fdfc7a1b748ff477df426e697553a9c --- /dev/null +++ b/node_modules/@swc/helpers/src/_iterable_to_array_limit.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_iterable_to_array_limit.js"; diff --git a/node_modules/@swc/helpers/src/_iterable_to_array_limit_loose.mjs b/node_modules/@swc/helpers/src/_iterable_to_array_limit_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..400a9e019fa62d55e697898982b8416fc4b8db80 --- /dev/null +++ b/node_modules/@swc/helpers/src/_iterable_to_array_limit_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_iterable_to_array_limit_loose.js"; diff --git a/node_modules/@swc/helpers/src/_jsx.mjs b/node_modules/@swc/helpers/src/_jsx.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8b0646a0f85ffce214b69ddc1eabb738650aa99c --- /dev/null +++ b/node_modules/@swc/helpers/src/_jsx.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_jsx.js"; diff --git a/node_modules/@swc/helpers/src/_new_arrow_check.mjs b/node_modules/@swc/helpers/src/_new_arrow_check.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e694d150cf518a9a826c74be35233e907346d2e5 --- /dev/null +++ b/node_modules/@swc/helpers/src/_new_arrow_check.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_new_arrow_check.js"; diff --git a/node_modules/@swc/helpers/src/_non_iterable_rest.mjs b/node_modules/@swc/helpers/src/_non_iterable_rest.mjs new file mode 100644 index 0000000000000000000000000000000000000000..83218078cb83ac7ad740d4991143db7a5237074b --- /dev/null +++ b/node_modules/@swc/helpers/src/_non_iterable_rest.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_non_iterable_rest.js"; diff --git a/node_modules/@swc/helpers/src/_non_iterable_spread.mjs b/node_modules/@swc/helpers/src/_non_iterable_spread.mjs new file mode 100644 index 0000000000000000000000000000000000000000..12993f133d0d19cafe2279dc1dc30b43ecfcde7b --- /dev/null +++ b/node_modules/@swc/helpers/src/_non_iterable_spread.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_non_iterable_spread.js"; diff --git a/node_modules/@swc/helpers/src/_object_destructuring_empty.mjs b/node_modules/@swc/helpers/src/_object_destructuring_empty.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b8aed9ce98d6933a22b9951013eab1315dd558d3 --- /dev/null +++ b/node_modules/@swc/helpers/src/_object_destructuring_empty.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_object_destructuring_empty.js"; diff --git a/node_modules/@swc/helpers/src/_object_spread.mjs b/node_modules/@swc/helpers/src/_object_spread.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9b536f58d64da93abc86b8d1050baabe8f79133d --- /dev/null +++ b/node_modules/@swc/helpers/src/_object_spread.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_object_spread.js"; diff --git a/node_modules/@swc/helpers/src/_object_spread_props.mjs b/node_modules/@swc/helpers/src/_object_spread_props.mjs new file mode 100644 index 0000000000000000000000000000000000000000..799de3f688769af054dabb5f16accc42e1713c45 --- /dev/null +++ b/node_modules/@swc/helpers/src/_object_spread_props.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_object_spread_props.js"; diff --git a/node_modules/@swc/helpers/src/_object_without_properties.mjs b/node_modules/@swc/helpers/src/_object_without_properties.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f0ce12c6c1d4060268f13d452cb98efccff35df7 --- /dev/null +++ b/node_modules/@swc/helpers/src/_object_without_properties.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_object_without_properties.js"; diff --git a/node_modules/@swc/helpers/src/_object_without_properties_loose.mjs b/node_modules/@swc/helpers/src/_object_without_properties_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f6f26696e521cd5959979a55b2be6c97c804e1f3 --- /dev/null +++ b/node_modules/@swc/helpers/src/_object_without_properties_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_object_without_properties_loose.js"; diff --git a/node_modules/@swc/helpers/src/_overload_yield.mjs b/node_modules/@swc/helpers/src/_overload_yield.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d854c354454ebc5620c1cc556a092b867f5f11c3 --- /dev/null +++ b/node_modules/@swc/helpers/src/_overload_yield.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_overload_yield.js"; diff --git a/node_modules/@swc/helpers/src/_possible_constructor_return.mjs b/node_modules/@swc/helpers/src/_possible_constructor_return.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ee9657d256cfa0ce49ba8fa14b3d718fd6ae17e9 --- /dev/null +++ b/node_modules/@swc/helpers/src/_possible_constructor_return.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_possible_constructor_return.js"; diff --git a/node_modules/@swc/helpers/src/_read_only_error.mjs b/node_modules/@swc/helpers/src/_read_only_error.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3e95329b1430b6d42833466404eac08f997bd3b5 --- /dev/null +++ b/node_modules/@swc/helpers/src/_read_only_error.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_read_only_error.js"; diff --git a/node_modules/@swc/helpers/src/_set.mjs b/node_modules/@swc/helpers/src/_set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5cc033773f86b25240a88b6eaf3e68c7611b90d6 --- /dev/null +++ b/node_modules/@swc/helpers/src/_set.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_set.js"; diff --git a/node_modules/@swc/helpers/src/_set_prototype_of.mjs b/node_modules/@swc/helpers/src/_set_prototype_of.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f244856c06d0e81b10b9e2af893ec186d13bbc7c --- /dev/null +++ b/node_modules/@swc/helpers/src/_set_prototype_of.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_set_prototype_of.js"; diff --git a/node_modules/@swc/helpers/src/_skip_first_generator_next.mjs b/node_modules/@swc/helpers/src/_skip_first_generator_next.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f437b3ce8d22a24157f65ae86f68fdcc6b0d46e6 --- /dev/null +++ b/node_modules/@swc/helpers/src/_skip_first_generator_next.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_skip_first_generator_next.js"; diff --git a/node_modules/@swc/helpers/src/_sliced_to_array.mjs b/node_modules/@swc/helpers/src/_sliced_to_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..34f97233d08a7aca1b05c49c633d8082288f0e16 --- /dev/null +++ b/node_modules/@swc/helpers/src/_sliced_to_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_sliced_to_array.js"; diff --git a/node_modules/@swc/helpers/src/_sliced_to_array_loose.mjs b/node_modules/@swc/helpers/src/_sliced_to_array_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..116211bc5e8d53fb6df1b836ac6bb968c2a11992 --- /dev/null +++ b/node_modules/@swc/helpers/src/_sliced_to_array_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_sliced_to_array_loose.js"; diff --git a/node_modules/@swc/helpers/src/_super_prop_base.mjs b/node_modules/@swc/helpers/src/_super_prop_base.mjs new file mode 100644 index 0000000000000000000000000000000000000000..25a1b4b471aa70874f7903b58213fa215f2b4007 --- /dev/null +++ b/node_modules/@swc/helpers/src/_super_prop_base.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_super_prop_base.js"; diff --git a/node_modules/@swc/helpers/src/_tagged_template_literal.mjs b/node_modules/@swc/helpers/src/_tagged_template_literal.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ea788727152e810036920619a7d3206d53acf5b9 --- /dev/null +++ b/node_modules/@swc/helpers/src/_tagged_template_literal.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_tagged_template_literal.js"; diff --git a/node_modules/@swc/helpers/src/_tagged_template_literal_loose.mjs b/node_modules/@swc/helpers/src/_tagged_template_literal_loose.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f65c3bb96cb74697023650709cb99c917af31626 --- /dev/null +++ b/node_modules/@swc/helpers/src/_tagged_template_literal_loose.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_tagged_template_literal_loose.js"; diff --git a/node_modules/@swc/helpers/src/_throw.mjs b/node_modules/@swc/helpers/src/_throw.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a0b50e049821d3616ee6cb659d28eaa153ceddfd --- /dev/null +++ b/node_modules/@swc/helpers/src/_throw.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_throw.js"; diff --git a/node_modules/@swc/helpers/src/_to_array.mjs b/node_modules/@swc/helpers/src/_to_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d42cba535fc0174c5574b916c711790400350f86 --- /dev/null +++ b/node_modules/@swc/helpers/src/_to_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_to_array.js"; diff --git a/node_modules/@swc/helpers/src/_to_consumable_array.mjs b/node_modules/@swc/helpers/src/_to_consumable_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e23f2ebc610b6fcca2eb82191ebe59e080c8ca78 --- /dev/null +++ b/node_modules/@swc/helpers/src/_to_consumable_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_to_consumable_array.js"; diff --git a/node_modules/@swc/helpers/src/_to_primitive.mjs b/node_modules/@swc/helpers/src/_to_primitive.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0d4a248636fc7338159a5b0368c35fec30bbed51 --- /dev/null +++ b/node_modules/@swc/helpers/src/_to_primitive.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_to_primitive.js"; diff --git a/node_modules/@swc/helpers/src/_to_property_key.mjs b/node_modules/@swc/helpers/src/_to_property_key.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7b767073fe22d03acba912f6ea0fd6676dd7d4e0 --- /dev/null +++ b/node_modules/@swc/helpers/src/_to_property_key.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_to_property_key.js"; diff --git a/node_modules/@swc/helpers/src/_ts_add_disposable_resource.mjs b/node_modules/@swc/helpers/src/_ts_add_disposable_resource.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b059656ed4f603ce9f2e0e6604b5d461edbd0922 --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_add_disposable_resource.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_add_disposable_resource.js"; diff --git a/node_modules/@swc/helpers/src/_ts_decorate.mjs b/node_modules/@swc/helpers/src/_ts_decorate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2d7763f3516b49384460263ea06c64f127a04c9c --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_decorate.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_decorate.js"; diff --git a/node_modules/@swc/helpers/src/_ts_dispose_resources.mjs b/node_modules/@swc/helpers/src/_ts_dispose_resources.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ba5ec13678ca62b0644c48cbdf0a98644714bae0 --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_dispose_resources.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_dispose_resources.js"; diff --git a/node_modules/@swc/helpers/src/_ts_generator.mjs b/node_modules/@swc/helpers/src/_ts_generator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f595f6d8753215b2a79f2da4cf49f184d2daf5ba --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_generator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_generator.js"; diff --git a/node_modules/@swc/helpers/src/_ts_metadata.mjs b/node_modules/@swc/helpers/src/_ts_metadata.mjs new file mode 100644 index 0000000000000000000000000000000000000000..424457eba9d0fa2c29b2ed25b383808841f2187f --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_metadata.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_metadata.js"; diff --git a/node_modules/@swc/helpers/src/_ts_param.mjs b/node_modules/@swc/helpers/src/_ts_param.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1806317955415fb518eca6bb4cae127028347142 --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_param.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_param.js"; diff --git a/node_modules/@swc/helpers/src/_ts_rewrite_relative_import_extension.mjs b/node_modules/@swc/helpers/src/_ts_rewrite_relative_import_extension.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d135817f9749b8009239f72d26adf478ed815d59 --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_rewrite_relative_import_extension.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_rewrite_relative_import_extension.js"; diff --git a/node_modules/@swc/helpers/src/_ts_values.mjs b/node_modules/@swc/helpers/src/_ts_values.mjs new file mode 100644 index 0000000000000000000000000000000000000000..126c78379e63dd43b24acbcc25f6e0599b2eec44 --- /dev/null +++ b/node_modules/@swc/helpers/src/_ts_values.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_ts_values.js"; diff --git a/node_modules/@swc/helpers/src/_type_of.mjs b/node_modules/@swc/helpers/src/_type_of.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4f8a93659e2c913833a8bdcc9018f4e878c6b2f1 --- /dev/null +++ b/node_modules/@swc/helpers/src/_type_of.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_type_of.js"; diff --git a/node_modules/@swc/helpers/src/_unsupported_iterable_to_array.mjs b/node_modules/@swc/helpers/src/_unsupported_iterable_to_array.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9e4222212cd297cb99ae171756f0aae9f3e723d8 --- /dev/null +++ b/node_modules/@swc/helpers/src/_unsupported_iterable_to_array.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_unsupported_iterable_to_array.js"; diff --git a/node_modules/@swc/helpers/src/_update.mjs b/node_modules/@swc/helpers/src/_update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6adb4a428daadcf4d8a340f101cd0da3afa19b92 --- /dev/null +++ b/node_modules/@swc/helpers/src/_update.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_update.js"; diff --git a/node_modules/@swc/helpers/src/_using.mjs b/node_modules/@swc/helpers/src/_using.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f71681556fd04759dc6b2d0e0279318f172d4c9a --- /dev/null +++ b/node_modules/@swc/helpers/src/_using.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_using.js"; diff --git a/node_modules/@swc/helpers/src/_using_ctx.mjs b/node_modules/@swc/helpers/src/_using_ctx.mjs new file mode 100644 index 0000000000000000000000000000000000000000..87e80979e1a8fed77a193cc930bbbccd014ed668 --- /dev/null +++ b/node_modules/@swc/helpers/src/_using_ctx.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_using_ctx.js"; diff --git a/node_modules/@swc/helpers/src/_wrap_async_generator.mjs b/node_modules/@swc/helpers/src/_wrap_async_generator.mjs new file mode 100644 index 0000000000000000000000000000000000000000..44acb1ab4aac6c7aa242be492b621cdbb4418ded --- /dev/null +++ b/node_modules/@swc/helpers/src/_wrap_async_generator.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_wrap_async_generator.js"; diff --git a/node_modules/@swc/helpers/src/_wrap_native_super.mjs b/node_modules/@swc/helpers/src/_wrap_native_super.mjs new file mode 100644 index 0000000000000000000000000000000000000000..266f5d3b74eda2dd9c46f3ff904a6ccc63ec3993 --- /dev/null +++ b/node_modules/@swc/helpers/src/_wrap_native_super.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_wrap_native_super.js"; diff --git a/node_modules/@swc/helpers/src/_wrap_reg_exp.mjs b/node_modules/@swc/helpers/src/_wrap_reg_exp.mjs new file mode 100644 index 0000000000000000000000000000000000000000..772afe9d1ae525a5d4c0427223484c9c643ca926 --- /dev/null +++ b/node_modules/@swc/helpers/src/_wrap_reg_exp.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_wrap_reg_exp.js"; diff --git a/node_modules/@swc/helpers/src/_write_only_error.mjs b/node_modules/@swc/helpers/src/_write_only_error.mjs new file mode 100644 index 0000000000000000000000000000000000000000..68c8af268662b7f0a016ce35f5c3ea6e388cf352 --- /dev/null +++ b/node_modules/@swc/helpers/src/_write_only_error.mjs @@ -0,0 +1 @@ +export { _ as default } from "../esm/_write_only_error.js"; diff --git a/node_modules/@swc/helpers/src/index.mjs b/node_modules/@swc/helpers/src/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d0d0812948c6fe0d4ce5f0fde507a21166548781 --- /dev/null +++ b/node_modules/@swc/helpers/src/index.mjs @@ -0,0 +1 @@ +export * from "../esm/index.js"; diff --git a/node_modules/@tailwindcss/node/LICENSE b/node_modules/@tailwindcss/node/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6a82290738a9f78946cbcb4594535d6984086dd --- /dev/null +++ b/node_modules/@tailwindcss/node/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Tailwind Labs, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tailwindcss/node/README.md b/node_modules/@tailwindcss/node/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5f532607d00a72faf633c2c1d613c9369fe27c35 --- /dev/null +++ b/node_modules/@tailwindcss/node/README.md @@ -0,0 +1,36 @@ +

+ + + + + Tailwind CSS + + +

+ +

+ A utility-first CSS framework for rapidly building custom user interfaces. +

+ +

+ Build Status + Total Downloads + Latest Release + License +

+ +--- + +## Documentation + +For full documentation, visit [tailwindcss.com](https://tailwindcss.com). + +## Community + +For help, discussion about best practices, or feature ideas: + +[Discuss Tailwind CSS on GitHub](https://github.com/tailwindlabs/tailwindcss/discussions) + +## Contributing + +If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindlabs/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**. diff --git a/node_modules/@tailwindcss/node/dist/esm-cache.loader.d.mts b/node_modules/@tailwindcss/node/dist/esm-cache.loader.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..66006c638a22a6b5979477cdb7e8f46a5248303a --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/esm-cache.loader.d.mts @@ -0,0 +1,6 @@ +import { ResolveHook, ResolveHookSync } from 'node:module'; + +declare let resolve: ResolveHook; +declare let resolveSync: ResolveHookSync; + +export { resolve, resolveSync }; diff --git a/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs b/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e444dfef826d68d18864d08af63a94ddd4dc9a24 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/esm-cache.loader.mjs @@ -0,0 +1 @@ +import{isBuiltin as a}from"module";var u=async(r,e,o)=>{let t=await o(r,e);return l(e,t)},i=(r,e,o)=>{let t=o(r,e);return l(e,t)};function l(r,e){try{if(e.url===import.meta.url||a(e.url)||!r.parentURL)return e;let t=new URL(r.parentURL).searchParams.get("id");if(t===null)return e;let n=new URL(e.url);return n.searchParams.set("id",t),{...e,url:`${n}`}}catch{return e}}export{u as resolve,i as resolveSync}; diff --git a/node_modules/@tailwindcss/node/dist/index.d.mts b/node_modules/@tailwindcss/node/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..23a898bf2f9e4aedeb4a3e921f45294b1348d657 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/index.d.mts @@ -0,0 +1,262 @@ +import { AstNode as AstNode$1 } from './ast'; +import { Candidate, Variant } from './candidate'; +import { compileAstNodes } from './compile'; +import { ClassEntry, VariantEntry, CanonicalizeOptions } from './intellisense'; +import { Theme } from './theme'; +import { Utilities } from './utilities'; +import { Variants } from './variants'; +import * as tailwindcss from 'tailwindcss'; +import { Polyfills, Features } from 'tailwindcss'; +export { Features, Polyfills } from 'tailwindcss'; + +declare const DEBUG: boolean; + +declare const env_DEBUG: typeof DEBUG; +declare namespace env { + export { env_DEBUG as DEBUG }; +} + +declare const enum CompileAstFlags { + None = 0, + RespectImportant = 1 +} +type DesignSystem = { + theme: Theme; + utilities: Utilities; + variants: Variants; + invalidCandidates: Set; + important: boolean; + getClassOrder(classes: string[]): [string, bigint | null][]; + getClassList(): ClassEntry[]; + getVariants(): VariantEntry[]; + parseCandidate(candidate: string): Readonly[]; + parseVariant(variant: string): Readonly | null; + compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType; + printCandidate(candidate: Candidate): string; + printVariant(variant: Variant): string; + getVariantOrder(): Map; + resolveThemeValue(path: string, forceInline?: boolean): string | undefined; + trackUsedVariables(raw: string): void; + canonicalizeCandidates(candidates: string[], options?: CanonicalizeOptions): string[]; + candidatesToCss(classes: string[]): (string | null)[]; + candidatesToAst(classes: string[]): AstNode$1[][]; + storage: Record; +}; + +/** + * The source code for one or more nodes in the AST + * + * This generally corresponds to a stylesheet + */ +interface Source { + /** + * The path to the file that contains the referenced source code + * + * If this references the *output* source code, this is `null`. + */ + file: string | null; + /** + * The referenced source code + */ + code: string; +} +/** + * The file and offsets within it that this node covers + * + * This can represent either: + * - A location in the original CSS which caused this node to be created + * - A location in the output CSS where this node resides + */ +type SourceLocation = [source: Source, start: number, end: number]; + +/** + * Line offset tables are the key to generating our source maps. They allow us + * to store indexes with our AST nodes and later convert them into positions as + * when given the source that the indexes refer to. + */ +/** + * A position in source code + * + * https://tc39.es/ecma426/#sec-position-record-type + */ +interface Position { + /** The line number, one-based */ + line: number; + /** The column/character number, one-based */ + column: number; +} + +interface OriginalPosition extends Position { + source: DecodedSource; +} +/** + * A "decoded" sourcemap + * + * @see https://tc39.es/ecma426/#decoded-source-map-record + */ +interface DecodedSourceMap { + file: string | null; + sources: DecodedSource[]; + mappings: DecodedMapping[]; +} +/** + * A "decoded" source + * + * @see https://tc39.es/ecma426/#decoded-source-record + */ +interface DecodedSource { + url: string | null; + content: string | null; + ignore: boolean; +} +/** + * A "decoded" mapping + * + * @see https://tc39.es/ecma426/#decoded-mapping-record + */ +interface DecodedMapping { + originalPosition: OriginalPosition | null; + generatedPosition: Position; + name: string | null; +} + +type StyleRule = { + kind: 'rule'; + selector: string; + nodes: AstNode[]; + src?: SourceLocation; + dst?: SourceLocation; +}; +type AtRule = { + kind: 'at-rule'; + name: string; + params: string; + nodes: AstNode[]; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Declaration = { + kind: 'declaration'; + property: string; + value: string | undefined; + important: boolean; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Comment = { + kind: 'comment'; + value: string; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Context = { + kind: 'context'; + context: Record; + nodes: AstNode[]; + src?: undefined; + dst?: undefined; +}; +type AtRoot = { + kind: 'at-root'; + nodes: AstNode[]; + src?: undefined; + dst?: undefined; +}; +type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot; + +type Resolver = (id: string, base: string) => Promise; +interface CompileOptions { + base: string; + from?: string; + onDependency: (path: string) => void; + shouldRewriteUrls?: boolean; + polyfills?: Polyfills; + customCssResolver?: Resolver; + customJsResolver?: Resolver; +} +declare function compileAst(ast: AstNode[], options: CompileOptions): Promise<{ + sources: { + base: string; + pattern: string; + negated: boolean; + }[]; + root: "none" | { + base: string; + pattern: string; + } | null; + features: Features; + build(candidates: string[]): AstNode[]; +}>; +declare function compile(css: string, options: CompileOptions): Promise<{ + sources: { + base: string; + pattern: string; + negated: boolean; + }[]; + root: "none" | { + base: string; + pattern: string; + } | null; + features: Features; + build(candidates: string[]): string; + buildSourceMap(): tailwindcss.DecodedSourceMap; +}>; +declare function __unstable__loadDesignSystem(css: string, { base }: { + base: string; +}): Promise; +declare function loadModule(id: string, base: string, onDependency: (path: string) => void, customJsResolver?: Resolver): Promise<{ + path: string; + base: string; + module: any; +}>; + +declare class Instrumentation implements Disposable { + #private; + private shouldReport; + private defaultFlush; + constructor(shouldReport?: boolean, defaultFlush?: (message: string) => undefined); + hit(label: string): void; + start(label: string): void; + end(label: string): void; + track(label: string): { + [Symbol.dispose]: () => void; + [Symbol.asyncDispose]: () => void; + }; + span(label: string, fn: () => T): T; + reset(): void; + report(flush?: (message: string) => undefined): void; + [Symbol.dispose](): void; +} + +declare function normalizePath(originalPath: string): string; + +interface OptimizeOptions { + /** + * The file being transformed + */ + file?: string; + /** + * Enabled minified output + */ + minify?: boolean; + /** + * The output source map before optimization + * + * If omitted a resulting source map will not be available + */ + map?: string; +} +interface TransformResult { + code: string; + map: string | undefined; +} +declare function optimize(input: string, { file, minify, map }?: OptimizeOptions): TransformResult; + +interface SourceMap { + readonly raw: string; + readonly inline: string; + comment(url: string): string; +} +declare function toSourceMap(map: DecodedSourceMap | string): SourceMap; + +export { type CompileOptions, type DecodedSource, type DecodedSourceMap, Instrumentation, type OptimizeOptions, type Resolver, type SourceMap, type TransformResult, __unstable__loadDesignSystem, compile, compileAst, env, loadModule, normalizePath, optimize, toSourceMap }; diff --git a/node_modules/@tailwindcss/node/dist/index.d.ts b/node_modules/@tailwindcss/node/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..23a898bf2f9e4aedeb4a3e921f45294b1348d657 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/index.d.ts @@ -0,0 +1,262 @@ +import { AstNode as AstNode$1 } from './ast'; +import { Candidate, Variant } from './candidate'; +import { compileAstNodes } from './compile'; +import { ClassEntry, VariantEntry, CanonicalizeOptions } from './intellisense'; +import { Theme } from './theme'; +import { Utilities } from './utilities'; +import { Variants } from './variants'; +import * as tailwindcss from 'tailwindcss'; +import { Polyfills, Features } from 'tailwindcss'; +export { Features, Polyfills } from 'tailwindcss'; + +declare const DEBUG: boolean; + +declare const env_DEBUG: typeof DEBUG; +declare namespace env { + export { env_DEBUG as DEBUG }; +} + +declare const enum CompileAstFlags { + None = 0, + RespectImportant = 1 +} +type DesignSystem = { + theme: Theme; + utilities: Utilities; + variants: Variants; + invalidCandidates: Set; + important: boolean; + getClassOrder(classes: string[]): [string, bigint | null][]; + getClassList(): ClassEntry[]; + getVariants(): VariantEntry[]; + parseCandidate(candidate: string): Readonly[]; + parseVariant(variant: string): Readonly | null; + compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType; + printCandidate(candidate: Candidate): string; + printVariant(variant: Variant): string; + getVariantOrder(): Map; + resolveThemeValue(path: string, forceInline?: boolean): string | undefined; + trackUsedVariables(raw: string): void; + canonicalizeCandidates(candidates: string[], options?: CanonicalizeOptions): string[]; + candidatesToCss(classes: string[]): (string | null)[]; + candidatesToAst(classes: string[]): AstNode$1[][]; + storage: Record; +}; + +/** + * The source code for one or more nodes in the AST + * + * This generally corresponds to a stylesheet + */ +interface Source { + /** + * The path to the file that contains the referenced source code + * + * If this references the *output* source code, this is `null`. + */ + file: string | null; + /** + * The referenced source code + */ + code: string; +} +/** + * The file and offsets within it that this node covers + * + * This can represent either: + * - A location in the original CSS which caused this node to be created + * - A location in the output CSS where this node resides + */ +type SourceLocation = [source: Source, start: number, end: number]; + +/** + * Line offset tables are the key to generating our source maps. They allow us + * to store indexes with our AST nodes and later convert them into positions as + * when given the source that the indexes refer to. + */ +/** + * A position in source code + * + * https://tc39.es/ecma426/#sec-position-record-type + */ +interface Position { + /** The line number, one-based */ + line: number; + /** The column/character number, one-based */ + column: number; +} + +interface OriginalPosition extends Position { + source: DecodedSource; +} +/** + * A "decoded" sourcemap + * + * @see https://tc39.es/ecma426/#decoded-source-map-record + */ +interface DecodedSourceMap { + file: string | null; + sources: DecodedSource[]; + mappings: DecodedMapping[]; +} +/** + * A "decoded" source + * + * @see https://tc39.es/ecma426/#decoded-source-record + */ +interface DecodedSource { + url: string | null; + content: string | null; + ignore: boolean; +} +/** + * A "decoded" mapping + * + * @see https://tc39.es/ecma426/#decoded-mapping-record + */ +interface DecodedMapping { + originalPosition: OriginalPosition | null; + generatedPosition: Position; + name: string | null; +} + +type StyleRule = { + kind: 'rule'; + selector: string; + nodes: AstNode[]; + src?: SourceLocation; + dst?: SourceLocation; +}; +type AtRule = { + kind: 'at-rule'; + name: string; + params: string; + nodes: AstNode[]; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Declaration = { + kind: 'declaration'; + property: string; + value: string | undefined; + important: boolean; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Comment = { + kind: 'comment'; + value: string; + src?: SourceLocation; + dst?: SourceLocation; +}; +type Context = { + kind: 'context'; + context: Record; + nodes: AstNode[]; + src?: undefined; + dst?: undefined; +}; +type AtRoot = { + kind: 'at-root'; + nodes: AstNode[]; + src?: undefined; + dst?: undefined; +}; +type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot; + +type Resolver = (id: string, base: string) => Promise; +interface CompileOptions { + base: string; + from?: string; + onDependency: (path: string) => void; + shouldRewriteUrls?: boolean; + polyfills?: Polyfills; + customCssResolver?: Resolver; + customJsResolver?: Resolver; +} +declare function compileAst(ast: AstNode[], options: CompileOptions): Promise<{ + sources: { + base: string; + pattern: string; + negated: boolean; + }[]; + root: "none" | { + base: string; + pattern: string; + } | null; + features: Features; + build(candidates: string[]): AstNode[]; +}>; +declare function compile(css: string, options: CompileOptions): Promise<{ + sources: { + base: string; + pattern: string; + negated: boolean; + }[]; + root: "none" | { + base: string; + pattern: string; + } | null; + features: Features; + build(candidates: string[]): string; + buildSourceMap(): tailwindcss.DecodedSourceMap; +}>; +declare function __unstable__loadDesignSystem(css: string, { base }: { + base: string; +}): Promise; +declare function loadModule(id: string, base: string, onDependency: (path: string) => void, customJsResolver?: Resolver): Promise<{ + path: string; + base: string; + module: any; +}>; + +declare class Instrumentation implements Disposable { + #private; + private shouldReport; + private defaultFlush; + constructor(shouldReport?: boolean, defaultFlush?: (message: string) => undefined); + hit(label: string): void; + start(label: string): void; + end(label: string): void; + track(label: string): { + [Symbol.dispose]: () => void; + [Symbol.asyncDispose]: () => void; + }; + span(label: string, fn: () => T): T; + reset(): void; + report(flush?: (message: string) => undefined): void; + [Symbol.dispose](): void; +} + +declare function normalizePath(originalPath: string): string; + +interface OptimizeOptions { + /** + * The file being transformed + */ + file?: string; + /** + * Enabled minified output + */ + minify?: boolean; + /** + * The output source map before optimization + * + * If omitted a resulting source map will not be available + */ + map?: string; +} +interface TransformResult { + code: string; + map: string | undefined; +} +declare function optimize(input: string, { file, minify, map }?: OptimizeOptions): TransformResult; + +interface SourceMap { + readonly raw: string; + readonly inline: string; + comment(url: string): string; +} +declare function toSourceMap(map: DecodedSourceMap | string): SourceMap; + +export { type CompileOptions, type DecodedSource, type DecodedSourceMap, Instrumentation, type OptimizeOptions, type Resolver, type SourceMap, type TransformResult, __unstable__loadDesignSystem, compile, compileAst, env, loadModule, normalizePath, optimize, toSourceMap }; diff --git a/node_modules/@tailwindcss/node/dist/index.js b/node_modules/@tailwindcss/node/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ae77d68d3551aae67b2089d2ee0be727f2ac0261 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/index.js @@ -0,0 +1,18 @@ +"use strict";var Mt=Object.create;var ae=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var je=(e,r)=>{for(var t in r)ae(e,t,{get:r[t],enumerable:!0})},We=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of jt(r))!Bt.call(e,i)&&i!==t&&ae(e,i,{get:()=>r[i],enumerable:!(n=Ft(r,i))||n.enumerable});return e};var N=(e,r,t)=>(t=e!=null?Mt(Wt(e)):{},We(r||!e||!e.__esModule?ae(t,"default",{value:e,enumerable:!0}):t,e)),Ht=e=>We(ae({},"__esModule",{value:!0}),e);var wn={};je(wn,{Features:()=>_.Features,Instrumentation:()=>Fe,Polyfills:()=>_.Polyfills,__unstable__loadDesignSystem:()=>un,compile:()=>sn,compileAst:()=>an,env:()=>se,loadModule:()=>Ke,normalizePath:()=>ve,optimize:()=>gn,toSourceMap:()=>kn});module.exports=Ht(wn);var le=N(require("module")),Kt=require("url");var se={};je(se,{DEBUG:()=>be});var be=Yt(process.env.DEBUG);function Yt(e){if(typeof e=="boolean")return e;if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let r=e.split(",").map(t=>t.split(":")[0]);return r.includes("-tailwindcss")?!1:!!r.includes("tailwindcss")}var Be=require("module"),qt={};var He=(e,r,t)=>{let n=t(e,r);return Gt(r,n)};function Gt(e,r){try{if(r.url===qt.url||(0,Be.isBuiltin)(r.url)||!e.parentURL)return r;let n=new URL(e.parentURL).searchParams.get("id");if(n===null)return r;let i=new URL(r.url);return i.searchParams.set("id",n),{...r,url:`${i}`}}catch{return r}}var W=N(require("enhanced-resolve")),Pt=require("jiti"),ke=N(require("fs")),ze=N(require("fs/promises")),q=N(require("path")),Ue=require("url"),_=require("tailwindcss");var ue=N(require("fs/promises")),H=N(require("path")),Zt=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Qt=[".js",".cjs",".mjs"],Jt=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Xt=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function er(e,r){for(let t of r){let n=`${e}${t}`;if((await ue.default.stat(n).catch(()=>null))?.isFile())return n}for(let t of r){let n=`${e}/index${t}`;if(await ue.default.access(n).then(()=>!0,()=>!1))return n}return null}async function Ye(e,r,t,n){let i=Qt.includes(n)?Jt:Xt,l=await er(H.default.resolve(t,r),i);if(l===null||e.has(l))return;e.add(l),t=H.default.dirname(l),n=H.default.extname(l);let o=await ue.default.readFile(l,"utf-8"),s=[];for(let a of Zt)for(let u of o.matchAll(a))u[1].startsWith(".")&&s.push(Ye(e,u[1],t,n));await Promise.all(s)}async function Ge(e){let r=new Set;return await Ye(r,e,H.default.dirname(e),H.default.extname(e)),Array.from(r)}var De=N(require("path"));function Y(e){return{kind:"word",value:e}}function tr(e,r){return{kind:"function",value:e,nodes:r}}function rr(e){return{kind:"separator",value:e}}function A(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+A(t.nodes)+")"}return r}var qe=92,nr=41,Ze=58,Qe=44,ir=34,Je=61,Xe=62,et=60,tt=10,or=40,lr=39,ar=47,rt=32,nt=9;function b(e){e=e.replaceAll(`\r +`,` +`);let r=[],t=[],n=null,i="",l;for(let o=0;o0){let u=Y(i);n?n.nodes.push(u):r.push(u),i=""}let a=Y(e[o]);n?n.nodes.push(a):r.push(a);break}case Ze:case Qe:case Je:case Xe:case et:case tt:case rt:case nt:{if(i.length>0){let c=Y(i);n?n.nodes.push(c):r.push(c),i=""}let a=o,u=o+1;for(;u0){let u=Y(i);a?.nodes.push(u),i=""}t.length>0?n=t[t.length-1]:n=null;break}default:i+=String.fromCharCode(s)}}return i.length>0&&r.push(Y(i)),r}var h=class extends Map{constructor(t){super();this.factory=t}factory;get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t,this),this.set(t,n)),n}};var Tn=new Uint8Array(256);var ce=new Uint8Array(256);function w(e,r){let t=0,n=[],i=0,l=e.length,o=r.charCodeAt(0);for(let s=0;s0&&a===ce[t-1]&&t--;break}}return n.push(e.slice(i)),n}var ye=(o=>(o[o.Continue=0]="Continue",o[o.Skip=1]="Skip",o[o.Stop=2]="Stop",o[o.Replace=3]="Replace",o[o.ReplaceSkip=4]="ReplaceSkip",o[o.ReplaceStop=5]="ReplaceStop",o))(ye||{}),v={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function g(e,r){typeof r=="function"?it(e,r):it(e,r.enter,r.exit)}function it(e,r=()=>v.Continue,t=()=>v.Continue){let n={value:[e,0,null],prev:null},i={parent:null,depth:0,index:0,siblings:e,path(){let l=[],o=n;for(;o;){let s=o.value[2];s&&l.push(s),o=o.prev}return l.reverse(),l}};for(;n!==null;){let l=n.value,o=l[0],s=l[1],a=l[2];if(s>=o.length){n=n.prev,i.depth-=1;continue}if(i.parent=a,i.siblings=o,s>=0){i.index=s;let f=o[s],d=r(f,i)??v.Continue;switch(d.kind){case 0:{f.nodes&&f.nodes.length>0&&(i.depth+=1,n={value:[f.nodes,0,f],prev:n}),l[1]=~s;continue}case 2:return;case 1:{l[1]=~s;continue}case 3:{o.splice(s,1,...d.nodes);continue}case 5:{o.splice(s,1,...d.nodes);return}case 4:{o.splice(s,1,...d.nodes),l[1]+=d.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${ye[d.kind]??`Unknown(${d.kind})`}\` in enter.`)}}let u=~s;i.index=u;let p=o[u],c=t(p,i)??v.Continue;switch(c.kind){case 0:l[1]=u+1;continue;case 2:return;case 3:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}case 5:{o.splice(u,1,...c.nodes);return}case 4:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${ye[c.kind]??`Unknown(${c.kind})`}\` in exit.`)}}}var Ln=new h(e=>{let r=b(e),t=new Set,n=new Set(["~",">","+","-","*","/"]);return g(r,(i,l)=>{if(i.kind==="word"&&n.has(i.value)){let o=l.index;if(o===-1)return;let s=l.siblings[o-1];if(s?.kind!=="separator"||s.value!==" ")return;let a=l.siblings[o+1];if(a?.kind!=="separator"||a.value!==" ")return;let u=l.siblings[o-2];if(u&&n.has(u.value))return;let p=l.siblings[o+2];if(p&&n.has(p.value))return;t.add(s),t.add(a)}else if(i.kind==="separator"&&i.value.length>0&&i.value.trim()==="")(l.siblings[0]===i||l.siblings[l.siblings.length-1]===i)&&t.add(i);else if(i.kind==="separator"&&i.value.trim()===",")i.value=",";else if(i.kind==="function"&&i.value.startsWith("--")){let o=l.index;if(o<=0)return;let s=l.siblings[o-1];if(s?.kind==="separator"&&s.value===",")return;let a=l.siblings[o-2];return a&&!n.has(a.value)?void 0:v.ReplaceSkip({kind:"function",value:"",nodes:[i]})}}),t.size>0&&g(r,i=>{if(t.has(i))return t.delete(i),v.ReplaceSkip([])}),xe(r),A(r)});var zn=new h(e=>{let r=b(e);return r.length===3&&r[0].kind==="word"&&r[0].value==="&"&&r[1].kind==="separator"&&r[1].value===":"&&r[2].kind==="function"&&r[2].value==="is"?A(r[2].nodes):e});function xe(e){for(let r of e)switch(r.kind){case"function":{if(r.value==="url"||r.value.endsWith("_url")){r.value=Z(r.value);break}if(r.value==="var"||r.value.endsWith("_var")||r.value==="theme"||r.value.endsWith("_theme")){r.value=Z(r.value);for(let t=0;t{let r=b(e);return r.length===1&&r[0].kind==="function"&&r[0].value==="var"});function ur(e){throw new Error(`Unexpected value: ${e}`)}function Z(e){return e.replaceAll("_",String.raw`\_`).replaceAll(" ","_")}var cr=/^(?[-+]?(?:\d*\.)?\d+)(?[a-z]+|%)?$/i,G=new h(e=>{let r=cr.exec(e);if(!r)return null;let t=r.groups?.value;if(t===void 0)return null;let n=Number(t);if(Number.isNaN(n))return null;let i=r.groups?.unit;return i===void 0?[n,null]:[n,i]});var D=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Jn=new RegExp(`^${D.source}$`);var Xn=new RegExp(`^${D.source}%$`);var ei=new RegExp(`^${D.source}\\s*/\\s*${D.source}$`);var fr=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],ti=new RegExp(`^${D.source}(${fr.join("|")})$`);var pr=["deg","rad","grad","turn"],ri=new RegExp(`^${D.source}(${pr.join("|")})$`);var ni=new RegExp(`^${D.source} +${D.source} +${D.source}$`);function S(e){let r=Number(e);return Number.isInteger(r)&&r>=0&&String(r)===String(e)}function Q(e,r){if(r===null)return e;let t=Number(r);return Number.isNaN(t)||(r=`${t*100}%`),r==="100%"?e:`color-mix(in oklab, ${e} ${r}, transparent)`}var gr={"--alpha":hr,"--spacing":vr,"--theme":kr,theme:wr};function hr(e,r,t,...n){let[i,l]=w(t,"/").map(o=>o.trim());if(!i||!l)throw new Error(`The --alpha(\u2026) function requires a color and an alpha value, e.g.: \`--alpha(${i||"var(--my-color)"} / ${l||"50%"})\``);if(n.length>0)throw new Error(`The --alpha(\u2026) function only accepts one argument, e.g.: \`--alpha(${i||"var(--my-color)"} / ${l||"50%"})\``);return Q(i,l)}function vr(e,r,t,...n){if(!t)throw new Error("The --spacing(\u2026) function requires an argument, but received none.");if(n.length>0)throw new Error(`The --spacing(\u2026) function only accepts a single argument, but received ${n.length+1}.`);let i=e.theme.resolve(null,["--spacing"]);if(!i)throw new Error("The --spacing(\u2026) function requires that the `--spacing` theme variable exists, but it was not found.");let l=G.get(t);if(l){if(l[0]===0)return"0px";if(l[0]===1)return i}return`calc(${i} * ${t})`}function kr(e,r,t,...n){if(!t.startsWith("--"))throw new Error("The --theme(\u2026) function can only be used with CSS variables from your theme.");let i=!1;t.endsWith(" inline")&&(i=!0,t=t.slice(0,-7)),r.kind==="at-rule"&&(i=!0);let l=e.resolveThemeValue(t,i);if(!l){if(n.length>0)return n.join(", ");throw new Error(`Could not resolve value for theme function: \`theme(${t})\`. Consider checking if the variable name is correct or provide a fallback value to silence this error.`)}if(n.length===0)return l;let o=n.join(", ");if(o==="initial")return l;if(l==="initial")return o;if(l.startsWith("var(")||l.startsWith("theme(")||l.startsWith("--theme(")){let s=b(l);return yr(s,o),A(s)}return l}function wr(e,r,t,...n){t=br(t);let i=e.resolveThemeValue(t);if(!i&&n.length>0)return n.join(", ");if(!i)throw new Error(`Could not resolve value for theme function: \`theme(${t})\`. Consider checking if the path is correct or provide a fallback value to silence this error.`);return i}var Ni=new RegExp(Object.keys(gr).map(e=>`${e}\\(`).join("|"));function br(e){if(e[0]!=="'"&&e[0]!=='"')return e;let r="",t=e[0];for(let n=1;n{if(t.kind==="function"&&!(t.value!=="var"&&t.value!=="theme"&&t.value!=="--theme"))if(t.nodes.length===1)t.nodes.push({kind:"word",value:`, ${r}`});else{let n=t.nodes[t.nodes.length-1];n.kind==="word"&&n.value==="initial"&&(n.value=r)}})}function M(e,r="top",t="right",n="bottom",i="left"){return ut(`${e}-${r}`,`${e}-${t}`,`${e}-${n}`,`${e}-${i}`)}function ut(e="top",r="right",t="bottom",n="left"){return{1:[[e,0],[r,0],[t,0],[n,0]],2:[[e,0],[r,1],[t,0],[n,1]],3:[[e,0],[r,1],[t,2],[n,1]],4:[[e,0],[r,1],[t,2],[n,3]]}}function $(e,r){return{1:[[e,0],[r,0]],2:[[e,0],[r,1]]}}var Hi={inset:ut(),margin:M("margin"),padding:M("padding"),"scroll-margin":M("scroll-margin"),"scroll-padding":M("scroll-padding"),"border-width":M("border","top-width","right-width","bottom-width","left-width"),"border-style":M("border","top-style","right-style","bottom-style","left-style"),"border-color":M("border","top-color","right-color","bottom-color","left-color"),gap:$("row-gap","column-gap"),overflow:$("overflow-x","overflow-y"),"overscroll-behavior":$("overscroll-behavior-x","overscroll-behavior-y")},Yi={"inset-block":$("top","bottom"),"inset-inline":$("left","right"),"margin-block":$("margin-top","margin-bottom"),"margin-inline":$("margin-left","margin-right"),"padding-block":$("padding-top","padding-bottom"),"padding-inline":$("padding-left","padding-right"),"scroll-margin-block":$("scroll-margin-top","scroll-margin-bottom"),"scroll-margin-inline":$("scroll-margin-left","scroll-margin-right"),"scroll-padding-block":$("scroll-padding-top","scroll-padding-bottom"),"scroll-padding-inline":$("scroll-padding-left","scroll-padding-right")};var Cr=1536,So=Cr/16;var Lo=new h(e=>{let r=[];return g(b(e),t=>{if(!(t.kind!=="function"||t.value!=="var"))return g(t.nodes,n=>{n.kind!=="word"||n.value[0]!=="-"||n.value[1]!=="-"||r.push(n.value)}),v.Skip}),r});function Te(e){let r=[0];for(let i=0;i0;){let a=(o|0)>>1,u=l+a;r[u]<=i?(l=u+1,o=o-a-1):o=a}l-=1;let s=i-r[l];return{line:l+1,column:s}}function n({line:i,column:l}){i-=1,i=Math.min(Math.max(i,0),r.length-1);let o=r[i],s=r[i+1]??o;return Math.min(Math.max(o+l,0),s)}return{find:t,findOffset:n}}var ee=92,pe=47,de=42,gt=34,ht=39,Or=58,me=59,V=10,ge=13,te=32,re=9,vt=123,Ee=125,Re=40,kt=41,_r=91,Dr=93,wt=45,Ne=64,Ir=33,R=class e extends Error{loc;constructor(r,t){if(t){let n=t[0],i=Te(n.code).find(t[1]);r=`${n.file}:${i.line}:${i.column+1}: ${r}`}super(r),this.name="CssSyntaxError",this.loc=t,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function ie(e,r){let t=r?.from?{file:r.from,code:e}:null;e[0]==="\uFEFF"&&(e=" "+e.slice(1));let n=[],i=[],l=[],o=null,s=null,a="",u="",p=0,c;for(let f=0;f0&&e[y]===m[m.length-1]&&(m=m.slice(0,-1));let z=Ve(a,k);if(!z)throw new R("Invalid custom property, expected a value",t?[t,C,f]:null);t&&(z.src=[t,C,f],z.dst=[t,C,f]),o?o.nodes.push(z):n.push(z),a=""}else if(d===me&&a.charCodeAt(0)===Ne)s=ne(a),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o?o.nodes.push(s):n.push(s),a="",s=null;else if(d===me&&u[u.length-1]!==")"){let m=Ve(a);if(!m){if(a.length===0)continue;throw new R(`Invalid declaration: \`${a.trim()}\``,t?[t,p,f]:null)}t&&(m.src=[t,p,f],m.dst=[t,p,f]),o?o.nodes.push(m):n.push(m),a=""}else if(d===vt&&u[u.length-1]!==")")u+="}",s=I(a.trim()),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o&&o.nodes.push(s),l.push(o),o=s,a="",s=null;else if(d===Ee&&u[u.length-1]!==")"){if(u==="")throw new R("Missing opening {",t?[t,f,f]:null);if(u=u.slice(0,-1),a.length>0)if(a.charCodeAt(0)===Ne)s=ne(a),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o?o.nodes.push(s):n.push(s),a="",s=null;else{let C=a.indexOf(":");if(o){let k=Ve(a,C);if(!k)throw new R(`Invalid declaration: \`${a.trim()}\``,t?[t,p,f]:null);t&&(k.src=[t,p,f],k.dst=[t,p,f]),o.nodes.push(k)}}let m=l.pop()??null;m===null&&o&&n.push(o),o=m,a="",s=null}else if(d===Re)u+=")",a+="(";else if(d===kt){if(u[u.length-1]!==")")throw new R("Missing opening (",t?[t,f,f]:null);u=u.slice(0,-1),a+=")"}else{if(a.length===0&&(d===te||d===V||d===re))continue;a===""&&(p=f),a+=String.fromCharCode(d)}}}if(a.charCodeAt(0)===Ne){let f=ne(a);t&&(f.src=[t,p,e.length],f.dst=[t,p,e.length]),n.push(f)}if(u.length>0&&o){if(o.kind==="rule")throw new R(`Missing closing } at ${o.selector}`,o.src?[o.src[0],o.src[1],o.src[1]]:null);if(o.kind==="at-rule")throw new R(`Missing closing } at ${o.name} ${o.params}`,o.src?[o.src[0],o.src[1],o.src[1]]:null)}return i.length>0?i.concat(n):n}function ne(e,r=[]){let t=e,n="";for(let i=5;i{if(S(e.value))return e.value}),x=j(e=>{if(S(e.value))return`${e.value}%`}),U=j(e=>{if(S(e.value))return`${e.value}px`}),xt=j(e=>{if(S(e.value))return`${e.value}ms`}),he=j(e=>{if(S(e.value))return`${e.value}deg`}),Mr=j(e=>{if(e.fraction===null)return;let[r,t]=w(e.fraction,"/");if(!(!S(r)||!S(t)))return e.fraction}),At=j(e=>{if(S(Number(e.value)))return`repeat(${e.value}, minmax(0, 1fr))`}),Fr={accentColor:({theme:e})=>e("colors"),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9",...Mr},backdropBlur:({theme:e})=>e("blur"),backdropBrightness:({theme:e})=>({...e("brightness"),...x}),backdropContrast:({theme:e})=>({...e("contrast"),...x}),backdropGrayscale:({theme:e})=>({...e("grayscale"),...x}),backdropHueRotate:({theme:e})=>({...e("hueRotate"),...he}),backdropInvert:({theme:e})=>({...e("invert"),...x}),backdropOpacity:({theme:e})=>({...e("opacity"),...x}),backdropSaturate:({theme:e})=>({...e("saturate"),...x}),backdropSepia:({theme:e})=>({...e("sepia"),...x}),backgroundColor:({theme:e})=>e("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:e})=>e("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:e})=>({DEFAULT:"currentcolor",...e("colors")}),borderOpacity:({theme:e})=>e("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:e})=>e("spacing"),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px",...U},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:e})=>e("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2",...x},caretColor:({theme:e})=>e("colors"),colors:()=>({..._e}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",...P},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2",...x},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:e})=>e("borderColor"),divideOpacity:({theme:e})=>e("borderOpacity"),divideWidth:({theme:e})=>({...e("borderWidth"),...U}),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:e})=>e("colors"),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",...e("spacing")}),flexGrow:{0:"0",DEFAULT:"1",...P},flexShrink:{0:"0",DEFAULT:"1",...P},fontFamily:{sans:["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"','"Noto Sans"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:e})=>e("spacing"),gradientColorStops:({theme:e})=>e("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%",...x},grayscale:{0:"0",DEFAULT:"100%",...x},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...P},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...P},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...P},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...P},gridTemplateColumns:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...At},gridTemplateRows:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...At},height:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg",...he},inset:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),invert:{0:"0",DEFAULT:"100%",...x},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:e})=>({auto:"auto",...e("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",...P},maxHeight:({theme:e})=>({none:"none",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),maxWidth:({theme:e})=>({none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...e("spacing")}),minHeight:({theme:e})=>({full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),minWidth:({theme:e})=>({full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",15:"0.15",20:"0.2",25:"0.25",30:"0.3",35:"0.35",40:"0.4",45:"0.45",50:"0.5",55:"0.55",60:"0.6",65:"0.65",70:"0.7",75:"0.75",80:"0.8",85:"0.85",90:"0.9",95:"0.95",100:"1",...x},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",...P},outlineColor:({theme:e})=>e("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},padding:({theme:e})=>e("spacing"),placeholderColor:({theme:e})=>e("colors"),placeholderOpacity:({theme:e})=>e("opacity"),ringColor:({theme:e})=>({DEFAULT:"currentcolor",...e("colors")}),ringOffsetColor:({theme:e})=>e("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},ringOpacity:({theme:e})=>({DEFAULT:"0.5",...e("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg",...he},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2",...x},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",...x},screens:{sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem","2xl":"96rem"},scrollMargin:({theme:e})=>e("spacing"),scrollPadding:({theme:e})=>e("spacing"),sepia:{0:"0",DEFAULT:"100%",...x},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",...he},space:({theme:e})=>e("spacing"),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:e})=>({none:"none",...e("colors")}),strokeWidth:{0:"0",1:"1",2:"2",...P},supports:{},data:{},textColor:({theme:e})=>e("colors"),textDecorationColor:({theme:e})=>e("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},textIndent:({theme:e})=>e("spacing"),textOpacity:({theme:e})=>e("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...U},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...xt},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...xt},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:e})=>({"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),size:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),width:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",...P}};var Wr=64;function K(e,r=[]){return{kind:"rule",selector:e,nodes:r}}function E(e,r="",t=[]){return{kind:"at-rule",name:e,params:r,nodes:t}}function I(e,r=[]){return e.charCodeAt(0)===Wr?ne(e,r):K(e,r)}function O(e,r,t=!1){return{kind:"declaration",property:e,value:r,important:t}}function Oe(e){return{kind:"comment",value:e}}function F(e,r){let t=0,n={file:null,code:""};function i(o,s=0){let a="",u=" ".repeat(s);if(o.kind==="declaration"){if(a+=`${u}${o.property}: ${o.value}${o.important?" !important":""}; +`,r){t+=u.length;let p=t;t+=o.property.length,t+=2,t+=o.value?.length??0,o.important&&(t+=11);let c=t;t+=2,o.dst=[n,p,c]}}else if(o.kind==="rule"){if(a+=`${u}${o.selector} { +`,r){t+=u.length;let p=t;t+=o.selector.length,t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}} +`,r&&(t+=u.length,t+=2)}else if(o.kind==="at-rule"){if(o.nodes.length===0){let p=`${u}${o.name} ${o.params}; +`;if(r){t+=u.length;let c=t;t+=o.name.length,t+=1,t+=o.params.length;let f=t;t+=2,o.dst=[n,c,f]}return p}if(a+=`${u}${o.name}${o.params?` ${o.params} `:" "}{ +`,r){t+=u.length;let p=t;t+=o.name.length,o.params&&(t+=1,t+=o.params.length),t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}} +`,r&&(t+=u.length,t+=2)}else if(o.kind==="comment"){if(a+=`${u}/*${o.value}*/ +`,r){t+=u.length;let p=t;t+=2+o.value.length+2;let c=t;o.dst=[n,p,c],t+=1}}else if(o.kind==="context"||o.kind==="at-root")return"";return a}let l="";for(let o of e)l+=i(o,0);return n.code=l,l}function Br(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var n="";if(t>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),n="//")}var l=e.split(/[/\\]+/);return r!==!1&&l[l.length-1]===""&&l.pop(),n+l.join("/")}function ve(e){let r=Br(e);return e.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var Ie=/(?[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?\w[^,]+))?(?:,|$)/g,Qr=/(?Yr.test(e),en=e=>Gr.test(e);async function St({css:e,base:r,root:t}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let n=ie(e),i=[];function l(o){if(o[0]==="/")return o;let s=De.posix.join(ve(r),o),a=De.posix.relative(ve(t),s);return a.startsWith(".")||(a="./"+a),a}return g(n,o=>{if(o.kind!=="declaration"||!o.value)return;let s=Ie.test(o.value),a=Ct.test(o.value);if(s||a){let u=a?tn:$t;i.push(u(o.value,l).then(p=>{o.value=p}))}}),i.length&&await Promise.all(i),F(n)}function $t(e,r){return Et(e,Ie,async t=>{let[n,i]=t;return await Tt(i.trim(),n,r)})}async function tn(e,r){return await Et(e,Ct,async t=>{let[,n]=t;return await nn(n,async({url:l})=>Ie.test(l)?await $t(l,r):Hr.test(l)?l:await Tt(l,l,r))})}async function Tt(e,r,t,n="url"){let i="",l=e[0];if((l==='"'||l==="'")&&(i=l,e=e.slice(1,-1)),rn(e))return r;let o=await t(e);return i===""&&o!==encodeURI(o)&&(i='"'),i==="'"&&o.includes("'")&&(i='"'),i==='"'&&o.includes('"')&&(o=o.replace(Qr,'\\"')),`${n}(${i}${o}${i})`}function rn(e,r){return en(e)||Xr(e)||!e[0].match(/[.a-zA-Z0-9_]/)||qr.test(e)}function nn(e,r){return Promise.all(on(e).map(async({url:t,descriptor:n})=>({url:await r({url:t,descriptor:n}),descriptor:n}))).then(ln)}function on(e){let r=e.trim().replace(Jr," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Zr);return Array.from(r,({groups:t})=>({url:t?.url?.trim()??"",descriptor:t?.descriptor?.trim()??""})).filter(({url:t})=>!!t)}function ln(e){return e.map(({url:r,descriptor:t})=>r+(t?` ${t}`:"")).join(", ")}async function Et(e,r,t){let n,i=e,l="";for(;n=r.exec(i);)l+=i.slice(0,n.index),l+=await t(n),i=i.slice(n.index+n[0].length);return l+=i,l}var mn={};function Ot({base:e,from:r,polyfills:t,onDependency:n,shouldRewriteUrls:i,customCssResolver:l,customJsResolver:o}){return{base:e,polyfills:t,from:r,async loadModule(s,a){return Ke(s,a,n,o)},async loadStylesheet(s,a){let u=await Dt(s,a,n,l);return i&&(u.content=await St({css:u.content,root:e,base:u.base})),u}}}async function _t(e){if(e.root&&e.root!=="none"){let r=/[*{]/,t=[];for(let i of e.root.pattern.split("/")){if(r.test(i))break;t.push(i)}if(!await ze.default.stat(q.default.resolve(e.root.base,t.join("/"))).then(i=>i.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist or is not a directory.`)}}async function an(e,r){let t=await(0,_.compileAst)(e,Ot(r));return await _t(t),t}async function sn(e,r){let t=await(0,_.compile)(e,Ot(r));return await _t(t),t}async function un(e,{base:r}){return(0,_.__unstable__loadDesignSystem)(e,{base:r,async loadModule(t,n){return Ke(t,n,()=>{})},async loadStylesheet(t,n){return Dt(t,n,()=>{})}})}async function Ke(e,r,t,n){if(e[0]!=="."){let s=await Rt(e,r,n);if(!s)throw new Error(`Could not resolve '${e}' from '${r}'`);let a=await Vt((0,Ue.pathToFileURL)(s).href);return{path:s,base:q.default.dirname(s),module:a.default??a}}let i=await Rt(e,r,n);if(!i)throw new Error(`Could not resolve '${e}' from '${r}'`);let[l,o]=await Promise.all([Vt((0,Ue.pathToFileURL)(i).href+"?id="+Date.now()),Ge(i)]);for(let s of o)t(s);return{path:i,base:q.default.dirname(i),module:l.default??l}}async function Dt(e,r,t,n){let i=await fn(e,r,n);if(!i)throw new Error(`Could not resolve '${e}' from '${r}'`);t(i);let l=await ze.default.readFile(i,"utf-8");return{path:i,base:q.default.dirname(i),content:l}}var Nt=null;async function Vt(e){if(typeof globalThis.__tw_load=="function"){let r=await globalThis.__tw_load(e);if(r)return r}try{return await import(e)}catch{return Nt??=(0,Pt.createJiti)(mn.url,{moduleCache:!1,fsCache:!1}),await Nt.import(e)}}var Me=["node_modules",...process.env.NODE_PATH?[...process.env.NODE_PATH.split(q.default.delimiter)]:[]],cn=W.default.ResolverFactory.createResolver({fileSystem:new W.default.CachedInputFileSystem(ke.default,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"],modules:Me});async function fn(e,r,t){if(typeof globalThis.__tw_resolve=="function"){let n=globalThis.__tw_resolve(e,r);if(n)return Promise.resolve(n)}if(t){let n=await t(e,r);if(n)return n}return Le(cn,e,r)}var pn=W.default.ResolverFactory.createResolver({fileSystem:new W.default.CachedInputFileSystem(ke.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"],modules:Me}),dn=W.default.ResolverFactory.createResolver({fileSystem:new W.default.CachedInputFileSystem(ke.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"],modules:Me});async function Rt(e,r,t){if(typeof globalThis.__tw_resolve=="function"){let n=globalThis.__tw_resolve(e,r);if(n)return Promise.resolve(n)}if(t){let n=await t(e,r);if(n)return n}return Le(pn,e,r).catch(()=>Le(dn,e,r))}function Le(e,r,t){return new Promise((n,i)=>e.resolve({},t,r,{},(l,o)=>{if(l)return i(l);n(o)}))}Symbol.dispose??=Symbol("Symbol.dispose");Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");var Fe=class{constructor(r=be,t=n=>{process.stderr.write(`${n} +`)}){this.shouldReport=r;this.defaultFlush=t}shouldReport;defaultFlush;#r=new h(()=>({value:0}));#t=new h(()=>({value:0n}));#e=[];hit(r){this.#r.get(r).value++}start(r){let t=this.#e.map(i=>i.label).join("//"),n=`${t}${t.length===0?"":"//"}${r}`;this.#r.get(n).value++,this.#t.get(n),this.#e.push({id:n,label:r,namespace:t,value:process.hrtime.bigint()})}end(r){let t=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==r)throw new Error(`Mismatched timer label: \`${r}\`, expected \`${this.#e[this.#e.length-1].label}\``);let n=this.#e.pop(),i=t-n.value;this.#t.get(n.id).value+=i}track(r){this.start(r);let t=!1;return{[Symbol.dispose]:()=>{t||(this.end(r),t=!0)},[Symbol.asyncDispose]:()=>{t||(this.end(r),t=!0)}}}span(r,t){this.start(r);let n=!1;try{let i=t();return n=i&&typeof i.then=="function",n?i.finally(()=>this.end(r)):i}finally{n||this.end(r)}}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(r=this.defaultFlush){let t=[],n=!1;for(let o=this.#e.length-1;o>=0;o--)this.end(this.#e[o].label);for(let[o,{value:s}]of this.#r.entries()){if(this.#t.has(o))continue;t.length===0&&(n=!0,t.push("Hits:"));let a=o.split("//").length;t.push(`${" ".repeat(a)}${o} ${we(It(`\xD7 ${s}`))}`)}this.#t.size>0&&n&&t.push(` +Timers:`);let i=-1/0,l=new Map;for(let[o,{value:s}]of this.#t){let a=`${(Number(s)/1e6).toFixed(2)}ms`;l.set(o,a),i=Math.max(i,a.length)}for(let o of this.#t.keys()){let s=o.split("//").length;t.push(`${we(`[${l.get(o).padStart(i," ")}]`)}${" ".repeat(s-1)}${s===1?" ":we(" \u21B3 ")}${o.split("//").pop()} ${this.#r.get(o).value===1?"":we(It(`\xD7 ${this.#r.get(o).value}`))}`.trimEnd())}r(` +${t.join(` +`)} +`),this.reset()}[Symbol.dispose](){this.shouldReport&&this.report()}};function we(e){return`\x1B[2m${e}\x1B[22m`}function It(e){return`\x1B[34m${e}\x1B[39m`}var Ut=N(require("@jridgewell/remapping")),L=require("lightningcss"),Lt=N(require("magic-string"));function gn(e,{file:r="input.css",minify:t=!1,map:n}={}){function i(a,u){return(0,L.transform)({filename:r,code:a,minify:t,sourceMap:typeof u<"u",inputSourceMap:u,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:L.Features.Nesting|L.Features.MediaQueries,exclude:L.Features.LogicalProperties|L.Features.DirSelector|L.Features.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0})}let l=i(Buffer.from(e),n);if(n=l.map?.toString(),l.warnings=l.warnings.filter(a=>!(/'(deep|slotted|global)' is not recognized as a valid pseudo-/.test(a.message)||/Unknown at rule: @position-try/.test(a.message))),l.warnings.length>0){let a=e.split(` +`),u=[`Found ${l.warnings.length} ${l.warnings.length===1?"warning":"warnings"} while optimizing generated CSS:`];for(let[p,c]of l.warnings.entries()){u.push(""),l.warnings.length>1&&u.push(`Issue #${p+1}:`);let f=2,d=Math.max(0,c.loc.line-f-1),m=Math.min(a.length,c.loc.line+f),C=a.slice(d,m).map((k,z)=>d+z+1===c.loc.line?`${oe("\u2502")} ${k}`:oe(`\u2502 ${k}`));C.splice(c.loc.line-d,0,`${oe("\u2506")}${" ".repeat(c.loc.column-1)} ${hn(`${oe("^--")} ${c.message}`)}`,`${oe("\u2506")}`),u.push(...C)}u.push(""),console.warn(u.join(` +`))}l=i(l.code,n),n=l.map?.toString();let o=l.code.toString(),s=new Lt.default(o);if(s.replaceAll("@media not (","@media not all and ("),n!==void 0&&s.hasChanged()){let a=s.generateMap({source:"original",hires:"boundary"}).toString();n=(0,Ut.default)([a,n],()=>null).toString()}return o=s.toString(),{code:o,map:n}}function oe(e){return`\x1B[2m${e}\x1B[22m`}function hn(e){return`\x1B[33m${e}\x1B[39m`}var zt=require("source-map-js");function vn(e){let r=new zt.SourceMapGenerator,t=1,n=new h(i=>({url:i?.url??``,content:i?.content??""}));for(let i of e.mappings){let l=n.get(i.originalPosition?.source??null);r.addMapping({generated:i.generatedPosition,original:i.originalPosition,source:l.url,name:i.name}),r.setSourceContent(l.url,l.content)}return r.toString()}function kn(e){let r=typeof e=="string"?e:vn(e);function t(n){return`/*# sourceMappingURL=${n} */ +`}return{raw:r,get inline(){let n=Buffer.from(r,"utf-8").toString("base64");return t(`data:application/json;base64,${n}`)},comment:t}}process.versions.bun||(le.registerHooks?le.registerHooks({resolve:He}):le.register?.((0,Kt.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader"))));0&&(module.exports={Features,Instrumentation,Polyfills,__unstable__loadDesignSystem,compile,compileAst,env,loadModule,normalizePath,optimize,toSourceMap}); diff --git a/node_modules/@tailwindcss/node/dist/index.mjs b/node_modules/@tailwindcss/node/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0a5563f35f69b7d0e3ed2c182063756c79e0244a --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/index.mjs @@ -0,0 +1,18 @@ +var Vt=Object.defineProperty;var Rt=(e,r)=>{for(var t in r)Vt(e,t,{get:r[t],enumerable:!0})};import*as M from"module";import{pathToFileURL as ln}from"url";var me={};Rt(me,{DEBUG:()=>de});var de=Pt(process.env.DEBUG);function Pt(e){if(typeof e=="boolean")return e;if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let r=e.split(",").map(t=>t.split(":")[0]);return r.includes("-tailwindcss")?!1:!!r.includes("tailwindcss")}import{isBuiltin as Ot}from"module";var Ie=(e,r,t)=>{let n=t(e,r);return _t(r,n)};function _t(e,r){try{if(r.url===import.meta.url||Ot(r.url)||!e.parentURL)return r;let n=new URL(e.parentURL).searchParams.get("id");if(n===null)return r;let i=new URL(r.url);return i.searchParams.set("id",n),{...r,url:`${i}`}}catch{return r}}import B from"enhanced-resolve";import{createJiti as Br}from"jiti";import _e from"fs";import At from"fs/promises";import re from"path";import{pathToFileURL as wt}from"url";import{__unstable__loadDesignSystem as Hr,compile as Yr,compileAst as Gr,Features as lu,Polyfills as au}from"tailwindcss";import ge from"fs/promises";import H from"path";var Dt=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],It=[".js",".cjs",".mjs"],Ut=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Lt=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function zt(e,r){for(let t of r){let n=`${e}${t}`;if((await ge.stat(n).catch(()=>null))?.isFile())return n}for(let t of r){let n=`${e}/index${t}`;if(await ge.access(n).then(()=>!0,()=>!1))return n}return null}async function Ue(e,r,t,n){let i=It.includes(n)?Ut:Lt,l=await zt(H.resolve(t,r),i);if(l===null||e.has(l))return;e.add(l),t=H.dirname(l),n=H.extname(l);let o=await ge.readFile(l,"utf-8"),s=[];for(let a of Dt)for(let u of o.matchAll(a))u[1].startsWith(".")&&s.push(Ue(e,u[1],t,n));await Promise.all(s)}async function Le(e){let r=new Set;return await Ue(r,e,H.dirname(e),H.extname(e)),Array.from(r)}import*as Re from"path";function j(e){return{kind:"word",value:e}}function Kt(e,r){return{kind:"function",value:e,nodes:r}}function Mt(e){return{kind:"separator",value:e}}function A(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+A(t.nodes)+")"}return r}var ze=92,Ft=41,Ke=58,Me=44,jt=34,Fe=61,je=62,We=60,Be=10,Wt=40,Bt=39,Ht=47,He=32,Ye=9;function b(e){e=e.replaceAll(`\r +`,` +`);let r=[],t=[],n=null,i="",l;for(let o=0;o0){let u=j(i);n?n.nodes.push(u):r.push(u),i=""}let a=j(e[o]);n?n.nodes.push(a):r.push(a);break}case Ke:case Me:case Fe:case je:case We:case Be:case He:case Ye:{if(i.length>0){let c=j(i);n?n.nodes.push(c):r.push(c),i=""}let a=o,u=o+1;for(;u0){let u=j(i);a?.nodes.push(u),i=""}t.length>0?n=t[t.length-1]:n=null;break}default:i+=String.fromCharCode(s)}}return i.length>0&&r.push(j(i)),r}var h=class extends Map{constructor(t){super();this.factory=t}factory;get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t,this),this.set(t,n)),n}};var vn=new Uint8Array(256);var oe=new Uint8Array(256);function w(e,r){let t=0,n=[],i=0,l=e.length,o=r.charCodeAt(0);for(let s=0;s0&&a===oe[t-1]&&t--;break}}return n.push(e.slice(i)),n}var he=(o=>(o[o.Continue=0]="Continue",o[o.Skip=1]="Skip",o[o.Stop=2]="Stop",o[o.Replace=3]="Replace",o[o.ReplaceSkip=4]="ReplaceSkip",o[o.ReplaceStop=5]="ReplaceStop",o))(he||{}),v={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function g(e,r){typeof r=="function"?Ge(e,r):Ge(e,r.enter,r.exit)}function Ge(e,r=()=>v.Continue,t=()=>v.Continue){let n={value:[e,0,null],prev:null},i={parent:null,depth:0,index:0,siblings:e,path(){let l=[],o=n;for(;o;){let s=o.value[2];s&&l.push(s),o=o.prev}return l.reverse(),l}};for(;n!==null;){let l=n.value,o=l[0],s=l[1],a=l[2];if(s>=o.length){n=n.prev,i.depth-=1;continue}if(i.parent=a,i.siblings=o,s>=0){i.index=s;let f=o[s],d=r(f,i)??v.Continue;switch(d.kind){case 0:{f.nodes&&f.nodes.length>0&&(i.depth+=1,n={value:[f.nodes,0,f],prev:n}),l[1]=~s;continue}case 2:return;case 1:{l[1]=~s;continue}case 3:{o.splice(s,1,...d.nodes);continue}case 5:{o.splice(s,1,...d.nodes);return}case 4:{o.splice(s,1,...d.nodes),l[1]+=d.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${he[d.kind]??`Unknown(${d.kind})`}\` in enter.`)}}let u=~s;i.index=u;let p=o[u],c=t(p,i)??v.Continue;switch(c.kind){case 0:l[1]=u+1;continue;case 2:return;case 3:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}case 5:{o.splice(u,1,...c.nodes);return}case 4:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${he[c.kind]??`Unknown(${c.kind})`}\` in exit.`)}}}var En=new h(e=>{let r=b(e),t=new Set,n=new Set(["~",">","+","-","*","/"]);return g(r,(i,l)=>{if(i.kind==="word"&&n.has(i.value)){let o=l.index;if(o===-1)return;let s=l.siblings[o-1];if(s?.kind!=="separator"||s.value!==" ")return;let a=l.siblings[o+1];if(a?.kind!=="separator"||a.value!==" ")return;let u=l.siblings[o-2];if(u&&n.has(u.value))return;let p=l.siblings[o+2];if(p&&n.has(p.value))return;t.add(s),t.add(a)}else if(i.kind==="separator"&&i.value.length>0&&i.value.trim()==="")(l.siblings[0]===i||l.siblings[l.siblings.length-1]===i)&&t.add(i);else if(i.kind==="separator"&&i.value.trim()===",")i.value=",";else if(i.kind==="function"&&i.value.startsWith("--")){let o=l.index;if(o<=0)return;let s=l.siblings[o-1];if(s?.kind==="separator"&&s.value===",")return;let a=l.siblings[o-2];return a&&!n.has(a.value)?void 0:v.ReplaceSkip({kind:"function",value:"",nodes:[i]})}}),t.size>0&&g(r,i=>{if(t.has(i))return t.delete(i),v.ReplaceSkip([])}),ve(r),A(r)});var Nn=new h(e=>{let r=b(e);return r.length===3&&r[0].kind==="word"&&r[0].value==="&"&&r[1].kind==="separator"&&r[1].value===":"&&r[2].kind==="function"&&r[2].value==="is"?A(r[2].nodes):e});function ve(e){for(let r of e)switch(r.kind){case"function":{if(r.value==="url"||r.value.endsWith("_url")){r.value=Y(r.value);break}if(r.value==="var"||r.value.endsWith("_var")||r.value==="theme"||r.value.endsWith("_theme")){r.value=Y(r.value);for(let t=0;t{let r=b(e);return r.length===1&&r[0].kind==="function"&&r[0].value==="var"});function Gt(e){throw new Error(`Unexpected value: ${e}`)}function Y(e){return e.replaceAll("_",String.raw`\_`).replaceAll(" ","_")}var qt=/^(?[-+]?(?:\d*\.)?\d+)(?[a-z]+|%)?$/i,W=new h(e=>{let r=qt.exec(e);if(!r)return null;let t=r.groups?.value;if(t===void 0)return null;let n=Number(t);if(Number.isNaN(n))return null;let i=r.groups?.unit;return i===void 0?[n,null]:[n,i]});var O=/[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?/,Fn=new RegExp(`^${O.source}$`);var jn=new RegExp(`^${O.source}%$`);var Wn=new RegExp(`^${O.source}\\s*/\\s*${O.source}$`);var Zt=["cm","mm","Q","in","pc","pt","px","em","ex","ch","rem","lh","rlh","vw","vh","vmin","vmax","vb","vi","svw","svh","lvw","lvh","dvw","dvh","cqw","cqh","cqi","cqb","cqmin","cqmax"],Bn=new RegExp(`^${O.source}(${Zt.join("|")})$`);var Qt=["deg","rad","grad","turn"],Hn=new RegExp(`^${O.source}(${Qt.join("|")})$`);var Yn=new RegExp(`^${O.source} +${O.source} +${O.source}$`);function S(e){let r=Number(e);return Number.isInteger(r)&&r>=0&&String(r)===String(e)}function G(e,r){if(r===null)return e;let t=Number(r);return Number.isNaN(t)||(r=`${t*100}%`),r==="100%"?e:`color-mix(in oklab, ${e} ${r}, transparent)`}var er={"--alpha":tr,"--spacing":rr,"--theme":nr,theme:ir};function tr(e,r,t,...n){let[i,l]=w(t,"/").map(o=>o.trim());if(!i||!l)throw new Error(`The --alpha(\u2026) function requires a color and an alpha value, e.g.: \`--alpha(${i||"var(--my-color)"} / ${l||"50%"})\``);if(n.length>0)throw new Error(`The --alpha(\u2026) function only accepts one argument, e.g.: \`--alpha(${i||"var(--my-color)"} / ${l||"50%"})\``);return G(i,l)}function rr(e,r,t,...n){if(!t)throw new Error("The --spacing(\u2026) function requires an argument, but received none.");if(n.length>0)throw new Error(`The --spacing(\u2026) function only accepts a single argument, but received ${n.length+1}.`);let i=e.theme.resolve(null,["--spacing"]);if(!i)throw new Error("The --spacing(\u2026) function requires that the `--spacing` theme variable exists, but it was not found.");let l=W.get(t);if(l){if(l[0]===0)return"0px";if(l[0]===1)return i}return`calc(${i} * ${t})`}function nr(e,r,t,...n){if(!t.startsWith("--"))throw new Error("The --theme(\u2026) function can only be used with CSS variables from your theme.");let i=!1;t.endsWith(" inline")&&(i=!0,t=t.slice(0,-7)),r.kind==="at-rule"&&(i=!0);let l=e.resolveThemeValue(t,i);if(!l){if(n.length>0)return n.join(", ");throw new Error(`Could not resolve value for theme function: \`theme(${t})\`. Consider checking if the variable name is correct or provide a fallback value to silence this error.`)}if(n.length===0)return l;let o=n.join(", ");if(o==="initial")return l;if(l==="initial")return o;if(l.startsWith("var(")||l.startsWith("theme(")||l.startsWith("--theme(")){let s=b(l);return lr(s,o),A(s)}return l}function ir(e,r,t,...n){t=or(t);let i=e.resolveThemeValue(t);if(!i&&n.length>0)return n.join(", ");if(!i)throw new Error(`Could not resolve value for theme function: \`theme(${t})\`. Consider checking if the path is correct or provide a fallback value to silence this error.`);return i}var wi=new RegExp(Object.keys(er).map(e=>`${e}\\(`).join("|"));function or(e){if(e[0]!=="'"&&e[0]!=='"')return e;let r="",t=e[0];for(let n=1;n{if(t.kind==="function"&&!(t.value!=="var"&&t.value!=="theme"&&t.value!=="--theme"))if(t.nodes.length===1)t.nodes.push({kind:"word",value:`, ${r}`});else{let n=t.nodes[t.nodes.length-1];n.kind==="word"&&n.value==="initial"&&(n.value=r)}})}function L(e,r="top",t="right",n="bottom",i="left"){return Xe(`${e}-${r}`,`${e}-${t}`,`${e}-${n}`,`${e}-${i}`)}function Xe(e="top",r="right",t="bottom",n="left"){return{1:[[e,0],[r,0],[t,0],[n,0]],2:[[e,0],[r,1],[t,0],[n,1]],3:[[e,0],[r,1],[t,2],[n,1]],4:[[e,0],[r,1],[t,2],[n,3]]}}function $(e,r){return{1:[[e,0],[r,0]],2:[[e,0],[r,1]]}}var Ii={inset:Xe(),margin:L("margin"),padding:L("padding"),"scroll-margin":L("scroll-margin"),"scroll-padding":L("scroll-padding"),"border-width":L("border","top-width","right-width","bottom-width","left-width"),"border-style":L("border","top-style","right-style","bottom-style","left-style"),"border-color":L("border","top-color","right-color","bottom-color","left-color"),gap:$("row-gap","column-gap"),overflow:$("overflow-x","overflow-y"),"overscroll-behavior":$("overscroll-behavior-x","overscroll-behavior-y")},Ui={"inset-block":$("top","bottom"),"inset-inline":$("left","right"),"margin-block":$("margin-top","margin-bottom"),"margin-inline":$("margin-left","margin-right"),"padding-block":$("padding-top","padding-bottom"),"padding-inline":$("padding-left","padding-right"),"scroll-margin-block":$("scroll-margin-top","scroll-margin-bottom"),"scroll-margin-inline":$("scroll-margin-left","scroll-margin-right"),"scroll-padding-block":$("scroll-padding-top","scroll-padding-bottom"),"scroll-padding-inline":$("scroll-padding-left","scroll-padding-right")};var ur=1536,go=ur/16;var Eo=new h(e=>{let r=[];return g(b(e),t=>{if(!(t.kind!=="function"||t.value!=="var"))return g(t.nodes,n=>{n.kind!=="word"||n.value[0]!=="-"||n.value[1]!=="-"||r.push(n.value)}),v.Skip}),r});function xe(e){let r=[0];for(let i=0;i0;){let a=(o|0)>>1,u=l+a;r[u]<=i?(l=u+1,o=o-a-1):o=a}l-=1;let s=i-r[l];return{line:l+1,column:s}}function n({line:i,column:l}){i-=1,i=Math.min(Math.max(i,0),r.length-1);let o=r[i],s=r[i+1]??o;return Math.min(Math.max(o+l,0),s)}return{find:t,findOffset:n}}var Q=92,ae=47,se=42,ot=34,lt=39,kr=58,ue=59,N=10,ce=13,J=32,X=9,at=123,Ae=125,$e=40,st=41,wr=91,br=93,ut=45,Ce=64,yr=33,V=class e extends Error{loc;constructor(r,t){if(t){let n=t[0],i=xe(n.code).find(t[1]);r=`${n.file}:${i.line}:${i.column+1}: ${r}`}super(r),this.name="CssSyntaxError",this.loc=t,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};function te(e,r){let t=r?.from?{file:r.from,code:e}:null;e[0]==="\uFEFF"&&(e=" "+e.slice(1));let n=[],i=[],l=[],o=null,s=null,a="",u="",p=0,c;for(let f=0;f0&&e[y]===m[m.length-1]&&(m=m.slice(0,-1));let I=Se(a,k);if(!I)throw new V("Invalid custom property, expected a value",t?[t,C,f]:null);t&&(I.src=[t,C,f],I.dst=[t,C,f]),o?o.nodes.push(I):n.push(I),a=""}else if(d===ue&&a.charCodeAt(0)===Ce)s=ee(a),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o?o.nodes.push(s):n.push(s),a="",s=null;else if(d===ue&&u[u.length-1]!==")"){let m=Se(a);if(!m){if(a.length===0)continue;throw new V(`Invalid declaration: \`${a.trim()}\``,t?[t,p,f]:null)}t&&(m.src=[t,p,f],m.dst=[t,p,f]),o?o.nodes.push(m):n.push(m),a=""}else if(d===at&&u[u.length-1]!==")")u+="}",s=_(a.trim()),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o&&o.nodes.push(s),l.push(o),o=s,a="",s=null;else if(d===Ae&&u[u.length-1]!==")"){if(u==="")throw new V("Missing opening {",t?[t,f,f]:null);if(u=u.slice(0,-1),a.length>0)if(a.charCodeAt(0)===Ce)s=ee(a),t&&(s.src=[t,p,f],s.dst=[t,p,f]),o?o.nodes.push(s):n.push(s),a="",s=null;else{let C=a.indexOf(":");if(o){let k=Se(a,C);if(!k)throw new V(`Invalid declaration: \`${a.trim()}\``,t?[t,p,f]:null);t&&(k.src=[t,p,f],k.dst=[t,p,f]),o.nodes.push(k)}}let m=l.pop()??null;m===null&&o&&n.push(o),o=m,a="",s=null}else if(d===$e)u+=")",a+="(";else if(d===st){if(u[u.length-1]!==")")throw new V("Missing opening (",t?[t,f,f]:null);u=u.slice(0,-1),a+=")"}else{if(a.length===0&&(d===J||d===N||d===X))continue;a===""&&(p=f),a+=String.fromCharCode(d)}}}if(a.charCodeAt(0)===Ce){let f=ee(a);t&&(f.src=[t,p,e.length],f.dst=[t,p,e.length]),n.push(f)}if(u.length>0&&o){if(o.kind==="rule")throw new V(`Missing closing } at ${o.selector}`,o.src?[o.src[0],o.src[1],o.src[1]]:null);if(o.kind==="at-rule")throw new V(`Missing closing } at ${o.name} ${o.params}`,o.src?[o.src[0],o.src[1],o.src[1]]:null)}return i.length>0?i.concat(n):n}function ee(e,r=[]){let t=e,n="";for(let i=5;i{if(S(e.value))return e.value}),x=K(e=>{if(S(e.value))return`${e.value}%`}),D=K(e=>{if(S(e.value))return`${e.value}px`}),pt=K(e=>{if(S(e.value))return`${e.value}ms`}),fe=K(e=>{if(S(e.value))return`${e.value}deg`}),$r=K(e=>{if(e.fraction===null)return;let[r,t]=w(e.fraction,"/");if(!(!S(r)||!S(t)))return e.fraction}),dt=K(e=>{if(S(Number(e.value)))return`repeat(${e.value}, minmax(0, 1fr))`}),Tr={accentColor:({theme:e})=>e("colors"),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9",...$r},backdropBlur:({theme:e})=>e("blur"),backdropBrightness:({theme:e})=>({...e("brightness"),...x}),backdropContrast:({theme:e})=>({...e("contrast"),...x}),backdropGrayscale:({theme:e})=>({...e("grayscale"),...x}),backdropHueRotate:({theme:e})=>({...e("hueRotate"),...fe}),backdropInvert:({theme:e})=>({...e("invert"),...x}),backdropOpacity:({theme:e})=>({...e("opacity"),...x}),backdropSaturate:({theme:e})=>({...e("saturate"),...x}),backdropSepia:({theme:e})=>({...e("sepia"),...x}),backgroundColor:({theme:e})=>e("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:e})=>e("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:e})=>({DEFAULT:"currentcolor",...e("colors")}),borderOpacity:({theme:e})=>e("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:e})=>e("spacing"),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px",...D},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:e})=>e("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2",...x},caretColor:({theme:e})=>e("colors"),colors:()=>({...Ne}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",...R},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2",...x},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:e})=>e("borderColor"),divideOpacity:({theme:e})=>e("borderOpacity"),divideWidth:({theme:e})=>({...e("borderWidth"),...D}),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:e})=>e("colors"),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",...e("spacing")}),flexGrow:{0:"0",DEFAULT:"1",...R},flexShrink:{0:"0",DEFAULT:"1",...R},fontFamily:{sans:["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"','"Noto Sans"',"Arial","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:e})=>e("spacing"),gradientColorStops:({theme:e})=>e("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%",...x},grayscale:{0:"0",DEFAULT:"100%",...x},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...R},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...R},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...R},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13",...R},gridTemplateColumns:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...dt},gridTemplateRows:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))",...dt},height:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg",...fe},inset:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),invert:{0:"0",DEFAULT:"100%",...x},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:e})=>({auto:"auto",...e("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",...R},maxHeight:({theme:e})=>({none:"none",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),maxWidth:({theme:e})=>({none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...e("spacing")}),minHeight:({theme:e})=>({full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),minWidth:({theme:e})=>({full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",15:"0.15",20:"0.2",25:"0.25",30:"0.3",35:"0.35",40:"0.4",45:"0.45",50:"0.5",55:"0.55",60:"0.6",65:"0.65",70:"0.7",75:"0.75",80:"0.8",85:"0.85",90:"0.9",95:"0.95",100:"1",...x},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",...R},outlineColor:({theme:e})=>e("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},padding:({theme:e})=>e("spacing"),placeholderColor:({theme:e})=>e("colors"),placeholderOpacity:({theme:e})=>e("opacity"),ringColor:({theme:e})=>({DEFAULT:"currentcolor",...e("colors")}),ringOffsetColor:({theme:e})=>e("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},ringOpacity:({theme:e})=>({DEFAULT:"0.5",...e("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg",...fe},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2",...x},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",...x},screens:{sm:"40rem",md:"48rem",lg:"64rem",xl:"80rem","2xl":"96rem"},scrollMargin:({theme:e})=>e("spacing"),scrollPadding:({theme:e})=>e("spacing"),sepia:{0:"0",DEFAULT:"100%",...x},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",...fe},space:({theme:e})=>e("spacing"),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:e})=>({none:"none",...e("colors")}),strokeWidth:{0:"0",1:"1",2:"2",...R},supports:{},data:{},textColor:({theme:e})=>e("colors"),textDecorationColor:({theme:e})=>e("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},textIndent:({theme:e})=>e("spacing"),textOpacity:({theme:e})=>e("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px",...D},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...pt},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms",...pt},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:e})=>({"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%",...e("spacing")}),size:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),width:({theme:e})=>({auto:"auto","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",min:"min-content",max:"max-content",fit:"fit-content",...e("spacing")}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50",...R}};var Nr=64;function U(e,r=[]){return{kind:"rule",selector:e,nodes:r}}function E(e,r="",t=[]){return{kind:"at-rule",name:e,params:r,nodes:t}}function _(e,r=[]){return e.charCodeAt(0)===Nr?ee(e,r):U(e,r)}function P(e,r,t=!1){return{kind:"declaration",property:e,value:r,important:t}}function Ee(e){return{kind:"comment",value:e}}function z(e,r){let t=0,n={file:null,code:""};function i(o,s=0){let a="",u=" ".repeat(s);if(o.kind==="declaration"){if(a+=`${u}${o.property}: ${o.value}${o.important?" !important":""}; +`,r){t+=u.length;let p=t;t+=o.property.length,t+=2,t+=o.value?.length??0,o.important&&(t+=11);let c=t;t+=2,o.dst=[n,p,c]}}else if(o.kind==="rule"){if(a+=`${u}${o.selector} { +`,r){t+=u.length;let p=t;t+=o.selector.length,t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}} +`,r&&(t+=u.length,t+=2)}else if(o.kind==="at-rule"){if(o.nodes.length===0){let p=`${u}${o.name} ${o.params}; +`;if(r){t+=u.length;let c=t;t+=o.name.length,t+=1,t+=o.params.length;let f=t;t+=2,o.dst=[n,c,f]}return p}if(a+=`${u}${o.name}${o.params?` ${o.params} `:" "}{ +`,r){t+=u.length;let p=t;t+=o.name.length,o.params&&(t+=1,t+=o.params.length),t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}} +`,r&&(t+=u.length,t+=2)}else if(o.kind==="comment"){if(a+=`${u}/*${o.value}*/ +`,r){t+=u.length;let p=t;t+=2+o.value.length+2;let c=t;o.dst=[n,p,c],t+=1}}else if(o.kind==="context"||o.kind==="at-root")return"";return a}let l="";for(let o of e)l+=i(o,0);return n.code=l,l}function Vr(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var n="";if(t>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),n="//")}var l=e.split(/[/\\]+/);return r!==!1&&l[l.length-1]===""&&l.pop(),n+l.join("/")}function Ve(e){let r=Vr(e);return e.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var Pe=/(?[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?\w[^,]+))?(?:,|$)/g,Ir=/(?Pr.test(e),zr=e=>Or.test(e);async function gt({css:e,base:r,root:t}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let n=te(e),i=[];function l(o){if(o[0]==="/")return o;let s=Re.posix.join(Ve(r),o),a=Re.posix.relative(Ve(t),s);return a.startsWith(".")||(a="./"+a),a}return g(n,o=>{if(o.kind!=="declaration"||!o.value)return;let s=Pe.test(o.value),a=mt.test(o.value);if(s||a){let u=a?Kr:ht;i.push(u(o.value,l).then(p=>{o.value=p}))}}),i.length&&await Promise.all(i),z(n)}function ht(e,r){return kt(e,Pe,async t=>{let[n,i]=t;return await vt(i.trim(),n,r)})}async function Kr(e,r){return await kt(e,mt,async t=>{let[,n]=t;return await Fr(n,async({url:l})=>Pe.test(l)?await ht(l,r):Rr.test(l)?l:await vt(l,l,r))})}async function vt(e,r,t,n="url"){let i="",l=e[0];if((l==='"'||l==="'")&&(i=l,e=e.slice(1,-1)),Mr(e))return r;let o=await t(e);return i===""&&o!==encodeURI(o)&&(i='"'),i==="'"&&o.includes("'")&&(i='"'),i==='"'&&o.includes('"')&&(o=o.replace(Ir,'\\"')),`${n}(${i}${o}${i})`}function Mr(e,r){return zr(e)||Lr(e)||!e[0].match(/[.a-zA-Z0-9_]/)||_r.test(e)}function Fr(e,r){return Promise.all(jr(e).map(async({url:t,descriptor:n})=>({url:await r({url:t,descriptor:n}),descriptor:n}))).then(Wr)}function jr(e){let r=e.trim().replace(Ur," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Dr);return Array.from(r,({groups:t})=>({url:t?.url?.trim()??"",descriptor:t?.descriptor?.trim()??""})).filter(({url:t})=>!!t)}function Wr(e){return e.map(({url:r,descriptor:t})=>r+(t?` ${t}`:"")).join(", ")}async function kt(e,r,t){let n,i=e,l="";for(;n=r.exec(i);)l+=i.slice(0,n.index),l+=await t(n),i=i.slice(n.index+n[0].length);return l+=i,l}function Ct({base:e,from:r,polyfills:t,onDependency:n,shouldRewriteUrls:i,customCssResolver:l,customJsResolver:o}){return{base:e,polyfills:t,from:r,async loadModule(s,a){return $t(s,a,n,o)},async loadStylesheet(s,a){let u=await Tt(s,a,n,l);return i&&(u.content=await gt({css:u.content,root:e,base:u.base})),u}}}async function St(e){if(e.root&&e.root!=="none"){let r=/[*{]/,t=[];for(let i of e.root.pattern.split("/")){if(r.test(i))break;t.push(i)}if(!await At.stat(re.resolve(e.root.base,t.join("/"))).then(i=>i.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist or is not a directory.`)}}async function cu(e,r){let t=await Gr(e,Ct(r));return await St(t),t}async function fu(e,r){let t=await Yr(e,Ct(r));return await St(t),t}async function pu(e,{base:r}){return Hr(e,{base:r,async loadModule(t,n){return $t(t,n,()=>{})},async loadStylesheet(t,n){return Tt(t,n,()=>{})}})}async function $t(e,r,t,n){if(e[0]!=="."){let s=await xt(e,r,n);if(!s)throw new Error(`Could not resolve '${e}' from '${r}'`);let a=await yt(wt(s).href);return{path:s,base:re.dirname(s),module:a.default??a}}let i=await xt(e,r,n);if(!i)throw new Error(`Could not resolve '${e}' from '${r}'`);let[l,o]=await Promise.all([yt(wt(i).href+"?id="+Date.now()),Le(i)]);for(let s of o)t(s);return{path:i,base:re.dirname(i),module:l.default??l}}async function Tt(e,r,t,n){let i=await Zr(e,r,n);if(!i)throw new Error(`Could not resolve '${e}' from '${r}'`);t(i);let l=await At.readFile(i,"utf-8");return{path:i,base:re.dirname(i),content:l}}var bt=null;async function yt(e){if(typeof globalThis.__tw_load=="function"){let r=await globalThis.__tw_load(e);if(r)return r}try{return await import(e)}catch{return bt??=Br(import.meta.url,{moduleCache:!1,fsCache:!1}),await bt.import(e)}}var De=["node_modules",...process.env.NODE_PATH?[...process.env.NODE_PATH.split(re.delimiter)]:[]],qr=B.ResolverFactory.createResolver({fileSystem:new B.CachedInputFileSystem(_e,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"],modules:De});async function Zr(e,r,t){if(typeof globalThis.__tw_resolve=="function"){let n=globalThis.__tw_resolve(e,r);if(n)return Promise.resolve(n)}if(t){let n=await t(e,r);if(n)return n}return Oe(qr,e,r)}var Qr=B.ResolverFactory.createResolver({fileSystem:new B.CachedInputFileSystem(_e,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"],modules:De}),Jr=B.ResolverFactory.createResolver({fileSystem:new B.CachedInputFileSystem(_e,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"],modules:De});async function xt(e,r,t){if(typeof globalThis.__tw_resolve=="function"){let n=globalThis.__tw_resolve(e,r);if(n)return Promise.resolve(n)}if(t){let n=await t(e,r);if(n)return n}return Oe(Qr,e,r).catch(()=>Oe(Jr,e,r))}function Oe(e,r,t){return new Promise((n,i)=>e.resolve({},t,r,{},(l,o)=>{if(l)return i(l);n(o)}))}Symbol.dispose??=Symbol("Symbol.dispose");Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");var Et=class{constructor(r=de,t=n=>{process.stderr.write(`${n} +`)}){this.shouldReport=r;this.defaultFlush=t}shouldReport;defaultFlush;#r=new h(()=>({value:0}));#t=new h(()=>({value:0n}));#e=[];hit(r){this.#r.get(r).value++}start(r){let t=this.#e.map(i=>i.label).join("//"),n=`${t}${t.length===0?"":"//"}${r}`;this.#r.get(n).value++,this.#t.get(n),this.#e.push({id:n,label:r,namespace:t,value:process.hrtime.bigint()})}end(r){let t=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==r)throw new Error(`Mismatched timer label: \`${r}\`, expected \`${this.#e[this.#e.length-1].label}\``);let n=this.#e.pop(),i=t-n.value;this.#t.get(n.id).value+=i}track(r){this.start(r);let t=!1;return{[Symbol.dispose]:()=>{t||(this.end(r),t=!0)},[Symbol.asyncDispose]:()=>{t||(this.end(r),t=!0)}}}span(r,t){this.start(r);let n=!1;try{let i=t();return n=i&&typeof i.then=="function",n?i.finally(()=>this.end(r)):i}finally{n||this.end(r)}}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(r=this.defaultFlush){let t=[],n=!1;for(let o=this.#e.length-1;o>=0;o--)this.end(this.#e[o].label);for(let[o,{value:s}]of this.#r.entries()){if(this.#t.has(o))continue;t.length===0&&(n=!0,t.push("Hits:"));let a=o.split("//").length;t.push(`${" ".repeat(a)}${o} ${pe(Nt(`\xD7 ${s}`))}`)}this.#t.size>0&&n&&t.push(` +Timers:`);let i=-1/0,l=new Map;for(let[o,{value:s}]of this.#t){let a=`${(Number(s)/1e6).toFixed(2)}ms`;l.set(o,a),i=Math.max(i,a.length)}for(let o of this.#t.keys()){let s=o.split("//").length;t.push(`${pe(`[${l.get(o).padStart(i," ")}]`)}${" ".repeat(s-1)}${s===1?" ":pe(" \u21B3 ")}${o.split("//").pop()} ${this.#r.get(o).value===1?"":pe(Nt(`\xD7 ${this.#r.get(o).value}`))}`.trimEnd())}r(` +${t.join(` +`)} +`),this.reset()}[Symbol.dispose](){this.shouldReport&&this.report()}};function pe(e){return`\x1B[2m${e}\x1B[22m`}function Nt(e){return`\x1B[34m${e}\x1B[39m`}import Xr from"@jridgewell/remapping";import{Features as ne,transform as en}from"lightningcss";import tn from"magic-string";function wu(e,{file:r="input.css",minify:t=!1,map:n}={}){function i(a,u){return en({filename:r,code:a,minify:t,sourceMap:typeof u<"u",inputSourceMap:u,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:ne.Nesting|ne.MediaQueries,exclude:ne.LogicalProperties|ne.DirSelector|ne.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0})}let l=i(Buffer.from(e),n);if(n=l.map?.toString(),l.warnings=l.warnings.filter(a=>!(/'(deep|slotted|global)' is not recognized as a valid pseudo-/.test(a.message)||/Unknown at rule: @position-try/.test(a.message))),l.warnings.length>0){let a=e.split(` +`),u=[`Found ${l.warnings.length} ${l.warnings.length===1?"warning":"warnings"} while optimizing generated CSS:`];for(let[p,c]of l.warnings.entries()){u.push(""),l.warnings.length>1&&u.push(`Issue #${p+1}:`);let f=2,d=Math.max(0,c.loc.line-f-1),m=Math.min(a.length,c.loc.line+f),C=a.slice(d,m).map((k,I)=>d+I+1===c.loc.line?`${ie("\u2502")} ${k}`:ie(`\u2502 ${k}`));C.splice(c.loc.line-d,0,`${ie("\u2506")}${" ".repeat(c.loc.column-1)} ${rn(`${ie("^--")} ${c.message}`)}`,`${ie("\u2506")}`),u.push(...C)}u.push(""),console.warn(u.join(` +`))}l=i(l.code,n),n=l.map?.toString();let o=l.code.toString(),s=new tn(o);if(s.replaceAll("@media not (","@media not all and ("),n!==void 0&&s.hasChanged()){let a=s.generateMap({source:"original",hires:"boundary"}).toString();n=Xr([a,n],()=>null).toString()}return o=s.toString(),{code:o,map:n}}function ie(e){return`\x1B[2m${e}\x1B[22m`}function rn(e){return`\x1B[33m${e}\x1B[39m`}import{SourceMapGenerator as nn}from"source-map-js";function on(e){let r=new nn,t=1,n=new h(i=>({url:i?.url??``,content:i?.content??""}));for(let i of e.mappings){let l=n.get(i.originalPosition?.source??null);r.addMapping({generated:i.generatedPosition,original:i.originalPosition,source:l.url,name:i.name}),r.setSourceContent(l.url,l.content)}return r.toString()}function Au(e){let r=typeof e=="string"?e:on(e);function t(n){return`/*# sourceMappingURL=${n} */ +`}return{raw:r,get inline(){let n=Buffer.from(r,"utf-8").toString("base64");return t(`data:application/json;base64,${n}`)},comment:t}}if(!process.versions.bun)if(M.registerHooks)M.registerHooks({resolve:Ie});else{let e=M.createRequire(import.meta.url);M.register?.(ln(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{lu as Features,Et as Instrumentation,au as Polyfills,pu as __unstable__loadDesignSystem,fu as compile,cu as compileAst,me as env,$t as loadModule,Ve as normalizePath,wu as optimize,Au as toSourceMap}; diff --git a/node_modules/@tailwindcss/node/dist/require-cache.d.ts b/node_modules/@tailwindcss/node/dist/require-cache.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..de970b93e0e3de5fee1c7bbd0e90557a749626d9 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/require-cache.d.ts @@ -0,0 +1,3 @@ +declare function clearRequireCache(files: string[]): void; + +export { clearRequireCache }; diff --git a/node_modules/@tailwindcss/node/dist/require-cache.js b/node_modules/@tailwindcss/node/dist/require-cache.js new file mode 100644 index 0000000000000000000000000000000000000000..398995fad99874c69392bbc01629281fb348c796 --- /dev/null +++ b/node_modules/@tailwindcss/node/dist/require-cache.js @@ -0,0 +1 @@ +"use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var n=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},u=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of f(e))!l.call(r,c)&&c!==t&&i(r,c,{get:()=>e[c],enumerable:!(o=a(e,c))||o.enumerable});return r};var h=r=>u(i({},"__esModule",{value:!0}),r);var d={};n(d,{clearRequireCache:()=>q});module.exports=h(d);function q(r){for(let e of r)delete require.cache[e]}0&&(module.exports={clearRequireCache}); diff --git a/node_modules/@tailwindcss/node/package.json b/node_modules/@tailwindcss/node/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1798a6432a22d5907a944406a5702c48f7d08532 --- /dev/null +++ b/node_modules/@tailwindcss/node/package.json @@ -0,0 +1,48 @@ +{ + "name": "@tailwindcss/node", + "version": "4.3.3", + "description": "A utility-first CSS framework for rapidly building custom user interfaces.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tailwindlabs/tailwindcss.git", + "directory": "packages/@tailwindcss-node" + }, + "bugs": "https://github.com/tailwindlabs/tailwindcss/issues", + "homepage": "https://tailwindcss.com", + "files": [ + "dist/" + ], + "publishConfig": { + "provenance": true, + "access": "public" + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./require-cache": { + "types": "./dist/require-cache.d.ts", + "default": "./dist/require-cache.js" + }, + "./esm-cache-loader": { + "types": "./dist/esm-cache.loader.d.mts", + "default": "./dist/esm-cache.loader.mjs" + } + }, + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.24.1", + "jiti": "^2.7.0", + "lightningcss": "1.32.0", + "magic-string": "^0.30.21", + "source-map-js": "^1.2.1", + "tailwindcss": "4.3.3" + }, + "scripts": { + "build": "tsup-node", + "dev": "pnpm run build -- --watch" + } +} \ No newline at end of file diff --git a/node_modules/@tailwindcss/oxide-win32-x64-msvc/LICENSE b/node_modules/@tailwindcss/oxide-win32-x64-msvc/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6a82290738a9f78946cbcb4594535d6984086dd --- /dev/null +++ b/node_modules/@tailwindcss/oxide-win32-x64-msvc/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Tailwind Labs, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tailwindcss/oxide-win32-x64-msvc/README.md b/node_modules/@tailwindcss/oxide-win32-x64-msvc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bb1c4ac9e910cb466024b0b93b7a14111bd49481 --- /dev/null +++ b/node_modules/@tailwindcss/oxide-win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `@tailwindcss/oxide-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `@tailwindcss/oxide` diff --git a/node_modules/@tailwindcss/oxide-win32-x64-msvc/package.json b/node_modules/@tailwindcss/oxide-win32-x64-msvc/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3d751df9ae2eece85b022f2e525e70682ffabf1b --- /dev/null +++ b/node_modules/@tailwindcss/oxide-win32-x64-msvc/package.json @@ -0,0 +1,27 @@ +{ + "name": "@tailwindcss/oxide-win32-x64-msvc", + "version": "4.3.3", + "repository": { + "type": "git", + "url": "git+https://github.com/tailwindlabs/tailwindcss.git", + "directory": "crates/node/npm/win32-x64-msvc" + }, + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "main": "tailwindcss-oxide.win32-x64-msvc.node", + "files": [ + "tailwindcss-oxide.win32-x64-msvc.node" + ], + "publishConfig": { + "provenance": true, + "access": "public" + }, + "license": "MIT", + "engines": { + "node": ">= 20" + } +} \ No newline at end of file diff --git a/node_modules/@tailwindcss/oxide-win32-x64-msvc/tailwindcss-oxide.win32-x64-msvc.node b/node_modules/@tailwindcss/oxide-win32-x64-msvc/tailwindcss-oxide.win32-x64-msvc.node new file mode 100644 index 0000000000000000000000000000000000000000..4b7163b361e84a07f9641ae436f30308e9cf268f --- /dev/null +++ b/node_modules/@tailwindcss/oxide-win32-x64-msvc/tailwindcss-oxide.win32-x64-msvc.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abdc655d7f9f413e2da0c97c90852fa476bcac3f2659e9ad51901cf58cb7eac4 +size 3190272 diff --git a/node_modules/@tailwindcss/oxide/LICENSE b/node_modules/@tailwindcss/oxide/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6a82290738a9f78946cbcb4594535d6984086dd --- /dev/null +++ b/node_modules/@tailwindcss/oxide/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Tailwind Labs, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tailwindcss/oxide/index.d.ts b/node_modules/@tailwindcss/oxide/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6d66ce6c510ce9099b54e8a68778e211dc89ad1 --- /dev/null +++ b/node_modules/@tailwindcss/oxide/index.d.ts @@ -0,0 +1,49 @@ +/* auto-generated by NAPI-RS */ +/* eslint-disable */ +export declare class Scanner { + constructor(opts: ScannerOptions) + scan(): Array + scanFiles(input: Array): Array + getCandidatesWithPositions(input: ChangedContent): Array + get files(): Array + get scannedFiles(): Array + get globs(): Array + get normalizedSources(): Array +} + +export interface CandidateWithPosition { + /** The candidate string */ + candidate: string + /** The position of the candidate inside the content file */ + position: number +} + +export interface ChangedContent { + /** File path to the changed file */ + file?: string + /** Contents of the changed file */ + content?: string + /** File extension */ + extension: string +} + +export interface GlobEntry { + /** Base path of the glob */ + base: string + /** Glob pattern */ + pattern: string +} + +export interface ScannerOptions { + /** Glob sources */ + sources?: Array +} + +export interface SourceEntry { + /** Base path of the glob */ + base: string + /** Glob pattern */ + pattern: string + /** Negated flag */ + negated: boolean +} diff --git a/node_modules/@tailwindcss/oxide/index.js b/node_modules/@tailwindcss/oxide/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4b0b441dd6388b62dfcf1dcb1304bf41d5594dd2 --- /dev/null +++ b/node_modules/@tailwindcss/oxide/index.js @@ -0,0 +1,589 @@ +// prettier-ignore +/* eslint-disable */ +// @ts-nocheck +/* auto-generated by NAPI-RS */ + +const { readFileSync } = require('node:fs') +let nativeBinding = null +const loadErrors = [] + +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') + +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + let report = null + if (typeof process.report?.getReport === 'function') { + process.report.excludeNetwork = true + report = process.report.getReport() + } + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { + return true + } + } + return false +} + +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false + } +} + +function requireNative() { + if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) { + try { + return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH); + } catch (err) { + loadErrors.push(err) + } + } else if (process.platform === 'android') { + if (process.arch === 'arm64') { + try { + return require('./tailwindcss-oxide.android-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-android-arm64') + const bindingPackageVersion = require('@tailwindcss/oxide-android-arm64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./tailwindcss-oxide.android-arm-eabi.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-android-arm-eabi') + const bindingPackageVersion = require('@tailwindcss/oxide-android-arm-eabi/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) + } + } else if (process.platform === 'win32') { + if (process.arch === 'x64') { + if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') { + try { + return require('./tailwindcss-oxide.win32-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-win32-x64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.win32-x64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-win32-x64-msvc') + const bindingPackageVersion = require('@tailwindcss/oxide-win32-x64-msvc/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'ia32') { + try { + return require('./tailwindcss-oxide.win32-ia32-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-win32-ia32-msvc') + const bindingPackageVersion = require('@tailwindcss/oxide-win32-ia32-msvc/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./tailwindcss-oxide.win32-arm64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-win32-arm64-msvc') + const bindingPackageVersion = require('@tailwindcss/oxide-win32-arm64-msvc/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) + } + } else if (process.platform === 'darwin') { + try { + return require('./tailwindcss-oxide.darwin-universal.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-darwin-universal') + const bindingPackageVersion = require('@tailwindcss/oxide-darwin-universal/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + if (process.arch === 'x64') { + try { + return require('./tailwindcss-oxide.darwin-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-darwin-x64') + const bindingPackageVersion = require('@tailwindcss/oxide-darwin-x64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./tailwindcss-oxide.darwin-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-darwin-arm64') + const bindingPackageVersion = require('@tailwindcss/oxide-darwin-arm64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) + } + } else if (process.platform === 'freebsd') { + if (process.arch === 'x64') { + try { + return require('./tailwindcss-oxide.freebsd-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-freebsd-x64') + const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-x64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./tailwindcss-oxide.freebsd-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-freebsd-arm64') + const bindingPackageVersion = require('@tailwindcss/oxide-freebsd-arm64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) + } + } else if (process.platform === 'linux') { + if (process.arch === 'x64') { + if (isMusl()) { + try { + return require('./tailwindcss-oxide.linux-x64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-x64-musl') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-musl/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.linux-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-x64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-x64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'arm64') { + if (isMusl()) { + try { + return require('./tailwindcss-oxide.linux-arm64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-arm64-musl') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-musl/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.linux-arm64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-arm64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'arm') { + if (isMusl()) { + try { + return require('./tailwindcss-oxide.linux-arm-musleabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-arm-musleabihf') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-musleabihf/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.linux-arm-gnueabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-arm-gnueabihf') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-arm-gnueabihf/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'loong64') { + if (isMusl()) { + try { + return require('./tailwindcss-oxide.linux-loong64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-loong64-musl') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-musl/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.linux-loong64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-loong64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-loong64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'riscv64') { + if (isMusl()) { + try { + return require('./tailwindcss-oxide.linux-riscv64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-riscv64-musl') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-musl/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./tailwindcss-oxide.linux-riscv64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-riscv64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-riscv64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'ppc64') { + try { + return require('./tailwindcss-oxide.linux-ppc64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-ppc64-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-ppc64-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 's390x') { + try { + return require('./tailwindcss-oxide.linux-s390x-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-linux-s390x-gnu') + const bindingPackageVersion = require('@tailwindcss/oxide-linux-s390x-gnu/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) + } + } else if (process.platform === 'openharmony') { + if (process.arch === 'arm64') { + try { + return require('./tailwindcss-oxide.openharmony-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-openharmony-arm64') + const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'x64') { + try { + return require('./tailwindcss-oxide.openharmony-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-openharmony-x64') + const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-x64/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./tailwindcss-oxide.openharmony-arm.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@tailwindcss/oxide-openharmony-arm') + const bindingPackageVersion = require('@tailwindcss/oxide-openharmony-arm/package.json').version + if (bindingPackageVersion !== '4.3.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 4.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)) + } + } else { + loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) + } +} + +nativeBinding = requireNative() + +// NAPI_RS_FORCE_WASI is a tri-state flag: +// unset / any other value → native binding preferred, WASI is only a fallback +// 'true' → force WASI fallback even if native loaded +// 'error' → force WASI and throw if no WASI binding is found +// Treating any non-empty string as truthy (the historical behavior) meant +// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered +// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file. +const forceWasi = + process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error' + +if (!nativeBinding || forceWasi) { + let wasiBinding = null + let wasiBindingError = null + try { + wasiBinding = require('./tailwindcss-oxide.wasi.cjs') + nativeBinding = wasiBinding + } catch (err) { + if (forceWasi) { + wasiBindingError = err + } + } + if (!nativeBinding || forceWasi) { + try { + wasiBinding = require('@tailwindcss/oxide-wasm32-wasi') + nativeBinding = wasiBinding + } catch (err) { + if (forceWasi) { + if (!wasiBindingError) { + wasiBindingError = err + } else { + wasiBindingError.cause = err + } + loadErrors.push(err) + } + } + } + if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) { + const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error') + error.cause = wasiBindingError + throw error + } +} + +if (!nativeBinding) { + if (loadErrors.length > 0) { + throw new Error( + `Cannot find native binding. ` + + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + + 'Please try `npm i` again after removing both package-lock.json and node_modules directory.', + { + cause: loadErrors.reduce((err, cur) => { + cur.cause = err + return cur + }), + }, + ) + } + throw new Error(`Failed to load native binding`) +} + +module.exports = nativeBinding +module.exports.Scanner = nativeBinding.Scanner diff --git a/node_modules/@tailwindcss/oxide/package.json b/node_modules/@tailwindcss/oxide/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e37aaeadace83368f9cb54529e0df347ceb4b01d --- /dev/null +++ b/node_modules/@tailwindcss/oxide/package.json @@ -0,0 +1,75 @@ +{ + "name": "@tailwindcss/oxide", + "version": "4.3.3", + "repository": { + "type": "git", + "url": "git+https://github.com/tailwindlabs/tailwindcss.git", + "directory": "crates/node" + }, + "main": "index.js", + "types": "index.d.ts", + "napi": { + "binaryName": "tailwindcss-oxide", + "packageName": "@tailwindcss/oxide", + "targets": [ + "armv7-linux-androideabi", + "aarch64-linux-android", + "aarch64-apple-darwin", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "armv7-unknown-linux-gnueabihf", + "x86_64-unknown-linux-musl", + "x86_64-unknown-freebsd", + "i686-pc-windows-msvc", + "aarch64-pc-windows-msvc", + "wasm32-wasip1-threads" + ], + "wasm": { + "initialMemory": 16384, + "browser": { + "fs": true + } + } + }, + "license": "MIT", + "devDependencies": { + "@napi-rs/cli": "3.7.0", + "@napi-rs/wasm-runtime": "^1.1.5", + "emnapi": "1.11.1" + }, + "engines": { + "node": ">= 20" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "publishConfig": { + "provenance": true, + "access": "public" + }, + "optionalDependencies": { + "@tailwindcss/oxide-darwin-arm64": "4.3.3", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-x64-musl": "4.3.3", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", + "@tailwindcss/oxide-wasm32-wasi": "4.3.3", + "@tailwindcss/oxide-freebsd-x64": "4.3.3", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.3", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", + "@tailwindcss/oxide-darwin-x64": "4.3.3", + "@tailwindcss/oxide-android-arm64": "4.3.3" + }, + "scripts": { + "build": "pnpm run build:platform && pnpm run build:wasm", + "build:platform": "napi build --platform --release", + "postbuild:platform": "node ./scripts/move-artifacts.mjs", + "build:wasm": "napi build --release --target wasm32-wasip1-threads", + "postbuild:wasm": "node ./scripts/move-artifacts.mjs", + "dev": "cargo watch --quiet --shell 'npm run build'", + "build:debug": "napi build --platform", + "version": "napi version" + } +} \ No newline at end of file diff --git a/node_modules/@tailwindcss/vite/LICENSE b/node_modules/@tailwindcss/vite/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6a82290738a9f78946cbcb4594535d6984086dd --- /dev/null +++ b/node_modules/@tailwindcss/vite/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Tailwind Labs, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@tailwindcss/vite/README.md b/node_modules/@tailwindcss/vite/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1a5d25c736520e2bbd6a181718a08be0186e3745 --- /dev/null +++ b/node_modules/@tailwindcss/vite/README.md @@ -0,0 +1,76 @@ +

+ + + + + Tailwind CSS + + +

+ +

+ A utility-first CSS framework for rapidly building custom user interfaces. +

+ +

+ Build Status + Total Downloads + Latest Release + License +

+ +--- + +## Documentation + +For full documentation, visit [tailwindcss.com](https://tailwindcss.com). + +## Community + +For help, discussion about best practices, or feature ideas: + +[Discuss Tailwind CSS on GitHub](https://github.com/tailwindlabs/tailwindcss/discussions) + +## Contributing + +If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindlabs/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**. + +--- + +## `@tailwindcss/vite` plugin API + +### Enabling or disabling Lightning CSS + +By default, this plugin detects whether or not the CSS is being built for production by checking the `NODE_ENV` environment variable. When building for production Lightning CSS will be enabled otherwise it is disabled. + +If you want to always enable or disable Lightning CSS the `optimize` option may be used: + +```js +import tailwindcss from '@tailwindcss/vite' +import { defineConfig } from 'vite' + +export default defineConfig({ + plugins: [ + tailwindcss({ + // Disable Lightning CSS optimization + optimize: false, + }), + ], +}) +``` + +It's also possible to keep Lightning CSS enabled but disable minification: + +```js +import tailwindcss from '@tailwindcss/vite' +import { defineConfig } from 'vite' + +export default defineConfig({ + plugins: [ + tailwindcss({ + // Enable Lightning CSS but disable minification + optimize: { minify: false }, + }), + ], +}) +``` diff --git a/node_modules/@tailwindcss/vite/dist/index.d.mts b/node_modules/@tailwindcss/vite/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..67287edc9a5c7a4d241f1440e07691867cacd5a1 --- /dev/null +++ b/node_modules/@tailwindcss/vite/dist/index.d.mts @@ -0,0 +1,13 @@ +import { Plugin } from 'vite'; + +type PluginOptions = { + /** + * Optimize and minify the output CSS. + */ + optimize?: boolean | { + minify?: boolean; + }; +}; +declare function tailwindcss(opts?: PluginOptions): Plugin[]; + +export { type PluginOptions, tailwindcss as default }; diff --git a/node_modules/@tailwindcss/vite/dist/index.mjs b/node_modules/@tailwindcss/vite/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a6db9f128b86aab5d8efcef9dd206f6d1d6d3f5f --- /dev/null +++ b/node_modules/@tailwindcss/vite/dist/index.mjs @@ -0,0 +1 @@ +var W=(n,r)=>(r=Symbol[n])?r:Symbol.for("Symbol."+n),J=n=>{throw TypeError(n)};var E=(n,r,e)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&J("Object expected");var t,m;e&&(t=r[W("asyncDispose")]),t===void 0&&(t=r[W("dispose")],e&&(m=t)),typeof t!="function"&&J("Object not disposable"),m&&(t=function(){try{m.call(this)}catch(c){return Promise.reject(c)}}),n.push([e,t,r])}else e&&n.push([e]);return r},F=(n,r,e)=>{var t=typeof SuppressedError=="function"?SuppressedError:function(s,g,R,l){return l=Error(R),l.name="SuppressedError",l.error=s,l.suppressed=g,l},m=s=>r=e?new t(s,r,"An error was suppressed during disposal"):(e=!0,s),c=s=>{for(;s=n.pop();)try{var g=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(g).then(c,R=>(m(R),c()))}catch(R){m(R)}if(e)throw r};return c()};import{compile as A,env as I,Features as b,Instrumentation as N,normalizePath as T,optimize as K,toSourceMap as k}from"@tailwindcss/node";import{clearRequireCache as L}from"@tailwindcss/node/require-cache";import{Scanner as Y}from"@tailwindcss/oxide";import{realpathSync as X}from"fs";import x from"fs/promises";import S from"path";import*as M from"vite";var v=I.DEBUG,D=/[?&](?:worker|sharedworker|raw|url)\b/,B=/\?commonjs-proxy/,_=/[?&]index=\d+\.css$/,Q=/^\.[cm]?[jt]sx?$/;function C(n,r=e=>!0){return async(e,t)=>{let m=S.resolve(t,"__placeholder__.ts");for(let c of n){let s=await c(e,m);if(s&&s!==e&&(s[0]==="."&&(s=S.resolve(t,s)),!!r(s)&&S.isAbsolute(s)))return s}}}function H(n={}){let r=[],e=null,t=new O(l=>new Map),m=new Set,c=!1,s=!0,g=!0;function R(l,i){let d,u;if(l){let p=function(a,h){let w=a.createResolver(h),j;return async(P,G,U,V)=>P.name==="client"||P.name==="ssr"?w(G,U,V,P.name==="ssr"):(j??=M.createIdResolver(a,h),j(P,G,U,V))};var y=p;let f=p(l.config,{...l.config.resolve,extensions:[".css"],mainFields:["style"],conditions:["style","development|production"],tryIndex:!1,preferRelative:!0}),o=p(l.config,l.config.resolve);d=C([(a,h)=>f(l,a,h,!0),(a,h)=>f(l,a,h,!1)],a=>a.endsWith(".css")),u=C([(a,h)=>o(l,a,h,!0),(a,h)=>o(l,a,h,!1)],a=>!a.endsWith(".css"))}else{let p=e.createResolver({...e.resolve,extensions:[".css"],mainFields:["style"],conditions:["style","development|production"],tryIndex:!1,preferRelative:!0}),f=e.createResolver(e.resolve);d=C([(o,a)=>p(o,a,!0,c),(o,a)=>p(o,a,!1,c)],o=>o.endsWith(".css")),u=C([(o,a)=>f(o,a,!0,c),(o,a)=>f(o,a,!1,c)],o=>!o.endsWith(".css"))}return new z(i,e.root,e?.css.devSourcemap??!1,d,u)}return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(l){r.push(l)},async configResolved(l){e=l,c=e.build.ssr!==!1&&e.build.ssr!==void 0,n.optimize!==void 0&&(s=n.optimize!==!1),g=s&&e.build.cssMinify!==!1,typeof n.optimize=="object"&&(g=n.optimize.minify!==!1)}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",enforce:"pre",transform:{filter:{id:{exclude:[/\/\.vite\//,D,B],include:[/\.css(?:\?.*)?$/,/&lang\.css/,_]}},async handler(l,i){var f=[];try{if(!$(i))return;let d=E(f,new N);v&&d.start("[@tailwindcss/vite] Generate CSS (serve)");let u=t.get(this.environment?.name??"default");let y=u.get(i);y||(y??=R(this.environment??null,i),u.set(i,y));let p=await y.generate(l,w=>this.addWatchFile(w),d);if(!p){u.delete(i);return}v&&d.end("[@tailwindcss/vite] Generate CSS (serve)");return p}catch(o){var a=o,h=!0}finally{F(f,a,h)}}},hotUpdate({file:l,modules:i,timestamp:d,server:u}){{if(!(i.length>0&&i.every(f=>f.type==="asset"||f.id===void 0)))return;for(let f of Object.values(u.environments)){if(f.name===this.environment.name)continue;let o=f.moduleGraph.getModulesByFile(l);if(o){for(let a of o)if(a.type!=="asset")return}}let p=S.extname(l);if(Q.test(p)||M.isCSSRequest(l))return;if(p!==""){if(m.has(p))return;for(let f of Object.values(u.environments))for(let o of f.moduleGraph.idToModuleMap.values())if(o.file?.endsWith(p)&&o.type!=="asset"&&o.transformResult!=null&&!(!o.id||o.id.includes("?"))){m.add(p);return}}for(let f of new Set([this.environment.name,"client"])){let o=t.get(f);if(o.size===0||!ee(l,i,o))continue;let a=new Set;for(let h of i)this.environment.moduleGraph.invalidateModule(h,a,d,!0);return f===this.environment.name?this.environment.hot.send({type:"full-reload"}):u.hot.send?u.hot.send({type:"full-reload"}):u.ws.send&&u.ws.send({type:"full-reload"}),[]}}}},{name:"@tailwindcss/vite:generate:build",apply:"build",enforce:"pre",transform:{filter:{id:{exclude:[/\/\.vite\//,D,B],include:[/\.css(?:\?.*)?$/,/&lang\.css/,_]}},async handler(l,i){var f=[];try{if(!$(i))return;let d=E(f,new N);v&&d.start("[@tailwindcss/vite] Generate CSS (build)");let u=t.get(this.environment?.name??"default");let y=u.get(i);y||(y??=R(this.environment??null,i),u.set(i,y));let p=await y.generate(l,w=>this.addWatchFile(w),d);if(!p){u.delete(i);return}v&&d.end("[@tailwindcss/vite] Generate CSS (build)");s&&(v&&d.start("[@tailwindcss/vite] Optimize CSS"),p=K(p.code,{minify:g,map:p.map}),v&&d.end("[@tailwindcss/vite] Optimize CSS"));return p}catch(o){var a=o,h=!0}finally{F(f,a,h)}}}}]}function Z(n){let[r]=n.split("?",2);return S.extname(r).slice(1)}function $(n){return n.includes("/.vite/")||D.test(n)||B.test(n)?!1:Z(n)==="css"||n.includes("&lang.css")||n.match(_)}function q(n){return S.resolve(n.replace(/\?.*$/,""))}var O=class extends Map{constructor(e){super();this.factory=e}factory;get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e,this),this.set(e,t)),t}},z=class{constructor(r,e,t,m,c){this.id=r;this.base=e;this.enableSourceMaps=t;this.customCssResolver=m;this.customJsResolver=c}id;base;enableSourceMaps;customCssResolver;customJsResolver;compiler;scanner;candidates=new Set;buildDependencies=new Map;get scannedFiles(){return this.scanner?.files??[]}async generate(r,e,t){let m=q(this.id);function c(i){i!==m&&(/[#?].*\.svg$/.test(i)||e(i))}let s=this.requiresBuild(),g=S.dirname(S.resolve(m));if(!this.compiler||!this.scanner||await s){L(Array.from(this.buildDependencies.keys())),this.buildDependencies.clear(),this.addBuildDependency(q(m)),v&&t.start("Setup compiler");let i=[];this.compiler=await A(r,{from:this.enableSourceMaps?this.id:void 0,base:g,shouldRewriteUrls:!0,onDependency:u=>{c(u),i.push(this.addBuildDependency(u))},customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver}),await Promise.all(i),v&&t.end("Setup compiler"),v&&t.start("Setup scanner");let d=(this.compiler.root==="none"?[]:this.compiler.root===null?[{base:this.base,pattern:"**/*",negated:!1}]:[{...this.compiler.root,negated:!1}]).concat(this.compiler.sources);this.scanner=new Y({sources:d}),v&&t.end("Setup scanner")}else for(let i of this.buildDependencies.keys())c(i);if(!(this.compiler.features&(b.AtApply|b.JsPluginCompat|b.ThemeFunction|b.Utilities|b.Variants)))return!1;if(this.compiler.features&b.Utilities){v&&t.start("Scan for candidates");for(let i of this.scanner.scan())this.candidates.add(i);v&&t.end("Scan for candidates")}if(this.compiler.features&b.Utilities){v&&t.start("Register dependency messages");for(let i of this.scanner.files)c(i);for(let i of this.scanner.globs){if(i.pattern[0]==="!")continue;let d=S.relative(this.base,i.base);d[0]!=="."&&(d="./"+d),d=T(d),c(S.posix.join(d,i.pattern));let u=this.compiler.root;if(u!=="none"&&u!==null){let y=T(S.resolve(u.base,u.pattern));if(!await x.stat(y).then(f=>f.isDirectory(),()=>!1))throw new Error(`The path given to \`source(\u2026)\` must be a directory but got \`source(${y})\` instead.`)}}v&&t.end("Register dependency messages")}v&&t.start("Build CSS");let R=this.compiler.build([...this.candidates]);v&&t.end("Build CSS"),v&&t.start("Build Source Map");let l=this.enableSourceMaps?k(this.compiler.buildSourceMap()).raw:void 0;return v&&t.end("Build Source Map"),{code:R,map:l}}async addBuildDependency(r){let e=null;try{e=(await x.stat(r)).mtimeMs}catch{}this.buildDependencies.set(r,e)}async requiresBuild(){for(let[r,e]of this.buildDependencies){if(e===null)return!0;try{if((await x.stat(r)).mtimeMs>e)return!0}catch{return!0}}return!1}};function ee(n,r,e){let t=new Set,m=[...r],c={file:n,get realpath(){try{let s=X(n);return Object.defineProperty(c,"realpath",{value:s}),s}catch{return null}}};for(;m.length>0;){let s=m.shift();if(!t.has(s)){if(t.add(s),s.id){let g=e.get(s.id);if(g&&(g.scannedFiles.includes(c.file)||c.realpath&&g.scannedFiles.includes(c.realpath)))return!0}for(let g of s.importers)m.push(g)}}return!1}export{H as default}; diff --git a/node_modules/@tailwindcss/vite/package.json b/node_modules/@tailwindcss/vite/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7e6b954004ffeb23ac43d4b1e964f3cea2247502 --- /dev/null +++ b/node_modules/@tailwindcss/vite/package.json @@ -0,0 +1,42 @@ +{ + "name": "@tailwindcss/vite", + "version": "4.3.3", + "description": "A utility-first CSS framework for rapidly building custom user interfaces.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tailwindlabs/tailwindcss.git", + "directory": "packages/@tailwindcss-vite" + }, + "bugs": "https://github.com/tailwindlabs/tailwindcss/issues", + "homepage": "https://tailwindcss.com", + "files": [ + "dist/" + ], + "publishConfig": { + "provenance": true, + "access": "public" + }, + "exports": { + ".": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + } + }, + "dependencies": { + "@tailwindcss/oxide": "4.3.3", + "@tailwindcss/node": "4.3.3", + "tailwindcss": "4.3.3" + }, + "devDependencies": { + "@types/node": "22.19.21", + "vite": "^8.1.2" + }, + "peerDependencies": { + "vite": "^5.2.0 || ^6 || ^7 || ^8" + }, + "scripts": { + "build": "tsup-node", + "dev": "pnpm run build -- --watch" + } +} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.cts b/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..11c0bc6093fa54fc7dea07311297128475a85e34 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.cts @@ -0,0 +1,2188 @@ +export declare type Action = ContinueAction_2 | ErrorAction_2 | FailedAction_2 | PendingAction | PauseAction_2 | SuccessAction_2; + +export declare type Action_alias_1 = ContinueAction | ErrorAction | FailedAction | FetchAction | InvalidateAction | PauseAction | SetStateAction | SuccessAction; + +export declare function addConsumeAwareSignal(object: T, getSignal: () => AbortSignal, onCancelled: VoidFunction): T & { + signal: AbortSignal; +}; + +export declare function addToEnd(items: Array, item: T, max?: number): Array; + +export declare function addToStart(items: Array, item: T, max?: number): Array; + +declare type AnyDataTag = { + [dataTagSymbol]: any; + [dataTagErrorSymbol]: any; +}; +export { AnyDataTag } +export { AnyDataTag as AnyDataTag_alias_1 } + +declare type BaseStreamedQueryParams = { + streamFn: (context: QueryFunctionContext) => AsyncIterable | Promise>; + refetchMode?: 'append' | 'reset' | 'replace'; +}; + +declare type BatchCallsCallback> = (...args: T) => void; + +declare type BatchNotifyFunction = (callback: () => void) => void; + +declare class CancelledError extends Error { + revert?: boolean; + silent?: boolean; + constructor(options?: CancelOptions); +} +export { CancelledError } +export { CancelledError as CancelledError_alias_1 } + +declare interface CancelOptions { + revert?: boolean; + silent?: boolean; +} +export { CancelOptions } +export { CancelOptions as CancelOptions_alias_1 } + +export declare function canFetch(networkMode: NetworkMode | undefined): boolean; + +declare type CombineFn = (result: Array) => TCombinedResult; + +declare interface ContinueAction { + type: 'continue'; +} + +declare interface ContinueAction_2 { + type: 'continue'; +} + +export declare function createNotifyManager(): { + readonly batch: (callback: () => T) => T; + /** + * All calls to the wrapped function will be batched. + */ + readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; + readonly schedule: (callback: NotifyCallback) => void; + /** + * Use this method to set a custom notify function. + * This can be used to for example wrap notifications with `React.act` while running tests. + */ + readonly setNotifyFunction: (fn: NotifyFunction) => void; + /** + * Use this method to set a custom function to batch notifications together into a single tick. + * By default React Query will use the batch function provided by ReactDOM or React Native. + */ + readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + readonly setScheduler: (fn: ScheduleFunction) => void; +}; + +export declare function createRetryer(config: RetryerConfig): Retryer; + +declare type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagSymbol]: TValue; + [dataTagErrorSymbol]: TError; +}; +export { DataTag } +export { DataTag as DataTag_alias_1 } + +declare const dataTagErrorSymbol: unique symbol; + +declare type dataTagErrorSymbol = typeof dataTagErrorSymbol; +export { dataTagErrorSymbol } +export { dataTagErrorSymbol as dataTagErrorSymbol_alias_1 } + +declare const dataTagSymbol: unique symbol; + +declare type dataTagSymbol = typeof dataTagSymbol; +export { dataTagSymbol } +export { dataTagSymbol as dataTagSymbol_alias_1 } + +declare type DefaultedInfiniteQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; +export { DefaultedInfiniteQueryObserverOptions } +export { DefaultedInfiniteQueryObserverOptions as DefaultedInfiniteQueryObserverOptions_alias_1 } + +declare type DefaultedQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; +export { DefaultedQueryObserverOptions } +export { DefaultedQueryObserverOptions as DefaultedQueryObserverOptions_alias_1 } + +declare type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; +export { DefaultError } +export { DefaultError as DefaultError_alias_1 } + +declare interface DefaultOptions { + queries?: OmitKeyof, 'suspense' | 'queryKey'>; + mutations?: MutationObserverOptions; + hydrate?: HydrateOptions['defaultOptions']; + dehydrate?: DehydrateOptions; +} +export { DefaultOptions } +export { DefaultOptions as DefaultOptions_alias_1 } + +declare const defaultScheduler: ScheduleFunction; +export { defaultScheduler } +export { defaultScheduler as defaultScheduler_alias_1 } + +declare function defaultShouldDehydrateMutation(mutation: Mutation): boolean; +export { defaultShouldDehydrateMutation } +export { defaultShouldDehydrateMutation as defaultShouldDehydrateMutation_alias_1 } + +declare function defaultShouldDehydrateQuery(query: Query): boolean; +export { defaultShouldDehydrateQuery } +export { defaultShouldDehydrateQuery as defaultShouldDehydrateQuery_alias_1 } + +export declare const defaultTimeoutProvider: TimeoutProvider; + +declare type DefinedInfiniteQueryObserverResult = InfiniteQueryObserverRefetchErrorResult | InfiniteQueryObserverSuccessResult; +export { DefinedInfiniteQueryObserverResult } +export { DefinedInfiniteQueryObserverResult as DefinedInfiniteQueryObserverResult_alias_1 } + +declare type DefinedQueryObserverResult = QueryObserverRefetchErrorResult | QueryObserverSuccessResult; +export { DefinedQueryObserverResult } +export { DefinedQueryObserverResult as DefinedQueryObserverResult_alias_1 } + +declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState; +export { dehydrate } +export { dehydrate as dehydrate_alias_1 } + +declare interface DehydratedMutation { + mutationKey?: MutationKey; + state: MutationState; + meta?: MutationMeta; + scope?: MutationScope; +} + +declare interface DehydratedQuery { + queryHash: string; + queryKey: QueryKey; + state: QueryState; + promise?: Promise; + meta?: QueryMeta; + queryType?: 'infinite'; + dehydratedAt?: number; +} + +declare interface DehydratedState { + mutations: Array; + queries: Array; +} +export { DehydratedState } +export { DehydratedState as DehydratedState_alias_1 } + +declare interface DehydrateOptions { + serializeData?: TransformerFn; + shouldDehydrateMutation?: (mutation: Mutation) => boolean; + shouldDehydrateQuery?: (query: Query) => boolean; + shouldRedactErrors?: (error: unknown) => boolean; +} +export { DehydrateOptions } +export { DehydrateOptions as DehydrateOptions_alias_1 } + +declare type DistributiveOmit = TObject extends any ? Omit : never; +export { DistributiveOmit } +export { DistributiveOmit as DistributiveOmit_alias_1 } + +declare type DropLast> = T extends readonly [ +...infer R, +unknown +] ? readonly [...R] : never; + +declare type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; +export { EnsureInfiniteQueryDataOptions } +export { EnsureInfiniteQueryDataOptions as EnsureInfiniteQueryDataOptions_alias_1 } + +declare interface EnsureQueryDataOptions extends FetchQueryOptions { + revalidateIfStale?: boolean; +} +export { EnsureQueryDataOptions } +export { EnsureQueryDataOptions as EnsureQueryDataOptions_alias_1 } + +export declare function ensureQueryFn(options: { + queryFn?: QueryFunction | SkipToken; + queryHash?: string; +}, fetchOptions?: FetchOptions): QueryFunction; + +/** + * Manages environment detection used by TanStack Query internals. + */ +declare const environmentManager: { + /** + * Returns whether the current runtime should be treated as a server environment. + */ + isServer(): boolean; + /** + * Overrides the server check globally. + */ + setIsServer(isServerValue: IsServerValue): void; +}; +export { environmentManager } +export { environmentManager as environmentManager_alias_1 } + +declare interface ErrorAction { + type: 'error'; + error: TError; +} + +declare interface ErrorAction_2 { + type: 'error'; + error: TError; +} + +declare interface FailedAction { + type: 'failed'; + failureCount: number; + error: TError; +} + +declare interface FailedAction_2 { + type: 'failed'; + failureCount: number; + error: TError | null; +} + +declare interface FetchAction { + type: 'fetch'; + meta?: FetchMeta; +} + +export declare interface FetchContext { + fetchFn: () => unknown | Promise; + fetchOptions?: FetchOptions; + signal: AbortSignal; + options: QueryOptions; + client: QueryClient; + queryKey: TQueryKey; + state: QueryState; +} + +export declare type FetchDirection = 'forward' | 'backward'; + +declare type FetchInfiniteQueryOptions = Omit, TQueryKey, TPageParam>, 'initialPageParam'> & InitialPageParam & FetchInfiniteQueryPages; +export { FetchInfiniteQueryOptions } +export { FetchInfiniteQueryOptions as FetchInfiniteQueryOptions_alias_1 } + +declare type FetchInfiniteQueryPages = { + pages?: never; +} | { + pages: number; + getNextPageParam: GetNextPageParamFunction; +}; + +export declare interface FetchMeta { + fetchMore?: { + direction: FetchDirection; + }; +} + +declare interface FetchNextPageOptions extends ResultOptions { + /** + * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time, + * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. + * + * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { FetchNextPageOptions } +export { FetchNextPageOptions as FetchNextPageOptions_alias_1 } + +export declare interface FetchOptions { + cancelRefetch?: boolean; + meta?: FetchMeta; + initialPromise?: Promise; +} + +declare interface FetchPreviousPageOptions extends ResultOptions { + /** + * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time, + * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. + * + * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { FetchPreviousPageOptions } +export { FetchPreviousPageOptions as FetchPreviousPageOptions_alias_1 } + +declare interface FetchQueryOptions extends WithRequired, 'queryKey'> { + initialPageParam?: never; + /** + * The time in milliseconds after data is considered stale. + * If the data is fresh it will be returned from the cache. + */ + staleTime?: StaleTimeFunction; +} +export { FetchQueryOptions } +export { FetchQueryOptions as FetchQueryOptions_alias_1 } + +export declare function fetchState(data: TData | undefined, options: QueryOptions): { + readonly error?: null | undefined; + readonly status?: "pending" | undefined; + readonly fetchFailureCount: 0; + readonly fetchFailureReason: null; + readonly fetchStatus: "fetching" | "paused"; +}; + +declare type FetchStatus = 'fetching' | 'paused' | 'idle'; +export { FetchStatus } +export { FetchStatus as FetchStatus_alias_1 } + +export declare class FocusManager extends Subscribable { + #private; + constructor(); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + setEventListener(setup: SetupFn): void; + setFocused(focused?: boolean): void; + onFocus(): void; + isFocused(): boolean; +} + +declare const focusManager: FocusManager; +export { focusManager } +export { focusManager as focusManager_alias_1 } + +/** + * Thenable types which matches React's types for promises + * + * React seemingly uses `.status`, `.value` and `.reason` properties on a promises to optimistically unwrap data from promises + * + * @see https://github.com/facebook/react/blob/main/packages/shared/ReactTypes.js#L112-L138 + * @see https://github.com/facebook/react/blob/4f604941569d2e8947ce1460a0b2997e835f37b9/packages/react-debug-tools/src/ReactDebugHooks.js#L224-L227 + */ +declare interface Fulfilled { + status: 'fulfilled'; + value: T; +} + +export declare type FulfilledThenable = Promise & Fulfilled; + +export declare function functionalUpdate(updater: Updater, input: TInput): TOutput; + +export declare function getDefaultState(): MutationState; + +declare type GetNextPageParamFunction = (lastPage: TQueryFnData, allPages: Array, lastPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; +export { GetNextPageParamFunction } +export { GetNextPageParamFunction as GetNextPageParamFunction_alias_1 } + +declare type GetPreviousPageParamFunction = (firstPage: TQueryFnData, allPages: Array, firstPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; +export { GetPreviousPageParamFunction } +export { GetPreviousPageParamFunction as GetPreviousPageParamFunction_alias_1 } + +/** + * Default query & mutation keys hash function. + * Hashes the value into a stable hash. + */ +declare function hashKey(queryKey: QueryKey | MutationKey): string; +export { hashKey } +export { hashKey as hashKey_alias_1 } + +export declare function hashQueryKeyByOptions(queryKey: TQueryKey, options?: Pick, 'queryKeyHashFn'>): string; + +/** + * Checks if there is a next page. + */ +export declare function hasNextPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; + +/** + * Checks if there is a previous page. + */ +export declare function hasPreviousPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; + +declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void; +export { hydrate } +export { hydrate as hydrate_alias_1 } + +declare interface HydrateOptions { + defaultOptions?: { + deserializeData?: TransformerFn; + queries?: QueryOptions; + mutations?: MutationOptions; + }; +} +export { HydrateOptions } +export { HydrateOptions as HydrateOptions_alias_1 } + +declare type InferDataFromTag = TTaggedQueryKey extends DataTag ? TaggedValue : TQueryFnData; +export { InferDataFromTag } +export { InferDataFromTag as InferDataFromTag_alias_1 } + +declare type InferErrorFromTag = TTaggedQueryKey extends DataTag ? TaggedError extends UnsetMarker ? TError : TaggedError : TError; +export { InferErrorFromTag } +export { InferErrorFromTag as InferErrorFromTag_alias_1 } + +declare interface InfiniteData { + pages: Array; + pageParams: Array; +} +export { InfiniteData } +export { InfiniteData as InfiniteData_alias_1 } + +export declare function infiniteQueryBehavior(pages?: number): QueryBehavior>; + +declare class InfiniteQueryObserver, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends QueryObserver, TQueryKey> { + subscribe: Subscribable>['subscribe']; + getCurrentResult: ReplaceReturnType, TQueryKey>['getCurrentResult'], InfiniteQueryObserverResult>; + protected fetch: ReplaceReturnType, TQueryKey>['fetch'], Promise>>; + constructor(client: QueryClient, options: InfiniteQueryObserverOptions); + protected bindMethods(): void; + setOptions(options: InfiniteQueryObserverOptions): void; + getOptimisticResult(options: DefaultedInfiniteQueryObserverOptions): InfiniteQueryObserverResult; + fetchNextPage(options?: FetchNextPageOptions): Promise>; + fetchPreviousPage(options?: FetchPreviousPageOptions): Promise>; + protected createResult(query: Query, TQueryKey>, options: InfiniteQueryObserverOptions): InfiniteQueryObserverResult; +} +export { InfiniteQueryObserver } +export { InfiniteQueryObserver as InfiniteQueryObserver_alias_1 } + +declare interface InfiniteQueryObserverBaseResult extends QueryObserverBaseResult { + /** + * This function allows you to fetch the next "page" of results. + */ + fetchNextPage: (options?: FetchNextPageOptions) => Promise>; + /** + * This function allows you to fetch the previous "page" of results. + */ + fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise>; + /** + * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). + */ + hasNextPage: boolean; + /** + * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). + */ + hasPreviousPage: boolean; + /** + * Will be `true` if the query failed while fetching the next page. + */ + isFetchNextPageError: boolean; + /** + * Will be `true` while fetching the next page with `fetchNextPage`. + */ + isFetchingNextPage: boolean; + /** + * Will be `true` if the query failed while fetching the previous page. + */ + isFetchPreviousPageError: boolean; + /** + * Will be `true` while fetching the previous page with `fetchPreviousPage`. + */ + isFetchingPreviousPage: boolean; +} +export { InfiniteQueryObserverBaseResult } +export { InfiniteQueryObserverBaseResult as InfiniteQueryObserverBaseResult_alias_1 } + +declare type InfiniteQueryObserverListener = (result: InfiniteQueryObserverResult) => void; + +declare interface InfiniteQueryObserverLoadingErrorResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: true; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { InfiniteQueryObserverLoadingErrorResult } +export { InfiniteQueryObserverLoadingErrorResult as InfiniteQueryObserverLoadingErrorResult_alias_1 } + +declare interface InfiniteQueryObserverLoadingResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoading: true; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { InfiniteQueryObserverLoadingResult } +export { InfiniteQueryObserverLoadingResult as InfiniteQueryObserverLoadingResult_alias_1 } + +declare interface InfiniteQueryObserverOptions extends QueryObserverOptions, TQueryKey, TPageParam>, InfiniteQueryPageParamsOptions { +} +export { InfiniteQueryObserverOptions } +export { InfiniteQueryObserverOptions as InfiniteQueryObserverOptions_alias_1 } + +declare interface InfiniteQueryObserverPendingResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { InfiniteQueryObserverPendingResult } +export { InfiniteQueryObserverPendingResult as InfiniteQueryObserverPendingResult_alias_1 } + +declare interface InfiniteQueryObserverPlaceholderResult extends InfiniteQueryObserverBaseResult { + data: TData; + isError: false; + error: null; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: true; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + status: 'success'; +} +export { InfiniteQueryObserverPlaceholderResult } +export { InfiniteQueryObserverPlaceholderResult as InfiniteQueryObserverPlaceholderResult_alias_1 } + +declare interface InfiniteQueryObserverRefetchErrorResult extends InfiniteQueryObserverBaseResult { + data: TData; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: true; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { InfiniteQueryObserverRefetchErrorResult } +export { InfiniteQueryObserverRefetchErrorResult as InfiniteQueryObserverRefetchErrorResult_alias_1 } + +declare type InfiniteQueryObserverResult = DefinedInfiniteQueryObserverResult | InfiniteQueryObserverLoadingErrorResult | InfiniteQueryObserverLoadingResult | InfiniteQueryObserverPendingResult | InfiniteQueryObserverPlaceholderResult; +export { InfiniteQueryObserverResult } +export { InfiniteQueryObserverResult as InfiniteQueryObserverResult_alias_1 } + +declare interface InfiniteQueryObserverSuccessResult extends InfiniteQueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: true; + isPlaceholderData: false; + status: 'success'; +} +export { InfiniteQueryObserverSuccessResult } +export { InfiniteQueryObserverSuccessResult as InfiniteQueryObserverSuccessResult_alias_1 } + +declare interface InfiniteQueryPageParamsOptions extends InitialPageParam { + /** + * This function can be set to automatically get the previous cursor for infinite queries. + * The result will also be used to determine the value of `hasPreviousPage`. + */ + getPreviousPageParam?: GetPreviousPageParamFunction; + /** + * This function can be set to automatically get the next cursor for infinite queries. + * The result will also be used to determine the value of `hasNextPage`. + */ + getNextPageParam: GetNextPageParamFunction; +} +export { InfiniteQueryPageParamsOptions } +export { InfiniteQueryPageParamsOptions as InfiniteQueryPageParamsOptions_alias_1 } + +declare type InitialDataFunction = () => T | undefined; +export { InitialDataFunction } +export { InitialDataFunction as InitialDataFunction_alias_1 } + +declare interface InitialPageParam { + initialPageParam: TPageParam; +} +export { InitialPageParam } +export { InitialPageParam as InitialPageParam_alias_1 } + +declare interface InvalidateAction { + type: 'invalidate'; +} + +declare interface InvalidateOptions extends RefetchOptions { +} +export { InvalidateOptions } +export { InvalidateOptions as InvalidateOptions_alias_1 } + +declare interface InvalidateQueryFilters extends QueryFilters { + refetchType?: QueryTypeFilter | 'none'; +} +export { InvalidateQueryFilters } +export { InvalidateQueryFilters as InvalidateQueryFilters_alias_1 } + +/** + * @deprecated Use instanceof `CancelledError` instead. + */ +declare function isCancelledError(value: any): value is CancelledError; +export { isCancelledError } +export { isCancelledError as isCancelledError_alias_1 } + +export declare function isPlainArray(value: unknown): value is Array; + +export declare function isPlainObject(o: any): o is Record; + +/** @deprecated + * use `environmentManager.isServer()` instead. + */ +declare const isServer: boolean; +export { isServer } +export { isServer as isServer_alias_1 } + +export declare type IsServerValue = () => boolean; + +export declare function isValidTimeout(value: unknown): value is number; + +declare function keepPreviousData(previousData: T | undefined): T | undefined; +export { keepPreviousData } +export { keepPreviousData as keepPreviousData_alias_1 } + +declare type Listener = (focused: boolean) => void; + +declare type Listener_2 = (online: boolean) => void; + +/** + * Wrapping `setTimeout` is awkward from a typing perspective because platform + * typings may extend the return type of `setTimeout`. For example, NodeJS + * typings add `NodeJS.Timeout`; but a non-default `timeoutManager` may not be + * able to return such a type. + */ +declare type ManagedTimerId = number | { + [Symbol.toPrimitive]: () => number; +}; +export { ManagedTimerId } +export { ManagedTimerId as ManagedTimerId_alias_1 } + +declare function matchMutation(filters: MutationFilters, mutation: Mutation): boolean; +export { matchMutation } +export { matchMutation as matchMutation_alias_1 } + +declare function matchQuery(filters: QueryFilters, query: Query): boolean; +export { matchQuery } +export { matchQuery as matchQuery_alias_1 } + +declare type MutateFunction = (variables: TVariables, options?: MutateOptions) => Promise; +export { MutateFunction } +export { MutateFunction as MutateFunction_alias_1 } + +declare interface MutateOptions { + onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; + onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; + onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; +} +export { MutateOptions } +export { MutateOptions as MutateOptions_alias_1 } + +declare class Mutation extends Removable { + #private; + state: MutationState; + options: MutationOptions; + readonly mutationId: number; + constructor(config: MutationConfig); + setOptions(options: MutationOptions): void; + get meta(): MutationMeta | undefined; + addObserver(observer: MutationObserver_2): void; + removeObserver(observer: MutationObserver_2): void; + protected optionalRemove(): void; + continue(): Promise; + execute(variables: TVariables): Promise; +} +export { Mutation } +export { Mutation as Mutation_alias_1 } + +declare class MutationCache extends Subscribable { + #private; + config: MutationCacheConfig; + constructor(config?: MutationCacheConfig); + build(client: QueryClient, options: MutationOptions, state?: MutationState): Mutation; + add(mutation: Mutation): void; + remove(mutation: Mutation): void; + canRun(mutation: Mutation): boolean; + runNext(mutation: Mutation): Promise; + clear(): void; + getAll(): Array; + find(filters: MutationFilters): Mutation | undefined; + findAll(filters?: MutationFilters): Array; + notify(event: MutationCacheNotifyEvent): void; + resumePausedMutations(): Promise; +} +export { MutationCache } +export { MutationCache as MutationCache_alias_1 } + +declare interface MutationCacheConfig { + onError?: (error: DefaultError, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onSuccess?: (data: unknown, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onMutate?: (variables: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onSettled?: (data: unknown | undefined, error: DefaultError | null, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; +} + +declare type MutationCacheListener = (event: MutationCacheNotifyEvent) => void; + +declare type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated; +export { MutationCacheNotifyEvent } +export { MutationCacheNotifyEvent as MutationCacheNotifyEvent_alias_1 } + +declare interface MutationConfig { + client: QueryClient; + mutationId: number; + mutationCache: MutationCache; + options: MutationOptions; + state?: MutationState; +} + +declare interface MutationFilters { + /** + * Match mutation key exactly + */ + exact?: boolean; + /** + * Include mutations matching this predicate function + */ + predicate?: (mutation: Mutation) => boolean; + /** + * Include mutations matching this mutation key + */ + mutationKey?: TuplePrefixes; + /** + * Filter by mutation status + */ + status?: MutationStatus; +} +export { MutationFilters } +export { MutationFilters as MutationFilters_alias_1 } + +declare type MutationFunction = (variables: TVariables, context: MutationFunctionContext) => Promise; +export { MutationFunction } +export { MutationFunction as MutationFunction_alias_1 } + +declare type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; +export { MutationFunctionContext } +export { MutationFunctionContext as MutationFunctionContext_alias_1 } + +declare type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends Array ? TMutationKey : ReadonlyArray : ReadonlyArray; +export { MutationKey } +export { MutationKey as MutationKey_alias_1 } + +declare type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +export { MutationMeta } +export { MutationMeta as MutationMeta_alias_1 } + +declare class MutationObserver_2 extends Subscribable> { + #private; + options: MutationObserverOptions; + constructor(client: QueryClient, options: MutationObserverOptions); + protected bindMethods(): void; + setOptions(options: MutationObserverOptions): void; + protected onUnsubscribe(): void; + onMutationUpdate(action: Action): void; + getCurrentResult(): MutationObserverResult; + reset(): void; + mutate(variables: TVariables, options?: MutateOptions): Promise; +} +export { MutationObserver_2 as MutationObserver } +export { MutationObserver_2 as MutationObserver_alias_1 } + +declare interface MutationObserverBaseResult extends MutationState { + /** + * The last successfully resolved data for the mutation. + */ + data: TData | undefined; + /** + * The variables object passed to the `mutationFn`. + */ + variables: TVariables | undefined; + /** + * The error object for the mutation, if an error was encountered. + * - Defaults to `null`. + */ + error: TError | null; + /** + * A boolean variable derived from `status`. + * - `true` if the last mutation attempt resulted in an error. + */ + isError: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the mutation is in its initial state prior to executing. + */ + isIdle: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the mutation is currently executing. + */ + isPending: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the last mutation attempt was successful. + */ + isSuccess: boolean; + /** + * The status of the mutation. + * - Will be: + * - `idle` initial status prior to the mutation function executing. + * - `pending` if the mutation is currently executing. + * - `error` if the last mutation attempt resulted in an error. + * - `success` if the last mutation attempt was successful. + */ + status: MutationStatus; + /** + * The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. + * @param variables - The variables object to pass to the `mutationFn`. + * @param options.onSuccess - This function will fire when the mutation is successful and will be passed the mutation's result. + * @param options.onError - This function will fire if the mutation encounters an error and will be passed the error. + * @param options.onSettled - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error. + * @remarks + * - If you make multiple requests, `onSuccess` will fire only after the latest call you've made. + * - All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored. + */ + mutate: MutateFunction; + /** + * A function to clean the mutation internal state (i.e., it resets the mutation to its initial state). + */ + reset: () => void; +} +export { MutationObserverBaseResult } +export { MutationObserverBaseResult as MutationObserverBaseResult_alias_1 } + +declare interface MutationObserverErrorResult extends MutationObserverBaseResult { + data: undefined; + error: TError; + variables: TVariables; + isError: true; + isIdle: false; + isPending: false; + isSuccess: false; + status: 'error'; +} +export { MutationObserverErrorResult } +export { MutationObserverErrorResult as MutationObserverErrorResult_alias_1 } + +declare interface MutationObserverIdleResult extends MutationObserverBaseResult { + data: undefined; + variables: undefined; + error: null; + isError: false; + isIdle: true; + isPending: false; + isSuccess: false; + status: 'idle'; +} +export { MutationObserverIdleResult } +export { MutationObserverIdleResult as MutationObserverIdleResult_alias_1 } + +declare type MutationObserverListener = (result: MutationObserverResult) => void; + +declare interface MutationObserverLoadingResult extends MutationObserverBaseResult { + data: undefined; + variables: TVariables; + error: null; + isError: false; + isIdle: false; + isPending: true; + isSuccess: false; + status: 'pending'; +} +export { MutationObserverLoadingResult } +export { MutationObserverLoadingResult as MutationObserverLoadingResult_alias_1 } + +declare interface MutationObserverOptions extends MutationOptions { + throwOnError?: boolean | ((error: TError) => boolean); +} +export { MutationObserverOptions } +export { MutationObserverOptions as MutationObserverOptions_alias_1 } + +declare type MutationObserverResult = MutationObserverIdleResult | MutationObserverLoadingResult | MutationObserverErrorResult | MutationObserverSuccessResult; +export { MutationObserverResult } +export { MutationObserverResult as MutationObserverResult_alias_1 } + +declare interface MutationObserverSuccessResult extends MutationObserverBaseResult { + data: TData; + error: null; + variables: TVariables; + isError: false; + isIdle: false; + isPending: false; + isSuccess: true; + status: 'success'; +} +export { MutationObserverSuccessResult } +export { MutationObserverSuccessResult as MutationObserverSuccessResult_alias_1 } + +declare interface MutationOptions { + mutationFn?: MutationFunction; + mutationKey?: MutationKey; + onMutate?: (variables: TVariables, context: MutationFunctionContext) => Promise | TOnMutateResult; + onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => Promise | unknown; + onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; + onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode?: NetworkMode; + gcTime?: number; + _defaulted?: boolean; + meta?: MutationMeta; + scope?: MutationScope; +} +export { MutationOptions } +export { MutationOptions as MutationOptions_alias_1 } + +declare type MutationScope = { + id: string; +}; +export { MutationScope } +export { MutationScope as MutationScope_alias_1 } + +declare interface MutationState { + context: TOnMutateResult | undefined; + data: TData | undefined; + error: TError | null; + failureCount: number; + failureReason: TError | null; + isPaused: boolean; + status: MutationStatus; + variables: TVariables | undefined; + submittedAt: number; +} +export { MutationState } +export { MutationState as MutationState_alias_1 } + +declare type MutationStatus = 'idle' | 'pending' | 'success' | 'error'; +export { MutationStatus } +export { MutationStatus as MutationStatus_alias_1 } + +declare type NetworkMode = 'online' | 'always' | 'offlineFirst'; +export { NetworkMode } +export { NetworkMode as NetworkMode_alias_1 } + +declare type NonFunctionGuard = T extends Function ? never : T; + +declare type NonUndefinedGuard = T extends undefined ? never : T; +export { NonUndefinedGuard } +export { NonUndefinedGuard as NonUndefinedGuard_alias_1 } + +declare function noop(): void; + +declare function noop(): undefined; +export { noop } +export { noop as noop_alias_1 } + +declare type NotifyCallback = () => void; + +declare interface NotifyEvent { + type: NotifyEventType; +} +export { NotifyEvent } +export { NotifyEvent as NotifyEvent_alias_1 } + +declare interface NotifyEventMutationAdded extends NotifyEvent { + type: 'added'; + mutation: Mutation; +} + +declare interface NotifyEventMutationObserverAdded extends NotifyEvent { + type: 'observerAdded'; + mutation: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent { + type: 'observerOptionsUpdated'; + mutation?: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationObserverRemoved extends NotifyEvent { + type: 'observerRemoved'; + mutation: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationRemoved extends NotifyEvent { + type: 'removed'; + mutation: Mutation; +} + +declare interface NotifyEventMutationUpdated extends NotifyEvent { + type: 'updated'; + mutation: Mutation; + action: Action; +} + +declare interface NotifyEventQueryAdded extends NotifyEvent { + type: 'added'; + query: Query; +} + +declare interface NotifyEventQueryObserverAdded extends NotifyEvent { + type: 'observerAdded'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverOptionsUpdated extends NotifyEvent { + type: 'observerOptionsUpdated'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverRemoved extends NotifyEvent { + type: 'observerRemoved'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverResultsUpdated extends NotifyEvent { + type: 'observerResultsUpdated'; + query: Query; +} + +declare interface NotifyEventQueryRemoved extends NotifyEvent { + type: 'removed'; + query: Query; +} + +declare interface NotifyEventQueryUpdated extends NotifyEvent { + type: 'updated'; + query: Query; + action: Action_alias_1; +} + +declare type NotifyEventType = 'added' | 'removed' | 'updated' | 'observerAdded' | 'observerRemoved' | 'observerResultsUpdated' | 'observerOptionsUpdated'; +export { NotifyEventType } +export { NotifyEventType as NotifyEventType_alias_1 } + +declare type NotifyFunction = (callback: () => void) => void; + +declare const notifyManager: { + readonly batch: (callback: () => T) => T; + /** + * All calls to the wrapped function will be batched. + */ + readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; + readonly schedule: (callback: NotifyCallback) => void; + /** + * Use this method to set a custom notify function. + * This can be used to for example wrap notifications with `React.act` while running tests. + */ + readonly setNotifyFunction: (fn: NotifyFunction) => void; + /** + * Use this method to set a custom function to batch notifications together into a single tick. + * By default React Query will use the batch function provided by ReactDOM or React Native. + */ + readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + readonly setScheduler: (fn: ScheduleFunction) => void; +}; +export { notifyManager } +export { notifyManager as notifyManager_alias_1 } + +declare type NotifyOnChangeProps = Array | 'all' | undefined | (() => Array | 'all' | undefined); +export { NotifyOnChangeProps } +export { NotifyOnChangeProps as NotifyOnChangeProps_alias_1 } + +declare interface ObserverFetchOptions extends FetchOptions { + throwOnError?: boolean; +} + +declare type OmitKeyof) | (number & Record) | (symbol & Record) : keyof TObject, TStrictly extends 'strictly' | 'safely' = 'strictly'> = Omit; +export { OmitKeyof } +export { OmitKeyof as OmitKeyof_alias_1 } + +export declare class OnlineManager extends Subscribable { + #private; + constructor(); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + setEventListener(setup: SetupFn_2): void; + setOnline(online: boolean): void; + isOnline(): boolean; +} + +declare const onlineManager: OnlineManager; +export { onlineManager } +export { onlineManager as onlineManager_alias_1 } + +declare type Override = { + [AKey in keyof TTargetA]: AKey extends keyof TTargetB ? TTargetB[AKey] : TTargetA[AKey]; +}; +export { Override } +export { Override as Override_alias_1 } + +/** + * Checks if key `b` partially matches with key `a`. + */ +declare function partialMatchKey(a: QueryKey, b: QueryKey): boolean; +export { partialMatchKey } +export { partialMatchKey as partialMatchKey_alias_1 } + +declare interface PauseAction { + type: 'pause'; +} + +declare interface PauseAction_2 { + type: 'pause'; +} + +declare interface Pending { + status: 'pending'; + /** + * Resolve the promise with a value. + * Will remove the `resolve` and `reject` properties from the promise. + */ + resolve: (value: T) => void; + /** + * Reject the promise with a reason. + * Will remove the `resolve` and `reject` properties from the promise. + */ + reject: (reason: unknown) => void; +} + +declare interface PendingAction { + type: 'pending'; + isPaused: boolean; + variables?: TVariables; + context?: TOnMutateResult; +} + +export declare type PendingThenable = Promise & Pending; + +export declare function pendingThenable(): PendingThenable; + +declare type PlaceholderDataFunction = (previousData: TQueryData | undefined, previousQuery: Query | undefined) => TQueryData | undefined; +export { PlaceholderDataFunction } +export { PlaceholderDataFunction as PlaceholderDataFunction_alias_1 } + +declare class QueriesObserver> extends Subscribable { + #private; + constructor(client: QueryClient, queries: Array>, options?: QueriesObserverOptions); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + destroy(): void; + setQueries(queries: Array, options?: QueriesObserverOptions): void; + getCurrentResult(): Array; + getQueries(): Query[]; + getObservers(): QueryObserver[]; + getOptimisticResult(queries: Array, combine: CombineFn | undefined): [ + rawResult: Array, + combineResult: (r?: Array) => TCombinedResult, + trackResult: () => Array + ]; +} +export { QueriesObserver } +export { QueriesObserver as QueriesObserver_alias_1 } + +declare type QueriesObserverListener = (result: Array) => void; + +declare interface QueriesObserverOptions> { + combine?: CombineFn; +} +export { QueriesObserverOptions } +export { QueriesObserverOptions as QueriesObserverOptions_alias_1 } + +declare type QueriesPlaceholderDataFunction = (previousData: undefined, previousQuery: undefined) => TQueryData | undefined; +export { QueriesPlaceholderDataFunction } +export { QueriesPlaceholderDataFunction as QueriesPlaceholderDataFunction_alias_1 } + +declare class Query extends Removable { + #private; + queryKey: TQueryKey; + queryHash: string; + options: QueryOptions; + state: QueryState; + observers: Array>; + constructor(config: QueryConfig); + get meta(): QueryMeta | undefined; + get queryType(): "infinite" | undefined; + get promise(): Promise | undefined; + setOptions(options?: QueryOptions): void; + protected optionalRemove(): void; + setData(newData: TData, options?: SetDataOptions & { + manual: boolean; + }): TData; + setState(state: Partial>): void; + cancel(options?: CancelOptions): Promise; + destroy(): void; + get resetState(): QueryState; + reset(): void; + isActive(): boolean; + isDisabled(): boolean; + isFetched(): boolean; + isStatic(): boolean; + isStale(): boolean; + isStaleByTime(staleTime?: StaleTime): boolean; + onFocus(): void; + onOnline(): void; + addObserver(observer: QueryObserver): void; + removeObserver(observer: QueryObserver): void; + getObserversCount(): number; + invalidate(): void; + fetch(options?: QueryOptions, fetchOptions?: FetchOptions): Promise; +} +export { Query } +export { Query as Query_alias_1 } + +export declare interface QueryBehavior { + onFetch: (context: FetchContext, query: Query) => void; +} + +declare type QueryBooleanOption = boolean | ((query: Query) => boolean); +export { QueryBooleanOption } +export { QueryBooleanOption as QueryBooleanOption_alias_1 } + +declare class QueryCache extends Subscribable { + #private; + config: QueryCacheConfig; + constructor(config?: QueryCacheConfig); + build(client: QueryClient, options: WithRequired, 'queryKey'>, state?: QueryState): Query; + add(query: Query): void; + remove(query: Query): void; + clear(): void; + get(queryHash: string): Query | undefined; + getAll(): Array; + find(filters: WithRequired): Query | undefined; + findAll(filters?: QueryFilters): Array; + notify(event: QueryCacheNotifyEvent): void; + onFocus(): void; + onOnline(): void; +} +export { QueryCache } +export { QueryCache as QueryCache_alias_1 } + +declare interface QueryCacheConfig { + onError?: (error: DefaultError, query: Query) => void; + onSuccess?: (data: unknown, query: Query) => void; + onSettled?: (data: unknown | undefined, error: DefaultError | null, query: Query) => void; +} + +declare type QueryCacheListener = (event: QueryCacheNotifyEvent) => void; + +declare type QueryCacheNotifyEvent = NotifyEventQueryAdded | NotifyEventQueryRemoved | NotifyEventQueryUpdated | NotifyEventQueryObserverAdded | NotifyEventQueryObserverRemoved | NotifyEventQueryObserverResultsUpdated | NotifyEventQueryObserverOptionsUpdated; +export { QueryCacheNotifyEvent } +export { QueryCacheNotifyEvent as QueryCacheNotifyEvent_alias_1 } + +declare class QueryClient { + #private; + constructor(config?: QueryClientConfig); + mount(): void; + unmount(): void; + isFetching = QueryFilters>(filters?: TQueryFilters): number; + isMutating = MutationFilters>(filters?: TMutationFilters): number; + /** + * Imperative (non-reactive) way to retrieve data for a QueryKey. + * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates. + * + * Hint: Do not use this function inside a component, because it won't receive updates. + * Use `useQuery` to create a `QueryObserver` that subscribes to changes. + */ + getQueryData>(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined; + ensureQueryData(options: EnsureQueryDataOptions): Promise; + getQueriesData = QueryFilters>(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]>; + setQueryData>(queryKey: TTaggedQueryKey, updater: Updater | undefined, NoInfer | undefined>, options?: SetDataOptions): NoInfer | undefined; + setQueriesData = QueryFilters>(filters: TQueryFilters, updater: Updater | undefined, NoInfer | undefined>, options?: SetDataOptions): Array<[QueryKey, TQueryFnData | undefined]>; + getQueryState, TInferredError = InferErrorFromTag>(queryKey: TTaggedQueryKey): QueryState | undefined; + removeQueries(filters?: QueryFilters): void; + resetQueries(filters?: QueryFilters, options?: ResetOptions): Promise; + cancelQueries(filters?: QueryFilters, cancelOptions?: CancelOptions): Promise; + invalidateQueries(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise; + refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; + fetchQuery(options: FetchQueryOptions): Promise; + prefetchQuery(options: FetchQueryOptions): Promise; + fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; + prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; + ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; + resumePausedMutations(): Promise; + getQueryCache(): QueryCache; + getMutationCache(): MutationCache; + getDefaultOptions(): DefaultOptions; + setDefaultOptions(options: DefaultOptions): void; + setQueryDefaults(queryKey: QueryKey, options: Partial, 'queryKey'>>): void; + getQueryDefaults(queryKey: QueryKey): OmitKeyof, 'queryKey'>; + setMutationDefaults(mutationKey: MutationKey, options: OmitKeyof, 'mutationKey'>): void; + getMutationDefaults(mutationKey: MutationKey): OmitKeyof, 'mutationKey'>; + defaultQueryOptions(options: QueryObserverOptions | DefaultedQueryObserverOptions): DefaultedQueryObserverOptions; + defaultMutationOptions>(options?: T): T; + clear(): void; +} +export { QueryClient } +export { QueryClient as QueryClient_alias_1 } + +declare interface QueryClientConfig { + queryCache?: QueryCache; + mutationCache?: MutationCache; + defaultOptions?: DefaultOptions; +} +export { QueryClientConfig } +export { QueryClientConfig as QueryClientConfig_alias_1 } + +declare interface QueryConfig { + client: QueryClient; + queryKey: TQueryKey; + queryHash: string; + options?: QueryOptions; + defaultOptions?: QueryOptions; + state?: QueryState; +} + +declare interface QueryFilters { + /** + * Filter to active queries, inactive queries or all queries + */ + type?: QueryTypeFilter; + /** + * Match query key exactly + */ + exact?: boolean; + /** + * Include queries matching this predicate function + */ + predicate?: (query: Query) => boolean; + /** + * Include queries matching this query key + */ + queryKey?: TQueryKey | TuplePrefixes; + /** + * Include or exclude stale queries + */ + stale?: boolean; + /** + * Include queries matching their fetchStatus + */ + fetchStatus?: FetchStatus; +} +export { QueryFilters } +export { QueryFilters as QueryFilters_alias_1 } + +declare type QueryFunction = (context: QueryFunctionContext) => T | Promise; +export { QueryFunction } +export { QueryFunction as QueryFunction_alias_1 } + +declare type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + queryKey: TQueryKey; + signal: AbortSignal; + meta: QueryMeta | undefined; + pageParam?: unknown; + /** + * @deprecated + * if you want access to the direction, you can add it to the pageParam + */ + direction?: unknown; +} : { + client: QueryClient; + queryKey: TQueryKey; + signal: AbortSignal; + pageParam: TPageParam; + /** + * @deprecated + * if you want access to the direction, you can add it to the pageParam + */ + direction: FetchDirection; + meta: QueryMeta | undefined; +}; +export { QueryFunctionContext } +export { QueryFunctionContext as QueryFunctionContext_alias_1 } + +declare type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends Array ? TQueryKey : ReadonlyArray : ReadonlyArray; +export { QueryKey } +export { QueryKey as QueryKey_alias_1 } + +declare type QueryKeyHashFunction = (queryKey: TQueryKey) => string; +export { QueryKeyHashFunction } +export { QueryKeyHashFunction as QueryKeyHashFunction_alias_1 } + +declare type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +export { QueryMeta } +export { QueryMeta as QueryMeta_alias_1 } + +declare class QueryObserver extends Subscribable> { + #private; + options: QueryObserverOptions; + constructor(client: QueryClient, options: QueryObserverOptions); + protected bindMethods(): void; + protected onSubscribe(): void; + protected onUnsubscribe(): void; + shouldFetchOnReconnect(): boolean; + shouldFetchOnWindowFocus(): boolean; + destroy(): void; + setOptions(options: QueryObserverOptions): void; + getOptimisticResult(options: DefaultedQueryObserverOptions): QueryObserverResult; + getCurrentResult(): QueryObserverResult; + trackResult(result: QueryObserverResult, onPropTracked?: (key: keyof QueryObserverResult) => void): QueryObserverResult; + trackProp(key: keyof QueryObserverResult): void; + getCurrentQuery(): Query; + refetch({ ...options }?: RefetchOptions): Promise>; + fetchOptimistic(options: QueryObserverOptions): Promise>; + protected fetch(fetchOptions: ObserverFetchOptions): Promise>; + protected createResult(query: Query, options: QueryObserverOptions): QueryObserverResult; + updateResult(): void; + onQueryUpdate(): void; +} +export { QueryObserver } +export { QueryObserver as QueryObserver_alias_1 } + +declare interface QueryObserverBaseResult { + /** + * The last successfully resolved data for the query. + */ + data: TData | undefined; + /** + * The timestamp for when the query most recently returned the `status` as `"success"`. + */ + dataUpdatedAt: number; + /** + * The error object for the query, if an error was thrown. + * - Defaults to `null`. + */ + error: TError | null; + /** + * The timestamp for when the query most recently returned the `status` as `"error"`. + */ + errorUpdatedAt: number; + /** + * The failure count for the query. + * - Incremented every time the query fails. + * - Reset to `0` when the query succeeds. + */ + failureCount: number; + /** + * The failure reason for the query retry. + * - Reset to `null` when the query succeeds. + */ + failureReason: TError | null; + /** + * The sum of all errors. + */ + errorUpdateCount: number; + /** + * A derived boolean from the `status` variable, provided for convenience. + * - `true` if the query attempt resulted in an error. + */ + isError: boolean; + /** + * Will be `true` if the query has been fetched. + */ + isFetched: boolean; + /** + * Will be `true` if the query has been fetched after the component mounted. + * - This property can be used to not show any previously cached data. + */ + isFetchedAfterMount: boolean; + /** + * A derived boolean from the `fetchStatus` variable, provided for convenience. + * - `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch. + */ + isFetching: boolean; + /** + * Is `true` whenever the first fetch for a query is in-flight. + * - Is the same as `isFetching && isPending`. + */ + isLoading: boolean; + /** + * Will be `pending` if there's no cached data and no query attempt was finished yet. + */ + isPending: boolean; + /** + * Will be `true` if the query failed while fetching for the first time. + */ + isLoadingError: boolean; + /** + * @deprecated `isInitialLoading` is being deprecated in favor of `isLoading` + * and will be removed in the next major version. + */ + isInitialLoading: boolean; + /** + * A derived boolean from the `fetchStatus` variable, provided for convenience. + * - The query wanted to fetch, but has been `paused`. + */ + isPaused: boolean; + /** + * Will be `true` if the data shown is the placeholder data. + */ + isPlaceholderData: boolean; + /** + * Will be `true` if the query failed while refetching. + */ + isRefetchError: boolean; + /** + * Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`. + * - Is the same as `isFetching && !isPending`. + */ + isRefetching: boolean; + /** + * Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. + */ + isStale: boolean; + /** + * A derived boolean from the `status` variable, provided for convenience. + * - `true` if the query has received a response with no errors and is ready to display its data. + */ + isSuccess: boolean; + /** + * `true` if this observer is enabled, `false` otherwise. + */ + isEnabled: boolean; + /** + * A function to manually refetch the query. + */ + refetch: (options?: RefetchOptions) => Promise>; + /** + * The status of the query. + * - Will be: + * - `pending` if there's no cached data and no query attempt was finished yet. + * - `error` if the query attempt resulted in an error. + * - `success` if the query has received a response with no errors and is ready to display its data. + */ + status: QueryStatus; + /** + * The fetch status of the query. + * - `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch. + * - `paused`: The query wanted to fetch, but has been `paused`. + * - `idle`: The query is not fetching. + * - See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. + */ + fetchStatus: FetchStatus; + /** + * A stable promise that will be resolved with the data of the query. + * Requires the `experimental_prefetchInRender` feature flag to be enabled. + * @example + * + * ### Enabling the feature flag + * ```ts + * const client = new QueryClient({ + * defaultOptions: { + * queries: { + * experimental_prefetchInRender: true, + * }, + * }, + * }) + * ``` + * + * ### Usage + * ```tsx + * import { useQuery } from '@tanstack/react-query' + * import React from 'react' + * import { fetchTodos, type Todo } from './api' + * + * function TodoList({ query }: { query: UseQueryResult }) { + * const data = React.use(query.promise) + * + * return ( + *
    + * {data.map(todo => ( + *
  • {todo.title}
  • + * ))} + *
+ * ) + * } + * + * export function App() { + * const query = useQuery({ queryKey: ['todos'], queryFn: fetchTodos }) + * + * return ( + * <> + *

Todos

+ * Loading...}> + * + * + * + * ) + * } + * ``` + */ + promise: Promise; +} +export { QueryObserverBaseResult } +export { QueryObserverBaseResult as QueryObserverBaseResult_alias_1 } + +declare type QueryObserverListener = (result: QueryObserverResult) => void; + +declare interface QueryObserverLoadingErrorResult extends QueryObserverBaseResult { + data: undefined; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: true; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { QueryObserverLoadingErrorResult } +export { QueryObserverLoadingErrorResult as QueryObserverLoadingErrorResult_alias_1 } + +declare interface QueryObserverLoadingResult extends QueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoading: true; + isLoadingError: false; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { QueryObserverLoadingResult } +export { QueryObserverLoadingResult as QueryObserverLoadingResult_alias_1 } + +declare interface QueryObserverOptions extends WithRequired, 'queryKey'> { + /** + * Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys. + * To refetch the query, use the `refetch` method returned from the `useQuery` instance. + * Accepts a boolean or function that returns a boolean. + * Defaults to `true`. + */ + enabled?: QueryBooleanOption; + /** + * The time in milliseconds after data is considered stale. + * If set to `Infinity`, the data will never be considered stale. + * If set to a function, the function will be executed with the query to compute a `staleTime`. + * Defaults to `0`. + */ + staleTime?: StaleTimeFunction; + /** + * If set to a number, the query will continuously refetch at this frequency in milliseconds. + * If set to a function, the function will be executed with the latest data and query to compute a frequency + * Defaults to `false`. + */ + refetchInterval?: number | false | ((query: Query) => number | false | undefined); + /** + * If set to `true`, the query will continue to refetch while their tab/window is in the background. + * Defaults to `false`. + */ + refetchIntervalInBackground?: boolean; + /** + * If set to `true`, the query will refetch on window focus if the data is stale. + * If set to `false`, the query will not refetch on window focus. + * If set to `'always'`, the query will always refetch on window focus. + * If set to a function, the function will be executed with the latest data and query to compute the value. + * Defaults to `true`. + */ + refetchOnWindowFocus?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `true`, the query will refetch on reconnect if the data is stale. + * If set to `false`, the query will not refetch on reconnect. + * If set to `'always'`, the query will always refetch on reconnect. + * If set to a function, the function will be executed with the latest data and query to compute the value. + * Defaults to `true` unless `networkMode` is `'always'`. + */ + refetchOnReconnect?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `true`, the query will refetch on mount if the data is stale. + * If set to `false`, will disable additional instances of a query to trigger background refetch. + * If set to `'always'`, the query will always refetch on mount. + * If set to a function, the function will be executed with the latest data and query to compute the value + * Defaults to `true`. + */ + refetchOnMount?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `false`, the query will not be retried on mount if it contains an error. + * If set to a function, the function will be executed with the query to compute the value. + * Defaults to `true`. + */ + retryOnMount?: QueryBooleanOption; + /** + * If set, the component will only re-render if any of the listed properties change. + * When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. + * When set to `'all'`, the component will re-render whenever a query is updated. + * When set to a function, the function will be executed to compute the list of properties. + * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. + */ + notifyOnChangeProps?: NotifyOnChangeProps; + /** + * Whether errors should be thrown instead of setting the `error` property. + * If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary. + * If set to `false` and `suspense` is `false`, errors are returned as state. + * If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`). + * Defaults to `false`. + */ + throwOnError?: ThrowOnError; + /** + * This option can be used to transform or select a part of the data returned by the query function. + */ + select?: (data: TQueryData) => TData; + /** + * If set to `true`, the query will suspend when `status === 'pending'` + * and throw errors when `status === 'error'`. + * Defaults to `false`. + */ + suspense?: boolean; + /** + * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. + */ + placeholderData?: NonFunctionGuard | PlaceholderDataFunction, TError, NonFunctionGuard, TQueryKey>; + _optimisticResults?: 'optimistic' | 'isRestoring'; + /** + * Enable prefetching during rendering + */ + experimental_prefetchInRender?: boolean; +} +export { QueryObserverOptions } +export { QueryObserverOptions as QueryObserverOptions_alias_1 } + +declare interface QueryObserverPendingResult extends QueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoadingError: false; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { QueryObserverPendingResult } +export { QueryObserverPendingResult as QueryObserverPendingResult_alias_1 } + +declare interface QueryObserverPlaceholderResult extends QueryObserverBaseResult { + data: TData; + isError: false; + error: null; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: true; + status: 'success'; +} +export { QueryObserverPlaceholderResult } +export { QueryObserverPlaceholderResult as QueryObserverPlaceholderResult_alias_1 } + +declare interface QueryObserverRefetchErrorResult extends QueryObserverBaseResult { + data: TData; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: true; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { QueryObserverRefetchErrorResult } +export { QueryObserverRefetchErrorResult as QueryObserverRefetchErrorResult_alias_1 } + +declare type QueryObserverResult = DefinedQueryObserverResult | QueryObserverLoadingErrorResult | QueryObserverLoadingResult | QueryObserverPendingResult | QueryObserverPlaceholderResult; +export { QueryObserverResult } +export { QueryObserverResult as QueryObserverResult_alias_1 } + +declare interface QueryObserverSuccessResult extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: false; + status: 'success'; +} +export { QueryObserverSuccessResult } +export { QueryObserverSuccessResult as QueryObserverSuccessResult_alias_1 } + +declare interface QueryOptions { + /** + * If `false`, failed queries will not retry by default. + * If `true`, failed queries will retry infinitely. + * If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. + * If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. + */ + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode?: NetworkMode; + /** + * The time in milliseconds that unused/inactive cache data remains in memory. + * When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. + * When different garbage collection times are specified, the longest one will be used. + * Setting it to `Infinity` will disable garbage collection. + */ + gcTime?: number; + queryFn?: QueryFunction | SkipToken; + persister?: QueryPersister, TPageParam>; + queryHash?: string; + queryKey?: TQueryKey; + queryKeyHashFn?: QueryKeyHashFunction; + initialData?: TData | InitialDataFunction; + initialDataUpdatedAt?: number | (() => number | undefined); + behavior?: QueryBehavior; + /** + * Set this to `false` to disable structural sharing between query results. + * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic. + * Defaults to `true`. + */ + structuralSharing?: boolean | ((oldData: unknown | undefined, newData: unknown) => unknown); + _defaulted?: boolean; + _type?: 'infinite'; + /** + * Additional payload to be stored on each query. + * Use this property to pass information that can be used in other places. + */ + meta?: QueryMeta; + /** + * Maximum number of pages to store in the data of an infinite query. + */ + maxPages?: number; +} +export { QueryOptions } +export { QueryOptions as QueryOptions_alias_1 } + +declare type QueryPersister = [TPageParam] extends [never] ? (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise : (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise; +export { QueryPersister } +export { QueryPersister as QueryPersister_alias_1 } + +declare interface QueryState { + data: TData | undefined; + dataUpdateCount: number; + dataUpdatedAt: number; + error: TError | null; + errorUpdateCount: number; + errorUpdatedAt: number; + fetchFailureCount: number; + fetchFailureReason: TError | null; + fetchMeta: FetchMeta | null; + isInvalidated: boolean; + status: QueryStatus; + fetchStatus: FetchStatus; +} +export { QueryState } +export { QueryState as QueryState_alias_1 } + +declare type QueryStatus = 'pending' | 'error' | 'success'; +export { QueryStatus } +export { QueryStatus as QueryStatus_alias_1 } + +export declare interface QueryStore { + has: (queryHash: string) => boolean; + set: (queryHash: string, query: Query) => void; + get: (queryHash: string) => Query | undefined; + delete: (queryHash: string) => void; + values: () => IterableIterator; +} + +export declare type QueryTypeFilter = 'all' | 'active' | 'inactive'; + +declare type ReducibleStreamedQueryParams = BaseStreamedQueryParams & { + reducer: (acc: TData, chunk: TQueryFnData) => TData; + initialValue: TData; +}; + +declare interface RefetchOptions extends ResultOptions { + /** + * If set to `true`, a currently running request will be cancelled before a new request is made + * + * If set to `false`, no refetch will be made if there is already a request running. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { RefetchOptions } +export { RefetchOptions as RefetchOptions_alias_1 } + +declare interface RefetchQueryFilters extends QueryFilters { +} +export { RefetchQueryFilters } +export { RefetchQueryFilters as RefetchQueryFilters_alias_1 } + +declare interface Register { +} +export { Register } +export { Register as Register_alias_1 } + +declare interface Rejected { + status: 'rejected'; + reason: unknown; +} + +export declare type RejectedThenable = Promise & Rejected; + +export declare abstract class Removable { + #private; + gcTime: number; + destroy(): void; + protected scheduleGc(): void; + protected updateGcTime(newGcTime: number | undefined): void; + protected clearGcTimeout(): void; + protected abstract optionalRemove(): void; +} + +export declare function replaceData>(prevData: TData | undefined, data: TData, options: TOptions): TData; + +/** + * This function returns `a` if `b` is deeply equal. + * If not, it will replace any deeply equal children of `b` with those of `a`. + * This can be used for structural sharing between JSON values for example. + */ +declare function replaceEqualDeep(a: unknown, b: T, depth?: number): T; +export { replaceEqualDeep } +export { replaceEqualDeep as replaceEqualDeep_alias_1 } + +declare type ReplaceReturnType) => unknown, TReturn> = (...args: Parameters) => TReturn; + +declare interface ResetOptions extends RefetchOptions { +} +export { ResetOptions } +export { ResetOptions as ResetOptions_alias_1 } + +export declare function resolveQueryBoolean(option: undefined | QueryBooleanOption, query: Query): boolean | undefined; + +export declare function resolveStaleTime(staleTime: undefined | StaleTimeFunction, query: Query): StaleTime | undefined; + +declare interface ResultOptions { + throwOnError?: boolean; +} +export { ResultOptions } +export { ResultOptions as ResultOptions_alias_1 } + +declare type RetryDelayFunction = (failureCount: number, error: TError) => number; + +export declare type RetryDelayValue = number | RetryDelayFunction; + +export declare interface Retryer { + promise: Promise; + cancel: (cancelOptions?: CancelOptions) => void; + continue: () => Promise; + cancelRetry: () => void; + continueRetry: () => void; + canStart: () => boolean; + start: () => Promise; + status: () => 'pending' | 'resolved' | 'rejected'; +} + +declare interface RetryerConfig { + fn: () => TData | Promise; + initialPromise?: Promise; + onCancel?: (error: TError) => void; + onFail?: (failureCount: number, error: TError) => void; + onPause?: () => void; + onContinue?: () => void; + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode: NetworkMode | undefined; + canRun: () => boolean; +} + +export declare type RetryValue = boolean | number | ShouldRetryFunction; + +declare type ScheduleFunction = (callback: () => void) => void; + +declare interface SetDataOptions { + updatedAt?: number; +} +export { SetDataOptions } +export { SetDataOptions as SetDataOptions_alias_1 } + +declare interface SetStateAction { + type: 'setState'; + state: Partial>; +} + +declare type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined; + +declare type SetupFn_2 = (setOnline: Listener_2) => (() => void) | undefined; + +/** + * Shallow compare objects. + */ +export declare function shallowEqualObjects>(a: T, b: T | undefined): boolean; + +declare type ShouldRetryFunction = (failureCount: number, error: TError) => boolean; + +declare function shouldThrowError) => boolean>(throwOnError: boolean | T | undefined, params: Parameters): boolean; +export { shouldThrowError } +export { shouldThrowError as shouldThrowError_alias_1 } + +declare type SimpleStreamedQueryParams = BaseStreamedQueryParams & { + reducer?: never; + initialValue?: never; +}; + +declare type SkipToken = typeof skipToken; +export { SkipToken } +export { SkipToken as SkipToken_alias_1 } + +declare const skipToken: unique symbol; +export { skipToken } +export { skipToken as skipToken_alias_1 } + +export declare function sleep(timeout: number): Promise; + +declare type StaleTime = number | 'static'; +export { StaleTime } +export { StaleTime as StaleTime_alias_1 } + +declare type StaleTimeFunction = StaleTime | ((query: Query) => StaleTime); +export { StaleTimeFunction } +export { StaleTimeFunction as StaleTimeFunction_alias_1 } + +/** + * This is a helper function to create a query function that streams data from an AsyncIterable. + * Data will be an Array of all the chunks received. + * The query will be in a 'pending' state until the first chunk of data is received, but will go to 'success' after that. + * The query will stay in fetchStatus 'fetching' until the stream ends. + * @param queryFn - The function that returns an AsyncIterable to stream data from. + * @param refetchMode - Defines how re-fetches are handled. + * Defaults to `'reset'`, erases all data and puts the query back into `pending` state. + * Set to `'append'` to append new data to the existing data. + * Set to `'replace'` to write all data to the cache once the stream ends. + * @param reducer - A function to reduce the streamed chunks into the final data. + * Defaults to a function that appends chunks to the end of the array. + * @param initialValue - Initial value to be used while the first chunk is being fetched, and returned if the stream yields no values. + */ +declare function streamedQuery, TQueryKey extends QueryKey = QueryKey>({ streamFn, refetchMode, reducer, initialValue, }: StreamedQueryParams): QueryFunction; +export { streamedQuery as experimental_streamedQuery } +export { streamedQuery } + +declare type StreamedQueryParams = SimpleStreamedQueryParams | ReducibleStreamedQueryParams; + +export declare class Subscribable { + protected listeners: Set; + constructor(); + subscribe(listener: TListener): () => void; + hasListeners(): boolean; + protected onSubscribe(): void; + protected onUnsubscribe(): void; +} + +declare interface SuccessAction { + data: TData | undefined; + type: 'success'; + dataUpdatedAt?: number; + manual?: boolean; +} + +declare interface SuccessAction_2 { + type: 'success'; + data: TData; +} + +/** + * In many cases code wants to delay to the next event loop tick; this is not + * mediated by {@link timeoutManager}. + * + * This function is provided to make auditing the `tanstack/query-core` for + * incorrect use of system `setTimeout` easier. + */ +export declare function systemSetTimeoutZero(callback: TimeoutCallback): void; + +export declare type Thenable = FulfilledThenable | RejectedThenable | PendingThenable; + +declare type ThrowOnError = boolean | ((error: TError, query: Query) => boolean); +export { ThrowOnError } +export { ThrowOnError as ThrowOnError_alias_1 } + +/** + * {@link TimeoutManager} does not support passing arguments to the callback. + * + * `(_: void)` is the argument type inferred by TypeScript's default typings for + * `setTimeout(cb, number)`. + * If we don't accept a single void argument, then + * `new Promise(resolve => timeoutManager.setTimeout(resolve, N))` is a type error. + */ +declare type TimeoutCallback = (_: void) => void; +export { TimeoutCallback } +export { TimeoutCallback as TimeoutCallback_alias_1 } + +/** + * Allows customization of how timeouts are created. + * + * @tanstack/query-core makes liberal use of timeouts to implement `staleTime` + * and `gcTime`. The default TimeoutManager provider uses the platform's global + * `setTimeout` implementation, which is known to have scalability issues with + * thousands of timeouts on the event loop. + * + * If you hit this limitation, consider providing a custom TimeoutProvider that + * coalesces timeouts. + */ +export declare class TimeoutManager implements Omit { + #private; + setTimeoutProvider(provider: TimeoutProvider): void; + setTimeout(callback: TimeoutCallback, delay: number): ManagedTimerId; + clearTimeout(timeoutId: ManagedTimerId | undefined): void; + setInterval(callback: TimeoutCallback, delay: number): ManagedTimerId; + clearInterval(intervalId: ManagedTimerId | undefined): void; +} + +declare const timeoutManager: TimeoutManager; +export { timeoutManager } +export { timeoutManager as timeoutManager_alias_1 } + +/** + * Backend for timer functions. + */ +declare type TimeoutProvider = { + readonly setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; + readonly clearTimeout: (timeoutId: TTimerId | undefined) => void; + readonly setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + readonly clearInterval: (intervalId: TTimerId | undefined) => void; +}; +export { TimeoutProvider } +export { TimeoutProvider as TimeoutProvider_alias_1 } + +export declare function timeUntilStale(updatedAt: number, staleTime?: number): number; + +declare type TransformerFn = (data: any) => any; + +/** + * This function takes a Promise-like input and detects whether the data + * is synchronously available or not. + * + * It does not inspect .status, .value or .reason properties of the promise, + * as those are not always available, and the .status of React's promises + * should not be considered part of the public API. + */ +export declare function tryResolveSync(promise: Promise | Thenable): { + data: {} | null; +} | undefined; + +declare type TuplePrefixes> = T extends readonly [] ? readonly [] : TuplePrefixes> | T; + +declare type UnsetMarker = typeof unsetMarker; +export { UnsetMarker } +export { UnsetMarker as UnsetMarker_alias_1 } + +declare const unsetMarker: unique symbol; +export { unsetMarker } +export { unsetMarker as unsetMarker_alias_1 } + +declare type Updater = TOutput | ((input: TInput) => TOutput); +export { Updater } +export { Updater as Updater_alias_1 } + +declare type WithRequired = TTarget & { + [_ in TKey]: {}; +}; +export { WithRequired } +export { WithRequired as WithRequired_alias_1 } + +export { } diff --git a/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.ts b/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11c0bc6093fa54fc7dea07311297128475a85e34 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/_tsup-dts-rollup.d.ts @@ -0,0 +1,2188 @@ +export declare type Action = ContinueAction_2 | ErrorAction_2 | FailedAction_2 | PendingAction | PauseAction_2 | SuccessAction_2; + +export declare type Action_alias_1 = ContinueAction | ErrorAction | FailedAction | FetchAction | InvalidateAction | PauseAction | SetStateAction | SuccessAction; + +export declare function addConsumeAwareSignal(object: T, getSignal: () => AbortSignal, onCancelled: VoidFunction): T & { + signal: AbortSignal; +}; + +export declare function addToEnd(items: Array, item: T, max?: number): Array; + +export declare function addToStart(items: Array, item: T, max?: number): Array; + +declare type AnyDataTag = { + [dataTagSymbol]: any; + [dataTagErrorSymbol]: any; +}; +export { AnyDataTag } +export { AnyDataTag as AnyDataTag_alias_1 } + +declare type BaseStreamedQueryParams = { + streamFn: (context: QueryFunctionContext) => AsyncIterable | Promise>; + refetchMode?: 'append' | 'reset' | 'replace'; +}; + +declare type BatchCallsCallback> = (...args: T) => void; + +declare type BatchNotifyFunction = (callback: () => void) => void; + +declare class CancelledError extends Error { + revert?: boolean; + silent?: boolean; + constructor(options?: CancelOptions); +} +export { CancelledError } +export { CancelledError as CancelledError_alias_1 } + +declare interface CancelOptions { + revert?: boolean; + silent?: boolean; +} +export { CancelOptions } +export { CancelOptions as CancelOptions_alias_1 } + +export declare function canFetch(networkMode: NetworkMode | undefined): boolean; + +declare type CombineFn = (result: Array) => TCombinedResult; + +declare interface ContinueAction { + type: 'continue'; +} + +declare interface ContinueAction_2 { + type: 'continue'; +} + +export declare function createNotifyManager(): { + readonly batch: (callback: () => T) => T; + /** + * All calls to the wrapped function will be batched. + */ + readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; + readonly schedule: (callback: NotifyCallback) => void; + /** + * Use this method to set a custom notify function. + * This can be used to for example wrap notifications with `React.act` while running tests. + */ + readonly setNotifyFunction: (fn: NotifyFunction) => void; + /** + * Use this method to set a custom function to batch notifications together into a single tick. + * By default React Query will use the batch function provided by ReactDOM or React Native. + */ + readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + readonly setScheduler: (fn: ScheduleFunction) => void; +}; + +export declare function createRetryer(config: RetryerConfig): Retryer; + +declare type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagSymbol]: TValue; + [dataTagErrorSymbol]: TError; +}; +export { DataTag } +export { DataTag as DataTag_alias_1 } + +declare const dataTagErrorSymbol: unique symbol; + +declare type dataTagErrorSymbol = typeof dataTagErrorSymbol; +export { dataTagErrorSymbol } +export { dataTagErrorSymbol as dataTagErrorSymbol_alias_1 } + +declare const dataTagSymbol: unique symbol; + +declare type dataTagSymbol = typeof dataTagSymbol; +export { dataTagSymbol } +export { dataTagSymbol as dataTagSymbol_alias_1 } + +declare type DefaultedInfiniteQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; +export { DefaultedInfiniteQueryObserverOptions } +export { DefaultedInfiniteQueryObserverOptions as DefaultedInfiniteQueryObserverOptions_alias_1 } + +declare type DefaultedQueryObserverOptions = WithRequired, 'throwOnError' | 'refetchOnReconnect' | 'queryHash'>; +export { DefaultedQueryObserverOptions } +export { DefaultedQueryObserverOptions as DefaultedQueryObserverOptions_alias_1 } + +declare type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; +export { DefaultError } +export { DefaultError as DefaultError_alias_1 } + +declare interface DefaultOptions { + queries?: OmitKeyof, 'suspense' | 'queryKey'>; + mutations?: MutationObserverOptions; + hydrate?: HydrateOptions['defaultOptions']; + dehydrate?: DehydrateOptions; +} +export { DefaultOptions } +export { DefaultOptions as DefaultOptions_alias_1 } + +declare const defaultScheduler: ScheduleFunction; +export { defaultScheduler } +export { defaultScheduler as defaultScheduler_alias_1 } + +declare function defaultShouldDehydrateMutation(mutation: Mutation): boolean; +export { defaultShouldDehydrateMutation } +export { defaultShouldDehydrateMutation as defaultShouldDehydrateMutation_alias_1 } + +declare function defaultShouldDehydrateQuery(query: Query): boolean; +export { defaultShouldDehydrateQuery } +export { defaultShouldDehydrateQuery as defaultShouldDehydrateQuery_alias_1 } + +export declare const defaultTimeoutProvider: TimeoutProvider; + +declare type DefinedInfiniteQueryObserverResult = InfiniteQueryObserverRefetchErrorResult | InfiniteQueryObserverSuccessResult; +export { DefinedInfiniteQueryObserverResult } +export { DefinedInfiniteQueryObserverResult as DefinedInfiniteQueryObserverResult_alias_1 } + +declare type DefinedQueryObserverResult = QueryObserverRefetchErrorResult | QueryObserverSuccessResult; +export { DefinedQueryObserverResult } +export { DefinedQueryObserverResult as DefinedQueryObserverResult_alias_1 } + +declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState; +export { dehydrate } +export { dehydrate as dehydrate_alias_1 } + +declare interface DehydratedMutation { + mutationKey?: MutationKey; + state: MutationState; + meta?: MutationMeta; + scope?: MutationScope; +} + +declare interface DehydratedQuery { + queryHash: string; + queryKey: QueryKey; + state: QueryState; + promise?: Promise; + meta?: QueryMeta; + queryType?: 'infinite'; + dehydratedAt?: number; +} + +declare interface DehydratedState { + mutations: Array; + queries: Array; +} +export { DehydratedState } +export { DehydratedState as DehydratedState_alias_1 } + +declare interface DehydrateOptions { + serializeData?: TransformerFn; + shouldDehydrateMutation?: (mutation: Mutation) => boolean; + shouldDehydrateQuery?: (query: Query) => boolean; + shouldRedactErrors?: (error: unknown) => boolean; +} +export { DehydrateOptions } +export { DehydrateOptions as DehydrateOptions_alias_1 } + +declare type DistributiveOmit = TObject extends any ? Omit : never; +export { DistributiveOmit } +export { DistributiveOmit as DistributiveOmit_alias_1 } + +declare type DropLast> = T extends readonly [ +...infer R, +unknown +] ? readonly [...R] : never; + +declare type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; +export { EnsureInfiniteQueryDataOptions } +export { EnsureInfiniteQueryDataOptions as EnsureInfiniteQueryDataOptions_alias_1 } + +declare interface EnsureQueryDataOptions extends FetchQueryOptions { + revalidateIfStale?: boolean; +} +export { EnsureQueryDataOptions } +export { EnsureQueryDataOptions as EnsureQueryDataOptions_alias_1 } + +export declare function ensureQueryFn(options: { + queryFn?: QueryFunction | SkipToken; + queryHash?: string; +}, fetchOptions?: FetchOptions): QueryFunction; + +/** + * Manages environment detection used by TanStack Query internals. + */ +declare const environmentManager: { + /** + * Returns whether the current runtime should be treated as a server environment. + */ + isServer(): boolean; + /** + * Overrides the server check globally. + */ + setIsServer(isServerValue: IsServerValue): void; +}; +export { environmentManager } +export { environmentManager as environmentManager_alias_1 } + +declare interface ErrorAction { + type: 'error'; + error: TError; +} + +declare interface ErrorAction_2 { + type: 'error'; + error: TError; +} + +declare interface FailedAction { + type: 'failed'; + failureCount: number; + error: TError; +} + +declare interface FailedAction_2 { + type: 'failed'; + failureCount: number; + error: TError | null; +} + +declare interface FetchAction { + type: 'fetch'; + meta?: FetchMeta; +} + +export declare interface FetchContext { + fetchFn: () => unknown | Promise; + fetchOptions?: FetchOptions; + signal: AbortSignal; + options: QueryOptions; + client: QueryClient; + queryKey: TQueryKey; + state: QueryState; +} + +export declare type FetchDirection = 'forward' | 'backward'; + +declare type FetchInfiniteQueryOptions = Omit, TQueryKey, TPageParam>, 'initialPageParam'> & InitialPageParam & FetchInfiniteQueryPages; +export { FetchInfiniteQueryOptions } +export { FetchInfiniteQueryOptions as FetchInfiniteQueryOptions_alias_1 } + +declare type FetchInfiniteQueryPages = { + pages?: never; +} | { + pages: number; + getNextPageParam: GetNextPageParamFunction; +}; + +export declare interface FetchMeta { + fetchMore?: { + direction: FetchDirection; + }; +} + +declare interface FetchNextPageOptions extends ResultOptions { + /** + * If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time, + * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. + * + * If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { FetchNextPageOptions } +export { FetchNextPageOptions as FetchNextPageOptions_alias_1 } + +export declare interface FetchOptions { + cancelRefetch?: boolean; + meta?: FetchMeta; + initialPromise?: Promise; +} + +declare interface FetchPreviousPageOptions extends ResultOptions { + /** + * If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time, + * whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored. + * + * If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { FetchPreviousPageOptions } +export { FetchPreviousPageOptions as FetchPreviousPageOptions_alias_1 } + +declare interface FetchQueryOptions extends WithRequired, 'queryKey'> { + initialPageParam?: never; + /** + * The time in milliseconds after data is considered stale. + * If the data is fresh it will be returned from the cache. + */ + staleTime?: StaleTimeFunction; +} +export { FetchQueryOptions } +export { FetchQueryOptions as FetchQueryOptions_alias_1 } + +export declare function fetchState(data: TData | undefined, options: QueryOptions): { + readonly error?: null | undefined; + readonly status?: "pending" | undefined; + readonly fetchFailureCount: 0; + readonly fetchFailureReason: null; + readonly fetchStatus: "fetching" | "paused"; +}; + +declare type FetchStatus = 'fetching' | 'paused' | 'idle'; +export { FetchStatus } +export { FetchStatus as FetchStatus_alias_1 } + +export declare class FocusManager extends Subscribable { + #private; + constructor(); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + setEventListener(setup: SetupFn): void; + setFocused(focused?: boolean): void; + onFocus(): void; + isFocused(): boolean; +} + +declare const focusManager: FocusManager; +export { focusManager } +export { focusManager as focusManager_alias_1 } + +/** + * Thenable types which matches React's types for promises + * + * React seemingly uses `.status`, `.value` and `.reason` properties on a promises to optimistically unwrap data from promises + * + * @see https://github.com/facebook/react/blob/main/packages/shared/ReactTypes.js#L112-L138 + * @see https://github.com/facebook/react/blob/4f604941569d2e8947ce1460a0b2997e835f37b9/packages/react-debug-tools/src/ReactDebugHooks.js#L224-L227 + */ +declare interface Fulfilled { + status: 'fulfilled'; + value: T; +} + +export declare type FulfilledThenable = Promise & Fulfilled; + +export declare function functionalUpdate(updater: Updater, input: TInput): TOutput; + +export declare function getDefaultState(): MutationState; + +declare type GetNextPageParamFunction = (lastPage: TQueryFnData, allPages: Array, lastPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; +export { GetNextPageParamFunction } +export { GetNextPageParamFunction as GetNextPageParamFunction_alias_1 } + +declare type GetPreviousPageParamFunction = (firstPage: TQueryFnData, allPages: Array, firstPageParam: TPageParam, allPageParams: Array) => TPageParam | undefined | null; +export { GetPreviousPageParamFunction } +export { GetPreviousPageParamFunction as GetPreviousPageParamFunction_alias_1 } + +/** + * Default query & mutation keys hash function. + * Hashes the value into a stable hash. + */ +declare function hashKey(queryKey: QueryKey | MutationKey): string; +export { hashKey } +export { hashKey as hashKey_alias_1 } + +export declare function hashQueryKeyByOptions(queryKey: TQueryKey, options?: Pick, 'queryKeyHashFn'>): string; + +/** + * Checks if there is a next page. + */ +export declare function hasNextPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; + +/** + * Checks if there is a previous page. + */ +export declare function hasPreviousPage(options: InfiniteQueryPageParamsOptions, data?: InfiniteData): boolean; + +declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void; +export { hydrate } +export { hydrate as hydrate_alias_1 } + +declare interface HydrateOptions { + defaultOptions?: { + deserializeData?: TransformerFn; + queries?: QueryOptions; + mutations?: MutationOptions; + }; +} +export { HydrateOptions } +export { HydrateOptions as HydrateOptions_alias_1 } + +declare type InferDataFromTag = TTaggedQueryKey extends DataTag ? TaggedValue : TQueryFnData; +export { InferDataFromTag } +export { InferDataFromTag as InferDataFromTag_alias_1 } + +declare type InferErrorFromTag = TTaggedQueryKey extends DataTag ? TaggedError extends UnsetMarker ? TError : TaggedError : TError; +export { InferErrorFromTag } +export { InferErrorFromTag as InferErrorFromTag_alias_1 } + +declare interface InfiniteData { + pages: Array; + pageParams: Array; +} +export { InfiniteData } +export { InfiniteData as InfiniteData_alias_1 } + +export declare function infiniteQueryBehavior(pages?: number): QueryBehavior>; + +declare class InfiniteQueryObserver, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends QueryObserver, TQueryKey> { + subscribe: Subscribable>['subscribe']; + getCurrentResult: ReplaceReturnType, TQueryKey>['getCurrentResult'], InfiniteQueryObserverResult>; + protected fetch: ReplaceReturnType, TQueryKey>['fetch'], Promise>>; + constructor(client: QueryClient, options: InfiniteQueryObserverOptions); + protected bindMethods(): void; + setOptions(options: InfiniteQueryObserverOptions): void; + getOptimisticResult(options: DefaultedInfiniteQueryObserverOptions): InfiniteQueryObserverResult; + fetchNextPage(options?: FetchNextPageOptions): Promise>; + fetchPreviousPage(options?: FetchPreviousPageOptions): Promise>; + protected createResult(query: Query, TQueryKey>, options: InfiniteQueryObserverOptions): InfiniteQueryObserverResult; +} +export { InfiniteQueryObserver } +export { InfiniteQueryObserver as InfiniteQueryObserver_alias_1 } + +declare interface InfiniteQueryObserverBaseResult extends QueryObserverBaseResult { + /** + * This function allows you to fetch the next "page" of results. + */ + fetchNextPage: (options?: FetchNextPageOptions) => Promise>; + /** + * This function allows you to fetch the previous "page" of results. + */ + fetchPreviousPage: (options?: FetchPreviousPageOptions) => Promise>; + /** + * Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). + */ + hasNextPage: boolean; + /** + * Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). + */ + hasPreviousPage: boolean; + /** + * Will be `true` if the query failed while fetching the next page. + */ + isFetchNextPageError: boolean; + /** + * Will be `true` while fetching the next page with `fetchNextPage`. + */ + isFetchingNextPage: boolean; + /** + * Will be `true` if the query failed while fetching the previous page. + */ + isFetchPreviousPageError: boolean; + /** + * Will be `true` while fetching the previous page with `fetchPreviousPage`. + */ + isFetchingPreviousPage: boolean; +} +export { InfiniteQueryObserverBaseResult } +export { InfiniteQueryObserverBaseResult as InfiniteQueryObserverBaseResult_alias_1 } + +declare type InfiniteQueryObserverListener = (result: InfiniteQueryObserverResult) => void; + +declare interface InfiniteQueryObserverLoadingErrorResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: true; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { InfiniteQueryObserverLoadingErrorResult } +export { InfiniteQueryObserverLoadingErrorResult as InfiniteQueryObserverLoadingErrorResult_alias_1 } + +declare interface InfiniteQueryObserverLoadingResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoading: true; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { InfiniteQueryObserverLoadingResult } +export { InfiniteQueryObserverLoadingResult as InfiniteQueryObserverLoadingResult_alias_1 } + +declare interface InfiniteQueryObserverOptions extends QueryObserverOptions, TQueryKey, TPageParam>, InfiniteQueryPageParamsOptions { +} +export { InfiniteQueryObserverOptions } +export { InfiniteQueryObserverOptions as InfiniteQueryObserverOptions_alias_1 } + +declare interface InfiniteQueryObserverPendingResult extends InfiniteQueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { InfiniteQueryObserverPendingResult } +export { InfiniteQueryObserverPendingResult as InfiniteQueryObserverPendingResult_alias_1 } + +declare interface InfiniteQueryObserverPlaceholderResult extends InfiniteQueryObserverBaseResult { + data: TData; + isError: false; + error: null; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: true; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + status: 'success'; +} +export { InfiniteQueryObserverPlaceholderResult } +export { InfiniteQueryObserverPlaceholderResult as InfiniteQueryObserverPlaceholderResult_alias_1 } + +declare interface InfiniteQueryObserverRefetchErrorResult extends InfiniteQueryObserverBaseResult { + data: TData; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: true; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { InfiniteQueryObserverRefetchErrorResult } +export { InfiniteQueryObserverRefetchErrorResult as InfiniteQueryObserverRefetchErrorResult_alias_1 } + +declare type InfiniteQueryObserverResult = DefinedInfiniteQueryObserverResult | InfiniteQueryObserverLoadingErrorResult | InfiniteQueryObserverLoadingResult | InfiniteQueryObserverPendingResult | InfiniteQueryObserverPlaceholderResult; +export { InfiniteQueryObserverResult } +export { InfiniteQueryObserverResult as InfiniteQueryObserverResult_alias_1 } + +declare interface InfiniteQueryObserverSuccessResult extends InfiniteQueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isFetchNextPageError: false; + isFetchPreviousPageError: false; + isSuccess: true; + isPlaceholderData: false; + status: 'success'; +} +export { InfiniteQueryObserverSuccessResult } +export { InfiniteQueryObserverSuccessResult as InfiniteQueryObserverSuccessResult_alias_1 } + +declare interface InfiniteQueryPageParamsOptions extends InitialPageParam { + /** + * This function can be set to automatically get the previous cursor for infinite queries. + * The result will also be used to determine the value of `hasPreviousPage`. + */ + getPreviousPageParam?: GetPreviousPageParamFunction; + /** + * This function can be set to automatically get the next cursor for infinite queries. + * The result will also be used to determine the value of `hasNextPage`. + */ + getNextPageParam: GetNextPageParamFunction; +} +export { InfiniteQueryPageParamsOptions } +export { InfiniteQueryPageParamsOptions as InfiniteQueryPageParamsOptions_alias_1 } + +declare type InitialDataFunction = () => T | undefined; +export { InitialDataFunction } +export { InitialDataFunction as InitialDataFunction_alias_1 } + +declare interface InitialPageParam { + initialPageParam: TPageParam; +} +export { InitialPageParam } +export { InitialPageParam as InitialPageParam_alias_1 } + +declare interface InvalidateAction { + type: 'invalidate'; +} + +declare interface InvalidateOptions extends RefetchOptions { +} +export { InvalidateOptions } +export { InvalidateOptions as InvalidateOptions_alias_1 } + +declare interface InvalidateQueryFilters extends QueryFilters { + refetchType?: QueryTypeFilter | 'none'; +} +export { InvalidateQueryFilters } +export { InvalidateQueryFilters as InvalidateQueryFilters_alias_1 } + +/** + * @deprecated Use instanceof `CancelledError` instead. + */ +declare function isCancelledError(value: any): value is CancelledError; +export { isCancelledError } +export { isCancelledError as isCancelledError_alias_1 } + +export declare function isPlainArray(value: unknown): value is Array; + +export declare function isPlainObject(o: any): o is Record; + +/** @deprecated + * use `environmentManager.isServer()` instead. + */ +declare const isServer: boolean; +export { isServer } +export { isServer as isServer_alias_1 } + +export declare type IsServerValue = () => boolean; + +export declare function isValidTimeout(value: unknown): value is number; + +declare function keepPreviousData(previousData: T | undefined): T | undefined; +export { keepPreviousData } +export { keepPreviousData as keepPreviousData_alias_1 } + +declare type Listener = (focused: boolean) => void; + +declare type Listener_2 = (online: boolean) => void; + +/** + * Wrapping `setTimeout` is awkward from a typing perspective because platform + * typings may extend the return type of `setTimeout`. For example, NodeJS + * typings add `NodeJS.Timeout`; but a non-default `timeoutManager` may not be + * able to return such a type. + */ +declare type ManagedTimerId = number | { + [Symbol.toPrimitive]: () => number; +}; +export { ManagedTimerId } +export { ManagedTimerId as ManagedTimerId_alias_1 } + +declare function matchMutation(filters: MutationFilters, mutation: Mutation): boolean; +export { matchMutation } +export { matchMutation as matchMutation_alias_1 } + +declare function matchQuery(filters: QueryFilters, query: Query): boolean; +export { matchQuery } +export { matchQuery as matchQuery_alias_1 } + +declare type MutateFunction = (variables: TVariables, options?: MutateOptions) => Promise; +export { MutateFunction } +export { MutateFunction as MutateFunction_alias_1 } + +declare interface MutateOptions { + onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; + onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; + onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => void; +} +export { MutateOptions } +export { MutateOptions as MutateOptions_alias_1 } + +declare class Mutation extends Removable { + #private; + state: MutationState; + options: MutationOptions; + readonly mutationId: number; + constructor(config: MutationConfig); + setOptions(options: MutationOptions): void; + get meta(): MutationMeta | undefined; + addObserver(observer: MutationObserver_2): void; + removeObserver(observer: MutationObserver_2): void; + protected optionalRemove(): void; + continue(): Promise; + execute(variables: TVariables): Promise; +} +export { Mutation } +export { Mutation as Mutation_alias_1 } + +declare class MutationCache extends Subscribable { + #private; + config: MutationCacheConfig; + constructor(config?: MutationCacheConfig); + build(client: QueryClient, options: MutationOptions, state?: MutationState): Mutation; + add(mutation: Mutation): void; + remove(mutation: Mutation): void; + canRun(mutation: Mutation): boolean; + runNext(mutation: Mutation): Promise; + clear(): void; + getAll(): Array; + find(filters: MutationFilters): Mutation | undefined; + findAll(filters?: MutationFilters): Array; + notify(event: MutationCacheNotifyEvent): void; + resumePausedMutations(): Promise; +} +export { MutationCache } +export { MutationCache as MutationCache_alias_1 } + +declare interface MutationCacheConfig { + onError?: (error: DefaultError, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onSuccess?: (data: unknown, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onMutate?: (variables: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; + onSettled?: (data: unknown | undefined, error: DefaultError | null, variables: unknown, onMutateResult: unknown, mutation: Mutation, context: MutationFunctionContext) => Promise | unknown; +} + +declare type MutationCacheListener = (event: MutationCacheNotifyEvent) => void; + +declare type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated; +export { MutationCacheNotifyEvent } +export { MutationCacheNotifyEvent as MutationCacheNotifyEvent_alias_1 } + +declare interface MutationConfig { + client: QueryClient; + mutationId: number; + mutationCache: MutationCache; + options: MutationOptions; + state?: MutationState; +} + +declare interface MutationFilters { + /** + * Match mutation key exactly + */ + exact?: boolean; + /** + * Include mutations matching this predicate function + */ + predicate?: (mutation: Mutation) => boolean; + /** + * Include mutations matching this mutation key + */ + mutationKey?: TuplePrefixes; + /** + * Filter by mutation status + */ + status?: MutationStatus; +} +export { MutationFilters } +export { MutationFilters as MutationFilters_alias_1 } + +declare type MutationFunction = (variables: TVariables, context: MutationFunctionContext) => Promise; +export { MutationFunction } +export { MutationFunction as MutationFunction_alias_1 } + +declare type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; +export { MutationFunctionContext } +export { MutationFunctionContext as MutationFunctionContext_alias_1 } + +declare type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends Array ? TMutationKey : ReadonlyArray : ReadonlyArray; +export { MutationKey } +export { MutationKey as MutationKey_alias_1 } + +declare type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +export { MutationMeta } +export { MutationMeta as MutationMeta_alias_1 } + +declare class MutationObserver_2 extends Subscribable> { + #private; + options: MutationObserverOptions; + constructor(client: QueryClient, options: MutationObserverOptions); + protected bindMethods(): void; + setOptions(options: MutationObserverOptions): void; + protected onUnsubscribe(): void; + onMutationUpdate(action: Action): void; + getCurrentResult(): MutationObserverResult; + reset(): void; + mutate(variables: TVariables, options?: MutateOptions): Promise; +} +export { MutationObserver_2 as MutationObserver } +export { MutationObserver_2 as MutationObserver_alias_1 } + +declare interface MutationObserverBaseResult extends MutationState { + /** + * The last successfully resolved data for the mutation. + */ + data: TData | undefined; + /** + * The variables object passed to the `mutationFn`. + */ + variables: TVariables | undefined; + /** + * The error object for the mutation, if an error was encountered. + * - Defaults to `null`. + */ + error: TError | null; + /** + * A boolean variable derived from `status`. + * - `true` if the last mutation attempt resulted in an error. + */ + isError: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the mutation is in its initial state prior to executing. + */ + isIdle: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the mutation is currently executing. + */ + isPending: boolean; + /** + * A boolean variable derived from `status`. + * - `true` if the last mutation attempt was successful. + */ + isSuccess: boolean; + /** + * The status of the mutation. + * - Will be: + * - `idle` initial status prior to the mutation function executing. + * - `pending` if the mutation is currently executing. + * - `error` if the last mutation attempt resulted in an error. + * - `success` if the last mutation attempt was successful. + */ + status: MutationStatus; + /** + * The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. + * @param variables - The variables object to pass to the `mutationFn`. + * @param options.onSuccess - This function will fire when the mutation is successful and will be passed the mutation's result. + * @param options.onError - This function will fire if the mutation encounters an error and will be passed the error. + * @param options.onSettled - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error. + * @remarks + * - If you make multiple requests, `onSuccess` will fire only after the latest call you've made. + * - All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored. + */ + mutate: MutateFunction; + /** + * A function to clean the mutation internal state (i.e., it resets the mutation to its initial state). + */ + reset: () => void; +} +export { MutationObserverBaseResult } +export { MutationObserverBaseResult as MutationObserverBaseResult_alias_1 } + +declare interface MutationObserverErrorResult extends MutationObserverBaseResult { + data: undefined; + error: TError; + variables: TVariables; + isError: true; + isIdle: false; + isPending: false; + isSuccess: false; + status: 'error'; +} +export { MutationObserverErrorResult } +export { MutationObserverErrorResult as MutationObserverErrorResult_alias_1 } + +declare interface MutationObserverIdleResult extends MutationObserverBaseResult { + data: undefined; + variables: undefined; + error: null; + isError: false; + isIdle: true; + isPending: false; + isSuccess: false; + status: 'idle'; +} +export { MutationObserverIdleResult } +export { MutationObserverIdleResult as MutationObserverIdleResult_alias_1 } + +declare type MutationObserverListener = (result: MutationObserverResult) => void; + +declare interface MutationObserverLoadingResult extends MutationObserverBaseResult { + data: undefined; + variables: TVariables; + error: null; + isError: false; + isIdle: false; + isPending: true; + isSuccess: false; + status: 'pending'; +} +export { MutationObserverLoadingResult } +export { MutationObserverLoadingResult as MutationObserverLoadingResult_alias_1 } + +declare interface MutationObserverOptions extends MutationOptions { + throwOnError?: boolean | ((error: TError) => boolean); +} +export { MutationObserverOptions } +export { MutationObserverOptions as MutationObserverOptions_alias_1 } + +declare type MutationObserverResult = MutationObserverIdleResult | MutationObserverLoadingResult | MutationObserverErrorResult | MutationObserverSuccessResult; +export { MutationObserverResult } +export { MutationObserverResult as MutationObserverResult_alias_1 } + +declare interface MutationObserverSuccessResult extends MutationObserverBaseResult { + data: TData; + error: null; + variables: TVariables; + isError: false; + isIdle: false; + isPending: false; + isSuccess: true; + status: 'success'; +} +export { MutationObserverSuccessResult } +export { MutationObserverSuccessResult as MutationObserverSuccessResult_alias_1 } + +declare interface MutationOptions { + mutationFn?: MutationFunction; + mutationKey?: MutationKey; + onMutate?: (variables: TVariables, context: MutationFunctionContext) => Promise | TOnMutateResult; + onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => Promise | unknown; + onError?: (error: TError, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; + onSettled?: (data: TData | undefined, error: TError | null, variables: TVariables, onMutateResult: TOnMutateResult | undefined, context: MutationFunctionContext) => Promise | unknown; + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode?: NetworkMode; + gcTime?: number; + _defaulted?: boolean; + meta?: MutationMeta; + scope?: MutationScope; +} +export { MutationOptions } +export { MutationOptions as MutationOptions_alias_1 } + +declare type MutationScope = { + id: string; +}; +export { MutationScope } +export { MutationScope as MutationScope_alias_1 } + +declare interface MutationState { + context: TOnMutateResult | undefined; + data: TData | undefined; + error: TError | null; + failureCount: number; + failureReason: TError | null; + isPaused: boolean; + status: MutationStatus; + variables: TVariables | undefined; + submittedAt: number; +} +export { MutationState } +export { MutationState as MutationState_alias_1 } + +declare type MutationStatus = 'idle' | 'pending' | 'success' | 'error'; +export { MutationStatus } +export { MutationStatus as MutationStatus_alias_1 } + +declare type NetworkMode = 'online' | 'always' | 'offlineFirst'; +export { NetworkMode } +export { NetworkMode as NetworkMode_alias_1 } + +declare type NonFunctionGuard = T extends Function ? never : T; + +declare type NonUndefinedGuard = T extends undefined ? never : T; +export { NonUndefinedGuard } +export { NonUndefinedGuard as NonUndefinedGuard_alias_1 } + +declare function noop(): void; + +declare function noop(): undefined; +export { noop } +export { noop as noop_alias_1 } + +declare type NotifyCallback = () => void; + +declare interface NotifyEvent { + type: NotifyEventType; +} +export { NotifyEvent } +export { NotifyEvent as NotifyEvent_alias_1 } + +declare interface NotifyEventMutationAdded extends NotifyEvent { + type: 'added'; + mutation: Mutation; +} + +declare interface NotifyEventMutationObserverAdded extends NotifyEvent { + type: 'observerAdded'; + mutation: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent { + type: 'observerOptionsUpdated'; + mutation?: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationObserverRemoved extends NotifyEvent { + type: 'observerRemoved'; + mutation: Mutation; + observer: MutationObserver_2; +} + +declare interface NotifyEventMutationRemoved extends NotifyEvent { + type: 'removed'; + mutation: Mutation; +} + +declare interface NotifyEventMutationUpdated extends NotifyEvent { + type: 'updated'; + mutation: Mutation; + action: Action; +} + +declare interface NotifyEventQueryAdded extends NotifyEvent { + type: 'added'; + query: Query; +} + +declare interface NotifyEventQueryObserverAdded extends NotifyEvent { + type: 'observerAdded'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverOptionsUpdated extends NotifyEvent { + type: 'observerOptionsUpdated'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverRemoved extends NotifyEvent { + type: 'observerRemoved'; + query: Query; + observer: QueryObserver; +} + +declare interface NotifyEventQueryObserverResultsUpdated extends NotifyEvent { + type: 'observerResultsUpdated'; + query: Query; +} + +declare interface NotifyEventQueryRemoved extends NotifyEvent { + type: 'removed'; + query: Query; +} + +declare interface NotifyEventQueryUpdated extends NotifyEvent { + type: 'updated'; + query: Query; + action: Action_alias_1; +} + +declare type NotifyEventType = 'added' | 'removed' | 'updated' | 'observerAdded' | 'observerRemoved' | 'observerResultsUpdated' | 'observerOptionsUpdated'; +export { NotifyEventType } +export { NotifyEventType as NotifyEventType_alias_1 } + +declare type NotifyFunction = (callback: () => void) => void; + +declare const notifyManager: { + readonly batch: (callback: () => T) => T; + /** + * All calls to the wrapped function will be batched. + */ + readonly batchCalls: >(callback: BatchCallsCallback) => BatchCallsCallback; + readonly schedule: (callback: NotifyCallback) => void; + /** + * Use this method to set a custom notify function. + * This can be used to for example wrap notifications with `React.act` while running tests. + */ + readonly setNotifyFunction: (fn: NotifyFunction) => void; + /** + * Use this method to set a custom function to batch notifications together into a single tick. + * By default React Query will use the batch function provided by ReactDOM or React Native. + */ + readonly setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + readonly setScheduler: (fn: ScheduleFunction) => void; +}; +export { notifyManager } +export { notifyManager as notifyManager_alias_1 } + +declare type NotifyOnChangeProps = Array | 'all' | undefined | (() => Array | 'all' | undefined); +export { NotifyOnChangeProps } +export { NotifyOnChangeProps as NotifyOnChangeProps_alias_1 } + +declare interface ObserverFetchOptions extends FetchOptions { + throwOnError?: boolean; +} + +declare type OmitKeyof) | (number & Record) | (symbol & Record) : keyof TObject, TStrictly extends 'strictly' | 'safely' = 'strictly'> = Omit; +export { OmitKeyof } +export { OmitKeyof as OmitKeyof_alias_1 } + +export declare class OnlineManager extends Subscribable { + #private; + constructor(); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + setEventListener(setup: SetupFn_2): void; + setOnline(online: boolean): void; + isOnline(): boolean; +} + +declare const onlineManager: OnlineManager; +export { onlineManager } +export { onlineManager as onlineManager_alias_1 } + +declare type Override = { + [AKey in keyof TTargetA]: AKey extends keyof TTargetB ? TTargetB[AKey] : TTargetA[AKey]; +}; +export { Override } +export { Override as Override_alias_1 } + +/** + * Checks if key `b` partially matches with key `a`. + */ +declare function partialMatchKey(a: QueryKey, b: QueryKey): boolean; +export { partialMatchKey } +export { partialMatchKey as partialMatchKey_alias_1 } + +declare interface PauseAction { + type: 'pause'; +} + +declare interface PauseAction_2 { + type: 'pause'; +} + +declare interface Pending { + status: 'pending'; + /** + * Resolve the promise with a value. + * Will remove the `resolve` and `reject` properties from the promise. + */ + resolve: (value: T) => void; + /** + * Reject the promise with a reason. + * Will remove the `resolve` and `reject` properties from the promise. + */ + reject: (reason: unknown) => void; +} + +declare interface PendingAction { + type: 'pending'; + isPaused: boolean; + variables?: TVariables; + context?: TOnMutateResult; +} + +export declare type PendingThenable = Promise & Pending; + +export declare function pendingThenable(): PendingThenable; + +declare type PlaceholderDataFunction = (previousData: TQueryData | undefined, previousQuery: Query | undefined) => TQueryData | undefined; +export { PlaceholderDataFunction } +export { PlaceholderDataFunction as PlaceholderDataFunction_alias_1 } + +declare class QueriesObserver> extends Subscribable { + #private; + constructor(client: QueryClient, queries: Array>, options?: QueriesObserverOptions); + protected onSubscribe(): void; + protected onUnsubscribe(): void; + destroy(): void; + setQueries(queries: Array, options?: QueriesObserverOptions): void; + getCurrentResult(): Array; + getQueries(): Query[]; + getObservers(): QueryObserver[]; + getOptimisticResult(queries: Array, combine: CombineFn | undefined): [ + rawResult: Array, + combineResult: (r?: Array) => TCombinedResult, + trackResult: () => Array + ]; +} +export { QueriesObserver } +export { QueriesObserver as QueriesObserver_alias_1 } + +declare type QueriesObserverListener = (result: Array) => void; + +declare interface QueriesObserverOptions> { + combine?: CombineFn; +} +export { QueriesObserverOptions } +export { QueriesObserverOptions as QueriesObserverOptions_alias_1 } + +declare type QueriesPlaceholderDataFunction = (previousData: undefined, previousQuery: undefined) => TQueryData | undefined; +export { QueriesPlaceholderDataFunction } +export { QueriesPlaceholderDataFunction as QueriesPlaceholderDataFunction_alias_1 } + +declare class Query extends Removable { + #private; + queryKey: TQueryKey; + queryHash: string; + options: QueryOptions; + state: QueryState; + observers: Array>; + constructor(config: QueryConfig); + get meta(): QueryMeta | undefined; + get queryType(): "infinite" | undefined; + get promise(): Promise | undefined; + setOptions(options?: QueryOptions): void; + protected optionalRemove(): void; + setData(newData: TData, options?: SetDataOptions & { + manual: boolean; + }): TData; + setState(state: Partial>): void; + cancel(options?: CancelOptions): Promise; + destroy(): void; + get resetState(): QueryState; + reset(): void; + isActive(): boolean; + isDisabled(): boolean; + isFetched(): boolean; + isStatic(): boolean; + isStale(): boolean; + isStaleByTime(staleTime?: StaleTime): boolean; + onFocus(): void; + onOnline(): void; + addObserver(observer: QueryObserver): void; + removeObserver(observer: QueryObserver): void; + getObserversCount(): number; + invalidate(): void; + fetch(options?: QueryOptions, fetchOptions?: FetchOptions): Promise; +} +export { Query } +export { Query as Query_alias_1 } + +export declare interface QueryBehavior { + onFetch: (context: FetchContext, query: Query) => void; +} + +declare type QueryBooleanOption = boolean | ((query: Query) => boolean); +export { QueryBooleanOption } +export { QueryBooleanOption as QueryBooleanOption_alias_1 } + +declare class QueryCache extends Subscribable { + #private; + config: QueryCacheConfig; + constructor(config?: QueryCacheConfig); + build(client: QueryClient, options: WithRequired, 'queryKey'>, state?: QueryState): Query; + add(query: Query): void; + remove(query: Query): void; + clear(): void; + get(queryHash: string): Query | undefined; + getAll(): Array; + find(filters: WithRequired): Query | undefined; + findAll(filters?: QueryFilters): Array; + notify(event: QueryCacheNotifyEvent): void; + onFocus(): void; + onOnline(): void; +} +export { QueryCache } +export { QueryCache as QueryCache_alias_1 } + +declare interface QueryCacheConfig { + onError?: (error: DefaultError, query: Query) => void; + onSuccess?: (data: unknown, query: Query) => void; + onSettled?: (data: unknown | undefined, error: DefaultError | null, query: Query) => void; +} + +declare type QueryCacheListener = (event: QueryCacheNotifyEvent) => void; + +declare type QueryCacheNotifyEvent = NotifyEventQueryAdded | NotifyEventQueryRemoved | NotifyEventQueryUpdated | NotifyEventQueryObserverAdded | NotifyEventQueryObserverRemoved | NotifyEventQueryObserverResultsUpdated | NotifyEventQueryObserverOptionsUpdated; +export { QueryCacheNotifyEvent } +export { QueryCacheNotifyEvent as QueryCacheNotifyEvent_alias_1 } + +declare class QueryClient { + #private; + constructor(config?: QueryClientConfig); + mount(): void; + unmount(): void; + isFetching = QueryFilters>(filters?: TQueryFilters): number; + isMutating = MutationFilters>(filters?: TMutationFilters): number; + /** + * Imperative (non-reactive) way to retrieve data for a QueryKey. + * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates. + * + * Hint: Do not use this function inside a component, because it won't receive updates. + * Use `useQuery` to create a `QueryObserver` that subscribes to changes. + */ + getQueryData>(queryKey: TTaggedQueryKey): TInferredQueryFnData | undefined; + ensureQueryData(options: EnsureQueryDataOptions): Promise; + getQueriesData = QueryFilters>(filters: TQueryFilters): Array<[QueryKey, TQueryFnData | undefined]>; + setQueryData>(queryKey: TTaggedQueryKey, updater: Updater | undefined, NoInfer | undefined>, options?: SetDataOptions): NoInfer | undefined; + setQueriesData = QueryFilters>(filters: TQueryFilters, updater: Updater | undefined, NoInfer | undefined>, options?: SetDataOptions): Array<[QueryKey, TQueryFnData | undefined]>; + getQueryState, TInferredError = InferErrorFromTag>(queryKey: TTaggedQueryKey): QueryState | undefined; + removeQueries(filters?: QueryFilters): void; + resetQueries(filters?: QueryFilters, options?: ResetOptions): Promise; + cancelQueries(filters?: QueryFilters, cancelOptions?: CancelOptions): Promise; + invalidateQueries(filters?: InvalidateQueryFilters, options?: InvalidateOptions): Promise; + refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; + fetchQuery(options: FetchQueryOptions): Promise; + prefetchQuery(options: FetchQueryOptions): Promise; + fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; + prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; + ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; + resumePausedMutations(): Promise; + getQueryCache(): QueryCache; + getMutationCache(): MutationCache; + getDefaultOptions(): DefaultOptions; + setDefaultOptions(options: DefaultOptions): void; + setQueryDefaults(queryKey: QueryKey, options: Partial, 'queryKey'>>): void; + getQueryDefaults(queryKey: QueryKey): OmitKeyof, 'queryKey'>; + setMutationDefaults(mutationKey: MutationKey, options: OmitKeyof, 'mutationKey'>): void; + getMutationDefaults(mutationKey: MutationKey): OmitKeyof, 'mutationKey'>; + defaultQueryOptions(options: QueryObserverOptions | DefaultedQueryObserverOptions): DefaultedQueryObserverOptions; + defaultMutationOptions>(options?: T): T; + clear(): void; +} +export { QueryClient } +export { QueryClient as QueryClient_alias_1 } + +declare interface QueryClientConfig { + queryCache?: QueryCache; + mutationCache?: MutationCache; + defaultOptions?: DefaultOptions; +} +export { QueryClientConfig } +export { QueryClientConfig as QueryClientConfig_alias_1 } + +declare interface QueryConfig { + client: QueryClient; + queryKey: TQueryKey; + queryHash: string; + options?: QueryOptions; + defaultOptions?: QueryOptions; + state?: QueryState; +} + +declare interface QueryFilters { + /** + * Filter to active queries, inactive queries or all queries + */ + type?: QueryTypeFilter; + /** + * Match query key exactly + */ + exact?: boolean; + /** + * Include queries matching this predicate function + */ + predicate?: (query: Query) => boolean; + /** + * Include queries matching this query key + */ + queryKey?: TQueryKey | TuplePrefixes; + /** + * Include or exclude stale queries + */ + stale?: boolean; + /** + * Include queries matching their fetchStatus + */ + fetchStatus?: FetchStatus; +} +export { QueryFilters } +export { QueryFilters as QueryFilters_alias_1 } + +declare type QueryFunction = (context: QueryFunctionContext) => T | Promise; +export { QueryFunction } +export { QueryFunction as QueryFunction_alias_1 } + +declare type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + queryKey: TQueryKey; + signal: AbortSignal; + meta: QueryMeta | undefined; + pageParam?: unknown; + /** + * @deprecated + * if you want access to the direction, you can add it to the pageParam + */ + direction?: unknown; +} : { + client: QueryClient; + queryKey: TQueryKey; + signal: AbortSignal; + pageParam: TPageParam; + /** + * @deprecated + * if you want access to the direction, you can add it to the pageParam + */ + direction: FetchDirection; + meta: QueryMeta | undefined; +}; +export { QueryFunctionContext } +export { QueryFunctionContext as QueryFunctionContext_alias_1 } + +declare type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends Array ? TQueryKey : ReadonlyArray : ReadonlyArray; +export { QueryKey } +export { QueryKey as QueryKey_alias_1 } + +declare type QueryKeyHashFunction = (queryKey: TQueryKey) => string; +export { QueryKeyHashFunction } +export { QueryKeyHashFunction as QueryKeyHashFunction_alias_1 } + +declare type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +export { QueryMeta } +export { QueryMeta as QueryMeta_alias_1 } + +declare class QueryObserver extends Subscribable> { + #private; + options: QueryObserverOptions; + constructor(client: QueryClient, options: QueryObserverOptions); + protected bindMethods(): void; + protected onSubscribe(): void; + protected onUnsubscribe(): void; + shouldFetchOnReconnect(): boolean; + shouldFetchOnWindowFocus(): boolean; + destroy(): void; + setOptions(options: QueryObserverOptions): void; + getOptimisticResult(options: DefaultedQueryObserverOptions): QueryObserverResult; + getCurrentResult(): QueryObserverResult; + trackResult(result: QueryObserverResult, onPropTracked?: (key: keyof QueryObserverResult) => void): QueryObserverResult; + trackProp(key: keyof QueryObserverResult): void; + getCurrentQuery(): Query; + refetch({ ...options }?: RefetchOptions): Promise>; + fetchOptimistic(options: QueryObserverOptions): Promise>; + protected fetch(fetchOptions: ObserverFetchOptions): Promise>; + protected createResult(query: Query, options: QueryObserverOptions): QueryObserverResult; + updateResult(): void; + onQueryUpdate(): void; +} +export { QueryObserver } +export { QueryObserver as QueryObserver_alias_1 } + +declare interface QueryObserverBaseResult { + /** + * The last successfully resolved data for the query. + */ + data: TData | undefined; + /** + * The timestamp for when the query most recently returned the `status` as `"success"`. + */ + dataUpdatedAt: number; + /** + * The error object for the query, if an error was thrown. + * - Defaults to `null`. + */ + error: TError | null; + /** + * The timestamp for when the query most recently returned the `status` as `"error"`. + */ + errorUpdatedAt: number; + /** + * The failure count for the query. + * - Incremented every time the query fails. + * - Reset to `0` when the query succeeds. + */ + failureCount: number; + /** + * The failure reason for the query retry. + * - Reset to `null` when the query succeeds. + */ + failureReason: TError | null; + /** + * The sum of all errors. + */ + errorUpdateCount: number; + /** + * A derived boolean from the `status` variable, provided for convenience. + * - `true` if the query attempt resulted in an error. + */ + isError: boolean; + /** + * Will be `true` if the query has been fetched. + */ + isFetched: boolean; + /** + * Will be `true` if the query has been fetched after the component mounted. + * - This property can be used to not show any previously cached data. + */ + isFetchedAfterMount: boolean; + /** + * A derived boolean from the `fetchStatus` variable, provided for convenience. + * - `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch. + */ + isFetching: boolean; + /** + * Is `true` whenever the first fetch for a query is in-flight. + * - Is the same as `isFetching && isPending`. + */ + isLoading: boolean; + /** + * Will be `pending` if there's no cached data and no query attempt was finished yet. + */ + isPending: boolean; + /** + * Will be `true` if the query failed while fetching for the first time. + */ + isLoadingError: boolean; + /** + * @deprecated `isInitialLoading` is being deprecated in favor of `isLoading` + * and will be removed in the next major version. + */ + isInitialLoading: boolean; + /** + * A derived boolean from the `fetchStatus` variable, provided for convenience. + * - The query wanted to fetch, but has been `paused`. + */ + isPaused: boolean; + /** + * Will be `true` if the data shown is the placeholder data. + */ + isPlaceholderData: boolean; + /** + * Will be `true` if the query failed while refetching. + */ + isRefetchError: boolean; + /** + * Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`. + * - Is the same as `isFetching && !isPending`. + */ + isRefetching: boolean; + /** + * Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. + */ + isStale: boolean; + /** + * A derived boolean from the `status` variable, provided for convenience. + * - `true` if the query has received a response with no errors and is ready to display its data. + */ + isSuccess: boolean; + /** + * `true` if this observer is enabled, `false` otherwise. + */ + isEnabled: boolean; + /** + * A function to manually refetch the query. + */ + refetch: (options?: RefetchOptions) => Promise>; + /** + * The status of the query. + * - Will be: + * - `pending` if there's no cached data and no query attempt was finished yet. + * - `error` if the query attempt resulted in an error. + * - `success` if the query has received a response with no errors and is ready to display its data. + */ + status: QueryStatus; + /** + * The fetch status of the query. + * - `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch. + * - `paused`: The query wanted to fetch, but has been `paused`. + * - `idle`: The query is not fetching. + * - See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. + */ + fetchStatus: FetchStatus; + /** + * A stable promise that will be resolved with the data of the query. + * Requires the `experimental_prefetchInRender` feature flag to be enabled. + * @example + * + * ### Enabling the feature flag + * ```ts + * const client = new QueryClient({ + * defaultOptions: { + * queries: { + * experimental_prefetchInRender: true, + * }, + * }, + * }) + * ``` + * + * ### Usage + * ```tsx + * import { useQuery } from '@tanstack/react-query' + * import React from 'react' + * import { fetchTodos, type Todo } from './api' + * + * function TodoList({ query }: { query: UseQueryResult }) { + * const data = React.use(query.promise) + * + * return ( + *
    + * {data.map(todo => ( + *
  • {todo.title}
  • + * ))} + *
+ * ) + * } + * + * export function App() { + * const query = useQuery({ queryKey: ['todos'], queryFn: fetchTodos }) + * + * return ( + * <> + *

Todos

+ * Loading...}> + * + * + * + * ) + * } + * ``` + */ + promise: Promise; +} +export { QueryObserverBaseResult } +export { QueryObserverBaseResult as QueryObserverBaseResult_alias_1 } + +declare type QueryObserverListener = (result: QueryObserverResult) => void; + +declare interface QueryObserverLoadingErrorResult extends QueryObserverBaseResult { + data: undefined; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: true; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { QueryObserverLoadingErrorResult } +export { QueryObserverLoadingErrorResult as QueryObserverLoadingErrorResult_alias_1 } + +declare interface QueryObserverLoadingResult extends QueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoading: true; + isLoadingError: false; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { QueryObserverLoadingResult } +export { QueryObserverLoadingResult as QueryObserverLoadingResult_alias_1 } + +declare interface QueryObserverOptions extends WithRequired, 'queryKey'> { + /** + * Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys. + * To refetch the query, use the `refetch` method returned from the `useQuery` instance. + * Accepts a boolean or function that returns a boolean. + * Defaults to `true`. + */ + enabled?: QueryBooleanOption; + /** + * The time in milliseconds after data is considered stale. + * If set to `Infinity`, the data will never be considered stale. + * If set to a function, the function will be executed with the query to compute a `staleTime`. + * Defaults to `0`. + */ + staleTime?: StaleTimeFunction; + /** + * If set to a number, the query will continuously refetch at this frequency in milliseconds. + * If set to a function, the function will be executed with the latest data and query to compute a frequency + * Defaults to `false`. + */ + refetchInterval?: number | false | ((query: Query) => number | false | undefined); + /** + * If set to `true`, the query will continue to refetch while their tab/window is in the background. + * Defaults to `false`. + */ + refetchIntervalInBackground?: boolean; + /** + * If set to `true`, the query will refetch on window focus if the data is stale. + * If set to `false`, the query will not refetch on window focus. + * If set to `'always'`, the query will always refetch on window focus. + * If set to a function, the function will be executed with the latest data and query to compute the value. + * Defaults to `true`. + */ + refetchOnWindowFocus?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `true`, the query will refetch on reconnect if the data is stale. + * If set to `false`, the query will not refetch on reconnect. + * If set to `'always'`, the query will always refetch on reconnect. + * If set to a function, the function will be executed with the latest data and query to compute the value. + * Defaults to `true` unless `networkMode` is `'always'`. + */ + refetchOnReconnect?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `true`, the query will refetch on mount if the data is stale. + * If set to `false`, will disable additional instances of a query to trigger background refetch. + * If set to `'always'`, the query will always refetch on mount. + * If set to a function, the function will be executed with the latest data and query to compute the value + * Defaults to `true`. + */ + refetchOnMount?: boolean | 'always' | ((query: Query) => boolean | 'always'); + /** + * If set to `false`, the query will not be retried on mount if it contains an error. + * If set to a function, the function will be executed with the query to compute the value. + * Defaults to `true`. + */ + retryOnMount?: QueryBooleanOption; + /** + * If set, the component will only re-render if any of the listed properties change. + * When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. + * When set to `'all'`, the component will re-render whenever a query is updated. + * When set to a function, the function will be executed to compute the list of properties. + * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. + */ + notifyOnChangeProps?: NotifyOnChangeProps; + /** + * Whether errors should be thrown instead of setting the `error` property. + * If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary. + * If set to `false` and `suspense` is `false`, errors are returned as state. + * If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`). + * Defaults to `false`. + */ + throwOnError?: ThrowOnError; + /** + * This option can be used to transform or select a part of the data returned by the query function. + */ + select?: (data: TQueryData) => TData; + /** + * If set to `true`, the query will suspend when `status === 'pending'` + * and throw errors when `status === 'error'`. + * Defaults to `false`. + */ + suspense?: boolean; + /** + * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. + */ + placeholderData?: NonFunctionGuard | PlaceholderDataFunction, TError, NonFunctionGuard, TQueryKey>; + _optimisticResults?: 'optimistic' | 'isRestoring'; + /** + * Enable prefetching during rendering + */ + experimental_prefetchInRender?: boolean; +} +export { QueryObserverOptions } +export { QueryObserverOptions as QueryObserverOptions_alias_1 } + +declare interface QueryObserverPendingResult extends QueryObserverBaseResult { + data: undefined; + error: null; + isError: false; + isPending: true; + isLoadingError: false; + isRefetchError: false; + isSuccess: false; + isPlaceholderData: false; + status: 'pending'; +} +export { QueryObserverPendingResult } +export { QueryObserverPendingResult as QueryObserverPendingResult_alias_1 } + +declare interface QueryObserverPlaceholderResult extends QueryObserverBaseResult { + data: TData; + isError: false; + error: null; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: true; + status: 'success'; +} +export { QueryObserverPlaceholderResult } +export { QueryObserverPlaceholderResult as QueryObserverPlaceholderResult_alias_1 } + +declare interface QueryObserverRefetchErrorResult extends QueryObserverBaseResult { + data: TData; + error: TError; + isError: true; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: true; + isSuccess: false; + isPlaceholderData: false; + status: 'error'; +} +export { QueryObserverRefetchErrorResult } +export { QueryObserverRefetchErrorResult as QueryObserverRefetchErrorResult_alias_1 } + +declare type QueryObserverResult = DefinedQueryObserverResult | QueryObserverLoadingErrorResult | QueryObserverLoadingResult | QueryObserverPendingResult | QueryObserverPlaceholderResult; +export { QueryObserverResult } +export { QueryObserverResult as QueryObserverResult_alias_1 } + +declare interface QueryObserverSuccessResult extends QueryObserverBaseResult { + data: TData; + error: null; + isError: false; + isPending: false; + isLoading: false; + isLoadingError: false; + isRefetchError: false; + isSuccess: true; + isPlaceholderData: false; + status: 'success'; +} +export { QueryObserverSuccessResult } +export { QueryObserverSuccessResult as QueryObserverSuccessResult_alias_1 } + +declare interface QueryOptions { + /** + * If `false`, failed queries will not retry by default. + * If `true`, failed queries will retry infinitely. + * If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. + * If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. + */ + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode?: NetworkMode; + /** + * The time in milliseconds that unused/inactive cache data remains in memory. + * When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. + * When different garbage collection times are specified, the longest one will be used. + * Setting it to `Infinity` will disable garbage collection. + */ + gcTime?: number; + queryFn?: QueryFunction | SkipToken; + persister?: QueryPersister, TPageParam>; + queryHash?: string; + queryKey?: TQueryKey; + queryKeyHashFn?: QueryKeyHashFunction; + initialData?: TData | InitialDataFunction; + initialDataUpdatedAt?: number | (() => number | undefined); + behavior?: QueryBehavior; + /** + * Set this to `false` to disable structural sharing between query results. + * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic. + * Defaults to `true`. + */ + structuralSharing?: boolean | ((oldData: unknown | undefined, newData: unknown) => unknown); + _defaulted?: boolean; + _type?: 'infinite'; + /** + * Additional payload to be stored on each query. + * Use this property to pass information that can be used in other places. + */ + meta?: QueryMeta; + /** + * Maximum number of pages to store in the data of an infinite query. + */ + maxPages?: number; +} +export { QueryOptions } +export { QueryOptions as QueryOptions_alias_1 } + +declare type QueryPersister = [TPageParam] extends [never] ? (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise : (queryFn: QueryFunction, context: QueryFunctionContext, query: Query) => T | Promise; +export { QueryPersister } +export { QueryPersister as QueryPersister_alias_1 } + +declare interface QueryState { + data: TData | undefined; + dataUpdateCount: number; + dataUpdatedAt: number; + error: TError | null; + errorUpdateCount: number; + errorUpdatedAt: number; + fetchFailureCount: number; + fetchFailureReason: TError | null; + fetchMeta: FetchMeta | null; + isInvalidated: boolean; + status: QueryStatus; + fetchStatus: FetchStatus; +} +export { QueryState } +export { QueryState as QueryState_alias_1 } + +declare type QueryStatus = 'pending' | 'error' | 'success'; +export { QueryStatus } +export { QueryStatus as QueryStatus_alias_1 } + +export declare interface QueryStore { + has: (queryHash: string) => boolean; + set: (queryHash: string, query: Query) => void; + get: (queryHash: string) => Query | undefined; + delete: (queryHash: string) => void; + values: () => IterableIterator; +} + +export declare type QueryTypeFilter = 'all' | 'active' | 'inactive'; + +declare type ReducibleStreamedQueryParams = BaseStreamedQueryParams & { + reducer: (acc: TData, chunk: TQueryFnData) => TData; + initialValue: TData; +}; + +declare interface RefetchOptions extends ResultOptions { + /** + * If set to `true`, a currently running request will be cancelled before a new request is made + * + * If set to `false`, no refetch will be made if there is already a request running. + * + * Defaults to `true`. + */ + cancelRefetch?: boolean; +} +export { RefetchOptions } +export { RefetchOptions as RefetchOptions_alias_1 } + +declare interface RefetchQueryFilters extends QueryFilters { +} +export { RefetchQueryFilters } +export { RefetchQueryFilters as RefetchQueryFilters_alias_1 } + +declare interface Register { +} +export { Register } +export { Register as Register_alias_1 } + +declare interface Rejected { + status: 'rejected'; + reason: unknown; +} + +export declare type RejectedThenable = Promise & Rejected; + +export declare abstract class Removable { + #private; + gcTime: number; + destroy(): void; + protected scheduleGc(): void; + protected updateGcTime(newGcTime: number | undefined): void; + protected clearGcTimeout(): void; + protected abstract optionalRemove(): void; +} + +export declare function replaceData>(prevData: TData | undefined, data: TData, options: TOptions): TData; + +/** + * This function returns `a` if `b` is deeply equal. + * If not, it will replace any deeply equal children of `b` with those of `a`. + * This can be used for structural sharing between JSON values for example. + */ +declare function replaceEqualDeep(a: unknown, b: T, depth?: number): T; +export { replaceEqualDeep } +export { replaceEqualDeep as replaceEqualDeep_alias_1 } + +declare type ReplaceReturnType) => unknown, TReturn> = (...args: Parameters) => TReturn; + +declare interface ResetOptions extends RefetchOptions { +} +export { ResetOptions } +export { ResetOptions as ResetOptions_alias_1 } + +export declare function resolveQueryBoolean(option: undefined | QueryBooleanOption, query: Query): boolean | undefined; + +export declare function resolveStaleTime(staleTime: undefined | StaleTimeFunction, query: Query): StaleTime | undefined; + +declare interface ResultOptions { + throwOnError?: boolean; +} +export { ResultOptions } +export { ResultOptions as ResultOptions_alias_1 } + +declare type RetryDelayFunction = (failureCount: number, error: TError) => number; + +export declare type RetryDelayValue = number | RetryDelayFunction; + +export declare interface Retryer { + promise: Promise; + cancel: (cancelOptions?: CancelOptions) => void; + continue: () => Promise; + cancelRetry: () => void; + continueRetry: () => void; + canStart: () => boolean; + start: () => Promise; + status: () => 'pending' | 'resolved' | 'rejected'; +} + +declare interface RetryerConfig { + fn: () => TData | Promise; + initialPromise?: Promise; + onCancel?: (error: TError) => void; + onFail?: (failureCount: number, error: TError) => void; + onPause?: () => void; + onContinue?: () => void; + retry?: RetryValue; + retryDelay?: RetryDelayValue; + networkMode: NetworkMode | undefined; + canRun: () => boolean; +} + +export declare type RetryValue = boolean | number | ShouldRetryFunction; + +declare type ScheduleFunction = (callback: () => void) => void; + +declare interface SetDataOptions { + updatedAt?: number; +} +export { SetDataOptions } +export { SetDataOptions as SetDataOptions_alias_1 } + +declare interface SetStateAction { + type: 'setState'; + state: Partial>; +} + +declare type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined; + +declare type SetupFn_2 = (setOnline: Listener_2) => (() => void) | undefined; + +/** + * Shallow compare objects. + */ +export declare function shallowEqualObjects>(a: T, b: T | undefined): boolean; + +declare type ShouldRetryFunction = (failureCount: number, error: TError) => boolean; + +declare function shouldThrowError) => boolean>(throwOnError: boolean | T | undefined, params: Parameters): boolean; +export { shouldThrowError } +export { shouldThrowError as shouldThrowError_alias_1 } + +declare type SimpleStreamedQueryParams = BaseStreamedQueryParams & { + reducer?: never; + initialValue?: never; +}; + +declare type SkipToken = typeof skipToken; +export { SkipToken } +export { SkipToken as SkipToken_alias_1 } + +declare const skipToken: unique symbol; +export { skipToken } +export { skipToken as skipToken_alias_1 } + +export declare function sleep(timeout: number): Promise; + +declare type StaleTime = number | 'static'; +export { StaleTime } +export { StaleTime as StaleTime_alias_1 } + +declare type StaleTimeFunction = StaleTime | ((query: Query) => StaleTime); +export { StaleTimeFunction } +export { StaleTimeFunction as StaleTimeFunction_alias_1 } + +/** + * This is a helper function to create a query function that streams data from an AsyncIterable. + * Data will be an Array of all the chunks received. + * The query will be in a 'pending' state until the first chunk of data is received, but will go to 'success' after that. + * The query will stay in fetchStatus 'fetching' until the stream ends. + * @param queryFn - The function that returns an AsyncIterable to stream data from. + * @param refetchMode - Defines how re-fetches are handled. + * Defaults to `'reset'`, erases all data and puts the query back into `pending` state. + * Set to `'append'` to append new data to the existing data. + * Set to `'replace'` to write all data to the cache once the stream ends. + * @param reducer - A function to reduce the streamed chunks into the final data. + * Defaults to a function that appends chunks to the end of the array. + * @param initialValue - Initial value to be used while the first chunk is being fetched, and returned if the stream yields no values. + */ +declare function streamedQuery, TQueryKey extends QueryKey = QueryKey>({ streamFn, refetchMode, reducer, initialValue, }: StreamedQueryParams): QueryFunction; +export { streamedQuery as experimental_streamedQuery } +export { streamedQuery } + +declare type StreamedQueryParams = SimpleStreamedQueryParams | ReducibleStreamedQueryParams; + +export declare class Subscribable { + protected listeners: Set; + constructor(); + subscribe(listener: TListener): () => void; + hasListeners(): boolean; + protected onSubscribe(): void; + protected onUnsubscribe(): void; +} + +declare interface SuccessAction { + data: TData | undefined; + type: 'success'; + dataUpdatedAt?: number; + manual?: boolean; +} + +declare interface SuccessAction_2 { + type: 'success'; + data: TData; +} + +/** + * In many cases code wants to delay to the next event loop tick; this is not + * mediated by {@link timeoutManager}. + * + * This function is provided to make auditing the `tanstack/query-core` for + * incorrect use of system `setTimeout` easier. + */ +export declare function systemSetTimeoutZero(callback: TimeoutCallback): void; + +export declare type Thenable = FulfilledThenable | RejectedThenable | PendingThenable; + +declare type ThrowOnError = boolean | ((error: TError, query: Query) => boolean); +export { ThrowOnError } +export { ThrowOnError as ThrowOnError_alias_1 } + +/** + * {@link TimeoutManager} does not support passing arguments to the callback. + * + * `(_: void)` is the argument type inferred by TypeScript's default typings for + * `setTimeout(cb, number)`. + * If we don't accept a single void argument, then + * `new Promise(resolve => timeoutManager.setTimeout(resolve, N))` is a type error. + */ +declare type TimeoutCallback = (_: void) => void; +export { TimeoutCallback } +export { TimeoutCallback as TimeoutCallback_alias_1 } + +/** + * Allows customization of how timeouts are created. + * + * @tanstack/query-core makes liberal use of timeouts to implement `staleTime` + * and `gcTime`. The default TimeoutManager provider uses the platform's global + * `setTimeout` implementation, which is known to have scalability issues with + * thousands of timeouts on the event loop. + * + * If you hit this limitation, consider providing a custom TimeoutProvider that + * coalesces timeouts. + */ +export declare class TimeoutManager implements Omit { + #private; + setTimeoutProvider(provider: TimeoutProvider): void; + setTimeout(callback: TimeoutCallback, delay: number): ManagedTimerId; + clearTimeout(timeoutId: ManagedTimerId | undefined): void; + setInterval(callback: TimeoutCallback, delay: number): ManagedTimerId; + clearInterval(intervalId: ManagedTimerId | undefined): void; +} + +declare const timeoutManager: TimeoutManager; +export { timeoutManager } +export { timeoutManager as timeoutManager_alias_1 } + +/** + * Backend for timer functions. + */ +declare type TimeoutProvider = { + readonly setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; + readonly clearTimeout: (timeoutId: TTimerId | undefined) => void; + readonly setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + readonly clearInterval: (intervalId: TTimerId | undefined) => void; +}; +export { TimeoutProvider } +export { TimeoutProvider as TimeoutProvider_alias_1 } + +export declare function timeUntilStale(updatedAt: number, staleTime?: number): number; + +declare type TransformerFn = (data: any) => any; + +/** + * This function takes a Promise-like input and detects whether the data + * is synchronously available or not. + * + * It does not inspect .status, .value or .reason properties of the promise, + * as those are not always available, and the .status of React's promises + * should not be considered part of the public API. + */ +export declare function tryResolveSync(promise: Promise | Thenable): { + data: {} | null; +} | undefined; + +declare type TuplePrefixes> = T extends readonly [] ? readonly [] : TuplePrefixes> | T; + +declare type UnsetMarker = typeof unsetMarker; +export { UnsetMarker } +export { UnsetMarker as UnsetMarker_alias_1 } + +declare const unsetMarker: unique symbol; +export { unsetMarker } +export { unsetMarker as unsetMarker_alias_1 } + +declare type Updater = TOutput | ((input: TInput) => TOutput); +export { Updater } +export { Updater as Updater_alias_1 } + +declare type WithRequired = TTarget & { + [_ in TKey]: {}; +}; +export { WithRequired } +export { WithRequired as WithRequired_alias_1 } + +export { } diff --git a/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js b/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js new file mode 100644 index 0000000000000000000000000000000000000000..62f76a2493e14d1b8191e89d3481f31f4501eb9a --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js @@ -0,0 +1,25 @@ +var __typeError = (msg) => { + throw TypeError(msg); +}; +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); +var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); +var __privateWrapper = (obj, member, setter, getter) => ({ + set _(value) { + __privateSet(obj, member, value, setter); + }, + get _() { + return __privateGet(obj, member, getter); + } +}); + +export { + __privateGet, + __privateAdd, + __privateSet, + __privateMethod, + __privateWrapper +}; +//# sourceMappingURL=chunk-PXG64RU4.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js.map b/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js.map new file mode 100644 index 0000000000000000000000000000000000000000..84c51b288c478ac0d18748007ccfb8cddc797f3a --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/chunk-PXG64RU4.js.map @@ -0,0 +1 @@ +{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs b/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs new file mode 100644 index 0000000000000000000000000000000000000000..534aafb02338bd5120f93c82b96910455da81dc8 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs @@ -0,0 +1,48 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/environmentManager.ts +var environmentManager_exports = {}; +__export(environmentManager_exports, { + environmentManager: () => environmentManager +}); +module.exports = __toCommonJS(environmentManager_exports); +var import_utils = require("./utils.cjs"); +var environmentManager = /* @__PURE__ */ (() => { + let isServerFn = () => import_utils.isServer; + return { + /** + * Returns whether the current runtime should be treated as a server environment. + */ + isServer() { + return isServerFn(); + }, + /** + * Overrides the server check globally. + */ + setIsServer(isServerValue) { + isServerFn = isServerValue; + } + }; +})(); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + environmentManager +}); +//# sourceMappingURL=environmentManager.cjs.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs.map b/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..01c32e3354bf17854f4d81c3da39df4b12ce7b3b --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.cjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/environmentManager.ts"],"sourcesContent":["import { isServer } from './utils'\n\nexport type IsServerValue = () => boolean\n\n/**\n * Manages environment detection used by TanStack Query internals.\n */\nexport const environmentManager = (() => {\n let isServerFn: IsServerValue = () => isServer\n\n return {\n /**\n * Returns whether the current runtime should be treated as a server environment.\n */\n isServer(): boolean {\n return isServerFn()\n },\n /**\n * Overrides the server check globally.\n */\n setIsServer(isServerValue: IsServerValue): void {\n isServerFn = isServerValue\n },\n }\n})()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyB;AAOlB,IAAM,qBAAsB,uBAAM;AACvC,MAAI,aAA4B,MAAM;AAEtC,SAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAoB;AAClB,aAAO,WAAW;AAAA,IACpB;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,eAAoC;AAC9C,mBAAa;AAAA,IACf;AAAA,EACF;AACF,GAAG;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.cts b/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..3ee1ca64f0cb2655b3cb0437300bb012e0740f33 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.cts @@ -0,0 +1,2 @@ +export { IsServerValue } from './_tsup-dts-rollup.cjs'; +export { environmentManager } from './_tsup-dts-rollup.cjs'; diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.ts b/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7696202bd9963f671811ce89e55b6aacc6324b9f --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.d.ts @@ -0,0 +1,2 @@ +export { IsServerValue } from './_tsup-dts-rollup.js'; +export { environmentManager } from './_tsup-dts-rollup.js'; diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.js b/node_modules/@tanstack/query-core/build/legacy/environmentManager.js new file mode 100644 index 0000000000000000000000000000000000000000..59330ab3c2456b67a86d68d2c545c317e90da989 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.js @@ -0,0 +1,25 @@ +import "./chunk-PXG64RU4.js"; + +// src/environmentManager.ts +import { isServer } from "./utils.js"; +var environmentManager = /* @__PURE__ */ (() => { + let isServerFn = () => isServer; + return { + /** + * Returns whether the current runtime should be treated as a server environment. + */ + isServer() { + return isServerFn(); + }, + /** + * Overrides the server check globally. + */ + setIsServer(isServerValue) { + isServerFn = isServerValue; + } + }; +})(); +export { + environmentManager +}; +//# sourceMappingURL=environmentManager.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/environmentManager.js.map b/node_modules/@tanstack/query-core/build/legacy/environmentManager.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e67bb28a26a72af4fa2f280ac6a4dfabc23dee4d --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/environmentManager.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/environmentManager.ts"],"sourcesContent":["import { isServer } from './utils'\n\nexport type IsServerValue = () => boolean\n\n/**\n * Manages environment detection used by TanStack Query internals.\n */\nexport const environmentManager = (() => {\n let isServerFn: IsServerValue = () => isServer\n\n return {\n /**\n * Returns whether the current runtime should be treated as a server environment.\n */\n isServer(): boolean {\n return isServerFn()\n },\n /**\n * Overrides the server check globally.\n */\n setIsServer(isServerValue: IsServerValue): void {\n isServerFn = isServerValue\n },\n }\n})()\n"],"mappings":";;;AAAA,SAAS,gBAAgB;AAOlB,IAAM,qBAAsB,uBAAM;AACvC,MAAI,aAA4B,MAAM;AAEtC,SAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAoB;AAClB,aAAO,WAAW;AAAA,IACpB;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,eAAoC;AAC9C,mBAAa;AAAA,IACf;AAAA,EACF;AACF,GAAG;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs b/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs new file mode 100644 index 0000000000000000000000000000000000000000..136052c5e6c2a4dcbcd4f44b570b02cac37e172f --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs @@ -0,0 +1,107 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __typeError = (msg) => { + throw TypeError(msg); +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); + +// src/focusManager.ts +var focusManager_exports = {}; +__export(focusManager_exports, { + FocusManager: () => FocusManager, + focusManager: () => focusManager +}); +module.exports = __toCommonJS(focusManager_exports); +var import_subscribable = require("./subscribable.cjs"); +var _focused, _cleanup, _setup; +var FocusManager = class extends import_subscribable.Subscribable { + constructor() { + super(); + __privateAdd(this, _focused); + __privateAdd(this, _cleanup); + __privateAdd(this, _setup); + __privateSet(this, _setup, (onFocus) => { + if (typeof window !== "undefined" && window.addEventListener) { + const listener = () => onFocus(); + window.addEventListener("visibilitychange", listener, false); + return () => { + window.removeEventListener("visibilitychange", listener); + }; + } + return; + }); + } + onSubscribe() { + if (!__privateGet(this, _cleanup)) { + this.setEventListener(__privateGet(this, _setup)); + } + } + onUnsubscribe() { + var _a; + if (!this.hasListeners()) { + (_a = __privateGet(this, _cleanup)) == null ? void 0 : _a.call(this); + __privateSet(this, _cleanup, void 0); + } + } + setEventListener(setup) { + var _a; + __privateSet(this, _setup, setup); + (_a = __privateGet(this, _cleanup)) == null ? void 0 : _a.call(this); + __privateSet(this, _cleanup, setup((focused) => { + if (typeof focused === "boolean") { + this.setFocused(focused); + } else { + this.onFocus(); + } + })); + } + setFocused(focused) { + const changed = __privateGet(this, _focused) !== focused; + if (changed) { + __privateSet(this, _focused, focused); + this.onFocus(); + } + } + onFocus() { + const isFocused = this.isFocused(); + this.listeners.forEach((listener) => { + listener(isFocused); + }); + } + isFocused() { + var _a; + if (typeof __privateGet(this, _focused) === "boolean") { + return __privateGet(this, _focused); + } + return ((_a = globalThis.document) == null ? void 0 : _a.visibilityState) !== "hidden"; + } +}; +_focused = new WeakMap(); +_cleanup = new WeakMap(); +_setup = new WeakMap(); +var focusManager = new FocusManager(); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + FocusManager, + focusManager +}); +//# sourceMappingURL=focusManager.cjs.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs.map b/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..cdabd0016ad018bb7505c88c61dbb7254d82dc9f --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.cjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/focusManager.ts"],"sourcesContent":["import { Subscribable } from './subscribable'\n\ntype Listener = (focused: boolean) => void\n\ntype SetupFn = (\n setFocused: (focused?: boolean) => void,\n) => (() => void) | undefined\n\nexport class FocusManager extends Subscribable {\n #focused?: boolean\n #cleanup?: () => void\n\n #setup: SetupFn\n\n constructor() {\n super()\n this.#setup = (onFocus) => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof window !== 'undefined' && window.addEventListener) {\n const listener = () => onFocus()\n // Listen to visibilitychange\n window.addEventListener('visibilitychange', listener, false)\n\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener)\n }\n }\n return\n }\n }\n\n protected onSubscribe(): void {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup)\n }\n }\n\n protected onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.()\n this.#cleanup = undefined\n }\n }\n\n setEventListener(setup: SetupFn): void {\n this.#setup = setup\n this.#cleanup?.()\n this.#cleanup = setup((focused) => {\n if (typeof focused === 'boolean') {\n this.setFocused(focused)\n } else {\n this.onFocus()\n }\n })\n }\n\n setFocused(focused?: boolean): void {\n const changed = this.#focused !== focused\n if (changed) {\n this.#focused = focused\n this.onFocus()\n }\n }\n\n onFocus(): void {\n const isFocused = this.isFocused()\n this.listeners.forEach((listener) => {\n listener(isFocused)\n })\n }\n\n isFocused(): boolean {\n if (typeof this.#focused === 'boolean') {\n return this.#focused\n }\n\n // document global can be unavailable in react native\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return globalThis.document?.visibilityState !== 'hidden'\n }\n}\n\nexport const focusManager = new FocusManager()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAA7B;AAQO,IAAM,eAAN,cAA2B,iCAAuB;AAAA,EAMvD,cAAc;AACZ,UAAM;AANR;AACA;AAEA;AAIE,uBAAK,QAAS,CAAC,YAAY;AAGzB,UAAI,OAAO,WAAW,eAAe,OAAO,kBAAkB;AAC5D,cAAM,WAAW,MAAM,QAAQ;AAE/B,eAAO,iBAAiB,oBAAoB,UAAU,KAAK;AAE3D,eAAO,MAAM;AAEX,iBAAO,oBAAoB,oBAAoB,QAAQ;AAAA,QACzD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EAEU,cAAoB;AAC5B,QAAI,CAAC,mBAAK,WAAU;AAClB,WAAK,iBAAiB,mBAAK,OAAM;AAAA,IACnC;AAAA,EACF;AAAA,EAEU,gBAAgB;AAvC5B;AAwCI,QAAI,CAAC,KAAK,aAAa,GAAG;AACxB,+BAAK,cAAL;AACA,yBAAK,UAAW;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,iBAAiB,OAAsB;AA9CzC;AA+CI,uBAAK,QAAS;AACd,6BAAK,cAAL;AACA,uBAAK,UAAW,MAAM,CAAC,YAAY;AACjC,UAAI,OAAO,YAAY,WAAW;AAChC,aAAK,WAAW,OAAO;AAAA,MACzB,OAAO;AACL,aAAK,QAAQ;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,SAAyB;AAClC,UAAM,UAAU,mBAAK,cAAa;AAClC,QAAI,SAAS;AACX,yBAAK,UAAW;AAChB,WAAK,QAAQ;AAAA,IACf;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,UAAM,YAAY,KAAK,UAAU;AACjC,SAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,eAAS,SAAS;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,YAAqB;AAzEvB;AA0EI,QAAI,OAAO,mBAAK,cAAa,WAAW;AACtC,aAAO,mBAAK;AAAA,IACd;AAIA,aAAO,gBAAW,aAAX,mBAAqB,qBAAoB;AAAA,EAClD;AACF;AAzEE;AACA;AAEA;AAwEK,IAAM,eAAe,IAAI,aAAa;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.d.cts b/node_modules/@tanstack/query-core/build/legacy/focusManager.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..57c7ec8a7855369c37b6b752d96ecfc4d2c1aca4 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.d.cts @@ -0,0 +1,2 @@ +export { FocusManager } from './_tsup-dts-rollup.cjs'; +export { focusManager } from './_tsup-dts-rollup.cjs'; diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.d.ts b/node_modules/@tanstack/query-core/build/legacy/focusManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..75bce71c27b180cd69abce74603b149245a5be05 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.d.ts @@ -0,0 +1,2 @@ +export { FocusManager } from './_tsup-dts-rollup.js'; +export { focusManager } from './_tsup-dts-rollup.js'; diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.js b/node_modules/@tanstack/query-core/build/legacy/focusManager.js new file mode 100644 index 0000000000000000000000000000000000000000..d1c3ae276f0a1c74a71627d17801215c10ae8d40 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.js @@ -0,0 +1,80 @@ +import { + __privateAdd, + __privateGet, + __privateSet +} from "./chunk-PXG64RU4.js"; + +// src/focusManager.ts +import { Subscribable } from "./subscribable.js"; +var _focused, _cleanup, _setup; +var FocusManager = class extends Subscribable { + constructor() { + super(); + __privateAdd(this, _focused); + __privateAdd(this, _cleanup); + __privateAdd(this, _setup); + __privateSet(this, _setup, (onFocus) => { + if (typeof window !== "undefined" && window.addEventListener) { + const listener = () => onFocus(); + window.addEventListener("visibilitychange", listener, false); + return () => { + window.removeEventListener("visibilitychange", listener); + }; + } + return; + }); + } + onSubscribe() { + if (!__privateGet(this, _cleanup)) { + this.setEventListener(__privateGet(this, _setup)); + } + } + onUnsubscribe() { + var _a; + if (!this.hasListeners()) { + (_a = __privateGet(this, _cleanup)) == null ? void 0 : _a.call(this); + __privateSet(this, _cleanup, void 0); + } + } + setEventListener(setup) { + var _a; + __privateSet(this, _setup, setup); + (_a = __privateGet(this, _cleanup)) == null ? void 0 : _a.call(this); + __privateSet(this, _cleanup, setup((focused) => { + if (typeof focused === "boolean") { + this.setFocused(focused); + } else { + this.onFocus(); + } + })); + } + setFocused(focused) { + const changed = __privateGet(this, _focused) !== focused; + if (changed) { + __privateSet(this, _focused, focused); + this.onFocus(); + } + } + onFocus() { + const isFocused = this.isFocused(); + this.listeners.forEach((listener) => { + listener(isFocused); + }); + } + isFocused() { + var _a; + if (typeof __privateGet(this, _focused) === "boolean") { + return __privateGet(this, _focused); + } + return ((_a = globalThis.document) == null ? void 0 : _a.visibilityState) !== "hidden"; + } +}; +_focused = new WeakMap(); +_cleanup = new WeakMap(); +_setup = new WeakMap(); +var focusManager = new FocusManager(); +export { + FocusManager, + focusManager +}; +//# sourceMappingURL=focusManager.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/focusManager.js.map b/node_modules/@tanstack/query-core/build/legacy/focusManager.js.map new file mode 100644 index 0000000000000000000000000000000000000000..50018a3871e4ddf978df60088fa5d667db771107 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/focusManager.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/focusManager.ts"],"sourcesContent":["import { Subscribable } from './subscribable'\n\ntype Listener = (focused: boolean) => void\n\ntype SetupFn = (\n setFocused: (focused?: boolean) => void,\n) => (() => void) | undefined\n\nexport class FocusManager extends Subscribable {\n #focused?: boolean\n #cleanup?: () => void\n\n #setup: SetupFn\n\n constructor() {\n super()\n this.#setup = (onFocus) => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof window !== 'undefined' && window.addEventListener) {\n const listener = () => onFocus()\n // Listen to visibilitychange\n window.addEventListener('visibilitychange', listener, false)\n\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener)\n }\n }\n return\n }\n }\n\n protected onSubscribe(): void {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup)\n }\n }\n\n protected onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.()\n this.#cleanup = undefined\n }\n }\n\n setEventListener(setup: SetupFn): void {\n this.#setup = setup\n this.#cleanup?.()\n this.#cleanup = setup((focused) => {\n if (typeof focused === 'boolean') {\n this.setFocused(focused)\n } else {\n this.onFocus()\n }\n })\n }\n\n setFocused(focused?: boolean): void {\n const changed = this.#focused !== focused\n if (changed) {\n this.#focused = focused\n this.onFocus()\n }\n }\n\n onFocus(): void {\n const isFocused = this.isFocused()\n this.listeners.forEach((listener) => {\n listener(isFocused)\n })\n }\n\n isFocused(): boolean {\n if (typeof this.#focused === 'boolean') {\n return this.#focused\n }\n\n // document global can be unavailable in react native\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return globalThis.document?.visibilityState !== 'hidden'\n }\n}\n\nexport const focusManager = new FocusManager()\n"],"mappings":";;;;;;;AAAA,SAAS,oBAAoB;AAA7B;AAQO,IAAM,eAAN,cAA2B,aAAuB;AAAA,EAMvD,cAAc;AACZ,UAAM;AANR;AACA;AAEA;AAIE,uBAAK,QAAS,CAAC,YAAY;AAGzB,UAAI,OAAO,WAAW,eAAe,OAAO,kBAAkB;AAC5D,cAAM,WAAW,MAAM,QAAQ;AAE/B,eAAO,iBAAiB,oBAAoB,UAAU,KAAK;AAE3D,eAAO,MAAM;AAEX,iBAAO,oBAAoB,oBAAoB,QAAQ;AAAA,QACzD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EAEU,cAAoB;AAC5B,QAAI,CAAC,mBAAK,WAAU;AAClB,WAAK,iBAAiB,mBAAK,OAAM;AAAA,IACnC;AAAA,EACF;AAAA,EAEU,gBAAgB;AAvC5B;AAwCI,QAAI,CAAC,KAAK,aAAa,GAAG;AACxB,+BAAK,cAAL;AACA,yBAAK,UAAW;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,iBAAiB,OAAsB;AA9CzC;AA+CI,uBAAK,QAAS;AACd,6BAAK,cAAL;AACA,uBAAK,UAAW,MAAM,CAAC,YAAY;AACjC,UAAI,OAAO,YAAY,WAAW;AAChC,aAAK,WAAW,OAAO;AAAA,MACzB,OAAO;AACL,aAAK,QAAQ;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,SAAyB;AAClC,UAAM,UAAU,mBAAK,cAAa;AAClC,QAAI,SAAS;AACX,yBAAK,UAAW;AAChB,WAAK,QAAQ;AAAA,IACf;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,UAAM,YAAY,KAAK,UAAU;AACjC,SAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,eAAS,SAAS;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,YAAqB;AAzEvB;AA0EI,QAAI,OAAO,mBAAK,cAAa,WAAW;AACtC,aAAO,mBAAK;AAAA,IACd;AAIA,aAAO,gBAAW,aAAX,mBAAqB,qBAAoB;AAAA,EAClD;AACF;AAzEE;AACA;AAEA;AAwEK,IAAM,eAAe,IAAI,aAAa;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.cjs b/node_modules/@tanstack/query-core/build/legacy/hydration.cjs new file mode 100644 index 0000000000000000000000000000000000000000..76386a6bb0d628a163d684ea89bee39184ef2a97 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.cjs @@ -0,0 +1,208 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/hydration.ts +var hydration_exports = {}; +__export(hydration_exports, { + defaultShouldDehydrateMutation: () => defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery: () => defaultShouldDehydrateQuery, + dehydrate: () => dehydrate, + hydrate: () => hydrate +}); +module.exports = __toCommonJS(hydration_exports); +var import_thenable = require("./thenable.cjs"); +var import_utils = require("./utils.cjs"); +function defaultTransformerFn(data) { + return data; +} +function dehydrateMutation(mutation) { + return { + mutationKey: mutation.options.mutationKey, + state: mutation.state, + ...mutation.options.scope && { scope: mutation.options.scope }, + ...mutation.meta && { meta: mutation.meta } + }; +} +function dehydrateQuery(query, serializeData, shouldRedactErrors) { + const dehydratePromise = () => { + var _a; + const promise = (_a = query.promise) == null ? void 0 : _a.then(serializeData).catch((error) => { + if (!shouldRedactErrors(error)) { + return Promise.reject(error); + } + if (process.env.NODE_ENV !== "production") { + console.error( + `A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds` + ); + } + return Promise.reject(new Error("redacted")); + }); + promise == null ? void 0 : promise.catch(import_utils.noop); + return promise; + }; + return { + dehydratedAt: Date.now(), + state: { + ...query.state, + ...query.state.data !== void 0 && { + data: serializeData(query.state.data) + } + }, + queryKey: query.queryKey, + queryHash: query.queryHash, + ...query.state.status === "pending" && { + promise: dehydratePromise() + }, + ...query.meta && { meta: query.meta }, + ...query.queryType && { queryType: query.queryType } + }; +} +function defaultShouldDehydrateMutation(mutation) { + return mutation.state.isPaused; +} +function defaultShouldDehydrateQuery(query) { + return query.state.status === "success"; +} +function defaultShouldRedactErrors(_) { + return true; +} +function dehydrate(client, options = {}) { + var _a, _b, _c, _d; + const filterMutation = options.shouldDehydrateMutation ?? ((_a = client.getDefaultOptions().dehydrate) == null ? void 0 : _a.shouldDehydrateMutation) ?? defaultShouldDehydrateMutation; + const mutations = client.getMutationCache().getAll().flatMap( + (mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : [] + ); + const filterQuery = options.shouldDehydrateQuery ?? ((_b = client.getDefaultOptions().dehydrate) == null ? void 0 : _b.shouldDehydrateQuery) ?? defaultShouldDehydrateQuery; + const shouldRedactErrors = options.shouldRedactErrors ?? ((_c = client.getDefaultOptions().dehydrate) == null ? void 0 : _c.shouldRedactErrors) ?? defaultShouldRedactErrors; + const serializeData = options.serializeData ?? ((_d = client.getDefaultOptions().dehydrate) == null ? void 0 : _d.serializeData) ?? defaultTransformerFn; + const queries = client.getQueryCache().getAll().flatMap( + (query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : [] + ); + return { mutations, queries }; +} +function hydrate(client, dehydratedState, options) { + var _a, _b; + if (typeof dehydratedState !== "object" || dehydratedState === null) { + return; + } + const mutationCache = client.getMutationCache(); + const queryCache = client.getQueryCache(); + const deserializeData = ((_a = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _a.deserializeData) ?? ((_b = client.getDefaultOptions().hydrate) == null ? void 0 : _b.deserializeData) ?? defaultTransformerFn; + const mutations = dehydratedState.mutations || []; + const queries = dehydratedState.queries || []; + mutations.forEach(({ state, ...mutationOptions }) => { + var _a2, _b2; + mutationCache.build( + client, + { + ...(_a2 = client.getDefaultOptions().hydrate) == null ? void 0 : _a2.mutations, + ...(_b2 = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b2.mutations, + ...mutationOptions + }, + state + ); + }); + queries.forEach( + ({ + queryKey, + state, + queryHash, + meta, + promise, + dehydratedAt, + queryType + }) => { + var _a2, _b2; + const syncData = promise ? (0, import_thenable.tryResolveSync)(promise) : void 0; + const rawData = state.data === void 0 ? syncData == null ? void 0 : syncData.data : state.data; + const data = rawData === void 0 ? rawData : deserializeData(rawData); + let query = queryCache.get(queryHash); + const existingQueryIsPending = (query == null ? void 0 : query.state.status) === "pending"; + const existingQueryIsFetching = (query == null ? void 0 : query.state.fetchStatus) === "fetching"; + if (query) { + const hasNewerSyncData = syncData && // We only need this undefined check to handle older dehydration + // payloads that might not have dehydratedAt + dehydratedAt !== void 0 && dehydratedAt > query.state.dataUpdatedAt; + if (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) { + const { fetchStatus: _ignored, ...serializedState } = state; + query.setState({ + ...serializedState, + data, + // If the query was pending at the moment of dehydration, but resolved to have data + // before hydration, we can assume the query should be hydrated as successful. + // + // Since you can opt into dehydrating failed queries, and those can have data from + // previous successful fetches, we make sure we only do this for pending queries. + ...state.status === "pending" && data !== void 0 && { + status: "success", + dataUpdatedAt: dehydratedAt ?? Date.now(), + // Preserve existing fetchStatus if the existing query is actively fetching. + ...!existingQueryIsFetching && { + fetchStatus: "idle" + } + } + }); + } + } else { + query = queryCache.build( + client, + { + ...(_a2 = client.getDefaultOptions().hydrate) == null ? void 0 : _a2.queries, + ...(_b2 = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b2.queries, + queryKey, + queryHash, + meta, + _type: queryType + }, + // Reset fetch status to idle to avoid + // query being stuck in fetching state upon hydration + { + ...state, + data, + fetchStatus: "idle", + // Like above, if the query was pending at the moment of dehydration but has data, + // we can assume it should be hydrated as successful. + status: state.status === "pending" && data !== void 0 ? "success" : state.status, + ...state.status === "pending" && data !== void 0 && { + dataUpdatedAt: dehydratedAt ?? Date.now() + } + } + ); + } + if (promise && // If the data was synchronously available, there is no need to set up + // a retryer and thus no reason to call fetch + !syncData && !existingQueryIsPending && !existingQueryIsFetching && // Only hydrate if dehydration is newer than any existing data, + // this is always true for new queries + (dehydratedAt === void 0 || dehydratedAt > query.state.dataUpdatedAt)) { + query.fetch(void 0, { + // RSC transformed promises are not thenable + initialPromise: Promise.resolve(promise).then(deserializeData) + }).catch(import_utils.noop); + } + } + ); +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery, + dehydrate, + hydrate +}); +//# sourceMappingURL=hydration.cjs.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.cjs.map b/node_modules/@tanstack/query-core/build/legacy/hydration.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..e822e51f1fa2df647f3a715fc9882cfc2469f2dd --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.cjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/hydration.ts"],"sourcesContent":["import { tryResolveSync } from './thenable'\nimport { noop } from './utils'\nimport type {\n DefaultError,\n MutationKey,\n MutationMeta,\n MutationOptions,\n MutationScope,\n QueryKey,\n QueryMeta,\n QueryOptions,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\ntype TransformerFn = (data: any) => any\nfunction defaultTransformerFn(data: any): any {\n return data\n}\n\nexport interface DehydrateOptions {\n serializeData?: TransformerFn\n shouldDehydrateMutation?: (mutation: Mutation) => boolean\n shouldDehydrateQuery?: (query: Query) => boolean\n shouldRedactErrors?: (error: unknown) => boolean\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n deserializeData?: TransformerFn\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n meta?: MutationMeta\n scope?: MutationScope\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n promise?: Promise\n meta?: QueryMeta\n queryType?: 'infinite'\n // This is only optional because older versions of Query might have dehydrated\n // without it which we need to handle for backwards compatibility.\n // This should be changed to required in the future.\n dehydratedAt?: number\n}\n\nexport interface DehydratedState {\n mutations: Array\n queries: Array\n}\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n ...(mutation.options.scope && { scope: mutation.options.scope }),\n ...(mutation.meta && { meta: mutation.meta }),\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(\n query: Query,\n serializeData: TransformerFn,\n shouldRedactErrors: (error: unknown) => boolean,\n): DehydratedQuery {\n const dehydratePromise = () => {\n const promise = query.promise?.then(serializeData).catch((error) => {\n if (!shouldRedactErrors(error)) {\n // Reject original error if it should not be redacted\n return Promise.reject(error)\n }\n // If not in production, log original error before rejecting redacted error\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`,\n )\n }\n return Promise.reject(new Error('redacted'))\n })\n\n // Avoid unhandled promise rejections\n // We need the promise we dehydrate to reject to get the correct result into\n // the query cache, but we also want to avoid unhandled promise rejections\n // in whatever environment the prefetches are happening in.\n promise?.catch(noop)\n\n return promise\n }\n\n return {\n dehydratedAt: Date.now(),\n state: {\n ...query.state,\n ...(query.state.data !== undefined && {\n data: serializeData(query.state.data),\n }),\n },\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n ...(query.state.status === 'pending' && {\n promise: dehydratePromise(),\n }),\n ...(query.meta && { meta: query.meta }),\n ...(query.queryType && { queryType: query.queryType }),\n }\n}\n\nexport function defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nexport function defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nfunction defaultShouldRedactErrors(_: unknown) {\n return true\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const filterMutation =\n options.shouldDehydrateMutation ??\n client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ??\n defaultShouldDehydrateMutation\n\n const mutations = client\n .getMutationCache()\n .getAll()\n .flatMap((mutation) =>\n filterMutation(mutation) ? [dehydrateMutation(mutation)] : [],\n )\n\n const filterQuery =\n options.shouldDehydrateQuery ??\n client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ??\n defaultShouldDehydrateQuery\n\n const shouldRedactErrors =\n options.shouldRedactErrors ??\n client.getDefaultOptions().dehydrate?.shouldRedactErrors ??\n defaultShouldRedactErrors\n\n const serializeData =\n options.serializeData ??\n client.getDefaultOptions().dehydrate?.serializeData ??\n defaultTransformerFn\n\n const queries = client\n .getQueryCache()\n .getAll()\n .flatMap((query) =>\n filterQuery(query)\n ? [dehydrateQuery(query, serializeData, shouldRedactErrors)]\n : [],\n )\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n const deserializeData =\n options?.defaultOptions?.deserializeData ??\n client.getDefaultOptions().hydrate?.deserializeData ??\n defaultTransformerFn\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach(({ state, ...mutationOptions }) => {\n mutationCache.build(\n client,\n {\n ...client.getDefaultOptions().hydrate?.mutations,\n ...options?.defaultOptions?.mutations,\n ...mutationOptions,\n },\n state,\n )\n })\n\n queries.forEach(\n ({\n queryKey,\n state,\n queryHash,\n meta,\n promise,\n dehydratedAt,\n queryType,\n }) => {\n const syncData = promise ? tryResolveSync(promise) : undefined\n const rawData = state.data === undefined ? syncData?.data : state.data\n const data = rawData === undefined ? rawData : deserializeData(rawData)\n\n let query = queryCache.get(queryHash)\n const existingQueryIsPending = query?.state.status === 'pending'\n const existingQueryIsFetching = query?.state.fetchStatus === 'fetching'\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n const hasNewerSyncData =\n syncData &&\n // We only need this undefined check to handle older dehydration\n // payloads that might not have dehydratedAt\n dehydratedAt !== undefined &&\n dehydratedAt > query.state.dataUpdatedAt\n if (\n state.dataUpdatedAt > query.state.dataUpdatedAt ||\n hasNewerSyncData\n ) {\n // Omit fetchStatus from dehydrated state so that query stays in its current fetchStatus\n const { fetchStatus: _ignored, ...serializedState } = state\n query.setState({\n ...serializedState,\n data,\n // If the query was pending at the moment of dehydration, but resolved to have data\n // before hydration, we can assume the query should be hydrated as successful.\n //\n // Since you can opt into dehydrating failed queries, and those can have data from\n // previous successful fetches, we make sure we only do this for pending queries.\n ...(state.status === 'pending' &&\n data !== undefined && {\n status: 'success' as const,\n dataUpdatedAt: dehydratedAt ?? Date.now(),\n // Preserve existing fetchStatus if the existing query is actively fetching.\n ...(!existingQueryIsFetching && {\n fetchStatus: 'idle' as const,\n }),\n }),\n })\n }\n } else {\n // Restore query\n query = queryCache.build(\n client,\n {\n ...client.getDefaultOptions().hydrate?.queries,\n ...options?.defaultOptions?.queries,\n queryKey,\n queryHash,\n meta,\n _type: queryType,\n },\n // Reset fetch status to idle to avoid\n // query being stuck in fetching state upon hydration\n {\n ...state,\n data,\n fetchStatus: 'idle',\n // Like above, if the query was pending at the moment of dehydration but has data,\n // we can assume it should be hydrated as successful.\n status:\n state.status === 'pending' && data !== undefined\n ? 'success'\n : state.status,\n ...(state.status === 'pending' &&\n data !== undefined && {\n dataUpdatedAt: dehydratedAt ?? Date.now(),\n }),\n },\n )\n }\n\n if (\n promise &&\n // If the data was synchronously available, there is no need to set up\n // a retryer and thus no reason to call fetch\n !syncData &&\n !existingQueryIsPending &&\n !existingQueryIsFetching &&\n // Only hydrate if dehydration is newer than any existing data,\n // this is always true for new queries\n (dehydratedAt === undefined || dehydratedAt > query.state.dataUpdatedAt)\n ) {\n // This doesn't actually fetch - it just creates a retryer\n // which will re-use the passed `initialPromise`\n query\n .fetch(undefined, {\n // RSC transformed promises are not thenable\n initialPromise: Promise.resolve(promise).then(deserializeData),\n })\n // Avoid unhandled promise rejections\n .catch(noop)\n }\n },\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA+B;AAC/B,mBAAqB;AAiBrB,SAAS,qBAAqB,MAAgB;AAC5C,SAAO;AACT;AA4CA,SAAS,kBAAkB,UAAwC;AACjE,SAAO;AAAA,IACL,aAAa,SAAS,QAAQ;AAAA,IAC9B,OAAO,SAAS;AAAA,IAChB,GAAI,SAAS,QAAQ,SAAS,EAAE,OAAO,SAAS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AA,YAGb,QACE,MAAM,WAAW,aAAa,SAAS,SACnC,YACA,MAAM;AAAA,YACZ,GAAI,MAAM,WAAW,aACnB,SAAS,UAAa;AAAA,cACpB,eAAe,gBAAgB,KAAK,IAAI;AAAA,YAC1C;AAAA,UACJ;AAAA,QACF;AAAA,MACF;AAEA,UACE;AAAA;AAAA,MAGA,CAAC,YACD,CAAC,0BACD,CAAC;AAAA;AAAA,OAGA,iBAAiB,UAAa,eAAe,MAAM,MAAM,gBAC1D;AAGA,cACG,MAAM,QAAW;AAAA;AAAA,UAEhB,gBAAgB,QAAQ,QAAQ,OAAO,EAAE,KAAK,eAAe;AAAA,QAC/D,CAAC,EAEA,MAAM,iBAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;","names":["_a","_b"]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.d.cts b/node_modules/@tanstack/query-core/build/legacy/hydration.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..6fe3b5aec3619c9ab7c5e56b053d2c0ba041a7a2 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.d.cts @@ -0,0 +1,7 @@ +export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.cjs'; +export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.cjs'; +export { dehydrate } from './_tsup-dts-rollup.cjs'; +export { hydrate } from './_tsup-dts-rollup.cjs'; +export { DehydrateOptions } from './_tsup-dts-rollup.cjs'; +export { HydrateOptions } from './_tsup-dts-rollup.cjs'; +export { DehydratedState } from './_tsup-dts-rollup.cjs'; diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.d.ts b/node_modules/@tanstack/query-core/build/legacy/hydration.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3b1be4a7af599e838b7b7ca3515b4f999b2571e --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.d.ts @@ -0,0 +1,7 @@ +export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.js'; +export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.js'; +export { dehydrate } from './_tsup-dts-rollup.js'; +export { hydrate } from './_tsup-dts-rollup.js'; +export { DehydrateOptions } from './_tsup-dts-rollup.js'; +export { HydrateOptions } from './_tsup-dts-rollup.js'; +export { DehydratedState } from './_tsup-dts-rollup.js'; diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.js b/node_modules/@tanstack/query-core/build/legacy/hydration.js new file mode 100644 index 0000000000000000000000000000000000000000..adbea37c579659ff5b7bb26b50cc989862a14409 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.js @@ -0,0 +1,182 @@ +import "./chunk-PXG64RU4.js"; + +// src/hydration.ts +import { tryResolveSync } from "./thenable.js"; +import { noop } from "./utils.js"; +function defaultTransformerFn(data) { + return data; +} +function dehydrateMutation(mutation) { + return { + mutationKey: mutation.options.mutationKey, + state: mutation.state, + ...mutation.options.scope && { scope: mutation.options.scope }, + ...mutation.meta && { meta: mutation.meta } + }; +} +function dehydrateQuery(query, serializeData, shouldRedactErrors) { + const dehydratePromise = () => { + var _a; + const promise = (_a = query.promise) == null ? void 0 : _a.then(serializeData).catch((error) => { + if (!shouldRedactErrors(error)) { + return Promise.reject(error); + } + if (process.env.NODE_ENV !== "production") { + console.error( + `A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds` + ); + } + return Promise.reject(new Error("redacted")); + }); + promise == null ? void 0 : promise.catch(noop); + return promise; + }; + return { + dehydratedAt: Date.now(), + state: { + ...query.state, + ...query.state.data !== void 0 && { + data: serializeData(query.state.data) + } + }, + queryKey: query.queryKey, + queryHash: query.queryHash, + ...query.state.status === "pending" && { + promise: dehydratePromise() + }, + ...query.meta && { meta: query.meta }, + ...query.queryType && { queryType: query.queryType } + }; +} +function defaultShouldDehydrateMutation(mutation) { + return mutation.state.isPaused; +} +function defaultShouldDehydrateQuery(query) { + return query.state.status === "success"; +} +function defaultShouldRedactErrors(_) { + return true; +} +function dehydrate(client, options = {}) { + var _a, _b, _c, _d; + const filterMutation = options.shouldDehydrateMutation ?? ((_a = client.getDefaultOptions().dehydrate) == null ? void 0 : _a.shouldDehydrateMutation) ?? defaultShouldDehydrateMutation; + const mutations = client.getMutationCache().getAll().flatMap( + (mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : [] + ); + const filterQuery = options.shouldDehydrateQuery ?? ((_b = client.getDefaultOptions().dehydrate) == null ? void 0 : _b.shouldDehydrateQuery) ?? defaultShouldDehydrateQuery; + const shouldRedactErrors = options.shouldRedactErrors ?? ((_c = client.getDefaultOptions().dehydrate) == null ? void 0 : _c.shouldRedactErrors) ?? defaultShouldRedactErrors; + const serializeData = options.serializeData ?? ((_d = client.getDefaultOptions().dehydrate) == null ? void 0 : _d.serializeData) ?? defaultTransformerFn; + const queries = client.getQueryCache().getAll().flatMap( + (query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : [] + ); + return { mutations, queries }; +} +function hydrate(client, dehydratedState, options) { + var _a, _b; + if (typeof dehydratedState !== "object" || dehydratedState === null) { + return; + } + const mutationCache = client.getMutationCache(); + const queryCache = client.getQueryCache(); + const deserializeData = ((_a = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _a.deserializeData) ?? ((_b = client.getDefaultOptions().hydrate) == null ? void 0 : _b.deserializeData) ?? defaultTransformerFn; + const mutations = dehydratedState.mutations || []; + const queries = dehydratedState.queries || []; + mutations.forEach(({ state, ...mutationOptions }) => { + var _a2, _b2; + mutationCache.build( + client, + { + ...(_a2 = client.getDefaultOptions().hydrate) == null ? void 0 : _a2.mutations, + ...(_b2 = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b2.mutations, + ...mutationOptions + }, + state + ); + }); + queries.forEach( + ({ + queryKey, + state, + queryHash, + meta, + promise, + dehydratedAt, + queryType + }) => { + var _a2, _b2; + const syncData = promise ? tryResolveSync(promise) : void 0; + const rawData = state.data === void 0 ? syncData == null ? void 0 : syncData.data : state.data; + const data = rawData === void 0 ? rawData : deserializeData(rawData); + let query = queryCache.get(queryHash); + const existingQueryIsPending = (query == null ? void 0 : query.state.status) === "pending"; + const existingQueryIsFetching = (query == null ? void 0 : query.state.fetchStatus) === "fetching"; + if (query) { + const hasNewerSyncData = syncData && // We only need this undefined check to handle older dehydration + // payloads that might not have dehydratedAt + dehydratedAt !== void 0 && dehydratedAt > query.state.dataUpdatedAt; + if (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) { + const { fetchStatus: _ignored, ...serializedState } = state; + query.setState({ + ...serializedState, + data, + // If the query was pending at the moment of dehydration, but resolved to have data + // before hydration, we can assume the query should be hydrated as successful. + // + // Since you can opt into dehydrating failed queries, and those can have data from + // previous successful fetches, we make sure we only do this for pending queries. + ...state.status === "pending" && data !== void 0 && { + status: "success", + dataUpdatedAt: dehydratedAt ?? Date.now(), + // Preserve existing fetchStatus if the existing query is actively fetching. + ...!existingQueryIsFetching && { + fetchStatus: "idle" + } + } + }); + } + } else { + query = queryCache.build( + client, + { + ...(_a2 = client.getDefaultOptions().hydrate) == null ? void 0 : _a2.queries, + ...(_b2 = options == null ? void 0 : options.defaultOptions) == null ? void 0 : _b2.queries, + queryKey, + queryHash, + meta, + _type: queryType + }, + // Reset fetch status to idle to avoid + // query being stuck in fetching state upon hydration + { + ...state, + data, + fetchStatus: "idle", + // Like above, if the query was pending at the moment of dehydration but has data, + // we can assume it should be hydrated as successful. + status: state.status === "pending" && data !== void 0 ? "success" : state.status, + ...state.status === "pending" && data !== void 0 && { + dataUpdatedAt: dehydratedAt ?? Date.now() + } + } + ); + } + if (promise && // If the data was synchronously available, there is no need to set up + // a retryer and thus no reason to call fetch + !syncData && !existingQueryIsPending && !existingQueryIsFetching && // Only hydrate if dehydration is newer than any existing data, + // this is always true for new queries + (dehydratedAt === void 0 || dehydratedAt > query.state.dataUpdatedAt)) { + query.fetch(void 0, { + // RSC transformed promises are not thenable + initialPromise: Promise.resolve(promise).then(deserializeData) + }).catch(noop); + } + } + ); +} +export { + defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery, + dehydrate, + hydrate +}; +//# sourceMappingURL=hydration.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/hydration.js.map b/node_modules/@tanstack/query-core/build/legacy/hydration.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c077c0f3353c7b449739b03ba215007602a5c12d --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/hydration.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/hydration.ts"],"sourcesContent":["import { tryResolveSync } from './thenable'\nimport { noop } from './utils'\nimport type {\n DefaultError,\n MutationKey,\n MutationMeta,\n MutationOptions,\n MutationScope,\n QueryKey,\n QueryMeta,\n QueryOptions,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\ntype TransformerFn = (data: any) => any\nfunction defaultTransformerFn(data: any): any {\n return data\n}\n\nexport interface DehydrateOptions {\n serializeData?: TransformerFn\n shouldDehydrateMutation?: (mutation: Mutation) => boolean\n shouldDehydrateQuery?: (query: Query) => boolean\n shouldRedactErrors?: (error: unknown) => boolean\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n deserializeData?: TransformerFn\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n meta?: MutationMeta\n scope?: MutationScope\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n promise?: Promise\n meta?: QueryMeta\n queryType?: 'infinite'\n // This is only optional because older versions of Query might have dehydrated\n // without it which we need to handle for backwards compatibility.\n // This should be changed to required in the future.\n dehydratedAt?: number\n}\n\nexport interface DehydratedState {\n mutations: Array\n queries: Array\n}\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n ...(mutation.options.scope && { scope: mutation.options.scope }),\n ...(mutation.meta && { meta: mutation.meta }),\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(\n query: Query,\n serializeData: TransformerFn,\n shouldRedactErrors: (error: unknown) => boolean,\n): DehydratedQuery {\n const dehydratePromise = () => {\n const promise = query.promise?.then(serializeData).catch((error) => {\n if (!shouldRedactErrors(error)) {\n // Reject original error if it should not be redacted\n return Promise.reject(error)\n }\n // If not in production, log original error before rejecting redacted error\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n `A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`,\n )\n }\n return Promise.reject(new Error('redacted'))\n })\n\n // Avoid unhandled promise rejections\n // We need the promise we dehydrate to reject to get the correct result into\n // the query cache, but we also want to avoid unhandled promise rejections\n // in whatever environment the prefetches are happening in.\n promise?.catch(noop)\n\n return promise\n }\n\n return {\n dehydratedAt: Date.now(),\n state: {\n ...query.state,\n ...(query.state.data !== undefined && {\n data: serializeData(query.state.data),\n }),\n },\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n ...(query.state.status === 'pending' && {\n promise: dehydratePromise(),\n }),\n ...(query.meta && { meta: query.meta }),\n ...(query.queryType && { queryType: query.queryType }),\n }\n}\n\nexport function defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nexport function defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nfunction defaultShouldRedactErrors(_: unknown) {\n return true\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const filterMutation =\n options.shouldDehydrateMutation ??\n client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ??\n defaultShouldDehydrateMutation\n\n const mutations = client\n .getMutationCache()\n .getAll()\n .flatMap((mutation) =>\n filterMutation(mutation) ? [dehydrateMutation(mutation)] : [],\n )\n\n const filterQuery =\n options.shouldDehydrateQuery ??\n client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ??\n defaultShouldDehydrateQuery\n\n const shouldRedactErrors =\n options.shouldRedactErrors ??\n client.getDefaultOptions().dehydrate?.shouldRedactErrors ??\n defaultShouldRedactErrors\n\n const serializeData =\n options.serializeData ??\n client.getDefaultOptions().dehydrate?.serializeData ??\n defaultTransformerFn\n\n const queries = client\n .getQueryCache()\n .getAll()\n .flatMap((query) =>\n filterQuery(query)\n ? [dehydrateQuery(query, serializeData, shouldRedactErrors)]\n : [],\n )\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n const deserializeData =\n options?.defaultOptions?.deserializeData ??\n client.getDefaultOptions().hydrate?.deserializeData ??\n defaultTransformerFn\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach(({ state, ...mutationOptions }) => {\n mutationCache.build(\n client,\n {\n ...client.getDefaultOptions().hydrate?.mutations,\n ...options?.defaultOptions?.mutations,\n ...mutationOptions,\n },\n state,\n )\n })\n\n queries.forEach(\n ({\n queryKey,\n state,\n queryHash,\n meta,\n promise,\n dehydratedAt,\n queryType,\n }) => {\n const syncData = promise ? tryResolveSync(promise) : undefined\n const rawData = state.data === undefined ? syncData?.data : state.data\n const data = rawData === undefined ? rawData : deserializeData(rawData)\n\n let query = queryCache.get(queryHash)\n const existingQueryIsPending = query?.state.status === 'pending'\n const existingQueryIsFetching = query?.state.fetchStatus === 'fetching'\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n const hasNewerSyncData =\n syncData &&\n // We only need this undefined check to handle older dehydration\n // payloads that might not have dehydratedAt\n dehydratedAt !== undefined &&\n dehydratedAt > query.state.dataUpdatedAt\n if (\n state.dataUpdatedAt > query.state.dataUpdatedAt ||\n hasNewerSyncData\n ) {\n // Omit fetchStatus from dehydrated state so that query stays in its current fetchStatus\n const { fetchStatus: _ignored, ...serializedState } = state\n query.setState({\n ...serializedState,\n data,\n // If the query was pending at the moment of dehydration, but resolved to have data\n // before hydration, we can assume the query should be hydrated as successful.\n //\n // Since you can opt into dehydrating failed queries, and those can have data from\n // previous successful fetches, we make sure we only do this for pending queries.\n ...(state.status === 'pending' &&\n data !== undefined && {\n status: 'success' as const,\n dataUpdatedAt: dehydratedAt ?? Date.now(),\n // Preserve existing fetchStatus if the existing query is actively fetching.\n ...(!existingQueryIsFetching && {\n fetchStatus: 'idle' as const,\n }),\n }),\n })\n }\n } else {\n // Restore query\n query = queryCache.build(\n client,\n {\n ...client.getDefaultOptions().hydrate?.queries,\n ...options?.defaultOptions?.queries,\n queryKey,\n queryHash,\n meta,\n _type: queryType,\n },\n // Reset fetch status to idle to avoid\n // query being stuck in fetching state upon hydration\n {\n ...state,\n data,\n fetchStatus: 'idle',\n // Like above, if the query was pending at the moment of dehydration but has data,\n // we can assume it should be hydrated as successful.\n status:\n state.status === 'pending' && data !== undefined\n ? 'success'\n : state.status,\n ...(state.status === 'pending' &&\n data !== undefined && {\n dataUpdatedAt: dehydratedAt ?? Date.now(),\n }),\n },\n )\n }\n\n if (\n promise &&\n // If the data was synchronously available, there is no need to set up\n // a retryer and thus no reason to call fetch\n !syncData &&\n !existingQueryIsPending &&\n !existingQueryIsFetching &&\n // Only hydrate if dehydration is newer than any existing data,\n // this is always true for new queries\n (dehydratedAt === undefined || dehydratedAt > query.state.dataUpdatedAt)\n ) {\n // This doesn't actually fetch - it just creates a retryer\n // which will re-use the passed `initialPromise`\n query\n .fetch(undefined, {\n // RSC transformed promises are not thenable\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H;AAAA,MACF,OAAO;AAEL,gBAAQ,WAAW;AAAA,UACjB;AAAA,UACA;AAAA,YACE,IAAGD,MAAA,OAAO,kBAAkB,EAAE,YAA3B,gBAAAA,IAAoC;AAAA,YACvC,IAAGC,MAAA,mCAAS,mBAAT,gBAAAA,IAAyB;AAAA,YAC5B;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO;AAAA,UACT;AAAA;AAAA;AAAA,UAGA;AAAA,YACE,GAAG;AAAA,YACH;AAAA,YACA,aAAa;AAAA;AAAA;AAAA,YAGb,QACE,MAAM,WAAW,aAAa,SAAS,SACnC,YACA,MAAM;AAAA,YACZ,GAAI,MAAM,WAAW,aACnB,SAAS,UAAa;AAAA,cACpB,eAAe,gBAAgB,KAAK,IAAI;AAAA,YAC1C;AAAA,UACJ;AAAA,QACF;AAAA,MACF;AAEA,UACE;AAAA;AAAA,MAGA,CAAC,YACD,CAAC,0BACD,CAAC;AAAA;AAAA,OAGA,iBAAiB,UAAa,eAAe,MAAM,MAAM,gBAC1D;AAGA,cACG,MAAM,QAAW;AAAA;AAAA,UAEhB,gBAAgB,QAAQ,QAAQ,OAAO,EAAE,KAAK,eAAe;AAAA,QAC/D,CAAC,EAEA,MAAM,IAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;","names":["_a","_b"]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/index.cjs b/node_modules/@tanstack/query-core/build/legacy/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..f0b1aeba6d5716944dfe10d55e58c224bb9034d3 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.cjs @@ -0,0 +1,113 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var index_exports = {}; +__export(index_exports, { + CancelledError: () => import_retryer.CancelledError, + InfiniteQueryObserver: () => import_infiniteQueryObserver.InfiniteQueryObserver, + Mutation: () => import_mutation.Mutation, + MutationCache: () => import_mutationCache.MutationCache, + MutationObserver: () => import_mutationObserver.MutationObserver, + QueriesObserver: () => import_queriesObserver.QueriesObserver, + Query: () => import_query.Query, + QueryCache: () => import_queryCache.QueryCache, + QueryClient: () => import_queryClient.QueryClient, + QueryObserver: () => import_queryObserver.QueryObserver, + defaultScheduler: () => import_notifyManager.defaultScheduler, + defaultShouldDehydrateMutation: () => import_hydration.defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery: () => import_hydration.defaultShouldDehydrateQuery, + dehydrate: () => import_hydration.dehydrate, + environmentManager: () => import_environmentManager.environmentManager, + experimental_streamedQuery: () => import_streamedQuery.streamedQuery, + focusManager: () => import_focusManager.focusManager, + hashKey: () => import_utils.hashKey, + hydrate: () => import_hydration.hydrate, + isCancelledError: () => import_retryer.isCancelledError, + isServer: () => import_utils.isServer, + keepPreviousData: () => import_utils.keepPreviousData, + matchMutation: () => import_utils.matchMutation, + matchQuery: () => import_utils.matchQuery, + noop: () => import_utils.noop, + notifyManager: () => import_notifyManager.notifyManager, + onlineManager: () => import_onlineManager.onlineManager, + partialMatchKey: () => import_utils.partialMatchKey, + replaceEqualDeep: () => import_utils.replaceEqualDeep, + shouldThrowError: () => import_utils.shouldThrowError, + skipToken: () => import_utils.skipToken, + timeoutManager: () => import_timeoutManager.timeoutManager +}); +module.exports = __toCommonJS(index_exports); +var import_focusManager = require("./focusManager.cjs"); +var import_environmentManager = require("./environmentManager.cjs"); +var import_hydration = require("./hydration.cjs"); +var import_infiniteQueryObserver = require("./infiniteQueryObserver.cjs"); +var import_mutationCache = require("./mutationCache.cjs"); +var import_mutationObserver = require("./mutationObserver.cjs"); +var import_notifyManager = require("./notifyManager.cjs"); +var import_onlineManager = require("./onlineManager.cjs"); +var import_queriesObserver = require("./queriesObserver.cjs"); +var import_queryCache = require("./queryCache.cjs"); +var import_queryClient = require("./queryClient.cjs"); +var import_queryObserver = require("./queryObserver.cjs"); +var import_retryer = require("./retryer.cjs"); +var import_timeoutManager = require("./timeoutManager.cjs"); +var import_utils = require("./utils.cjs"); +var import_streamedQuery = require("./streamedQuery.cjs"); +var import_mutation = require("./mutation.cjs"); +var import_query = require("./query.cjs"); +__reExport(index_exports, require("./types.cjs"), module.exports); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + CancelledError, + InfiniteQueryObserver, + Mutation, + MutationCache, + MutationObserver, + QueriesObserver, + Query, + QueryCache, + QueryClient, + QueryObserver, + defaultScheduler, + defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery, + dehydrate, + environmentManager, + experimental_streamedQuery, + focusManager, + hashKey, + hydrate, + isCancelledError, + isServer, + keepPreviousData, + matchMutation, + matchQuery, + noop, + notifyManager, + onlineManager, + partialMatchKey, + replaceEqualDeep, + shouldThrowError, + skipToken, + timeoutManager, + ...require("./types.cjs") +}); +//# sourceMappingURL=index.cjs.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/index.cjs.map b/node_modules/@tanstack/query-core/build/legacy/index.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..4d2cea0111a798de8fa8addd8f52727fd94d93fc --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.cjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { focusManager } from './focusManager'\nexport { environmentManager } from './environmentManager'\nexport {\n defaultShouldDehydrateMutation,\n defaultShouldDehydrateQuery,\n dehydrate,\n hydrate,\n} from './hydration'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { defaultScheduler, notifyManager } from './notifyManager'\nexport { onlineManager } from './onlineManager'\nexport { QueriesObserver } from './queriesObserver'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { CancelledError, isCancelledError } from './retryer'\nexport {\n timeoutManager,\n type ManagedTimerId,\n type TimeoutCallback,\n type TimeoutProvider,\n} from './timeoutManager'\nexport {\n hashKey,\n isServer,\n keepPreviousData,\n matchMutation,\n matchQuery,\n noop,\n partialMatchKey,\n replaceEqualDeep,\n shouldThrowError,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, SkipToken, Updater } from './utils'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport type {\n DehydratedState,\n DehydrateOptions,\n HydrateOptions,\n} from './hydration'\nexport { Mutation } from './mutation'\nexport type { MutationState } from './mutation'\nexport type { QueriesObserverOptions } from './queriesObserver'\nexport { Query } from './query'\nexport type { QueryState } from './query'\nexport * from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA6B;AAC7B,gCAAmC;AACnC,uBAKO;AACP,mCAAsC;AACtC,2BAA8B;AAE9B,8BAAiC;AACjC,2BAAgD;AAChD,2BAA8B;AAC9B,6BAAgC;AAChC,wBAA2B;AAE3B,yBAA4B;AAC5B,2BAA8B;AAC9B,qBAAiD;AACjD,4BAKO;AACP,mBAWO;AAGP,2BAA4D;AAQ5D,sBAAyB;AAGzB,mBAAsB;AAEtB,0BAAc,wBAvDd;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/index.d.cts b/node_modules/@tanstack/query-core/build/legacy/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..22fe1e4057ba501df42ce18d1232f81a64d61097 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.d.cts @@ -0,0 +1,141 @@ +export { focusManager_alias_1 as focusManager } from './_tsup-dts-rollup.cjs'; +export { environmentManager_alias_1 as environmentManager } from './_tsup-dts-rollup.cjs'; +export { defaultShouldDehydrateMutation_alias_1 as defaultShouldDehydrateMutation } from './_tsup-dts-rollup.cjs'; +export { defaultShouldDehydrateQuery_alias_1 as defaultShouldDehydrateQuery } from './_tsup-dts-rollup.cjs'; +export { dehydrate_alias_1 as dehydrate } from './_tsup-dts-rollup.cjs'; +export { hydrate_alias_1 as hydrate } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserver } from './_tsup-dts-rollup.cjs'; +export { MutationCache } from './_tsup-dts-rollup.cjs'; +export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; +export { MutationObserver } from './_tsup-dts-rollup.cjs'; +export { defaultScheduler } from './_tsup-dts-rollup.cjs'; +export { notifyManager } from './_tsup-dts-rollup.cjs'; +export { onlineManager } from './_tsup-dts-rollup.cjs'; +export { QueriesObserver } from './_tsup-dts-rollup.cjs'; +export { QueryCache } from './_tsup-dts-rollup.cjs'; +export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; +export { QueryClient } from './_tsup-dts-rollup.cjs'; +export { QueryObserver } from './_tsup-dts-rollup.cjs'; +export { CancelledError } from './_tsup-dts-rollup.cjs'; +export { isCancelledError } from './_tsup-dts-rollup.cjs'; +export { timeoutManager } from './_tsup-dts-rollup.cjs'; +export { ManagedTimerId } from './_tsup-dts-rollup.cjs'; +export { TimeoutCallback } from './_tsup-dts-rollup.cjs'; +export { TimeoutProvider } from './_tsup-dts-rollup.cjs'; +export { hashKey } from './_tsup-dts-rollup.cjs'; +export { isServer } from './_tsup-dts-rollup.cjs'; +export { keepPreviousData } from './_tsup-dts-rollup.cjs'; +export { matchMutation } from './_tsup-dts-rollup.cjs'; +export { matchQuery } from './_tsup-dts-rollup.cjs'; +export { noop } from './_tsup-dts-rollup.cjs'; +export { partialMatchKey } from './_tsup-dts-rollup.cjs'; +export { replaceEqualDeep } from './_tsup-dts-rollup.cjs'; +export { shouldThrowError } from './_tsup-dts-rollup.cjs'; +export { skipToken } from './_tsup-dts-rollup.cjs'; +export { MutationFilters } from './_tsup-dts-rollup.cjs'; +export { QueryFilters } from './_tsup-dts-rollup.cjs'; +export { SkipToken } from './_tsup-dts-rollup.cjs'; +export { Updater } from './_tsup-dts-rollup.cjs'; +export { experimental_streamedQuery } from './_tsup-dts-rollup.cjs'; +export { DehydratedState_alias_1 as DehydratedState } from './_tsup-dts-rollup.cjs'; +export { DehydrateOptions_alias_1 as DehydrateOptions } from './_tsup-dts-rollup.cjs'; +export { HydrateOptions_alias_1 as HydrateOptions } from './_tsup-dts-rollup.cjs'; +export { Mutation } from './_tsup-dts-rollup.cjs'; +export { MutationState } from './_tsup-dts-rollup.cjs'; +export { QueriesObserverOptions } from './_tsup-dts-rollup.cjs'; +export { Query } from './_tsup-dts-rollup.cjs'; +export { QueryState } from './_tsup-dts-rollup.cjs'; +export { NonUndefinedGuard } from './_tsup-dts-rollup.cjs'; +export { DistributiveOmit } from './_tsup-dts-rollup.cjs'; +export { OmitKeyof } from './_tsup-dts-rollup.cjs'; +export { Override } from './_tsup-dts-rollup.cjs'; +export { Register } from './_tsup-dts-rollup.cjs'; +export { DefaultError } from './_tsup-dts-rollup.cjs'; +export { QueryKey } from './_tsup-dts-rollup.cjs'; +export { dataTagSymbol } from './_tsup-dts-rollup.cjs'; +export { dataTagErrorSymbol } from './_tsup-dts-rollup.cjs'; +export { unsetMarker } from './_tsup-dts-rollup.cjs'; +export { UnsetMarker } from './_tsup-dts-rollup.cjs'; +export { AnyDataTag } from './_tsup-dts-rollup.cjs'; +export { DataTag } from './_tsup-dts-rollup.cjs'; +export { InferDataFromTag } from './_tsup-dts-rollup.cjs'; +export { InferErrorFromTag } from './_tsup-dts-rollup.cjs'; +export { QueryFunction } from './_tsup-dts-rollup.cjs'; +export { StaleTime } from './_tsup-dts-rollup.cjs'; +export { StaleTimeFunction } from './_tsup-dts-rollup.cjs'; +export { QueryBooleanOption } from './_tsup-dts-rollup.cjs'; +export { QueryPersister } from './_tsup-dts-rollup.cjs'; +export { QueryFunctionContext } from './_tsup-dts-rollup.cjs'; +export { InitialDataFunction } from './_tsup-dts-rollup.cjs'; +export { PlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; +export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; +export { QueryKeyHashFunction } from './_tsup-dts-rollup.cjs'; +export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.cjs'; +export { GetNextPageParamFunction } from './_tsup-dts-rollup.cjs'; +export { InfiniteData } from './_tsup-dts-rollup.cjs'; +export { QueryMeta } from './_tsup-dts-rollup.cjs'; +export { NetworkMode } from './_tsup-dts-rollup.cjs'; +export { NotifyOnChangeProps } from './_tsup-dts-rollup.cjs'; +export { QueryOptions } from './_tsup-dts-rollup.cjs'; +export { InitialPageParam } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.cjs'; +export { ThrowOnError } from './_tsup-dts-rollup.cjs'; +export { QueryObserverOptions } from './_tsup-dts-rollup.cjs'; +export { WithRequired } from './_tsup-dts-rollup.cjs'; +export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; +export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; +export { FetchQueryOptions } from './_tsup-dts-rollup.cjs'; +export { EnsureQueryDataOptions } from './_tsup-dts-rollup.cjs'; +export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.cjs'; +export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; +export { ResultOptions } from './_tsup-dts-rollup.cjs'; +export { RefetchOptions } from './_tsup-dts-rollup.cjs'; +export { InvalidateQueryFilters } from './_tsup-dts-rollup.cjs'; +export { RefetchQueryFilters } from './_tsup-dts-rollup.cjs'; +export { InvalidateOptions } from './_tsup-dts-rollup.cjs'; +export { ResetOptions } from './_tsup-dts-rollup.cjs'; +export { FetchNextPageOptions } from './_tsup-dts-rollup.cjs'; +export { FetchPreviousPageOptions } from './_tsup-dts-rollup.cjs'; +export { QueryStatus } from './_tsup-dts-rollup.cjs'; +export { FetchStatus } from './_tsup-dts-rollup.cjs'; +export { QueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; +export { DefinedQueryObserverResult } from './_tsup-dts-rollup.cjs'; +export { QueryObserverResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; +export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; +export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; +export { MutationKey } from './_tsup-dts-rollup.cjs'; +export { MutationStatus } from './_tsup-dts-rollup.cjs'; +export { MutationScope } from './_tsup-dts-rollup.cjs'; +export { MutationMeta } from './_tsup-dts-rollup.cjs'; +export { MutationFunctionContext } from './_tsup-dts-rollup.cjs'; +export { MutationFunction } from './_tsup-dts-rollup.cjs'; +export { MutationOptions } from './_tsup-dts-rollup.cjs'; +export { MutationObserverOptions } from './_tsup-dts-rollup.cjs'; +export { MutateOptions } from './_tsup-dts-rollup.cjs'; +export { MutateFunction } from './_tsup-dts-rollup.cjs'; +export { MutationObserverBaseResult } from './_tsup-dts-rollup.cjs'; +export { MutationObserverIdleResult } from './_tsup-dts-rollup.cjs'; +export { MutationObserverLoadingResult } from './_tsup-dts-rollup.cjs'; +export { MutationObserverErrorResult } from './_tsup-dts-rollup.cjs'; +export { MutationObserverSuccessResult } from './_tsup-dts-rollup.cjs'; +export { MutationObserverResult } from './_tsup-dts-rollup.cjs'; +export { QueryClientConfig } from './_tsup-dts-rollup.cjs'; +export { DefaultOptions } from './_tsup-dts-rollup.cjs'; +export { CancelOptions } from './_tsup-dts-rollup.cjs'; +export { SetDataOptions } from './_tsup-dts-rollup.cjs'; +export { NotifyEventType } from './_tsup-dts-rollup.cjs'; +export { NotifyEvent } from './_tsup-dts-rollup.cjs'; diff --git a/node_modules/@tanstack/query-core/build/legacy/index.d.ts b/node_modules/@tanstack/query-core/build/legacy/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..15e2821122487ce37111ed56e449bb093718bffd --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.d.ts @@ -0,0 +1,141 @@ +export { focusManager_alias_1 as focusManager } from './_tsup-dts-rollup.js'; +export { environmentManager_alias_1 as environmentManager } from './_tsup-dts-rollup.js'; +export { defaultShouldDehydrateMutation_alias_1 as defaultShouldDehydrateMutation } from './_tsup-dts-rollup.js'; +export { defaultShouldDehydrateQuery_alias_1 as defaultShouldDehydrateQuery } from './_tsup-dts-rollup.js'; +export { dehydrate_alias_1 as dehydrate } from './_tsup-dts-rollup.js'; +export { hydrate_alias_1 as hydrate } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserver } from './_tsup-dts-rollup.js'; +export { MutationCache } from './_tsup-dts-rollup.js'; +export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.js'; +export { MutationObserver } from './_tsup-dts-rollup.js'; +export { defaultScheduler } from './_tsup-dts-rollup.js'; +export { notifyManager } from './_tsup-dts-rollup.js'; +export { onlineManager } from './_tsup-dts-rollup.js'; +export { QueriesObserver } from './_tsup-dts-rollup.js'; +export { QueryCache } from './_tsup-dts-rollup.js'; +export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.js'; +export { QueryClient } from './_tsup-dts-rollup.js'; +export { QueryObserver } from './_tsup-dts-rollup.js'; +export { CancelledError } from './_tsup-dts-rollup.js'; +export { isCancelledError } from './_tsup-dts-rollup.js'; +export { timeoutManager } from './_tsup-dts-rollup.js'; +export { ManagedTimerId } from './_tsup-dts-rollup.js'; +export { TimeoutCallback } from './_tsup-dts-rollup.js'; +export { TimeoutProvider } from './_tsup-dts-rollup.js'; +export { hashKey } from './_tsup-dts-rollup.js'; +export { isServer } from './_tsup-dts-rollup.js'; +export { keepPreviousData } from './_tsup-dts-rollup.js'; +export { matchMutation } from './_tsup-dts-rollup.js'; +export { matchQuery } from './_tsup-dts-rollup.js'; +export { noop } from './_tsup-dts-rollup.js'; +export { partialMatchKey } from './_tsup-dts-rollup.js'; +export { replaceEqualDeep } from './_tsup-dts-rollup.js'; +export { shouldThrowError } from './_tsup-dts-rollup.js'; +export { skipToken } from './_tsup-dts-rollup.js'; +export { MutationFilters } from './_tsup-dts-rollup.js'; +export { QueryFilters } from './_tsup-dts-rollup.js'; +export { SkipToken } from './_tsup-dts-rollup.js'; +export { Updater } from './_tsup-dts-rollup.js'; +export { experimental_streamedQuery } from './_tsup-dts-rollup.js'; +export { DehydratedState_alias_1 as DehydratedState } from './_tsup-dts-rollup.js'; +export { DehydrateOptions_alias_1 as DehydrateOptions } from './_tsup-dts-rollup.js'; +export { HydrateOptions_alias_1 as HydrateOptions } from './_tsup-dts-rollup.js'; +export { Mutation } from './_tsup-dts-rollup.js'; +export { MutationState } from './_tsup-dts-rollup.js'; +export { QueriesObserverOptions } from './_tsup-dts-rollup.js'; +export { Query } from './_tsup-dts-rollup.js'; +export { QueryState } from './_tsup-dts-rollup.js'; +export { NonUndefinedGuard } from './_tsup-dts-rollup.js'; +export { DistributiveOmit } from './_tsup-dts-rollup.js'; +export { OmitKeyof } from './_tsup-dts-rollup.js'; +export { Override } from './_tsup-dts-rollup.js'; +export { Register } from './_tsup-dts-rollup.js'; +export { DefaultError } from './_tsup-dts-rollup.js'; +export { QueryKey } from './_tsup-dts-rollup.js'; +export { dataTagSymbol } from './_tsup-dts-rollup.js'; +export { dataTagErrorSymbol } from './_tsup-dts-rollup.js'; +export { unsetMarker } from './_tsup-dts-rollup.js'; +export { UnsetMarker } from './_tsup-dts-rollup.js'; +export { AnyDataTag } from './_tsup-dts-rollup.js'; +export { DataTag } from './_tsup-dts-rollup.js'; +export { InferDataFromTag } from './_tsup-dts-rollup.js'; +export { InferErrorFromTag } from './_tsup-dts-rollup.js'; +export { QueryFunction } from './_tsup-dts-rollup.js'; +export { StaleTime } from './_tsup-dts-rollup.js'; +export { StaleTimeFunction } from './_tsup-dts-rollup.js'; +export { QueryBooleanOption } from './_tsup-dts-rollup.js'; +export { QueryPersister } from './_tsup-dts-rollup.js'; +export { QueryFunctionContext } from './_tsup-dts-rollup.js'; +export { InitialDataFunction } from './_tsup-dts-rollup.js'; +export { PlaceholderDataFunction } from './_tsup-dts-rollup.js'; +export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.js'; +export { QueryKeyHashFunction } from './_tsup-dts-rollup.js'; +export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.js'; +export { GetNextPageParamFunction } from './_tsup-dts-rollup.js'; +export { InfiniteData } from './_tsup-dts-rollup.js'; +export { QueryMeta } from './_tsup-dts-rollup.js'; +export { NetworkMode } from './_tsup-dts-rollup.js'; +export { NotifyOnChangeProps } from './_tsup-dts-rollup.js'; +export { QueryOptions } from './_tsup-dts-rollup.js'; +export { InitialPageParam } from './_tsup-dts-rollup.js'; +export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.js'; +export { ThrowOnError } from './_tsup-dts-rollup.js'; +export { QueryObserverOptions } from './_tsup-dts-rollup.js'; +export { WithRequired } from './_tsup-dts-rollup.js'; +export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; +export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; +export { FetchQueryOptions } from './_tsup-dts-rollup.js'; +export { EnsureQueryDataOptions } from './_tsup-dts-rollup.js'; +export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.js'; +export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.js'; +export { ResultOptions } from './_tsup-dts-rollup.js'; +export { RefetchOptions } from './_tsup-dts-rollup.js'; +export { InvalidateQueryFilters } from './_tsup-dts-rollup.js'; +export { RefetchQueryFilters } from './_tsup-dts-rollup.js'; +export { InvalidateOptions } from './_tsup-dts-rollup.js'; +export { ResetOptions } from './_tsup-dts-rollup.js'; +export { FetchNextPageOptions } from './_tsup-dts-rollup.js'; +export { FetchPreviousPageOptions } from './_tsup-dts-rollup.js'; +export { QueryStatus } from './_tsup-dts-rollup.js'; +export { FetchStatus } from './_tsup-dts-rollup.js'; +export { QueryObserverBaseResult } from './_tsup-dts-rollup.js'; +export { QueryObserverPendingResult } from './_tsup-dts-rollup.js'; +export { QueryObserverLoadingResult } from './_tsup-dts-rollup.js'; +export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; +export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; +export { QueryObserverSuccessResult } from './_tsup-dts-rollup.js'; +export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; +export { DefinedQueryObserverResult } from './_tsup-dts-rollup.js'; +export { QueryObserverResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; +export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; +export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; +export { MutationKey } from './_tsup-dts-rollup.js'; +export { MutationStatus } from './_tsup-dts-rollup.js'; +export { MutationScope } from './_tsup-dts-rollup.js'; +export { MutationMeta } from './_tsup-dts-rollup.js'; +export { MutationFunctionContext } from './_tsup-dts-rollup.js'; +export { MutationFunction } from './_tsup-dts-rollup.js'; +export { MutationOptions } from './_tsup-dts-rollup.js'; +export { MutationObserverOptions } from './_tsup-dts-rollup.js'; +export { MutateOptions } from './_tsup-dts-rollup.js'; +export { MutateFunction } from './_tsup-dts-rollup.js'; +export { MutationObserverBaseResult } from './_tsup-dts-rollup.js'; +export { MutationObserverIdleResult } from './_tsup-dts-rollup.js'; +export { MutationObserverLoadingResult } from './_tsup-dts-rollup.js'; +export { MutationObserverErrorResult } from './_tsup-dts-rollup.js'; +export { MutationObserverSuccessResult } from './_tsup-dts-rollup.js'; +export { MutationObserverResult } from './_tsup-dts-rollup.js'; +export { QueryClientConfig } from './_tsup-dts-rollup.js'; +export { DefaultOptions } from './_tsup-dts-rollup.js'; +export { CancelOptions } from './_tsup-dts-rollup.js'; +export { SetDataOptions } from './_tsup-dts-rollup.js'; +export { NotifyEventType } from './_tsup-dts-rollup.js'; +export { NotifyEvent } from './_tsup-dts-rollup.js'; diff --git a/node_modules/@tanstack/query-core/build/legacy/index.js b/node_modules/@tanstack/query-core/build/legacy/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ef32e2261df152154664106b327dd9e883d88555 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.js @@ -0,0 +1,75 @@ +import "./chunk-PXG64RU4.js"; + +// src/index.ts +import { focusManager } from "./focusManager.js"; +import { environmentManager } from "./environmentManager.js"; +import { + defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery, + dehydrate, + hydrate +} from "./hydration.js"; +import { InfiniteQueryObserver } from "./infiniteQueryObserver.js"; +import { MutationCache } from "./mutationCache.js"; +import { MutationObserver } from "./mutationObserver.js"; +import { defaultScheduler, notifyManager } from "./notifyManager.js"; +import { onlineManager } from "./onlineManager.js"; +import { QueriesObserver } from "./queriesObserver.js"; +import { QueryCache } from "./queryCache.js"; +import { QueryClient } from "./queryClient.js"; +import { QueryObserver } from "./queryObserver.js"; +import { CancelledError, isCancelledError } from "./retryer.js"; +import { + timeoutManager +} from "./timeoutManager.js"; +import { + hashKey, + isServer, + keepPreviousData, + matchMutation, + matchQuery, + noop, + partialMatchKey, + replaceEqualDeep, + shouldThrowError, + skipToken +} from "./utils.js"; +import { streamedQuery } from "./streamedQuery.js"; +import { Mutation } from "./mutation.js"; +import { Query } from "./query.js"; +export * from "./types.js"; +export { + CancelledError, + InfiniteQueryObserver, + Mutation, + MutationCache, + MutationObserver, + QueriesObserver, + Query, + QueryCache, + QueryClient, + QueryObserver, + defaultScheduler, + defaultShouldDehydrateMutation, + defaultShouldDehydrateQuery, + dehydrate, + environmentManager, + streamedQuery as experimental_streamedQuery, + focusManager, + hashKey, + hydrate, + isCancelledError, + isServer, + keepPreviousData, + matchMutation, + matchQuery, + noop, + notifyManager, + onlineManager, + partialMatchKey, + replaceEqualDeep, + shouldThrowError, + skipToken, + timeoutManager +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/index.js.map b/node_modules/@tanstack/query-core/build/legacy/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6d4634e37855eb8a8f37345abf0262d2f4e8b21c --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\nexport { focusManager } from './focusManager'\nexport { environmentManager } from './environmentManager'\nexport {\n defaultShouldDehydrateMutation,\n defaultShouldDehydrateQuery,\n dehydrate,\n hydrate,\n} from './hydration'\nexport { InfiniteQueryObserver } from './infiniteQueryObserver'\nexport { MutationCache } from './mutationCache'\nexport type { MutationCacheNotifyEvent } from './mutationCache'\nexport { MutationObserver } from './mutationObserver'\nexport { defaultScheduler, notifyManager } from './notifyManager'\nexport { onlineManager } from './onlineManager'\nexport { QueriesObserver } from './queriesObserver'\nexport { QueryCache } from './queryCache'\nexport type { QueryCacheNotifyEvent } from './queryCache'\nexport { QueryClient } from './queryClient'\nexport { QueryObserver } from './queryObserver'\nexport { CancelledError, isCancelledError } from './retryer'\nexport {\n timeoutManager,\n type ManagedTimerId,\n type TimeoutCallback,\n type TimeoutProvider,\n} from './timeoutManager'\nexport {\n hashKey,\n isServer,\n keepPreviousData,\n matchMutation,\n matchQuery,\n noop,\n partialMatchKey,\n replaceEqualDeep,\n shouldThrowError,\n skipToken,\n} from './utils'\nexport type { MutationFilters, QueryFilters, SkipToken, Updater } from './utils'\n\nexport { streamedQuery as experimental_streamedQuery } from './streamedQuery'\n\n// Types\nexport type {\n DehydratedState,\n DehydrateOptions,\n HydrateOptions,\n} from './hydration'\nexport { Mutation } from './mutation'\nexport type { MutationState } from './mutation'\nexport type { QueriesObserverOptions } from './queriesObserver'\nexport { Query } from './query'\nexport type { QueryState } from './query'\nexport * from './types'\n"],"mappings":";;;AAEA,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAE9B,SAAS,wBAAwB;AACjC,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,wBAAwB;AACjD;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAA0B,qBAAkC;AAQ5D,SAAS,gBAAgB;AAGzB,SAAS,aAAa;AAEtB,cAAc;","names":[]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs new file mode 100644 index 0000000000000000000000000000000000000000..bd920711cd0055a8cfcdcd466093e9faa103103c --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs @@ -0,0 +1,146 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/infiniteQueryBehavior.ts +var infiniteQueryBehavior_exports = {}; +__export(infiniteQueryBehavior_exports, { + hasNextPage: () => hasNextPage, + hasPreviousPage: () => hasPreviousPage, + infiniteQueryBehavior: () => infiniteQueryBehavior +}); +module.exports = __toCommonJS(infiniteQueryBehavior_exports); +var import_utils = require("./utils.cjs"); +function infiniteQueryBehavior(pages) { + return { + onFetch: (context, query) => { + var _a, _b, _c, _d, _e; + const options = context.options; + const direction = (_c = (_b = (_a = context.fetchOptions) == null ? void 0 : _a.meta) == null ? void 0 : _b.fetchMore) == null ? void 0 : _c.direction; + const oldPages = ((_d = context.state.data) == null ? void 0 : _d.pages) || []; + const oldPageParams = ((_e = context.state.data) == null ? void 0 : _e.pageParams) || []; + let result = { pages: [], pageParams: [] }; + let currentPage = 0; + const fetchFn = async () => { + let cancelled = false; + const addSignalProperty = (object) => { + (0, import_utils.addConsumeAwareSignal)( + object, + () => context.signal, + () => cancelled = true + ); + }; + const queryFn = (0, import_utils.ensureQueryFn)(context.options, context.fetchOptions); + const fetchPage = async (data, param, previous) => { + if (cancelled) { + return Promise.reject(context.signal.reason); + } + if (param == null && data.pages.length) { + return Promise.resolve(data); + } + const createQueryFnContext = () => { + const queryFnContext2 = { + client: context.client, + queryKey: context.queryKey, + pageParam: param, + direction: previous ? "backward" : "forward", + meta: context.options.meta + }; + addSignalProperty(queryFnContext2); + return queryFnContext2; + }; + const queryFnContext = createQueryFnContext(); + const page = await queryFn(queryFnContext); + const { maxPages } = context.options; + const addTo = previous ? import_utils.addToStart : import_utils.addToEnd; + return { + pages: addTo(data.pages, page, maxPages), + pageParams: addTo(data.pageParams, param, maxPages) + }; + }; + if (direction && oldPages.length) { + const previous = direction === "backward"; + const pageParamFn = previous ? getPreviousPageParam : getNextPageParam; + const oldData = { + pages: oldPages, + pageParams: oldPageParams + }; + const param = pageParamFn(options, oldData); + result = await fetchPage(oldData, param, previous); + } else { + const remainingPages = pages ?? oldPages.length; + do { + const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result); + if (currentPage > 0 && param == null) { + break; + } + result = await fetchPage(result, param); + currentPage++; + } while (currentPage < remainingPages); + } + return result; + }; + if (context.options.persister) { + context.fetchFn = () => { + var _a2, _b2; + return (_b2 = (_a2 = context.options).persister) == null ? void 0 : _b2.call( + _a2, + fetchFn, + { + client: context.client, + queryKey: context.queryKey, + meta: context.options.meta, + signal: context.signal + }, + query + ); + }; + } else { + context.fetchFn = fetchFn; + } + } + }; +} +function getNextPageParam(options, { pages, pageParams }) { + const lastIndex = pages.length - 1; + return pages.length > 0 ? options.getNextPageParam( + pages[lastIndex], + pages, + pageParams[lastIndex], + pageParams + ) : void 0; +} +function getPreviousPageParam(options, { pages, pageParams }) { + var _a; + return pages.length > 0 ? (_a = options.getPreviousPageParam) == null ? void 0 : _a.call(options, pages[0], pages, pageParams[0], pageParams) : void 0; +} +function hasNextPage(options, data) { + if (!data) return false; + return getNextPageParam(options, data) != null; +} +function hasPreviousPage(options, data) { + if (!data || !options.getPreviousPageParam) return false; + return getPreviousPageParam(options, data) != null; +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + hasNextPage, + hasPreviousPage, + infiniteQueryBehavior +}); +//# sourceMappingURL=infiniteQueryBehavior.cjs.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs.map b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs.map new file mode 100644 index 0000000000000000000000000000000000000000..aac37beda0beb92ca3e52c413d064fceda87dfcc --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.cjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/infiniteQueryBehavior.ts"],"sourcesContent":["import {\n addConsumeAwareSignal,\n addToEnd,\n addToStart,\n ensureQueryFn,\n} from './utils'\nimport type { QueryBehavior } from './query'\nimport type {\n InfiniteData,\n InfiniteQueryPageParamsOptions,\n OmitKeyof,\n QueryFunctionContext,\n QueryKey,\n} from './types'\n\nexport function infiniteQueryBehavior(\n pages?: number,\n): QueryBehavior> {\n return {\n onFetch: (context, query) => {\n const options = context.options as InfiniteQueryPageParamsOptions\n const direction = context.fetchOptions?.meta?.fetchMore?.direction\n const oldPages = context.state.data?.pages || []\n const oldPageParams = context.state.data?.pageParams || []\n let result: InfiniteData = { pages: [], pageParams: [] }\n let currentPage = 0\n\n const fetchFn = async () => {\n let cancelled = false\n const addSignalProperty = (object: unknown) => {\n addConsumeAwareSignal(\n object,\n () => context.signal,\n () => (cancelled = true),\n )\n }\n\n const queryFn = ensureQueryFn(context.options, context.fetchOptions)\n\n // Create function to fetch a page\n const fetchPage = async (\n data: InfiniteData,\n param: unknown,\n previous?: boolean,\n ): Promise> => {\n if (cancelled) {\n return Promise.reject(context.signal.reason)\n }\n\n if (param == null && data.pages.length) {\n return Promise.resolve(data)\n }\n\n const createQueryFnContext = () => {\n const queryFnContext: OmitKeyof<\n QueryFunctionContext,\n 'signal'\n > = {\n client: context.client,\n queryKey: context.queryKey,\n pageParam: param,\n direction: previous ? 'backward' : 'forward',\n meta: context.options.meta,\n }\n addSignalProperty(queryFnContext)\n return queryFnContext as QueryFunctionContext\n }\n\n const queryFnContext = createQueryFnContext()\n\n const page = await queryFn(queryFnContext)\n\n const { maxPages } = context.options\n const addTo = previous ? addToStart : addToEnd\n\n return {\n pages: addTo(data.pages, page, maxPages),\n pageParams: addTo(data.pageParams, param, maxPages),\n }\n }\n\n // fetch next / previous page?\n if (direction && oldPages.length) {\n const previous = direction === 'backward'\n const pageParamFn = previous ? getPreviousPageParam : getNextPageParam\n const oldData = {\n pages: oldPages,\n pageParams: oldPageParams,\n }\n const param = pageParamFn(options, oldData)\n\n result = await fetchPage(oldData, param, previous)\n } else {\n const remainingPages = pages ?? oldPages.length\n\n // Fetch all pages\n do {\n const param =\n currentPage === 0\n ? (oldPageParams[0] ?? options.initialPageParam)\n : getNextPageParam(options, result)\n if (currentPage > 0 && param == null) {\n break\n }\n result = await fetchPage(result, param)\n currentPage++\n } while (currentPage < remainingPages)\n }\n\n return result\n }\n if (context.options.persister) {\n context.fetchFn = () => {\n return context.options.persister?.(\n fetchFn as any,\n {\n client: context.client,\n queryKey: context.queryKey,\n meta: context.options.meta,\n signal: context.signal,\n },\n query,\n )\n }\n } else {\n context.fetchFn = fetchFn\n }\n },\n }\n}\n\nfunction getNextPageParam(\n options: InfiniteQueryPageParamsOptions,\n { pages, pageParams }: InfiniteData,\n): unknown | undefined {\n const lastIndex = pages.length - 1\n return pages.length > 0\n ? options.getNextPageParam(\n pages[lastIndex],\n pages,\n pageParams[lastIndex],\n pageParams,\n )\n : undefined\n}\n\nfunction getPreviousPageParam(\n options: InfiniteQueryPageParamsOptions,\n { pages, pageParams }: InfiniteData,\n): unknown | undefined {\n return pages.length > 0\n ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams)\n : undefined\n}\n\n/**\n * Checks if there is a next page.\n */\nexport function hasNextPage(\n options: InfiniteQueryPageParamsOptions,\n data?: InfiniteData,\n): boolean {\n if (!data) return false\n return getNextPageParam(options, data) != null\n}\n\n/**\n * Checks if there is a previous page.\n */\nexport function hasPreviousPage(\n options: InfiniteQueryPageParamsOptions,\n data?: InfiniteData,\n): boolean {\n if (!data || !options.getPreviousPageParam) return false\n return getPreviousPageParam(options, data) != null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKO;AAUA,SAAS,sBACd,OACsE;AACtE,SAAO;AAAA,IACL,SAAS,CAAC,SAAS,UAAU;AAnBjC;AAoBM,YAAM,UAAU,QAAQ;AACxB,YAAM,aAAY,yBAAQ,iBAAR,mBAAsB,SAAtB,mBAA4B,cAA5B,mBAAuC;AACzD,YAAM,aAAW,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T,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,iBAAiB,SAAS,IAAI,KAAK;AAC5C;AAKO,SAAS,gBACd,SACA,MACS;AACT,MAAI,CAAC,QAAQ,CAAC,QAAQ,qBAAsB,QAAO;AACnD,SAAO,qBAAqB,SAAS,IAAI,KAAK;AAChD;","names":["queryFnContext","_a","_b"]} \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.cts b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..9998b15b515786b58e88fe044d5b007d34288a33 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.cts @@ -0,0 +1,3 @@ +export { infiniteQueryBehavior } from './_tsup-dts-rollup.cjs'; +export { hasNextPage } from './_tsup-dts-rollup.cjs'; +export { hasPreviousPage } from './_tsup-dts-rollup.cjs'; diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.ts b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b50d229b5f1d06ebc7c0d56cac2870d4d399d5ee --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.d.ts @@ -0,0 +1,3 @@ +export { infiniteQueryBehavior } from './_tsup-dts-rollup.js'; +export { hasNextPage } from './_tsup-dts-rollup.js'; +export { hasPreviousPage } from './_tsup-dts-rollup.js'; diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..decd92ff330545842ed97ae2b02723a42ec581d2 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js @@ -0,0 +1,126 @@ +import "./chunk-PXG64RU4.js"; + +// src/infiniteQueryBehavior.ts +import { + addConsumeAwareSignal, + addToEnd, + addToStart, + ensureQueryFn +} from "./utils.js"; +function infiniteQueryBehavior(pages) { + return { + onFetch: (context, query) => { + var _a, _b, _c, _d, _e; + const options = context.options; + const direction = (_c = (_b = (_a = context.fetchOptions) == null ? void 0 : _a.meta) == null ? void 0 : _b.fetchMore) == null ? void 0 : _c.direction; + const oldPages = ((_d = context.state.data) == null ? void 0 : _d.pages) || []; + const oldPageParams = ((_e = context.state.data) == null ? void 0 : _e.pageParams) || []; + let result = { pages: [], pageParams: [] }; + let currentPage = 0; + const fetchFn = async () => { + let cancelled = false; + const addSignalProperty = (object) => { + addConsumeAwareSignal( + object, + () => context.signal, + () => cancelled = true + ); + }; + const queryFn = ensureQueryFn(context.options, context.fetchOptions); + const fetchPage = async (data, param, previous) => { + if (cancelled) { + return Promise.reject(context.signal.reason); + } + if (param == null && data.pages.length) { + return Promise.resolve(data); + } + const createQueryFnContext = () => { + const queryFnContext2 = { + client: context.client, + queryKey: context.queryKey, + pageParam: param, + direction: previous ? "backward" : "forward", + meta: context.options.meta + }; + addSignalProperty(queryFnContext2); + return queryFnContext2; + }; + const queryFnContext = createQueryFnContext(); + const page = await queryFn(queryFnContext); + const { maxPages } = context.options; + const addTo = previous ? addToStart : addToEnd; + return { + pages: addTo(data.pages, page, maxPages), + pageParams: addTo(data.pageParams, param, maxPages) + }; + }; + if (direction && oldPages.length) { + const previous = direction === "backward"; + const pageParamFn = previous ? getPreviousPageParam : getNextPageParam; + const oldData = { + pages: oldPages, + pageParams: oldPageParams + }; + const param = pageParamFn(options, oldData); + result = await fetchPage(oldData, param, previous); + } else { + const remainingPages = pages ?? oldPages.length; + do { + const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result); + if (currentPage > 0 && param == null) { + break; + } + result = await fetchPage(result, param); + currentPage++; + } while (currentPage < remainingPages); + } + return result; + }; + if (context.options.persister) { + context.fetchFn = () => { + var _a2, _b2; + return (_b2 = (_a2 = context.options).persister) == null ? void 0 : _b2.call( + _a2, + fetchFn, + { + client: context.client, + queryKey: context.queryKey, + meta: context.options.meta, + signal: context.signal + }, + query + ); + }; + } else { + context.fetchFn = fetchFn; + } + } + }; +} +function getNextPageParam(options, { pages, pageParams }) { + const lastIndex = pages.length - 1; + return pages.length > 0 ? options.getNextPageParam( + pages[lastIndex], + pages, + pageParams[lastIndex], + pageParams + ) : void 0; +} +function getPreviousPageParam(options, { pages, pageParams }) { + var _a; + return pages.length > 0 ? (_a = options.getPreviousPageParam) == null ? void 0 : _a.call(options, pages[0], pages, pageParams[0], pageParams) : void 0; +} +function hasNextPage(options, data) { + if (!data) return false; + return getNextPageParam(options, data) != null; +} +function hasPreviousPage(options, data) { + if (!data || !options.getPreviousPageParam) return false; + return getPreviousPageParam(options, data) != null; +} +export { + hasNextPage, + hasPreviousPage, + infiniteQueryBehavior +}; +//# sourceMappingURL=infiniteQueryBehavior.js.map \ No newline at end of file diff --git a/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js.map b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5de9fe99c473e71e960e169960cef2fb125889d3 --- /dev/null +++ b/node_modules/@tanstack/query-core/build/legacy/infiniteQueryBehavior.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/infiniteQueryBehavior.ts"],"sourcesContent":["import {\n addConsumeAwareSignal,\n addToEnd,\n addToStart,\n ensureQueryFn,\n} from './utils'\nimport type { QueryBehavior } from './query'\nimport type {\n InfiniteData,\n InfiniteQueryPageParamsOptions,\n OmitKeyof,\n QueryFunctionContext,\n QueryKey,\n} from './types'\n\nexport function infiniteQueryBehavior(\n pages?: number,\n): QueryBehavior> {\n return {\n onFetch: (context, query) => {\n const options = context.options as InfiniteQueryPageParamsOptions\n const direction = context.fetchOptions?.meta?.fetchMore?.direction\n const oldPages = context.state.data?.pages || []\n const oldPageParams = context.state.data?.pageParams || []\n let result: InfiniteData = { pages: [], pageParams: [] }\n let currentPage = 0\n\n const fetchFn = async () => {\n let cancelled = false\n const addSignalProperty = (object: unknown) => {\n addConsumeAwareSignal(\n object,\n () => context.signal,\n () => (cancelled = true),\n )\n }\n\n const queryFn = ensureQueryFn(context.options, context.fetchOptions)\n\n // Create function to fetch a page\n const fetchPage = async (\n data: InfiniteData,\n param: unknown,\n previous?: boolean,\n ): Promise> => {\n if (cancelled) {\n return Promise.reject(context.signal.reason)\n }\n\n if (param == null && data.pages.length) {\n return Promise.resolve(data)\n }\n\n const createQueryFnContext = () => {\n const queryFnContext: OmitKeyof<\n QueryFunctionContext,\n 'signal'\n > = {\n client: context.client,\n queryKey: context.queryKey,\n pageParam: param,\n direction: previous ? 'backward' : 'forward',\n meta: context.options.meta,\n }\n addSignalProperty(queryFnContext)\n return queryFnContext as QueryFunctionContext\n }\n\n const queryFnContext = createQueryFnContext()\n\n const page = await queryFn(queryFnContext)\n\n const { maxPages } = context.options\n const addTo = previous ? addToStart : addToEnd\n\n return {\n pages: addTo(data.pages, page, maxPages),\n pageParams: addTo(data.pageParams, param, maxPages),\n }\n }\n\n // fetch next / previous page?\n if (direction && oldPages.length) {\n const previous = direction === 'backward'\n const pageParamFn = previous ? getPreviousPageParam : getNextPageParam\n const oldData = {\n pages: oldPages,\n pageParams: oldPageParams,\n }\n const param = pageParamFn(options, oldData)\n\n result = await fetchPage(oldData, param, previous)\n } else {\n const remainingPages = pages ?? oldPages.length\n\n // Fetch all pages\n do {\n const param =\n currentPage === 0\n ? (oldPageParams[0] ?? options.initialPageParam)\n : getNextPageParam(options, result)\n if (currentPage > 0 && param == null) {\n break\n }\n result = await fetchPage(result, param)\n currentPage++\n } while (currentPage < remainingPages)\n }\n\n return result\n }\n if (context.options.persister) {\n context.fetchFn = () => {\n return context.options.persister?.(\n fetchFn as any,\n {\n client: context.client,\n queryKey: context.queryKey,\n meta: context.options.meta,\n signal: context.signal,\n },\n query,\n )\n }\n } else {\n context.fetchFn = fetchFn\n }\n },\n }\n}\n\nfunction getNextPageParam(\n options: InfiniteQueryPageParamsOptions,\n { pages, pageParams }: InfiniteData,\n): unknown | undefined {\n const lastIndex = pages.length - 1\n return pages.length > 0\n ? options.getNextPageParam(\n pages[lastIndex],\n pages,\n pageParams[lastIndex],\n pageParams,\n )\n : undefined\n}\n\nfunction getPreviousPageParam(\n options: InfiniteQueryPageParamsOptions,\n { pages, pageParams }: InfiniteData,\n): unknown | undefined {\n return pages.length > 0\n ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams)\n : undefined\n}\n\n/**\n * Checks if there is a next page.\n */\nexport function hasNextPage(\n options: InfiniteQueryPageParamsOptions,\n data?: InfiniteData,\n): boolean {\n if (!data) return false\n return getNextPageParam(options, data) != null\n}\n\n/**\n * Checks if there is a previous page.\n */\nexport function hasPreviousPage(\n options: InfiniteQueryPageParamsOptions,\n data?: InfiniteData,\n): boolean {\n if (!data || !options.getPreviousPageParam) return false\n return getPreviousPageParam(options, data) != null\n}\n"],"mappings":";;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,SAAS,sBACd,OACsE;AACtE,SAAO;AAAA,IACL,SAAS,CAAC,SAAS,UAAU;AAnBjC;AAoBM,YAAM,UAAU,QAAQ;AACxB,YAAM,aAAY,yBAAQ,iBAAR,mBAAsB,SAAtB,mBAA4B,cAA5B,mBAAuC;AACzD,YAAM,aAAW,aAAQ,MAAM,SAAd,mBAAoB,UAAS,CAAC;AAC/C,YAAM,kBAAgB,aAAQ,MAAM,SAAd,mBAAoB,eAAc,CAAC;AACzD,UAAI,SAAgC,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,EAAE;AAChE,UAAI,cAAc;AAElB,YAAM,UAAU,YAAY;AAC1B,YAAI,YAAY;AAChB,cAAM,oBAAoB,CAAC,WAAoB;AAC7C;AAAA,YACE;AAAA,YACA,MAAM,QAAQ;AAAA,YACd,MAAO,YAAY;AAAA,UACrB;AAAA,QACF;AAEA,cAAM,UAAU,cAAc,QAAQ,SAAS,Q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