@supabase/supabase-js 2.118.0 → 2.119.0-canary.1
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 +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -4
- package/dist/index.mjs.map +1 -1
- package/dist/umd/supabase.js +7 -7
- package/package.json +6 -6
- package/src/SupabaseClient.ts +38 -6
- package/src/index.ts +1 -0
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/supabase-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.119.0-canary.1",
|
|
4
4
|
"description": "Isomorphic Javascript SDK for Supabase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"directory": "packages/core/supabase-js"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@supabase/auth-js": "2.
|
|
81
|
-
"@supabase/functions-js": "2.
|
|
82
|
-
"@supabase/postgrest-js": "2.
|
|
83
|
-
"@supabase/realtime-js": "2.
|
|
84
|
-
"@supabase/storage-js": "2.
|
|
80
|
+
"@supabase/auth-js": "2.119.0-canary.1",
|
|
81
|
+
"@supabase/functions-js": "2.119.0-canary.1",
|
|
82
|
+
"@supabase/postgrest-js": "2.119.0-canary.1",
|
|
83
|
+
"@supabase/realtime-js": "2.119.0-canary.1",
|
|
84
|
+
"@supabase/storage-js": "2.119.0-canary.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@opentelemetry/api": ">=1.0.0"
|
package/src/SupabaseClient.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type PostgrestFilterBuilder,
|
|
6
6
|
type PostgrestOpenApiSpec,
|
|
7
7
|
type PostgrestQueryBuilder,
|
|
8
|
+
type PostgrestQueryBuilderOptions,
|
|
8
9
|
type PostgrestSingleResponse,
|
|
9
10
|
} from '@supabase/postgrest-js'
|
|
10
11
|
import {
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
DEFAULT_REALTIME_OPTIONS,
|
|
23
24
|
DEFAULT_TRACE_PROPAGATION_OPTIONS,
|
|
24
25
|
} from './lib/constants'
|
|
25
|
-
import { checkApiKeyFormat, fetchWithAuth } from './lib/fetch'
|
|
26
|
+
import { checkApiKeyFormat, fetchWithAuth, resolveFetch } from './lib/fetch'
|
|
26
27
|
import {
|
|
27
28
|
applySettingDefaults,
|
|
28
29
|
checkTopLevelSchemaOption,
|
|
@@ -398,10 +399,20 @@ export default class SupabaseClient<
|
|
|
398
399
|
.catch((e) => console.warn('Failed to set initial Realtime auth token:', e))
|
|
399
400
|
}
|
|
400
401
|
|
|
402
|
+
// The PostgREST client applies the auth wrapper itself, so a per-request fetch
|
|
403
|
+
// passed to `from()` carries the same headers as the client-level fetch.
|
|
401
404
|
this.rest = new PostgrestClient(new URL('rest/v1', baseUrl).href, {
|
|
402
405
|
headers: this.headers,
|
|
403
406
|
schema: settings.db.schema,
|
|
404
|
-
fetch:
|
|
407
|
+
fetch: resolveFetch(settings.global.fetch),
|
|
408
|
+
wrapFetch: (fetch) =>
|
|
409
|
+
fetchWithAuth(
|
|
410
|
+
supabaseKey,
|
|
411
|
+
supabaseUrl,
|
|
412
|
+
this._getSessionToken.bind(this),
|
|
413
|
+
fetch,
|
|
414
|
+
settings.tracePropagation
|
|
415
|
+
),
|
|
405
416
|
timeout: settings.db.timeout,
|
|
406
417
|
urlLengthLimit: settings.db.urlLengthLimit,
|
|
407
418
|
retry: settings.db.retry,
|
|
@@ -433,17 +444,38 @@ export default class SupabaseClient<
|
|
|
433
444
|
from<
|
|
434
445
|
TableName extends string & keyof Schema['Tables'],
|
|
435
446
|
Table extends Schema['Tables'][TableName],
|
|
436
|
-
>(
|
|
447
|
+
>(
|
|
448
|
+
relation: TableName,
|
|
449
|
+
options?: PostgrestQueryBuilderOptions
|
|
450
|
+
): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>
|
|
437
451
|
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(
|
|
438
|
-
relation: ViewName
|
|
452
|
+
relation: ViewName,
|
|
453
|
+
options?: PostgrestQueryBuilderOptions
|
|
439
454
|
): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>
|
|
440
455
|
/**
|
|
441
456
|
* Perform a query on a table or a view.
|
|
442
457
|
*
|
|
458
|
+
* A per-request `fetch` is wrapped the same way as the client-level fetch: the
|
|
459
|
+
* `apikey`, `Authorization` and trace headers are added before it is called.
|
|
460
|
+
* The same applies to clients returned by `.schema()`.
|
|
461
|
+
*
|
|
443
462
|
* @param relation - The table or view name to query
|
|
463
|
+
* @param options - Per-request options that override client-level defaults
|
|
464
|
+
*
|
|
465
|
+
* @example Per-request fetch options
|
|
466
|
+
* ```ts
|
|
467
|
+
* const { data } = await supabase
|
|
468
|
+
* .from('countries', {
|
|
469
|
+
* fetch: (input, init) => fetch(input, { ...init, cache: 'force-cache' }),
|
|
470
|
+
* })
|
|
471
|
+
* .select('*')
|
|
472
|
+
* ```
|
|
444
473
|
*/
|
|
445
|
-
from(
|
|
446
|
-
|
|
474
|
+
from(
|
|
475
|
+
relation: string,
|
|
476
|
+
options?: PostgrestQueryBuilderOptions
|
|
477
|
+
): PostgrestQueryBuilder<ClientOptions, Schema, any> {
|
|
478
|
+
return this.rest.from(relation, options)
|
|
447
479
|
}
|
|
448
480
|
|
|
449
481
|
// NOTE: signatures must be kept in sync with PostgrestClient.schema
|
package/src/index.ts
CHANGED
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.
|
|
7
|
+
export const version = '2.119.0-canary.1'
|