@supabase/supabase-js 2.87.4-canary.2 → 2.87.4-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +452 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +362 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +362 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +405 -0
- package/dist/index.mjs.map +1 -0
- package/dist/umd/supabase.js +23 -1
- package/package.json +21 -22
- package/src/lib/types.ts +19 -1
- package/src/lib/version.ts +1 -1
- package/dist/esm/wrapper.mjs +0 -94
- package/dist/main/SupabaseClient.d.ts +0 -139
- package/dist/main/SupabaseClient.d.ts.map +0 -1
- package/dist/main/SupabaseClient.js +0 -235
- package/dist/main/SupabaseClient.js.map +0 -1
- package/dist/main/index.d.ts +0 -24
- package/dist/main/index.d.ts.map +0 -1
- package/dist/main/index.js +0 -76
- package/dist/main/index.js.map +0 -1
- package/dist/main/lib/SupabaseAuthClient.d.ts +0 -6
- package/dist/main/lib/SupabaseAuthClient.d.ts.map +0 -1
- package/dist/main/lib/SupabaseAuthClient.js +0 -11
- package/dist/main/lib/SupabaseAuthClient.js.map +0 -1
- package/dist/main/lib/constants.d.ts +0 -16
- package/dist/main/lib/constants.d.ts.map +0 -1
- package/dist/main/lib/constants.js +0 -33
- package/dist/main/lib/constants.js.map +0 -1
- package/dist/main/lib/fetch.d.ts +0 -9
- package/dist/main/lib/fetch.d.ts.map +0 -1
- package/dist/main/lib/fetch.js +0 -32
- package/dist/main/lib/fetch.js.map +0 -1
- package/dist/main/lib/helpers.d.ts +0 -14
- package/dist/main/lib/helpers.d.ts.map +0 -1
- package/dist/main/lib/helpers.js +0 -62
- package/dist/main/lib/helpers.js.map +0 -1
- package/dist/main/lib/rest/types/common/common.d.ts +0 -55
- package/dist/main/lib/rest/types/common/common.d.ts.map +0 -1
- package/dist/main/lib/rest/types/common/common.js +0 -12
- package/dist/main/lib/rest/types/common/common.js.map +0 -1
- package/dist/main/lib/rest/types/common/rpc.d.ts +0 -49
- package/dist/main/lib/rest/types/common/rpc.d.ts.map +0 -1
- package/dist/main/lib/rest/types/common/rpc.js +0 -12
- package/dist/main/lib/rest/types/common/rpc.js.map +0 -1
- package/dist/main/lib/types.d.ts +0 -102
- package/dist/main/lib/types.d.ts.map +0 -1
- package/dist/main/lib/types.js +0 -3
- package/dist/main/lib/types.js.map +0 -1
- package/dist/main/lib/version.d.ts +0 -2
- package/dist/main/lib/version.d.ts.map +0 -1
- package/dist/main/lib/version.js +0 -11
- package/dist/main/lib/version.js.map +0 -1
- package/dist/module/SupabaseClient.d.ts +0 -139
- package/dist/module/SupabaseClient.d.ts.map +0 -1
- package/dist/module/SupabaseClient.js +0 -232
- package/dist/module/SupabaseClient.js.map +0 -1
- package/dist/module/index.d.ts +0 -24
- package/dist/module/index.d.ts.map +0 -1
- package/dist/module/index.js +0 -48
- package/dist/module/index.js.map +0 -1
- package/dist/module/lib/SupabaseAuthClient.d.ts +0 -6
- package/dist/module/lib/SupabaseAuthClient.d.ts.map +0 -1
- package/dist/module/lib/SupabaseAuthClient.js +0 -7
- package/dist/module/lib/SupabaseAuthClient.js.map +0 -1
- package/dist/module/lib/constants.d.ts +0 -16
- package/dist/module/lib/constants.d.ts.map +0 -1
- package/dist/module/lib/constants.js +0 -30
- package/dist/module/lib/constants.js.map +0 -1
- package/dist/module/lib/fetch.d.ts +0 -9
- package/dist/module/lib/fetch.d.ts.map +0 -1
- package/dist/module/lib/fetch.js +0 -26
- package/dist/module/lib/fetch.js.map +0 -1
- package/dist/module/lib/helpers.d.ts +0 -14
- package/dist/module/lib/helpers.d.ts.map +0 -1
- package/dist/module/lib/helpers.js +0 -54
- package/dist/module/lib/helpers.js.map +0 -1
- package/dist/module/lib/rest/types/common/common.d.ts +0 -55
- package/dist/module/lib/rest/types/common/common.d.ts.map +0 -1
- package/dist/module/lib/rest/types/common/common.js +0 -11
- package/dist/module/lib/rest/types/common/common.js.map +0 -1
- package/dist/module/lib/rest/types/common/rpc.d.ts +0 -49
- package/dist/module/lib/rest/types/common/rpc.d.ts.map +0 -1
- package/dist/module/lib/rest/types/common/rpc.js +0 -11
- package/dist/module/lib/rest/types/common/rpc.js.map +0 -1
- package/dist/module/lib/types.d.ts +0 -102
- package/dist/module/lib/types.d.ts.map +0 -1
- package/dist/module/lib/types.js +0 -2
- package/dist/module/lib/types.js.map +0 -1
- package/dist/module/lib/version.d.ts +0 -2
- package/dist/module/lib/version.d.ts.map +0 -1
- package/dist/module/lib/version.js +0 -8
- package/dist/module/lib/version.js.map +0 -1
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { FunctionsClient } from '@supabase/functions-js';
|
|
2
|
-
import { PostgrestClient, type PostgrestFilterBuilder, type PostgrestQueryBuilder } from '@supabase/postgrest-js';
|
|
3
|
-
import { type RealtimeChannel, type RealtimeChannelOptions, RealtimeClient } from '@supabase/realtime-js';
|
|
4
|
-
import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js';
|
|
5
|
-
import { SupabaseAuthClient } from './lib/SupabaseAuthClient';
|
|
6
|
-
import type { Fetch, GenericSchema, SupabaseClientOptions } from './lib/types';
|
|
7
|
-
import { GetRpcFunctionFilterBuilderByArgs } from './lib/rest/types/common/rpc';
|
|
8
|
-
/**
|
|
9
|
-
* Supabase Client.
|
|
10
|
-
*
|
|
11
|
-
* An isomorphic Javascript client for interacting with Postgres.
|
|
12
|
-
*/
|
|
13
|
-
export default class SupabaseClient<Database = any, SchemaNameOrClientOptions extends (string & keyof Omit<Database, '__InternalSupabase'>) | {
|
|
14
|
-
PostgrestVersion: string;
|
|
15
|
-
} = 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Database, '__InternalSupabase'>, SchemaName extends string & keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? SchemaNameOrClientOptions : 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>, Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never, ClientOptions extends {
|
|
16
|
-
PostgrestVersion: string;
|
|
17
|
-
} = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? Database extends {
|
|
18
|
-
__InternalSupabase: {
|
|
19
|
-
PostgrestVersion: string;
|
|
20
|
-
};
|
|
21
|
-
} ? Database['__InternalSupabase'] : {
|
|
22
|
-
PostgrestVersion: '12';
|
|
23
|
-
} : SchemaNameOrClientOptions extends {
|
|
24
|
-
PostgrestVersion: string;
|
|
25
|
-
} ? SchemaNameOrClientOptions : never> {
|
|
26
|
-
protected supabaseUrl: string;
|
|
27
|
-
protected supabaseKey: string;
|
|
28
|
-
/**
|
|
29
|
-
* Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
|
|
30
|
-
*/
|
|
31
|
-
auth: SupabaseAuthClient;
|
|
32
|
-
realtime: RealtimeClient;
|
|
33
|
-
/**
|
|
34
|
-
* Supabase Storage allows you to manage user-generated content, such as photos or videos.
|
|
35
|
-
*/
|
|
36
|
-
storage: SupabaseStorageClient;
|
|
37
|
-
protected realtimeUrl: URL;
|
|
38
|
-
protected authUrl: URL;
|
|
39
|
-
protected storageUrl: URL;
|
|
40
|
-
protected functionsUrl: URL;
|
|
41
|
-
protected rest: PostgrestClient<Database, ClientOptions, SchemaName>;
|
|
42
|
-
protected storageKey: string;
|
|
43
|
-
protected fetch?: Fetch;
|
|
44
|
-
protected changedAccessToken?: string;
|
|
45
|
-
protected accessToken?: () => Promise<string | null>;
|
|
46
|
-
protected headers: Record<string, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Create a new client for use in the browser.
|
|
49
|
-
* @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
|
|
50
|
-
* @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
|
|
51
|
-
* @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
|
|
52
|
-
* @param options.auth.autoRefreshToken Set to "true" if you want to automatically refresh the token before expiring.
|
|
53
|
-
* @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
|
|
54
|
-
* @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
|
|
55
|
-
* @param options.realtime Options passed along to realtime-js constructor.
|
|
56
|
-
* @param options.storage Options passed along to the storage-js constructor.
|
|
57
|
-
* @param options.global.fetch A custom fetch implementation.
|
|
58
|
-
* @param options.global.headers Any additional headers to send with each network request.
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
62
|
-
*
|
|
63
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
64
|
-
* const { data } = await supabase.from('profiles').select('*')
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions<SchemaName>);
|
|
68
|
-
/**
|
|
69
|
-
* Supabase Functions allows you to deploy and invoke edge functions.
|
|
70
|
-
*/
|
|
71
|
-
get functions(): FunctionsClient;
|
|
72
|
-
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>;
|
|
73
|
-
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
|
|
74
|
-
/**
|
|
75
|
-
* Select a schema to query or perform an function (rpc) call.
|
|
76
|
-
*
|
|
77
|
-
* The schema needs to be on the list of exposed schemas inside Supabase.
|
|
78
|
-
*
|
|
79
|
-
* @param schema - The schema to query
|
|
80
|
-
*/
|
|
81
|
-
schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>;
|
|
82
|
-
/**
|
|
83
|
-
* Perform a function call.
|
|
84
|
-
*
|
|
85
|
-
* @param fn - The function name to call
|
|
86
|
-
* @param args - The arguments to pass to the function call
|
|
87
|
-
* @param options - Named parameters
|
|
88
|
-
* @param options.head - When set to `true`, `data` will not be returned.
|
|
89
|
-
* Useful if you only need the count.
|
|
90
|
-
* @param options.get - When set to `true`, the function will be called with
|
|
91
|
-
* read-only access mode.
|
|
92
|
-
* @param options.count - Count algorithm to use to count rows returned by the
|
|
93
|
-
* function. Only applicable for [set-returning
|
|
94
|
-
* functions](https://www.postgresql.org/docs/current/functions-srf.html).
|
|
95
|
-
*
|
|
96
|
-
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
97
|
-
* hood.
|
|
98
|
-
*
|
|
99
|
-
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
100
|
-
* statistics under the hood.
|
|
101
|
-
*
|
|
102
|
-
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
103
|
-
* numbers.
|
|
104
|
-
*/
|
|
105
|
-
rpc<FnName extends string & keyof Schema['Functions'], Args extends Schema['Functions'][FnName]['Args'] = never, FilterBuilder extends GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args> = GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>>(fn: FnName, args?: Args, options?: {
|
|
106
|
-
head?: boolean;
|
|
107
|
-
get?: boolean;
|
|
108
|
-
count?: 'exact' | 'planned' | 'estimated';
|
|
109
|
-
}): PostgrestFilterBuilder<ClientOptions, Schema, FilterBuilder['Row'], FilterBuilder['Result'], FilterBuilder['RelationName'], FilterBuilder['Relationships'], 'RPC'>;
|
|
110
|
-
/**
|
|
111
|
-
* Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
|
|
112
|
-
*
|
|
113
|
-
* @param {string} name - The name of the Realtime channel.
|
|
114
|
-
* @param {Object} opts - The options to pass to the Realtime channel.
|
|
115
|
-
*
|
|
116
|
-
*/
|
|
117
|
-
channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel;
|
|
118
|
-
/**
|
|
119
|
-
* Returns all Realtime channels.
|
|
120
|
-
*/
|
|
121
|
-
getChannels(): RealtimeChannel[];
|
|
122
|
-
/**
|
|
123
|
-
* Unsubscribes and removes Realtime channel from Realtime client.
|
|
124
|
-
*
|
|
125
|
-
* @param {RealtimeChannel} channel - The name of the Realtime channel.
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
removeChannel(channel: RealtimeChannel): Promise<'ok' | 'timed out' | 'error'>;
|
|
129
|
-
/**
|
|
130
|
-
* Unsubscribes and removes all Realtime channels from Realtime client.
|
|
131
|
-
*/
|
|
132
|
-
removeAllChannels(): Promise<('ok' | 'timed out' | 'error')[]>;
|
|
133
|
-
private _getAccessToken;
|
|
134
|
-
private _initSupabaseAuthClient;
|
|
135
|
-
private _initRealtimeClient;
|
|
136
|
-
private _listenForAuthEvents;
|
|
137
|
-
private _handleTokenChanged;
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=SupabaseClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseClient.d.ts","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,cAAc,EAEf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,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AAI,CAAC,EAAE,OAAO,CAAA;QACd,GAAG,CAAC,EAAE,OAAO,CAAA;QACb,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAA;KAK1C,GACA,sBAAsB,CACvB,aAAa,EACb,MAAM,EACN,aAAa,CAAC,KAAK,CAAC,EACpB,aAAa,CAAC,QAAQ,CAAC,EACvB,aAAa,CAAC,cAAc,CAAC,EAC7B,aAAa,CAAC,eAAe,CAAC,EAC9B,KAAK,CACN;IAYD;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,sBAAuC,GAAG,eAAe;IAIrF;;OAEG;IACH,WAAW,IAAI,eAAe,EAAE;IAIhC;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC;IAI9E;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,CAAC,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC,EAAE,CAAC;YAIhD,eAAe;IAU7B,OAAO,CAAC,uBAAuB;IA0C/B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,mBAAmB;CAiB5B"}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { FunctionsClient } from '@supabase/functions-js';
|
|
2
|
-
import { PostgrestClient, } from '@supabase/postgrest-js';
|
|
3
|
-
import { RealtimeClient, } from '@supabase/realtime-js';
|
|
4
|
-
import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js';
|
|
5
|
-
import { DEFAULT_AUTH_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_GLOBAL_OPTIONS, DEFAULT_REALTIME_OPTIONS, } from './lib/constants.js';
|
|
6
|
-
import { fetchWithAuth } from './lib/fetch.js';
|
|
7
|
-
import { applySettingDefaults, validateSupabaseUrl } from './lib/helpers.js';
|
|
8
|
-
import { SupabaseAuthClient } from './lib/SupabaseAuthClient.js';
|
|
9
|
-
/**
|
|
10
|
-
* Supabase Client.
|
|
11
|
-
*
|
|
12
|
-
* An isomorphic Javascript client for interacting with Postgres.
|
|
13
|
-
*/
|
|
14
|
-
export default class SupabaseClient {
|
|
15
|
-
/**
|
|
16
|
-
* Create a new client for use in the browser.
|
|
17
|
-
* @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
|
|
18
|
-
* @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
|
|
19
|
-
* @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
|
|
20
|
-
* @param options.auth.autoRefreshToken Set to "true" if you want to automatically refresh the token before expiring.
|
|
21
|
-
* @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
|
|
22
|
-
* @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
|
|
23
|
-
* @param options.realtime Options passed along to realtime-js constructor.
|
|
24
|
-
* @param options.storage Options passed along to the storage-js constructor.
|
|
25
|
-
* @param options.global.fetch A custom fetch implementation.
|
|
26
|
-
* @param options.global.headers Any additional headers to send with each network request.
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
30
|
-
*
|
|
31
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
32
|
-
* const { data } = await supabase.from('profiles').select('*')
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
constructor(supabaseUrl, supabaseKey, options) {
|
|
36
|
-
var _a, _b, _c;
|
|
37
|
-
this.supabaseUrl = supabaseUrl;
|
|
38
|
-
this.supabaseKey = supabaseKey;
|
|
39
|
-
const baseUrl = validateSupabaseUrl(supabaseUrl);
|
|
40
|
-
if (!supabaseKey)
|
|
41
|
-
throw new Error('supabaseKey is required.');
|
|
42
|
-
this.realtimeUrl = new URL('realtime/v1', baseUrl);
|
|
43
|
-
this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace('http', 'ws');
|
|
44
|
-
this.authUrl = new URL('auth/v1', baseUrl);
|
|
45
|
-
this.storageUrl = new URL('storage/v1', baseUrl);
|
|
46
|
-
this.functionsUrl = new URL('functions/v1', baseUrl);
|
|
47
|
-
// default storage key uses the supabase project ref as a namespace
|
|
48
|
-
const defaultStorageKey = `sb-${baseUrl.hostname.split('.')[0]}-auth-token`;
|
|
49
|
-
const DEFAULTS = {
|
|
50
|
-
db: DEFAULT_DB_OPTIONS,
|
|
51
|
-
realtime: DEFAULT_REALTIME_OPTIONS,
|
|
52
|
-
auth: Object.assign(Object.assign({}, DEFAULT_AUTH_OPTIONS), { storageKey: defaultStorageKey }),
|
|
53
|
-
global: DEFAULT_GLOBAL_OPTIONS,
|
|
54
|
-
};
|
|
55
|
-
const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
|
|
56
|
-
this.storageKey = (_a = settings.auth.storageKey) !== null && _a !== void 0 ? _a : '';
|
|
57
|
-
this.headers = (_b = settings.global.headers) !== null && _b !== void 0 ? _b : {};
|
|
58
|
-
if (!settings.accessToken) {
|
|
59
|
-
this.auth = this._initSupabaseAuthClient((_c = settings.auth) !== null && _c !== void 0 ? _c : {}, this.headers, settings.global.fetch);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
this.accessToken = settings.accessToken;
|
|
63
|
-
this.auth = new Proxy({}, {
|
|
64
|
-
get: (_, prop) => {
|
|
65
|
-
throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
|
|
70
|
-
this.realtime = this._initRealtimeClient(Object.assign({ headers: this.headers, accessToken: this._getAccessToken.bind(this) }, settings.realtime));
|
|
71
|
-
if (this.accessToken) {
|
|
72
|
-
// Start auth immediately to avoid race condition with channel subscriptions
|
|
73
|
-
this.accessToken()
|
|
74
|
-
.then((token) => this.realtime.setAuth(token))
|
|
75
|
-
.catch((e) => console.warn('Failed to set initial Realtime auth token:', e));
|
|
76
|
-
}
|
|
77
|
-
this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, {
|
|
78
|
-
headers: this.headers,
|
|
79
|
-
schema: settings.db.schema,
|
|
80
|
-
fetch: this.fetch,
|
|
81
|
-
});
|
|
82
|
-
this.storage = new SupabaseStorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
|
|
83
|
-
if (!settings.accessToken) {
|
|
84
|
-
this._listenForAuthEvents();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Supabase Functions allows you to deploy and invoke edge functions.
|
|
89
|
-
*/
|
|
90
|
-
get functions() {
|
|
91
|
-
return new FunctionsClient(this.functionsUrl.href, {
|
|
92
|
-
headers: this.headers,
|
|
93
|
-
customFetch: this.fetch,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Perform a query on a table or a view.
|
|
98
|
-
*
|
|
99
|
-
* @param relation - The table or view name to query
|
|
100
|
-
*/
|
|
101
|
-
from(relation) {
|
|
102
|
-
return this.rest.from(relation);
|
|
103
|
-
}
|
|
104
|
-
// NOTE: signatures must be kept in sync with PostgrestClient.schema
|
|
105
|
-
/**
|
|
106
|
-
* Select a schema to query or perform an function (rpc) call.
|
|
107
|
-
*
|
|
108
|
-
* The schema needs to be on the list of exposed schemas inside Supabase.
|
|
109
|
-
*
|
|
110
|
-
* @param schema - The schema to query
|
|
111
|
-
*/
|
|
112
|
-
schema(schema) {
|
|
113
|
-
return this.rest.schema(schema);
|
|
114
|
-
}
|
|
115
|
-
// NOTE: signatures must be kept in sync with PostgrestClient.rpc
|
|
116
|
-
/**
|
|
117
|
-
* Perform a function call.
|
|
118
|
-
*
|
|
119
|
-
* @param fn - The function name to call
|
|
120
|
-
* @param args - The arguments to pass to the function call
|
|
121
|
-
* @param options - Named parameters
|
|
122
|
-
* @param options.head - When set to `true`, `data` will not be returned.
|
|
123
|
-
* Useful if you only need the count.
|
|
124
|
-
* @param options.get - When set to `true`, the function will be called with
|
|
125
|
-
* read-only access mode.
|
|
126
|
-
* @param options.count - Count algorithm to use to count rows returned by the
|
|
127
|
-
* function. Only applicable for [set-returning
|
|
128
|
-
* functions](https://www.postgresql.org/docs/current/functions-srf.html).
|
|
129
|
-
*
|
|
130
|
-
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
131
|
-
* hood.
|
|
132
|
-
*
|
|
133
|
-
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
134
|
-
* statistics under the hood.
|
|
135
|
-
*
|
|
136
|
-
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
137
|
-
* numbers.
|
|
138
|
-
*/
|
|
139
|
-
rpc(fn, args = {}, options = {
|
|
140
|
-
head: false,
|
|
141
|
-
get: false,
|
|
142
|
-
count: undefined,
|
|
143
|
-
}) {
|
|
144
|
-
return this.rest.rpc(fn, args, options);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
|
|
148
|
-
*
|
|
149
|
-
* @param {string} name - The name of the Realtime channel.
|
|
150
|
-
* @param {Object} opts - The options to pass to the Realtime channel.
|
|
151
|
-
*
|
|
152
|
-
*/
|
|
153
|
-
channel(name, opts = { config: {} }) {
|
|
154
|
-
return this.realtime.channel(name, opts);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Returns all Realtime channels.
|
|
158
|
-
*/
|
|
159
|
-
getChannels() {
|
|
160
|
-
return this.realtime.getChannels();
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Unsubscribes and removes Realtime channel from Realtime client.
|
|
164
|
-
*
|
|
165
|
-
* @param {RealtimeChannel} channel - The name of the Realtime channel.
|
|
166
|
-
*
|
|
167
|
-
*/
|
|
168
|
-
removeChannel(channel) {
|
|
169
|
-
return this.realtime.removeChannel(channel);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Unsubscribes and removes all Realtime channels from Realtime client.
|
|
173
|
-
*/
|
|
174
|
-
removeAllChannels() {
|
|
175
|
-
return this.realtime.removeAllChannels();
|
|
176
|
-
}
|
|
177
|
-
async _getAccessToken() {
|
|
178
|
-
var _a, _b;
|
|
179
|
-
if (this.accessToken) {
|
|
180
|
-
return await this.accessToken();
|
|
181
|
-
}
|
|
182
|
-
const { data } = await this.auth.getSession();
|
|
183
|
-
return (_b = (_a = data.session) === null || _a === void 0 ? void 0 : _a.access_token) !== null && _b !== void 0 ? _b : this.supabaseKey;
|
|
184
|
-
}
|
|
185
|
-
_initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, }, headers, fetch) {
|
|
186
|
-
const authHeaders = {
|
|
187
|
-
Authorization: `Bearer ${this.supabaseKey}`,
|
|
188
|
-
apikey: `${this.supabaseKey}`,
|
|
189
|
-
};
|
|
190
|
-
return new SupabaseAuthClient({
|
|
191
|
-
url: this.authUrl.href,
|
|
192
|
-
headers: Object.assign(Object.assign({}, authHeaders), headers),
|
|
193
|
-
storageKey: storageKey,
|
|
194
|
-
autoRefreshToken,
|
|
195
|
-
persistSession,
|
|
196
|
-
detectSessionInUrl,
|
|
197
|
-
storage,
|
|
198
|
-
userStorage,
|
|
199
|
-
flowType,
|
|
200
|
-
lock,
|
|
201
|
-
debug,
|
|
202
|
-
throwOnError,
|
|
203
|
-
fetch,
|
|
204
|
-
// auth checks if there is a custom authorizaiton header using this flag
|
|
205
|
-
// so it knows whether to return an error when getUser is called with no session
|
|
206
|
-
hasCustomAuthorizationHeader: Object.keys(this.headers).some((key) => key.toLowerCase() === 'authorization'),
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
_initRealtimeClient(options) {
|
|
210
|
-
return new RealtimeClient(this.realtimeUrl.href, Object.assign(Object.assign({}, options), { params: Object.assign({ apikey: this.supabaseKey }, options === null || options === void 0 ? void 0 : options.params) }));
|
|
211
|
-
}
|
|
212
|
-
_listenForAuthEvents() {
|
|
213
|
-
const data = this.auth.onAuthStateChange((event, session) => {
|
|
214
|
-
this._handleTokenChanged(event, 'CLIENT', session === null || session === void 0 ? void 0 : session.access_token);
|
|
215
|
-
});
|
|
216
|
-
return data;
|
|
217
|
-
}
|
|
218
|
-
_handleTokenChanged(event, source, token) {
|
|
219
|
-
if ((event === 'TOKEN_REFRESHED' || event === 'SIGNED_IN') &&
|
|
220
|
-
this.changedAccessToken !== token) {
|
|
221
|
-
this.changedAccessToken = token;
|
|
222
|
-
this.realtime.setAuth(token);
|
|
223
|
-
}
|
|
224
|
-
else if (event === 'SIGNED_OUT') {
|
|
225
|
-
this.realtime.setAuth();
|
|
226
|
-
if (source == 'STORAGE')
|
|
227
|
-
this.auth.signOut();
|
|
228
|
-
this.changedAccessToken = undefined;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
//# sourceMappingURL=SupabaseClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseClient.js","sourceRoot":"","sources":["../../src/SupabaseClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,eAAe,GAGhB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,cAAc,GAEf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,oBAA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tD,IAAI,CAAC,kBAAkB,KAAK,KAAK,EACjC,CAAC;YACD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAA;YAC/B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC9B,CAAC;aAAM,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YAClC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;YACvB,IAAI,MAAM,IAAI,SAAS;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAA;YAC5C,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAA;QACrC,CAAC;IACH,CAAC;CACF"}
|
package/dist/module/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import SupabaseClient from './SupabaseClient';
|
|
2
|
-
import type { SupabaseClientOptions } from './lib/types';
|
|
3
|
-
export * from '@supabase/auth-js';
|
|
4
|
-
export type { User as AuthUser, Session as AuthSession } from '@supabase/auth-js';
|
|
5
|
-
export { type PostgrestResponse, type PostgrestSingleResponse, type PostgrestMaybeSingleResponse, PostgrestError, } from '@supabase/postgrest-js';
|
|
6
|
-
export { FunctionsHttpError, FunctionsFetchError, FunctionsRelayError, FunctionsError, type FunctionInvokeOptions, FunctionRegion, } from '@supabase/functions-js';
|
|
7
|
-
export * from '@supabase/realtime-js';
|
|
8
|
-
export { default as SupabaseClient } from './SupabaseClient';
|
|
9
|
-
export type { SupabaseClientOptions, QueryResult, QueryData, QueryError } from './lib/types';
|
|
10
|
-
/**
|
|
11
|
-
* Creates a new Supabase Client.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
16
|
-
*
|
|
17
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
18
|
-
* const { data, error } = await supabase.from('profiles').select('*')
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const createClient: <Database = any, SchemaNameOrClientOptions extends (string & keyof Omit<Database, "__InternalSupabase">) | {
|
|
22
|
-
PostgrestVersion: string;
|
|
23
|
-
} = "public" extends keyof Omit<Database, "__InternalSupabase"> ? "public" : string & keyof Omit<Database, "__InternalSupabase">, SchemaName extends string & keyof Omit<Database, "__InternalSupabase"> = SchemaNameOrClientOptions extends string & keyof Omit<Database, "__InternalSupabase"> ? SchemaNameOrClientOptions : "public" extends keyof Omit<Database, "__InternalSupabase"> ? "public" : string & keyof Omit<Omit<Database, "__InternalSupabase">, "__InternalSupabase">>(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions<SchemaName>) => SupabaseClient<Database, SchemaNameOrClientOptions, SchemaName>;
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,cAAc,mBAAmB,CAAA;AACjC,YAAY,EAAE,IAAI,IAAI,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,cAAc,GACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,wBAAwB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE5F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,GAAG,GAAG,EACd,yBAAyB,SACrB,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,GACrD;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,GAAG,QAAQ,SAAS,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GAC1F,QAAQ,GACR,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,EACvD,UAAU,SAAS,MAAM,GACvB,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GAAG,yBAAyB,SAAS,MAAM,GACrF,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GACxC,yBAAyB,GACzB,QAAQ,SAAS,MAAM,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,GACzD,QAAQ,GACR,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,EAErF,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,UAAU,qBAAqB,CAAC,UAAU,CAAC,KAC1C,cAAc,CAAC,QAAQ,EAAE,yBAAyB,EAAE,UAAU,CAMhE,CAAA"}
|
package/dist/module/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import SupabaseClient from './SupabaseClient.js';
|
|
2
|
-
export * from '@supabase/auth-js';
|
|
3
|
-
export { PostgrestError, } from '@supabase/postgrest-js';
|
|
4
|
-
export { FunctionsHttpError, FunctionsFetchError, FunctionsRelayError, FunctionsError, FunctionRegion, } from '@supabase/functions-js';
|
|
5
|
-
export * from '@supabase/realtime-js';
|
|
6
|
-
export { default as SupabaseClient } from './SupabaseClient.js';
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new Supabase Client.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
13
|
-
*
|
|
14
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
15
|
-
* const { data, error } = await supabase.from('profiles').select('*')
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export const createClient = (supabaseUrl, supabaseKey, options) => {
|
|
19
|
-
return new SupabaseClient(supabaseUrl, supabaseKey, options);
|
|
20
|
-
};
|
|
21
|
-
// Check for Node.js <= 18 deprecation
|
|
22
|
-
function shouldShowDeprecationWarning() {
|
|
23
|
-
// Skip in browser environments
|
|
24
|
-
if (typeof window !== 'undefined') {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
// Skip if process is not available (e.g., Edge Runtime)
|
|
28
|
-
if (typeof process === 'undefined') {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
// Use dynamic property access to avoid Next.js Edge Runtime static analysis warnings
|
|
32
|
-
const processVersion = process['version'];
|
|
33
|
-
if (processVersion === undefined || processVersion === null) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const versionMatch = processVersion.match(/^v(\d+)\./);
|
|
37
|
-
if (!versionMatch) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
const majorVersion = parseInt(versionMatch[1], 10);
|
|
41
|
-
return majorVersion <= 18;
|
|
42
|
-
}
|
|
43
|
-
if (shouldShowDeprecationWarning()) {
|
|
44
|
-
console.warn(`⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. ` +
|
|
45
|
-
`Please upgrade to Node.js 20 or later. ` +
|
|
46
|
-
`For more information, visit: https://github.com/orgs/supabase/discussions/37217`);
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=index.js.map
|
package/dist/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBA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AAyC;QACzC,iFAAiF,CACpF,CAAA;AACH,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '@supabase/auth-js';
|
|
2
|
-
import { SupabaseAuthClientOptions } from './types';
|
|
3
|
-
export declare class SupabaseAuthClient extends AuthClient {
|
|
4
|
-
constructor(options: SupabaseAuthClientOptions);
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=SupabaseAuthClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseAuthClient.d.ts","sourceRoot":"","sources":["../../../src/lib/SupabaseAuthClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAEnD,qBAAa,kBAAmB,SAAQ,UAAU;gBACpC,OAAO,EAAE,yBAAyB;CAG/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupabaseAuthClient.js","sourceRoot":"","sources":["../../../src/lib/SupabaseAuthClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAChD,YAAY,OAAkC;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;CACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RealtimeClientOptions } from '@supabase/realtime-js';
|
|
2
|
-
import { SupabaseAuthClientOptions } from './types';
|
|
3
|
-
export declare const DEFAULT_HEADERS: {
|
|
4
|
-
'X-Client-Info': string;
|
|
5
|
-
};
|
|
6
|
-
export declare const DEFAULT_GLOBAL_OPTIONS: {
|
|
7
|
-
headers: {
|
|
8
|
-
'X-Client-Info': string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const DEFAULT_DB_OPTIONS: {
|
|
12
|
-
schema: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const DEFAULT_AUTH_OPTIONS: SupabaseAuthClientOptions;
|
|
15
|
-
export declare const DEFAULT_REALTIME_OPTIONS: RealtimeClientOptions;
|
|
16
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAenD,eAAO,MAAM,eAAe;;CAA0D,CAAA;AAEtF,eAAO,MAAM,sBAAsB;;;;CAElC,CAAA;AAED,eAAO,MAAM,kBAAkB;;CAE9B,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,yBAKlC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,qBAA0B,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { version } from './version.js';
|
|
2
|
-
let JS_ENV = '';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
if (typeof Deno !== 'undefined') {
|
|
5
|
-
JS_ENV = 'deno';
|
|
6
|
-
}
|
|
7
|
-
else if (typeof document !== 'undefined') {
|
|
8
|
-
JS_ENV = 'web';
|
|
9
|
-
}
|
|
10
|
-
else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
|
11
|
-
JS_ENV = 'react-native';
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
JS_ENV = 'node';
|
|
15
|
-
}
|
|
16
|
-
export const DEFAULT_HEADERS = { 'X-Client-Info': `supabase-js-${JS_ENV}/${version}` };
|
|
17
|
-
export const DEFAULT_GLOBAL_OPTIONS = {
|
|
18
|
-
headers: DEFAULT_HEADERS,
|
|
19
|
-
};
|
|
20
|
-
export const DEFAULT_DB_OPTIONS = {
|
|
21
|
-
schema: 'public',
|
|
22
|
-
};
|
|
23
|
-
export const DEFAULT_AUTH_OPTIONS = {
|
|
24
|
-
autoRefreshToken: true,
|
|
25
|
-
persistSession: true,
|
|
26
|
-
detectSessionInUrl: true,
|
|
27
|
-
flowType: 'implicit',
|
|
28
|
-
};
|
|
29
|
-
export const DEFAULT_REALTIME_OPTIONS = {};
|
|
30
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,IAAI,MAAM,GAAG,EAAE,CAAA;AACf,aAAa;AACb,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;IAChC,MAAM,GAAG,MAAM,CAAA;AACjB,CAAC;KAAM,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;IAC3C,MAAM,GAAG,KAAK,CAAA;AAChB,CAAC;KAAM,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;IACnF,MAAM,GAAG,cAAc,CAAA;AACzB,CAAC;KAAM,CAAC;IACN,MAAM,GAAG,MAAM,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,eAAe,EAAE,eAAe,MAAM,IAAI,OAAO,EAAE,EAAE,CAAA;AAEtF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,OAAO,EAAE,eAAe;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;CACjB,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,kBAAkB,EAAE,IAAI;IACxB,QAAQ,EAAE,UAAU;CACrB,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAA0B,EAAE,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type Fetch = typeof fetch;
|
|
2
|
-
export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
|
|
3
|
-
export declare const resolveHeadersConstructor: () => {
|
|
4
|
-
new (init?: HeadersInit): Headers;
|
|
5
|
-
prototype: Headers;
|
|
6
|
-
};
|
|
7
|
-
export declare const fetchWithAuth: (supabaseKey: string, getAccessToken: () => Promise<string | null>, customFetch?: Fetch) => Fetch;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,OAAO,KAAK,CAAA;AAEzB,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAKlD,CAAA;AAED,eAAO,MAAM,yBAAyB;;;CAErC,CAAA;AAED,eAAO,MAAM,aAAa,GACxB,aAAa,MAAM,EACnB,gBAAgB,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAC5C,cAAc,KAAK,KAClB,KAkBF,CAAA"}
|
package/dist/module/lib/fetch.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const resolveFetch = (customFetch) => {
|
|
2
|
-
if (customFetch) {
|
|
3
|
-
return (...args) => customFetch(...args);
|
|
4
|
-
}
|
|
5
|
-
return (...args) => fetch(...args);
|
|
6
|
-
};
|
|
7
|
-
export const resolveHeadersConstructor = () => {
|
|
8
|
-
return Headers;
|
|
9
|
-
};
|
|
10
|
-
export const fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
|
|
11
|
-
const fetch = resolveFetch(customFetch);
|
|
12
|
-
const HeadersConstructor = resolveHeadersConstructor();
|
|
13
|
-
return async (input, init) => {
|
|
14
|
-
var _a;
|
|
15
|
-
const accessToken = (_a = (await getAccessToken())) !== null && _a !== void 0 ? _a : supabaseKey;
|
|
16
|
-
let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
17
|
-
if (!headers.has('apikey')) {
|
|
18
|
-
headers.set('apikey', supabaseKey);
|
|
19
|
-
}
|
|
20
|
-
if (!headers.has('Authorization')) {
|
|
21
|
-
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
22
|
-
}
|
|
23
|
-
return fetch(input, Object.assign(Object.assign({}, init), { headers }));
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,IAAuB,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,CAAC,GAAG,IAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA;AACvD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,WAAmB,EACnB,cAA4C,EAC5C,WAAmB,EACZ,EAAE;IACT,MAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAA;IACvC,MAAM,kBAAkB,GAAG,yBAAyB,EAAE,CAAA;IAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;;QAC3B,MAAM,WAAW,GAAG,MAAA,CAAC,MAAM,cAAc,EAAE,CAAC,mCAAI,WAAW,CAAA;QAC3D,IAAI,OAAO,GAAG,IAAI,kBAAkB,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,CAAA;QAEnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;QACpC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,WAAW,EAAE,CAAC,CAAA;QACvD,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,kCAAO,IAAI,KAAE,OAAO,IAAG,CAAA;IAC3C,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SupabaseClientOptions } from './types';
|
|
2
|
-
export declare function uuid(): string;
|
|
3
|
-
export declare function ensureTrailingSlash(url: string): string;
|
|
4
|
-
export declare const isBrowser: () => boolean;
|
|
5
|
-
export declare function applySettingDefaults<Database = any, SchemaName extends string & keyof Database = 'public' extends keyof Database ? 'public' : string & keyof Database>(options: SupabaseClientOptions<SchemaName>, defaults: SupabaseClientOptions<any>): Required<SupabaseClientOptions<SchemaName>>;
|
|
6
|
-
/**
|
|
7
|
-
* Validates a Supabase client URL
|
|
8
|
-
*
|
|
9
|
-
* @param {string} supabaseUrl - The Supabase client URL string.
|
|
10
|
-
* @returns {URL} - The validated base URL.
|
|
11
|
-
* @throws {Error}
|
|
12
|
-
*/
|
|
13
|
-
export declare function validateSupabaseUrl(supabaseUrl: string): URL;
|
|
14
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C,wBAAgB,IAAI,WAMnB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,eAAO,MAAM,SAAS,eAAsC,CAAA;AAE5D,wBAAgB,oBAAoB,CAClC,QAAQ,GAAG,GAAG,EACd,UAAU,SAAS,MAAM,GAAG,MAAM,QAAQ,GAAG,QAAQ,SAAS,MAAM,QAAQ,GACxE,QAAQ,GACR,MAAM,GAAG,MAAM,QAAQ,EAE3B,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC,EAC1C,QAAQ,EAAE,qBAAqB,CAAC,GAAG,CAAC,GACnC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CA+C7C;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG,CAgB5D"}
|