@supacloud/js 0.45.5 → 0.47.0
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/REALTIME.md +84 -0
- package/dist/index.cjs +417 -10
- package/dist/index.d.cts +29 -41
- package/dist/index.d.mts +29 -41
- package/dist/index.mjs +417 -10
- package/dist/realtime.cjs +431 -0
- package/dist/realtime.d.cts +171 -0
- package/dist/realtime.d.mts +171 -0
- package/dist/realtime.mjs +391 -0
- package/package.json +19 -8
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,8 @@ import { SupaCloudApiError } from "./api-error.cjs";
|
|
|
6
6
|
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
|
-
import { type
|
|
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";
|
|
10
11
|
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
11
12
|
import { type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult } from "./queue-rpc.cjs";
|
|
12
13
|
export { SupaCloudApiError } from "./api-error.cjs";
|
|
@@ -23,6 +24,7 @@ export { createSupaCloudApiFetch, type SupaCloudApiFetchOptions, } from "./api-f
|
|
|
23
24
|
export { createSupaCloudProcedureClient, SupaCloudProcedureError, isSupaCloudProcedureError, isSupaCloudProcedureErrorCode, isSupaCloudProcedureHttpError, isSupaCloudProcedureTransportError, type SupaCloudGeneratedClientConfig, type SupaCloudGeneratedClientFactory, type SupaCloudGeneratedClientOptions, type SupaCloudProcedureClient, type SupaCloudProcedureClientOptions, type SupaCloudProcedureErrorCode, type SupaCloudProcedureErrorOptions, } from "./procedure-client.cjs";
|
|
24
25
|
export * from "./commands.cjs";
|
|
25
26
|
export * from "./artifacts.cjs";
|
|
27
|
+
export * from "./realtime.cjs";
|
|
26
28
|
export type SupaCloudTaskStatus = "pending" | "leased" | "running" | "retry_scheduled" | "succeeded" | "failed" | "dead_lettered" | "cancelled" | "queued" | "processing" | "completed";
|
|
27
29
|
export type SupaCloudTaskLogEntry = {
|
|
28
30
|
timestamp: string;
|
|
@@ -226,6 +228,7 @@ export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClie
|
|
|
226
228
|
projectRef: string;
|
|
227
229
|
getAccessToken?: () => Promise<string | null> | string | null;
|
|
228
230
|
pollingIntervalMs?: number;
|
|
231
|
+
realtimeTransport?: RealtimeTransport | null;
|
|
229
232
|
};
|
|
230
233
|
export declare class SupaCloudTaskSubmitError extends Error {
|
|
231
234
|
readonly code = "TASK_SUBMIT_UNCONFIRMED";
|
|
@@ -350,46 +353,31 @@ declare class SupaCloudQueuesClient<TClient extends SupabaseClient = SupabaseCli
|
|
|
350
353
|
create(queueName: string, options?: SupaCloudQueueCreateOptions): Promise<SupaCloudQueueInfo>;
|
|
351
354
|
drop(queueName: string): Promise<void>;
|
|
352
355
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
oauthServer: SupaCloudOAuthServerClient;
|
|
361
|
-
oauthClients: SupaCloudOAuthClientsClient;
|
|
356
|
+
type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
357
|
+
readonly supabase: TClient;
|
|
358
|
+
readonly projectRef: string;
|
|
359
|
+
readonly managementApiUrl: string;
|
|
360
|
+
readonly auth: {
|
|
361
|
+
readonly oauthServer: SupaCloudOAuthServerClient;
|
|
362
|
+
readonly oauthClients: SupaCloudOAuthClientsClient;
|
|
362
363
|
};
|
|
363
|
-
tasks: SupaCloudTasksClient<TClient>;
|
|
364
|
-
workflows: SupaCloudWorkflowsClient<TClient>;
|
|
365
|
-
commands: SupaCloudCommandsClient<TClient>;
|
|
366
|
-
artifacts: SupaCloudArtifactsClient<TClient>;
|
|
367
|
-
queues: SupaCloudQueuesClient<TClient>;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
queryAdapter: (adapterOptions: QueryAdapterOptions) => import("@supacloud/query").QueryAdapter<TApiClient & {}>;
|
|
374
|
-
withClient: <T extends ProcedureSource>(apiClient: T) => {
|
|
375
|
-
supabase: TClient;
|
|
376
|
-
projectRef: string;
|
|
377
|
-
managementApiUrl: string;
|
|
378
|
-
auth: {
|
|
379
|
-
oauthServer: SupaCloudOAuthServerClient;
|
|
380
|
-
oauthClients: SupaCloudOAuthClientsClient;
|
|
381
|
-
};
|
|
382
|
-
tasks: SupaCloudTasksClient<TClient>;
|
|
383
|
-
workflows: SupaCloudWorkflowsClient<TClient>;
|
|
384
|
-
commands: SupaCloudCommandsClient<TClient>;
|
|
385
|
-
artifacts: SupaCloudArtifactsClient<TClient>;
|
|
386
|
-
queues: SupaCloudQueuesClient<TClient>;
|
|
387
|
-
queue: (name: string) => SupaCloudQueueClient<TClient>;
|
|
388
|
-
functions: {
|
|
389
|
-
invokeBackground: (functionName: string, submitOptions?: SupaCloudTaskSubmitOptions) => Promise<SupaCloudTaskReceipt<unknown>>;
|
|
390
|
-
};
|
|
391
|
-
procedures: ProceduresOf<T>;
|
|
392
|
-
queryAdapter: (adapterOptions: QueryAdapterOptions) => import("@supacloud/query").QueryAdapter<T>;
|
|
393
|
-
withClient: /*elided*/ any;
|
|
364
|
+
readonly tasks: SupaCloudTasksClient<TClient>;
|
|
365
|
+
readonly workflows: SupaCloudWorkflowsClient<TClient>;
|
|
366
|
+
readonly commands: SupaCloudCommandsClient<TClient>;
|
|
367
|
+
readonly artifacts: SupaCloudArtifactsClient<TClient>;
|
|
368
|
+
readonly queues: SupaCloudQueuesClient<TClient>;
|
|
369
|
+
readonly realtime: SupaCloudRealtimeAdapter;
|
|
370
|
+
channel(topic: string, config?: RealtimeChannelConfig): SupaCloudRealtimeChannel;
|
|
371
|
+
queue(name: string): SupaCloudQueueClient<TClient>;
|
|
372
|
+
readonly functions: {
|
|
373
|
+
invokeBackground(functionName: string, submitOptions?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<unknown>>;
|
|
394
374
|
};
|
|
395
375
|
};
|
|
376
|
+
type SupaCloudClientWithProcedures<TClient extends SupabaseClient, TProcedures> = SupaCloudClientBase<TClient> & {
|
|
377
|
+
readonly procedures: TProcedures;
|
|
378
|
+
queryAdapter(options: QueryAdapterOptions): ReturnType<typeof createQueryAdapter>;
|
|
379
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithProcedures<TClient, ProceduresOf<T>>;
|
|
380
|
+
};
|
|
381
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource | undefined = undefined>(options: SupaCloudClientOptions<TClient> & {
|
|
382
|
+
apiClient?: TApiClient;
|
|
383
|
+
}): SupaCloudClientWithProcedures<TClient, TApiClient extends ProcedureSource ? ProceduresOf<TApiClient> : undefined>;
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,8 @@ import { SupaCloudApiError } from "./api-error.mjs";
|
|
|
6
6
|
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
|
-
import { type
|
|
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";
|
|
10
11
|
export { createProcedureClient, createQueryAdapter, createQueryKey, invalidateByTags, type QueryAdapter, type QueryAdapterOptions, } from "@supacloud/query";
|
|
11
12
|
import { type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueIdempotentSendResult, type SupaCloudQueueMutationResult } from "./queue-rpc.mjs";
|
|
12
13
|
export { SupaCloudApiError } from "./api-error.mjs";
|
|
@@ -23,6 +24,7 @@ export { createSupaCloudApiFetch, type SupaCloudApiFetchOptions, } from "./api-f
|
|
|
23
24
|
export { createSupaCloudProcedureClient, SupaCloudProcedureError, isSupaCloudProcedureError, isSupaCloudProcedureErrorCode, isSupaCloudProcedureHttpError, isSupaCloudProcedureTransportError, type SupaCloudGeneratedClientConfig, type SupaCloudGeneratedClientFactory, type SupaCloudGeneratedClientOptions, type SupaCloudProcedureClient, type SupaCloudProcedureClientOptions, type SupaCloudProcedureErrorCode, type SupaCloudProcedureErrorOptions, } from "./procedure-client.mjs";
|
|
24
25
|
export * from "./commands.mjs";
|
|
25
26
|
export * from "./artifacts.mjs";
|
|
27
|
+
export * from "./realtime.mjs";
|
|
26
28
|
export type SupaCloudTaskStatus = "pending" | "leased" | "running" | "retry_scheduled" | "succeeded" | "failed" | "dead_lettered" | "cancelled" | "queued" | "processing" | "completed";
|
|
27
29
|
export type SupaCloudTaskLogEntry = {
|
|
28
30
|
timestamp: string;
|
|
@@ -226,6 +228,7 @@ export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClie
|
|
|
226
228
|
projectRef: string;
|
|
227
229
|
getAccessToken?: () => Promise<string | null> | string | null;
|
|
228
230
|
pollingIntervalMs?: number;
|
|
231
|
+
realtimeTransport?: RealtimeTransport | null;
|
|
229
232
|
};
|
|
230
233
|
export declare class SupaCloudTaskSubmitError extends Error {
|
|
231
234
|
readonly code = "TASK_SUBMIT_UNCONFIRMED";
|
|
@@ -350,46 +353,31 @@ declare class SupaCloudQueuesClient<TClient extends SupabaseClient = SupabaseCli
|
|
|
350
353
|
create(queueName: string, options?: SupaCloudQueueCreateOptions): Promise<SupaCloudQueueInfo>;
|
|
351
354
|
drop(queueName: string): Promise<void>;
|
|
352
355
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
oauthServer: SupaCloudOAuthServerClient;
|
|
361
|
-
oauthClients: SupaCloudOAuthClientsClient;
|
|
356
|
+
type SupaCloudClientBase<TClient extends SupabaseClient> = {
|
|
357
|
+
readonly supabase: TClient;
|
|
358
|
+
readonly projectRef: string;
|
|
359
|
+
readonly managementApiUrl: string;
|
|
360
|
+
readonly auth: {
|
|
361
|
+
readonly oauthServer: SupaCloudOAuthServerClient;
|
|
362
|
+
readonly oauthClients: SupaCloudOAuthClientsClient;
|
|
362
363
|
};
|
|
363
|
-
tasks: SupaCloudTasksClient<TClient>;
|
|
364
|
-
workflows: SupaCloudWorkflowsClient<TClient>;
|
|
365
|
-
commands: SupaCloudCommandsClient<TClient>;
|
|
366
|
-
artifacts: SupaCloudArtifactsClient<TClient>;
|
|
367
|
-
queues: SupaCloudQueuesClient<TClient>;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
queryAdapter: (adapterOptions: QueryAdapterOptions) => import("@supacloud/query").QueryAdapter<TApiClient & {}>;
|
|
374
|
-
withClient: <T extends ProcedureSource>(apiClient: T) => {
|
|
375
|
-
supabase: TClient;
|
|
376
|
-
projectRef: string;
|
|
377
|
-
managementApiUrl: string;
|
|
378
|
-
auth: {
|
|
379
|
-
oauthServer: SupaCloudOAuthServerClient;
|
|
380
|
-
oauthClients: SupaCloudOAuthClientsClient;
|
|
381
|
-
};
|
|
382
|
-
tasks: SupaCloudTasksClient<TClient>;
|
|
383
|
-
workflows: SupaCloudWorkflowsClient<TClient>;
|
|
384
|
-
commands: SupaCloudCommandsClient<TClient>;
|
|
385
|
-
artifacts: SupaCloudArtifactsClient<TClient>;
|
|
386
|
-
queues: SupaCloudQueuesClient<TClient>;
|
|
387
|
-
queue: (name: string) => SupaCloudQueueClient<TClient>;
|
|
388
|
-
functions: {
|
|
389
|
-
invokeBackground: (functionName: string, submitOptions?: SupaCloudTaskSubmitOptions) => Promise<SupaCloudTaskReceipt<unknown>>;
|
|
390
|
-
};
|
|
391
|
-
procedures: ProceduresOf<T>;
|
|
392
|
-
queryAdapter: (adapterOptions: QueryAdapterOptions) => import("@supacloud/query").QueryAdapter<T>;
|
|
393
|
-
withClient: /*elided*/ any;
|
|
364
|
+
readonly tasks: SupaCloudTasksClient<TClient>;
|
|
365
|
+
readonly workflows: SupaCloudWorkflowsClient<TClient>;
|
|
366
|
+
readonly commands: SupaCloudCommandsClient<TClient>;
|
|
367
|
+
readonly artifacts: SupaCloudArtifactsClient<TClient>;
|
|
368
|
+
readonly queues: SupaCloudQueuesClient<TClient>;
|
|
369
|
+
readonly realtime: SupaCloudRealtimeAdapter;
|
|
370
|
+
channel(topic: string, config?: RealtimeChannelConfig): SupaCloudRealtimeChannel;
|
|
371
|
+
queue(name: string): SupaCloudQueueClient<TClient>;
|
|
372
|
+
readonly functions: {
|
|
373
|
+
invokeBackground(functionName: string, submitOptions?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<unknown>>;
|
|
394
374
|
};
|
|
395
375
|
};
|
|
376
|
+
type SupaCloudClientWithProcedures<TClient extends SupabaseClient, TProcedures> = SupaCloudClientBase<TClient> & {
|
|
377
|
+
readonly procedures: TProcedures;
|
|
378
|
+
queryAdapter(options: QueryAdapterOptions): ReturnType<typeof createQueryAdapter>;
|
|
379
|
+
withClient<T extends ProcedureSource>(apiClient: T): SupaCloudClientWithProcedures<TClient, ProceduresOf<T>>;
|
|
380
|
+
};
|
|
381
|
+
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient, TApiClient extends ProcedureSource | undefined = undefined>(options: SupaCloudClientOptions<TClient> & {
|
|
382
|
+
apiClient?: TApiClient;
|
|
383
|
+
}): SupaCloudClientWithProcedures<TClient, TApiClient extends ProcedureSource ? ProceduresOf<TApiClient> : undefined>;
|