@supabase/supabase-js
Advanced tools
Comparing version 2.39.6 to 2.39.7
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.39.6"; | ||
export declare const version = "2.39.7"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.39.6'; | ||
exports.version = '2.39.7'; | ||
//# sourceMappingURL=version.js.map |
import { FunctionsClient } from '@supabase/functions-js'; | ||
import { PostgrestClient } from '@supabase/postgrest-js'; | ||
import { PostgrestClient, PostgrestFilterBuilder, PostgrestQueryBuilder } from '@supabase/postgrest-js'; | ||
import { RealtimeChannel, RealtimeChannelOptions, RealtimeClient } from '@supabase/realtime-js'; | ||
@@ -50,17 +50,13 @@ import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'; | ||
get storage(): SupabaseStorageClient; | ||
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<Schema, Table, TableName>; | ||
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<Schema, View, ViewName>; | ||
from(relation: string): PostgrestQueryBuilder<Schema, any, any>; | ||
/** | ||
* Perform a query on a table or a view. | ||
* Select a schema to query or perform an function (rpc) call. | ||
* | ||
* @param relation - The table or view name to query | ||
*/ | ||
from: PostgrestClient<Database, SchemaName>['from']; | ||
/** | ||
* Perform a query on a schema distinct from the default schema supplied via | ||
* the `options.db.schema` constructor parameter. | ||
* | ||
* The schema needs to be on the list of exposed schemas inside Supabase. | ||
* | ||
* @param schema - The name of the schema to query | ||
* @param schema - The schema to query | ||
*/ | ||
schema: PostgrestClient<Database, SchemaName>['schema']; | ||
schema<DynamicSchema extends string & keyof Database>(schema: DynamicSchema): PostgrestClient<Database, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>; | ||
/** | ||
@@ -87,3 +83,6 @@ * Perform a function call. | ||
*/ | ||
rpc: PostgrestClient<Database, SchemaName>['rpc']; | ||
rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>(fn: FnName, args?: Fn['Args'], options?: { | ||
head?: boolean; | ||
count?: 'exact' | 'planned' | 'estimated'; | ||
}): PostgrestFilterBuilder<Schema, Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : never, Fn['Returns']>; | ||
/** | ||
@@ -90,0 +89,0 @@ * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. |
@@ -42,45 +42,2 @@ "use strict"; | ||
this.supabaseKey = supabaseKey; | ||
/** | ||
* Perform a query on a table or a view. | ||
* | ||
* @param relation - The table or view name to query | ||
*/ | ||
this.from = (relation) => { | ||
return this.rest.from(relation); | ||
}; | ||
/** | ||
* Perform a query on a schema distinct from the default schema supplied via | ||
* the `options.db.schema` constructor parameter. | ||
* | ||
* The schema needs to be on the list of exposed schemas inside Supabase. | ||
* | ||
* @param schema - The name of the schema to query | ||
*/ | ||
this.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.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. | ||
*/ | ||
this.rpc = (fn, args = {}, options) => { | ||
return this.rest.rpc(fn, args, options); | ||
}; | ||
if (!supabaseUrl) | ||
@@ -132,2 +89,46 @@ throw new Error('supabaseUrl is required.'); | ||
/** | ||
* 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); | ||
} | ||
// 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) { | ||
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.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 = {}) { | ||
return this.rest.rpc(fn, args, options); | ||
} | ||
/** | ||
* Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. | ||
@@ -134,0 +135,0 @@ * |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.39.6"; | ||
export declare const version = "2.39.7"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '2.39.6'; | ||
export const version = '2.39.7'; | ||
//# sourceMappingURL=version.js.map |
import { FunctionsClient } from '@supabase/functions-js'; | ||
import { PostgrestClient } from '@supabase/postgrest-js'; | ||
import { PostgrestClient, PostgrestFilterBuilder, PostgrestQueryBuilder } from '@supabase/postgrest-js'; | ||
import { RealtimeChannel, RealtimeChannelOptions, RealtimeClient } from '@supabase/realtime-js'; | ||
@@ -50,17 +50,13 @@ import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'; | ||
get storage(): SupabaseStorageClient; | ||
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<Schema, Table, TableName>; | ||
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<Schema, View, ViewName>; | ||
from(relation: string): PostgrestQueryBuilder<Schema, any, any>; | ||
/** | ||
* Perform a query on a table or a view. | ||
* Select a schema to query or perform an function (rpc) call. | ||
* | ||
* @param relation - The table or view name to query | ||
*/ | ||
from: PostgrestClient<Database, SchemaName>['from']; | ||
/** | ||
* Perform a query on a schema distinct from the default schema supplied via | ||
* the `options.db.schema` constructor parameter. | ||
* | ||
* The schema needs to be on the list of exposed schemas inside Supabase. | ||
* | ||
* @param schema - The name of the schema to query | ||
* @param schema - The schema to query | ||
*/ | ||
schema: PostgrestClient<Database, SchemaName>['schema']; | ||
schema<DynamicSchema extends string & keyof Database>(schema: DynamicSchema): PostgrestClient<Database, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>; | ||
/** | ||
@@ -87,3 +83,6 @@ * Perform a function call. | ||
*/ | ||
rpc: PostgrestClient<Database, SchemaName>['rpc']; | ||
rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>(fn: FnName, args?: Fn['Args'], options?: { | ||
head?: boolean; | ||
count?: 'exact' | 'planned' | 'estimated'; | ||
}): PostgrestFilterBuilder<Schema, Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : never, Fn['Returns']>; | ||
/** | ||
@@ -90,0 +89,0 @@ * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. |
@@ -11,3 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { FunctionsClient } from '@supabase/functions-js'; | ||
import { PostgrestClient } from '@supabase/postgrest-js'; | ||
import { PostgrestClient, } from '@supabase/postgrest-js'; | ||
import { RealtimeClient, } from '@supabase/realtime-js'; | ||
@@ -41,45 +41,2 @@ import { StorageClient as SupabaseStorageClient } from '@supabase/storage-js'; | ||
this.supabaseKey = supabaseKey; | ||
/** | ||
* Perform a query on a table or a view. | ||
* | ||
* @param relation - The table or view name to query | ||
*/ | ||
this.from = (relation) => { | ||
return this.rest.from(relation); | ||
}; | ||
/** | ||
* Perform a query on a schema distinct from the default schema supplied via | ||
* the `options.db.schema` constructor parameter. | ||
* | ||
* The schema needs to be on the list of exposed schemas inside Supabase. | ||
* | ||
* @param schema - The name of the schema to query | ||
*/ | ||
this.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.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. | ||
*/ | ||
this.rpc = (fn, args = {}, options) => { | ||
return this.rest.rpc(fn, args, options); | ||
}; | ||
if (!supabaseUrl) | ||
@@ -131,2 +88,46 @@ throw new Error('supabaseUrl is required.'); | ||
/** | ||
* 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); | ||
} | ||
// 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) { | ||
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.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 = {}) { | ||
return this.rest.rpc(fn, args, options); | ||
} | ||
/** | ||
* Creates a Realtime channel with Broadcast, Presence, and Postgres Changes. | ||
@@ -133,0 +134,0 @@ * |
{ | ||
"name": "@supabase/supabase-js", | ||
"version": "2.39.6", | ||
"version": "2.39.7", | ||
"description": "Isomorphic Javascript client for Supabase", | ||
@@ -31,3 +31,4 @@ "keywords": [ | ||
"types-generate": "dts-gen -m '@supabase/supabase-js' -s", | ||
"test": "jest --runInBand", | ||
"test": "run-s test:types test:run", | ||
"test:run": "jest --runInBand", | ||
"test:coverage": "jest --runInBand --coverage", | ||
@@ -37,2 +38,3 @@ "test:db": "cd infra/db && docker-compose down && docker-compose up -d && sleep 5", | ||
"test:clean": "cd infra/db && docker-compose down", | ||
"test:types": "run-s build:module && tsd --files test/*.test-d.ts", | ||
"docs": "typedoc --entryPoints src/index.ts --out docs/v2 --includes src/**/*.ts", | ||
@@ -63,2 +65,3 @@ "docs:json": "typedoc --entryPoints src/index.ts --includes src/**/*.ts --json docs/v2/spec.json --excludeExternals", | ||
"ts-node": "^10.9.1", | ||
"tsd": "^0.30.4", | ||
"typedoc": "^0.22.16", | ||
@@ -65,0 +68,0 @@ "typescript": "^4.5.5", |
@@ -1,1 +0,1 @@ | ||
export const version = '2.39.6' | ||
export const version = '2.39.7' |
import { FunctionsClient } from '@supabase/functions-js' | ||
import { AuthChangeEvent } from '@supabase/gotrue-js' | ||
import { PostgrestClient } from '@supabase/postgrest-js' | ||
import { | ||
PostgrestClient, | ||
PostgrestFilterBuilder, | ||
PostgrestQueryBuilder, | ||
} from '@supabase/postgrest-js' | ||
import { | ||
RealtimeChannel, | ||
@@ -128,2 +132,11 @@ RealtimeChannelOptions, | ||
// 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<Schema, Table, TableName> | ||
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>( | ||
relation: ViewName | ||
): PostgrestQueryBuilder<Schema, View, ViewName> | ||
from(relation: string): PostgrestQueryBuilder<Schema, any, any> | ||
/** | ||
@@ -134,22 +147,25 @@ * Perform a query on a table or a view. | ||
*/ | ||
from: PostgrestClient<Database, SchemaName>['from'] = (relation: string) => { | ||
from(relation: string): PostgrestQueryBuilder<Schema, any, any> { | ||
return this.rest.from(relation) | ||
} | ||
// NOTE: signatures must be kept in sync with PostgrestClient.schema | ||
/** | ||
* Perform a query on a schema distinct from the default schema supplied via | ||
* the `options.db.schema` constructor parameter. | ||
* 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 name of the schema to query | ||
* @param schema - The schema to query | ||
*/ | ||
schema: PostgrestClient<Database, SchemaName>['schema'] = < | ||
DynamicSchema extends string & keyof Database | ||
>( | ||
schema<DynamicSchema extends string & keyof Database>( | ||
schema: DynamicSchema | ||
) => { | ||
): PostgrestClient< | ||
Database, | ||
DynamicSchema, | ||
Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any | ||
> { | ||
return this.rest.schema<DynamicSchema>(schema) | ||
} | ||
// NOTE: signatures must be kept in sync with PostgrestClient.rpc | ||
/** | ||
@@ -176,13 +192,18 @@ * Perform a function call. | ||
*/ | ||
rpc: PostgrestClient<Database, SchemaName>['rpc'] = < | ||
FunctionName extends string & keyof Schema['Functions'], | ||
Function_ extends Schema['Functions'][FunctionName] | ||
>( | ||
fn: FunctionName, | ||
args: Function_['Args'] = {}, | ||
options?: { | ||
rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>( | ||
fn: FnName, | ||
args: Fn['Args'] = {}, | ||
options: { | ||
head?: boolean | ||
count?: 'exact' | 'planned' | 'estimated' | ||
} | ||
) => { | ||
} = {} | ||
): PostgrestFilterBuilder< | ||
Schema, | ||
Fn['Returns'] extends any[] | ||
? Fn['Returns'][number] extends Record<string, unknown> | ||
? Fn['Returns'][number] | ||
: never | ||
: never, | ||
Fn['Returns'] | ||
> { | ||
return this.rest.rpc(fn, args, options) | ||
@@ -189,0 +210,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
218887
1770
17