@supacloud/js 0.47.1 → 0.48.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 +20 -7
- package/dist/index.d.cts +36 -8
- package/dist/index.d.mts +36 -8
- package/dist/index.mjs +20 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4916,6 +4916,12 @@ function openSupabaseChannel(supabase, topic, config) {
|
|
|
4916
4916
|
}
|
|
4917
4917
|
});
|
|
4918
4918
|
}
|
|
4919
|
+
function createApplicationSurface(apiClient) {
|
|
4920
|
+
return {
|
|
4921
|
+
procedures: createProcedureClient(apiClient),
|
|
4922
|
+
queryAdapter: (options) => createQueryAdapter(apiClient, options)
|
|
4923
|
+
};
|
|
4924
|
+
}
|
|
4919
4925
|
function createSupaCloudClient(options) {
|
|
4920
4926
|
const normalized = {
|
|
4921
4927
|
...options,
|
|
@@ -4937,6 +4943,7 @@ function createSupaCloudClient(options) {
|
|
|
4937
4943
|
});
|
|
4938
4944
|
const instance = {
|
|
4939
4945
|
supabase: options.supabase,
|
|
4946
|
+
compat: { supabase: options.supabase },
|
|
4940
4947
|
projectRef: normalized.projectRef,
|
|
4941
4948
|
managementApiUrl: normalized.managementApiUrl,
|
|
4942
4949
|
auth: {
|
|
@@ -4956,21 +4963,27 @@ function createSupaCloudClient(options) {
|
|
|
4956
4963
|
}
|
|
4957
4964
|
};
|
|
4958
4965
|
const withClient = (apiClient) => {
|
|
4966
|
+
const app = createApplicationSurface(apiClient);
|
|
4959
4967
|
return {
|
|
4960
4968
|
...instance,
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4969
|
+
app,
|
|
4970
|
+
procedures: app.procedures,
|
|
4971
|
+
queryAdapter: app.queryAdapter,
|
|
4972
|
+
withClient,
|
|
4973
|
+
withApp: withClient
|
|
4964
4974
|
};
|
|
4965
4975
|
};
|
|
4976
|
+
const app = options.apiClient === undefined ? undefined : createApplicationSurface(options.apiClient);
|
|
4966
4977
|
return {
|
|
4967
4978
|
...instance,
|
|
4968
|
-
|
|
4979
|
+
app,
|
|
4980
|
+
procedures: app === undefined ? undefined : app.procedures,
|
|
4969
4981
|
queryAdapter: (adapterOptions) => {
|
|
4970
|
-
if (
|
|
4982
|
+
if (app === undefined)
|
|
4971
4983
|
throw new Error("No procedure client attached");
|
|
4972
|
-
return
|
|
4984
|
+
return app.queryAdapter(adapterOptions);
|
|
4973
4985
|
},
|
|
4974
|
-
withClient
|
|
4986
|
+
withClient,
|
|
4987
|
+
withApp: withClient
|
|
4975
4988
|
};
|
|
4976
4989
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -7,8 +7,8 @@ import { type FetchTransport } from "./bounded-rpc-fetch.cjs";
|
|
|
7
7
|
import { SupaCloudOAuthClientsClient } from "./oauth-clients.cjs";
|
|
8
8
|
import { SupaCloudOAuthServerClient } from "./oauth-server.cjs";
|
|
9
9
|
import { type RealtimeChannelConfig, type RealtimeTransport, type SupaCloudRealtimeChannel, type SupaCloudRealtimeAdapter } from "./realtime.cjs";
|
|
10
|
-
import { createQueryAdapter, type ProcedureSource, type ProceduresOf, type QueryAdapterOptions } from "@supacloud/query";
|
|
11
|
-
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
10
|
+
import { createQueryAdapter, type ProcedureSource, type ProceduresOf, type QueryAdapter, type QueryAdapterOptions } from "@supacloud/query";
|
|
11
|
+
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type ProcedureSource, type ProceduresOf, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
12
12
|
import { type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult } from "./queue-rpc.cjs";
|
|
13
13
|
export { SupaCloudApiError } from "./api-error.cjs";
|
|
14
14
|
export { SupaCloudQueueError, type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult, } from "./queue-rpc.cjs";
|
|
@@ -231,6 +231,21 @@ export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClie
|
|
|
231
231
|
pollingIntervalMs?: number;
|
|
232
232
|
realtimeTransport?: RealtimeTransport | null;
|
|
233
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Compatibility-lane access remains owned by the caller's Supabase client.
|
|
236
|
+
* This facade never creates a second session store or protocol client.
|
|
237
|
+
*/
|
|
238
|
+
export type SupaCloudCompatibilitySurface<TClient extends SupabaseClient = SupabaseClient> = {
|
|
239
|
+
readonly supabase: TClient;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Application-lane access is compiler-generated and intentionally separate
|
|
243
|
+
* from compatibility CRUD so domain writes have an explicit API boundary.
|
|
244
|
+
*/
|
|
245
|
+
export type SupaCloudApplicationSurface<TApiClient extends ProcedureSource> = {
|
|
246
|
+
readonly procedures: ProceduresOf<TApiClient>;
|
|
247
|
+
readonly queryAdapter: (options: QueryAdapterOptions) => QueryAdapter<TApiClient>;
|
|
248
|
+
};
|
|
234
249
|
export declare class SupaCloudTaskSubmitError extends Error {
|
|
235
250
|
readonly code = "TASK_SUBMIT_UNCONFIRMED";
|
|
236
251
|
readonly mutationMayHaveApplied = true;
|
|
@@ -356,6 +371,7 @@ declare class SupaCloudQueuesClient<TClient extends SupabaseClient = SupabaseCli
|
|
|
356
371
|
}
|
|
357
372
|
type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
358
373
|
readonly supabase: TClient;
|
|
374
|
+
readonly compat: SupaCloudCompatibilitySurface<TClient>;
|
|
359
375
|
readonly projectRef: string;
|
|
360
376
|
readonly managementApiUrl: string;
|
|
361
377
|
readonly auth: {
|
|
@@ -374,11 +390,23 @@ type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
|
374
390
|
invokeBackground(functionName: string, submitOptions?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<unknown>>;
|
|
375
391
|
};
|
|
376
392
|
};
|
|
377
|
-
type
|
|
378
|
-
readonly procedures:
|
|
393
|
+
type SupaCloudClientWithApplication<TClient extends SupabaseClient, TApiClient extends ProcedureSource> = SupaCloudClientBase<TClient> & {
|
|
394
|
+
readonly procedures: ProceduresOf<TApiClient>;
|
|
395
|
+
readonly app: SupaCloudApplicationSurface<TApiClient>;
|
|
396
|
+
queryAdapter(options: QueryAdapterOptions): QueryAdapter<TApiClient>;
|
|
397
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
398
|
+
withApp<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
399
|
+
};
|
|
400
|
+
type SupaCloudClientUnbound<TClient extends SupabaseClient> = SupaCloudClientBase<TClient> & {
|
|
401
|
+
readonly procedures: undefined;
|
|
402
|
+
readonly app: undefined;
|
|
379
403
|
queryAdapter(options: QueryAdapterOptions): ReturnType<typeof createQueryAdapter>;
|
|
380
|
-
withClient<T extends ProcedureSource>(apiClient: T):
|
|
404
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
405
|
+
withApp<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
381
406
|
};
|
|
382
|
-
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource
|
|
383
|
-
apiClient
|
|
384
|
-
}):
|
|
407
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource = ProcedureSource>(options: SupaCloudClientOptions<TClient> & {
|
|
408
|
+
apiClient: TApiClient;
|
|
409
|
+
}): SupaCloudClientWithApplication<TClient, TApiClient>;
|
|
410
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient>(options: SupaCloudClientOptions<TClient> & {
|
|
411
|
+
apiClient?: undefined;
|
|
412
|
+
}): SupaCloudClientUnbound<TClient>;
|
package/dist/index.d.mts
CHANGED
|
@@ -7,8 +7,8 @@ import { type FetchTransport } from "./bounded-rpc-fetch.mjs";
|
|
|
7
7
|
import { SupaCloudOAuthClientsClient } from "./oauth-clients.mjs";
|
|
8
8
|
import { SupaCloudOAuthServerClient } from "./oauth-server.mjs";
|
|
9
9
|
import { type RealtimeChannelConfig, type RealtimeTransport, type SupaCloudRealtimeChannel, type SupaCloudRealtimeAdapter } from "./realtime.mjs";
|
|
10
|
-
import { createQueryAdapter, type ProcedureSource, type ProceduresOf, type QueryAdapterOptions } from "@supacloud/query";
|
|
11
|
-
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
10
|
+
import { createQueryAdapter, type ProcedureSource, type ProceduresOf, type QueryAdapter, type QueryAdapterOptions } from "@supacloud/query";
|
|
11
|
+
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type ProcedureSource, type ProceduresOf, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
12
12
|
import { type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult } from "./queue-rpc.mjs";
|
|
13
13
|
export { SupaCloudApiError } from "./api-error.mjs";
|
|
14
14
|
export { SupaCloudQueueError, type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult, } from "./queue-rpc.mjs";
|
|
@@ -231,6 +231,21 @@ export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClie
|
|
|
231
231
|
pollingIntervalMs?: number;
|
|
232
232
|
realtimeTransport?: RealtimeTransport | null;
|
|
233
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Compatibility-lane access remains owned by the caller's Supabase client.
|
|
236
|
+
* This facade never creates a second session store or protocol client.
|
|
237
|
+
*/
|
|
238
|
+
export type SupaCloudCompatibilitySurface<TClient extends SupabaseClient = SupabaseClient> = {
|
|
239
|
+
readonly supabase: TClient;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Application-lane access is compiler-generated and intentionally separate
|
|
243
|
+
* from compatibility CRUD so domain writes have an explicit API boundary.
|
|
244
|
+
*/
|
|
245
|
+
export type SupaCloudApplicationSurface<TApiClient extends ProcedureSource> = {
|
|
246
|
+
readonly procedures: ProceduresOf<TApiClient>;
|
|
247
|
+
readonly queryAdapter: (options: QueryAdapterOptions) => QueryAdapter<TApiClient>;
|
|
248
|
+
};
|
|
234
249
|
export declare class SupaCloudTaskSubmitError extends Error {
|
|
235
250
|
readonly code = "TASK_SUBMIT_UNCONFIRMED";
|
|
236
251
|
readonly mutationMayHaveApplied = true;
|
|
@@ -356,6 +371,7 @@ declare class SupaCloudQueuesClient<TClient extends SupabaseClient = SupabaseCli
|
|
|
356
371
|
}
|
|
357
372
|
type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
358
373
|
readonly supabase: TClient;
|
|
374
|
+
readonly compat: SupaCloudCompatibilitySurface<TClient>;
|
|
359
375
|
readonly projectRef: string;
|
|
360
376
|
readonly managementApiUrl: string;
|
|
361
377
|
readonly auth: {
|
|
@@ -374,11 +390,23 @@ type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
|
374
390
|
invokeBackground(functionName: string, submitOptions?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<unknown>>;
|
|
375
391
|
};
|
|
376
392
|
};
|
|
377
|
-
type
|
|
378
|
-
readonly procedures:
|
|
393
|
+
type SupaCloudClientWithApplication<TClient extends SupabaseClient, TApiClient extends ProcedureSource> = SupaCloudClientBase<TClient> & {
|
|
394
|
+
readonly procedures: ProceduresOf<TApiClient>;
|
|
395
|
+
readonly app: SupaCloudApplicationSurface<TApiClient>;
|
|
396
|
+
queryAdapter(options: QueryAdapterOptions): QueryAdapter<TApiClient>;
|
|
397
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
398
|
+
withApp<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
399
|
+
};
|
|
400
|
+
type SupaCloudClientUnbound<TClient extends SupabaseClient> = SupaCloudClientBase<TClient> & {
|
|
401
|
+
readonly procedures: undefined;
|
|
402
|
+
readonly app: undefined;
|
|
379
403
|
queryAdapter(options: QueryAdapterOptions): ReturnType<typeof createQueryAdapter>;
|
|
380
|
-
withClient<T extends ProcedureSource>(apiClient: T):
|
|
404
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
405
|
+
withApp<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithApplication<TClient, T>;
|
|
381
406
|
};
|
|
382
|
-
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource
|
|
383
|
-
apiClient
|
|
384
|
-
}):
|
|
407
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource = ProcedureSource>(options: SupaCloudClientOptions<TClient> & {
|
|
408
|
+
apiClient: TApiClient;
|
|
409
|
+
}): SupaCloudClientWithApplication<TClient, TApiClient>;
|
|
410
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient>(options: SupaCloudClientOptions<TClient> & {
|
|
411
|
+
apiClient?: undefined;
|
|
412
|
+
}): SupaCloudClientUnbound<TClient>;
|
package/dist/index.mjs
CHANGED
|
@@ -4820,6 +4820,12 @@ function openSupabaseChannel(supabase, topic, config) {
|
|
|
4820
4820
|
}
|
|
4821
4821
|
});
|
|
4822
4822
|
}
|
|
4823
|
+
function createApplicationSurface(apiClient) {
|
|
4824
|
+
return {
|
|
4825
|
+
procedures: createProcedureClient(apiClient),
|
|
4826
|
+
queryAdapter: (options) => createQueryAdapter(apiClient, options)
|
|
4827
|
+
};
|
|
4828
|
+
}
|
|
4823
4829
|
function createSupaCloudClient(options) {
|
|
4824
4830
|
const normalized = {
|
|
4825
4831
|
...options,
|
|
@@ -4841,6 +4847,7 @@ function createSupaCloudClient(options) {
|
|
|
4841
4847
|
});
|
|
4842
4848
|
const instance = {
|
|
4843
4849
|
supabase: options.supabase,
|
|
4850
|
+
compat: { supabase: options.supabase },
|
|
4844
4851
|
projectRef: normalized.projectRef,
|
|
4845
4852
|
managementApiUrl: normalized.managementApiUrl,
|
|
4846
4853
|
auth: {
|
|
@@ -4860,22 +4867,28 @@ function createSupaCloudClient(options) {
|
|
|
4860
4867
|
}
|
|
4861
4868
|
};
|
|
4862
4869
|
const withClient = (apiClient) => {
|
|
4870
|
+
const app = createApplicationSurface(apiClient);
|
|
4863
4871
|
return {
|
|
4864
4872
|
...instance,
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4873
|
+
app,
|
|
4874
|
+
procedures: app.procedures,
|
|
4875
|
+
queryAdapter: app.queryAdapter,
|
|
4876
|
+
withClient,
|
|
4877
|
+
withApp: withClient
|
|
4868
4878
|
};
|
|
4869
4879
|
};
|
|
4880
|
+
const app = options.apiClient === undefined ? undefined : createApplicationSurface(options.apiClient);
|
|
4870
4881
|
return {
|
|
4871
4882
|
...instance,
|
|
4872
|
-
|
|
4883
|
+
app,
|
|
4884
|
+
procedures: app === undefined ? undefined : app.procedures,
|
|
4873
4885
|
queryAdapter: (adapterOptions) => {
|
|
4874
|
-
if (
|
|
4886
|
+
if (app === undefined)
|
|
4875
4887
|
throw new Error("No procedure client attached");
|
|
4876
|
-
return
|
|
4888
|
+
return app.queryAdapter(adapterOptions);
|
|
4877
4889
|
},
|
|
4878
|
-
withClient
|
|
4890
|
+
withClient,
|
|
4891
|
+
withApp: withClient
|
|
4879
4892
|
};
|
|
4880
4893
|
}
|
|
4881
4894
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.1",
|
|
4
4
|
"description": "Platform SDK for SupaCloud, built on top of supabase-js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
"@types/bun": "^1.4.4",
|
|
125
125
|
"@supabase/supabase-js": "^2.118.0",
|
|
126
126
|
"typescript": "7.1.0-beta",
|
|
127
|
-
"@tanstack/query-core": "5.105.
|
|
128
|
-
"@tanstack/svelte-query": "6.3.
|
|
127
|
+
"@tanstack/query-core": "5.105.3",
|
|
128
|
+
"@tanstack/svelte-query": "6.3.9",
|
|
129
129
|
"typebox": "1.4.3",
|
|
130
130
|
"svelte": "5.57.3"
|
|
131
131
|
},
|