@supacloud/js 0.25.0 → 0.30.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/README.md +387 -56
- package/dist/api-error.d.ts +6 -0
- package/dist/artifact-fetch.d.ts +6 -0
- package/dist/artifact-link.d.ts +8 -0
- package/dist/artifact-read.d.ts +13 -0
- package/dist/artifact-register.d.ts +14 -0
- package/dist/artifact-rpc.d.ts +2 -0
- package/dist/artifacts.d.ts +3 -0
- package/dist/auth-fetch.d.ts +4 -2
- package/dist/bounded-rpc-fetch.d.ts +2 -0
- package/dist/command-fetch.d.ts +6 -0
- package/dist/commands.d.ts +27 -16
- package/dist/index.d.ts +104 -225
- package/dist/index.js +3027 -456
- package/dist/oauth-clients.d.ts +95 -0
- package/dist/oauth-server.d.ts +104 -0
- package/dist/queue-rpc.d.ts +54 -0
- package/dist/workflow-advance.d.ts +8 -0
- package/dist/workflow-attempt.d.ts +4 -0
- package/dist/workflow-cancel.d.ts +14 -0
- package/dist/workflow-claim.d.ts +12 -0
- package/dist/workflow-complete.d.ts +8 -0
- package/dist/workflow-events.d.ts +14 -0
- package/dist/workflow-fail.d.ts +8 -0
- package/dist/workflow-fetch.d.ts +9 -0
- package/dist/workflow-json.d.ts +2 -0
- package/dist/workflow-retry.d.ts +8 -0
- package/dist/workflow-rpc.d.ts +6 -0
- package/dist/workflow-run.d.ts +8 -0
- package/dist/workflow-start.d.ts +8 -0
- package/dist/workflow-timestamp.d.ts +1 -0
- package/dist/workflows.d.ts +9 -0
- package/package.json +6 -3
package/dist/commands.d.ts
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
1
|
+
import { type CommandLookup, type CommandStatus } from "@supacloud/contracts";
|
|
2
|
+
import { SupaCloudApiError } from "./api-error.js";
|
|
3
|
+
export declare class SupaCloudCommandReadError extends SupaCloudApiError {
|
|
4
|
+
readonly mutationMayHaveApplied = false;
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare class SupaCloudCommandSubmitError extends SupaCloudApiError {
|
|
8
|
+
readonly mutationMayHaveApplied: boolean;
|
|
9
|
+
constructor(mutationMayHaveApplied?: boolean);
|
|
10
|
+
}
|
|
11
|
+
/** Narrow, validated boundary compatible with the Supabase RPC client. */
|
|
12
|
+
export interface CommandRpcClient {
|
|
13
|
+
rpc(functionName: string, args: {
|
|
14
|
+
request: object;
|
|
15
|
+
}): PromiseLike<{
|
|
16
|
+
data: unknown;
|
|
17
|
+
error: unknown;
|
|
18
|
+
status?: number;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
3
21
|
export interface SupaCloudCommandSubmitRequest {
|
|
4
22
|
commandId: string;
|
|
5
23
|
commandType: string;
|
|
6
24
|
targetType: string;
|
|
7
25
|
targetId: string;
|
|
8
26
|
actorId?: string;
|
|
9
|
-
|
|
27
|
+
/** Required, together with actorId, when binding a submission to a durable executor. */
|
|
28
|
+
tenantId?: string;
|
|
29
|
+
payload?: Record<string, unknown>;
|
|
10
30
|
maxAttempts?: number;
|
|
11
31
|
}
|
|
12
|
-
export
|
|
13
|
-
commandId: string;
|
|
14
|
-
commandType: string;
|
|
15
|
-
targetType: string;
|
|
16
|
-
targetId: string;
|
|
17
|
-
actorId: string | null;
|
|
18
|
-
payloadFingerprint: string;
|
|
19
|
-
createdAt: string;
|
|
20
|
-
idempotent: boolean;
|
|
21
|
-
workflow: SupaCloudWorkflowRun;
|
|
22
|
-
}
|
|
32
|
+
export type SupaCloudCommandReceipt = CommandStatus;
|
|
23
33
|
/**
|
|
24
34
|
* Service-role-only transactional command receipt client. Application-owned
|
|
25
35
|
* database RPCs can call `supacloud_commands.submit` directly inside a larger
|
|
26
36
|
* transaction when the domain write and durable enqueue must commit together.
|
|
27
37
|
*/
|
|
28
|
-
export declare class SupaCloudCommandsClient<TClient extends
|
|
38
|
+
export declare class SupaCloudCommandsClient<TClient extends CommandRpcClient = CommandRpcClient> {
|
|
29
39
|
private readonly supabase;
|
|
30
40
|
constructor(supabase: TClient);
|
|
31
41
|
submit(request: SupaCloudCommandSubmitRequest): Promise<SupaCloudCommandReceipt>;
|
|
32
|
-
get(
|
|
42
|
+
get(lookup: string | CommandLookup): Promise<SupaCloudCommandReceipt | null>;
|
|
43
|
+
private request;
|
|
33
44
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,20 @@ import type { SupabaseClient } from "@supabase/supabase-js";
|
|
|
2
2
|
import { SupaCloudWorkflowsClient } from "./workflows.js";
|
|
3
3
|
import { SupaCloudCommandsClient } from "./commands.js";
|
|
4
4
|
import { SupaCloudArtifactsClient } from "./artifacts.js";
|
|
5
|
+
import { SupaCloudApiError } from "./api-error.js";
|
|
6
|
+
import { type FetchTransport } from "./bounded-rpc-fetch.js";
|
|
7
|
+
import { SupaCloudOAuthClientsClient } from "./oauth-clients.js";
|
|
8
|
+
import { SupaCloudOAuthServerClient } from "./oauth-server.js";
|
|
9
|
+
import { type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueMutationResult } from "./queue-rpc.js";
|
|
10
|
+
export { SupaCloudApiError } from "./api-error.js";
|
|
11
|
+
export { SupaCloudQueueError, type SupaCloudQueueJson, type SupaCloudQueueMessage, type SupaCloudQueueSendResult, type SupaCloudQueueMutationResult, } from "./queue-rpc.js";
|
|
12
|
+
export * from "./oauth-clients.js";
|
|
13
|
+
export * from "./oauth-server.js";
|
|
5
14
|
export { createSupaCloudOAuthFetch, type SupaCloudOAuthFetchOptions, } from "./auth-fetch.js";
|
|
6
15
|
export * from "./workflows.js";
|
|
16
|
+
export { createSupaCloudWorkflowFetch, type SupaCloudWorkflowFetchOptions } from "./workflow-fetch.js";
|
|
17
|
+
export { createSupaCloudCommandFetch, type SupaCloudCommandFetchOptions } from "./command-fetch.js";
|
|
18
|
+
export { createSupaCloudArtifactFetch, type SupaCloudArtifactFetchOptions } from "./artifact-fetch.js";
|
|
7
19
|
export * from "./commands.js";
|
|
8
20
|
export * from "./artifacts.js";
|
|
9
21
|
export type SupaCloudTaskStatus = "pending" | "leased" | "running" | "retry_scheduled" | "succeeded" | "failed" | "dead_lettered" | "cancelled" | "queued" | "processing" | "completed";
|
|
@@ -23,8 +35,12 @@ export type SupaCloudTaskAttempt = {
|
|
|
23
35
|
error: string | null;
|
|
24
36
|
logs: SupaCloudTaskLogEntry[];
|
|
25
37
|
};
|
|
26
|
-
export type
|
|
38
|
+
export type SupaCloudTaskResultDecoder<TResult> = (value: unknown) => TResult;
|
|
39
|
+
/** Alias kept short for consumers that already use decoder terminology. */
|
|
40
|
+
export type SupaCloudTaskDecoder<TResult> = SupaCloudTaskResultDecoder<TResult>;
|
|
41
|
+
export type SupaCloudTaskDetail<TResult = unknown> = {
|
|
27
42
|
id: string;
|
|
43
|
+
project_ref: string;
|
|
28
44
|
status: SupaCloudTaskStatus | string;
|
|
29
45
|
function_slug?: string | null;
|
|
30
46
|
function_version?: string | null;
|
|
@@ -33,7 +49,7 @@ export type SupaCloudTaskDetail = {
|
|
|
33
49
|
progress?: number | null;
|
|
34
50
|
error?: string | null;
|
|
35
51
|
error_message?: string | null;
|
|
36
|
-
result?:
|
|
52
|
+
result?: TResult;
|
|
37
53
|
payload?: Record<string, unknown>;
|
|
38
54
|
attempts?: SupaCloudTaskAttempt[];
|
|
39
55
|
latest_logs?: SupaCloudTaskLogEntry[];
|
|
@@ -44,13 +60,13 @@ export type SupaCloudTaskDetail = {
|
|
|
44
60
|
created_at?: string | null;
|
|
45
61
|
[key: string]: unknown;
|
|
46
62
|
};
|
|
47
|
-
export type SupaCloudTaskSnapshot = {
|
|
63
|
+
export type SupaCloudTaskSnapshot<TResult = unknown> = {
|
|
48
64
|
id: string;
|
|
49
65
|
status: SupaCloudTaskStatus | string;
|
|
50
66
|
progress?: number | null;
|
|
51
67
|
error?: string | null;
|
|
52
68
|
updatedAt?: string | null;
|
|
53
|
-
raw:
|
|
69
|
+
raw: SupaCloudTaskDetail<TResult>;
|
|
54
70
|
};
|
|
55
71
|
export type SupaCloudTaskListFilters = {
|
|
56
72
|
status?: string | string[];
|
|
@@ -62,7 +78,9 @@ export type SupaCloudTaskListFilters = {
|
|
|
62
78
|
export type SupaCloudTaskSubmitOptions = {
|
|
63
79
|
body?: string | Blob | ArrayBuffer | FormData | File | ReadableStream<Uint8Array> | Record<string, unknown>;
|
|
64
80
|
headers?: Record<string, string>;
|
|
81
|
+
/** @deprecated Configure retry policy on the platform; this compatibility field is ignored. */
|
|
65
82
|
retries?: number;
|
|
83
|
+
/** @deprecated Configure execution timeout on the platform; this compatibility field is ignored. */
|
|
66
84
|
timeoutSec?: number;
|
|
67
85
|
idempotencyKey?: string;
|
|
68
86
|
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
@@ -121,33 +139,6 @@ export type SupaCloudQueueListFilters = {
|
|
|
121
139
|
dlq?: boolean;
|
|
122
140
|
limit?: number;
|
|
123
141
|
};
|
|
124
|
-
export type SupaCloudQueueMessage = {
|
|
125
|
-
id: string;
|
|
126
|
-
msg_id: number;
|
|
127
|
-
read_ct?: number;
|
|
128
|
-
enqueued_at?: string | null;
|
|
129
|
-
vt?: string | null;
|
|
130
|
-
message?: Record<string, unknown>;
|
|
131
|
-
payload: Record<string, unknown>;
|
|
132
|
-
status?: string;
|
|
133
|
-
queue_name?: string;
|
|
134
|
-
task_type?: string;
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
};
|
|
137
|
-
export type SupaCloudQueueSendResult = {
|
|
138
|
-
id: string;
|
|
139
|
-
msg_id: number;
|
|
140
|
-
queue_name: string;
|
|
141
|
-
status: "pending";
|
|
142
|
-
payload: Record<string, unknown>;
|
|
143
|
-
};
|
|
144
|
-
export type SupaCloudQueueMutationResult = {
|
|
145
|
-
id: string;
|
|
146
|
-
msg_id: number;
|
|
147
|
-
queue_name: string;
|
|
148
|
-
status: "archived" | "deleted" | "released";
|
|
149
|
-
success: boolean;
|
|
150
|
-
};
|
|
151
142
|
export type SupaCloudQueueStats = {
|
|
152
143
|
queue_name: string;
|
|
153
144
|
queue_length: number;
|
|
@@ -174,103 +165,38 @@ export type SupaCloudQueueSettings = {
|
|
|
174
165
|
rate_limit_per_minute: number;
|
|
175
166
|
};
|
|
176
167
|
export type SupaCloudQueueSettingsUpdate = Partial<SupaCloudQueueSettings>;
|
|
177
|
-
export type SupaCloudSupAuthAdminMode = "sso" | "token" | "auto";
|
|
178
|
-
export type SupaCloudSupAuthStorageBucket = {
|
|
179
|
-
id: string;
|
|
180
|
-
public?: boolean;
|
|
181
|
-
fileSizeLimit?: number;
|
|
182
|
-
allowedMimeTypes?: string[];
|
|
183
|
-
};
|
|
184
|
-
export type SupaCloudSupAuthProvisionOptions = {
|
|
185
|
-
authDomain?: string;
|
|
186
|
-
apiDomain?: string;
|
|
187
|
-
adminMode?: SupaCloudSupAuthAdminMode;
|
|
188
|
-
adminSsoClientId?: string;
|
|
189
|
-
runtimeUrl?: string;
|
|
190
|
-
supaOAuthUrl?: string;
|
|
191
|
-
storageBuckets?: SupaCloudSupAuthStorageBucket[];
|
|
192
|
-
metadata?: Record<string, unknown>;
|
|
193
|
-
};
|
|
194
|
-
export type SupaCloudSupAuthReconcileOptions = {
|
|
195
|
-
dryRun?: boolean;
|
|
196
|
-
force?: boolean;
|
|
197
|
-
};
|
|
198
|
-
export type SupaCloudSupAuthStepResult = {
|
|
199
|
-
step: string;
|
|
200
|
-
status: "pending" | "running" | "succeeded" | "failed" | "skipped" | string;
|
|
201
|
-
message?: string;
|
|
202
|
-
details?: Record<string, unknown>;
|
|
203
|
-
};
|
|
204
|
-
export type SupaCloudSupAuthProvisionResult = {
|
|
205
|
-
projectRef: string;
|
|
206
|
-
status: "pending" | "running" | "succeeded" | "failed" | string;
|
|
207
|
-
steps?: SupaCloudSupAuthStepResult[];
|
|
208
|
-
raw?: unknown;
|
|
209
|
-
};
|
|
210
|
-
export type SupaCloudSupAuthReconcileResult = {
|
|
211
|
-
projectRef: string;
|
|
212
|
-
changed: boolean;
|
|
213
|
-
dryRun?: boolean;
|
|
214
|
-
steps?: SupaCloudSupAuthStepResult[];
|
|
215
|
-
raw?: unknown;
|
|
216
|
-
};
|
|
217
|
-
export type SupaCloudSupAuthRollbackResult = {
|
|
218
|
-
projectRef: string;
|
|
219
|
-
status: "succeeded" | "failed" | string;
|
|
220
|
-
steps?: SupaCloudSupAuthStepResult[];
|
|
221
|
-
raw?: unknown;
|
|
222
|
-
};
|
|
223
|
-
export type SupaCloudSupAuthClientConfig = {
|
|
224
|
-
projectRef: string;
|
|
225
|
-
supabaseUrl: string;
|
|
226
|
-
anonKey?: string | null;
|
|
227
|
-
authUrl: string;
|
|
228
|
-
restUrl: string;
|
|
229
|
-
storageUrl: string;
|
|
230
|
-
realtimeUrl: string;
|
|
231
|
-
functionsUrl: string;
|
|
232
|
-
issuer?: string | null;
|
|
233
|
-
jwksUrl?: string | null;
|
|
234
|
-
metadata?: Record<string, unknown>;
|
|
235
|
-
};
|
|
236
|
-
export type SupaCloudSupAuthVerificationCheck = {
|
|
237
|
-
name: string;
|
|
238
|
-
status: "pass" | "fail" | "warn" | string;
|
|
239
|
-
message?: string;
|
|
240
|
-
details?: Record<string, unknown>;
|
|
241
|
-
};
|
|
242
|
-
export type SupaCloudSupAuthVerification = {
|
|
243
|
-
projectRef: string;
|
|
244
|
-
healthy: boolean;
|
|
245
|
-
checks: SupaCloudSupAuthVerificationCheck[];
|
|
246
|
-
};
|
|
247
168
|
export type SupaCloudTaskWaitOptions = {
|
|
248
169
|
intervalMs?: number;
|
|
249
170
|
signal?: AbortSignal;
|
|
250
171
|
};
|
|
251
172
|
export type SupaCloudTaskSubscribeState = "connecting" | "realtime" | "polling" | "closed";
|
|
252
|
-
export type
|
|
173
|
+
export type SupaCloudTaskSubscription = {
|
|
174
|
+
readonly connectionState: SupaCloudTaskSubscribeState;
|
|
175
|
+
unsubscribe: () => void;
|
|
176
|
+
};
|
|
177
|
+
export type SupaCloudTaskSubscribeOptions<TResult = unknown> = {
|
|
178
|
+
realtime?: {
|
|
179
|
+
schema: string;
|
|
180
|
+
table: string;
|
|
181
|
+
};
|
|
253
182
|
pollingIntervalMs?: number;
|
|
254
183
|
realtimeTimeoutMs?: number;
|
|
255
184
|
reconcileIntervalMs?: number;
|
|
256
|
-
onUpdate: (task: SupaCloudTaskSnapshot) => void;
|
|
185
|
+
onUpdate: (task: SupaCloudTaskSnapshot<TResult>) => void;
|
|
257
186
|
onStateChange?: (state: SupaCloudTaskSubscribeState, details?: {
|
|
258
187
|
error?: unknown;
|
|
259
188
|
}) => void;
|
|
260
189
|
onError?: (error: unknown) => void;
|
|
261
190
|
stopOnTerminal?: boolean;
|
|
262
191
|
};
|
|
263
|
-
export type SupaCloudTaskReceipt = {
|
|
192
|
+
export type SupaCloudTaskReceipt<TResult = unknown> = {
|
|
264
193
|
taskId: string;
|
|
265
194
|
status: string;
|
|
266
|
-
get: () => Promise<SupaCloudTaskDetail
|
|
267
|
-
wait: (options?: SupaCloudTaskWaitOptions) => Promise<SupaCloudTaskDetail
|
|
268
|
-
cancel: () => Promise<SupaCloudTaskDetail
|
|
269
|
-
retry: () => Promise<SupaCloudTaskDetail
|
|
270
|
-
subscribe: (options: SupaCloudTaskSubscribeOptions) =>
|
|
271
|
-
connectionState: SupaCloudTaskSubscribeState;
|
|
272
|
-
unsubscribe: () => void;
|
|
273
|
-
};
|
|
195
|
+
get: () => Promise<SupaCloudTaskDetail<TResult>>;
|
|
196
|
+
wait: (options?: SupaCloudTaskWaitOptions) => Promise<SupaCloudTaskDetail<TResult>>;
|
|
197
|
+
cancel: () => Promise<SupaCloudTaskDetail<TResult>>;
|
|
198
|
+
retry: () => Promise<SupaCloudTaskDetail<TResult>>;
|
|
199
|
+
subscribe: (options: SupaCloudTaskSubscribeOptions<TResult>) => SupaCloudTaskSubscription;
|
|
274
200
|
};
|
|
275
201
|
export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClient> = {
|
|
276
202
|
supabase: TClient;
|
|
@@ -279,108 +205,88 @@ export type SupaCloudClientOptions<TClient extends SupabaseClient = SupabaseClie
|
|
|
279
205
|
getAccessToken?: () => Promise<string | null> | string | null;
|
|
280
206
|
pollingIntervalMs?: number;
|
|
281
207
|
};
|
|
282
|
-
export type SupaCloudOAuthServerStatus = {
|
|
283
|
-
project_ref: string;
|
|
284
|
-
organization_id?: string;
|
|
285
|
-
account_isolated: boolean;
|
|
286
|
-
enabled: boolean;
|
|
287
|
-
allow_dynamic_registration: boolean;
|
|
288
|
-
issuer: string;
|
|
289
|
-
authorization_path?: string;
|
|
290
|
-
discovery_url: string;
|
|
291
|
-
oauth_authorization_server_metadata_url?: string;
|
|
292
|
-
jwks_url: string;
|
|
293
|
-
authorization_endpoint: string;
|
|
294
|
-
token_endpoint: string;
|
|
295
|
-
userinfo_endpoint?: string;
|
|
296
|
-
registration_endpoint?: string;
|
|
297
|
-
signing_alg?: string;
|
|
298
|
-
oidc_id_token_ready?: boolean;
|
|
299
|
-
migration_status?: string;
|
|
300
|
-
warnings?: string[];
|
|
301
|
-
};
|
|
302
|
-
export type SupaCloudOAuthClientType = "public" | "confidential";
|
|
303
|
-
export type SupaCloudOAuthClientAuthMethod = "none" | "client_secret_basic" | "client_secret_post";
|
|
304
|
-
export type SupaCloudOAuthClient = {
|
|
305
|
-
client_id: string;
|
|
306
|
-
client_secret?: string;
|
|
307
|
-
client_type?: SupaCloudOAuthClientType | string;
|
|
308
|
-
redirect_uris?: string[];
|
|
309
|
-
token_endpoint_auth_method?: SupaCloudOAuthClientAuthMethod | string;
|
|
310
|
-
grant_types?: string[];
|
|
311
|
-
response_types?: string[];
|
|
312
|
-
client_name?: string;
|
|
313
|
-
client_uri?: string;
|
|
314
|
-
logo_uri?: string;
|
|
315
|
-
registration_type?: string;
|
|
316
|
-
created_at?: string;
|
|
317
|
-
updated_at?: string;
|
|
318
|
-
[key: string]: unknown;
|
|
319
|
-
};
|
|
320
|
-
export type SupaCloudOAuthClientList = {
|
|
321
|
-
clients?: SupaCloudOAuthClient[];
|
|
322
|
-
[key: string]: unknown;
|
|
323
|
-
};
|
|
324
|
-
export type SupaCloudOAuthClientCreate = {
|
|
325
|
-
redirect_uris: string[];
|
|
326
|
-
client_type?: SupaCloudOAuthClientType;
|
|
327
|
-
token_endpoint_auth_method?: SupaCloudOAuthClientAuthMethod;
|
|
328
|
-
grant_types?: string[];
|
|
329
|
-
client_name?: string;
|
|
330
|
-
client_uri?: string;
|
|
331
|
-
logo_uri?: string;
|
|
332
|
-
};
|
|
333
|
-
export type SupaCloudOAuthClientUpdate = Partial<Omit<SupaCloudOAuthClientCreate, "client_type">>;
|
|
334
|
-
export type SupaCloudAuthorizeUrlOptions = {
|
|
335
|
-
clientId: string;
|
|
336
|
-
redirectUri: string;
|
|
337
|
-
scope?: string | string[];
|
|
338
|
-
state?: string;
|
|
339
|
-
codeChallenge?: string;
|
|
340
|
-
codeChallengeMethod?: "S256" | "plain";
|
|
341
|
-
nonce?: string;
|
|
342
|
-
responseType?: "code";
|
|
343
|
-
resource?: string;
|
|
344
|
-
};
|
|
345
208
|
export declare class SupaCloudTaskSubmitError extends Error {
|
|
209
|
+
readonly code = "TASK_SUBMIT_UNCONFIRMED";
|
|
210
|
+
readonly mutationMayHaveApplied = true;
|
|
346
211
|
readonly responseBody: unknown;
|
|
347
212
|
constructor(message: string, responseBody: unknown);
|
|
348
213
|
}
|
|
349
|
-
export
|
|
350
|
-
readonly
|
|
351
|
-
|
|
352
|
-
readonly responseBody: unknown;
|
|
353
|
-
constructor(message: string, status: number, responseBody: unknown);
|
|
214
|
+
export interface SupaCloudTaskFetchOptions {
|
|
215
|
+
functionUrls: readonly string[];
|
|
216
|
+
fetch?: FetchTransport;
|
|
354
217
|
}
|
|
218
|
+
export declare function createSupaCloudTaskFetch(options: SupaCloudTaskFetchOptions): FetchTransport;
|
|
355
219
|
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
356
220
|
type ResponseDecoder<T> = (value: unknown) => T;
|
|
221
|
+
export declare class SupaCloudTaskResponseError extends SupaCloudApiError {
|
|
222
|
+
readonly mutationMayHaveApplied: boolean;
|
|
223
|
+
constructor(operation: "get" | "cancel" | "retry");
|
|
224
|
+
}
|
|
225
|
+
export type SupaCloudTaskDecodeOperation = "get" | "list" | "wait" | "cancel" | "retry" | "subscribe";
|
|
226
|
+
/**
|
|
227
|
+
* A caller-supplied result decoder failed. The original decoder error and
|
|
228
|
+
* response value are intentionally not retained because either may contain
|
|
229
|
+
* secrets or unbounded application data.
|
|
230
|
+
*/
|
|
231
|
+
export declare class SupaCloudTaskDecoderError extends SupaCloudApiError {
|
|
232
|
+
readonly operation: SupaCloudTaskDecodeOperation;
|
|
233
|
+
readonly code: "TASK_RESULT_INVALID";
|
|
234
|
+
readonly mutationMayHaveApplied: boolean;
|
|
235
|
+
constructor(operation: SupaCloudTaskDecodeOperation);
|
|
236
|
+
}
|
|
237
|
+
/** Compatibility spelling for callers that refer to decoding rather than decoding contracts. */
|
|
238
|
+
export { SupaCloudTaskDecoderError as SupaCloudTaskDecodeError };
|
|
239
|
+
export declare class SupaCloudTaskAuthenticationError extends SupaCloudApiError {
|
|
240
|
+
readonly mutationMayHaveApplied = false;
|
|
241
|
+
constructor(code?: "TASK_AUTH_INVALID" | "TASK_AUTH_TIMEOUT");
|
|
242
|
+
}
|
|
357
243
|
declare class SupaCloudManagementClient<TClient extends SupabaseClient = SupabaseClient> {
|
|
358
244
|
protected readonly options: Required<SupaCloudClientOptions<TClient>>;
|
|
359
245
|
constructor(options: Required<SupaCloudClientOptions<TClient>>);
|
|
360
|
-
protected resolveAccessToken(): Promise<string>;
|
|
361
|
-
protected request<T>(path: string, method: HttpMethod, body: unknown, decode: ResponseDecoder<T
|
|
246
|
+
protected resolveAccessToken(_signal?: AbortSignal): Promise<string>;
|
|
247
|
+
protected request<T>(path: string, method: HttpMethod, body: unknown, decode: ResponseDecoder<T>, transport?: FetchTransport, signal?: AbortSignal): Promise<T>;
|
|
362
248
|
}
|
|
363
249
|
declare class SupaCloudTasksClient<TClient extends SupabaseClient = SupabaseClient> extends SupaCloudManagementClient<TClient> {
|
|
250
|
+
protected resolveAccessToken(signal?: AbortSignal): Promise<string>;
|
|
251
|
+
protected request<T>(path: string, method: HttpMethod, body: unknown, decode: ResponseDecoder<T>, _transport?: FetchTransport, signal?: AbortSignal): Promise<T>;
|
|
364
252
|
private createReceipt;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
253
|
+
private createTypedReceipt;
|
|
254
|
+
private submitInternal;
|
|
255
|
+
submit(functionName: string, options?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<unknown>>;
|
|
256
|
+
submitTyped<TResult>(functionName: string, decoder: SupaCloudTaskResultDecoder<TResult>, options?: SupaCloudTaskSubmitOptions): Promise<SupaCloudTaskReceipt<TResult>>;
|
|
257
|
+
submitTyped<TResult>(functionName: string, options: SupaCloudTaskSubmitOptions, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskReceipt<TResult>>;
|
|
258
|
+
private getInternal;
|
|
259
|
+
get(taskId: string, signal?: AbortSignal): Promise<SupaCloudTaskDetail<unknown>>;
|
|
260
|
+
getTyped<TResult>(taskId: string, decoder: SupaCloudTaskResultDecoder<TResult>, signal?: AbortSignal): Promise<SupaCloudTaskDetail<TResult>>;
|
|
261
|
+
getTyped<TResult>(taskId: string, signal: AbortSignal | undefined, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskDetail<TResult>>;
|
|
262
|
+
list(filters?: SupaCloudTaskListFilters): Promise<SupaCloudTaskDetail<unknown>[]>;
|
|
263
|
+
listTyped<TResult>(decoder: SupaCloudTaskResultDecoder<TResult>, filters?: SupaCloudTaskListFilters): Promise<SupaCloudTaskDetail<TResult>[]>;
|
|
264
|
+
listTyped<TResult>(filters: SupaCloudTaskListFilters, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskDetail<TResult>[]>;
|
|
265
|
+
private cancelInternal;
|
|
266
|
+
cancel(taskId: string): Promise<SupaCloudTaskDetail<unknown>>;
|
|
267
|
+
cancelTyped<TResult>(taskId: string, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskDetail<TResult>>;
|
|
268
|
+
private retryInternal;
|
|
269
|
+
retry(taskId: string): Promise<SupaCloudTaskDetail<unknown>>;
|
|
270
|
+
retryTyped<TResult>(taskId: string, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskDetail<TResult>>;
|
|
271
|
+
listDlq(limit?: number): Promise<SupaCloudTaskDetail<unknown>[]>;
|
|
272
|
+
listDlqTyped<TResult>(decoder: SupaCloudTaskResultDecoder<TResult>, limit?: number): Promise<SupaCloudTaskDetail<TResult>[]>;
|
|
273
|
+
private waitInternal;
|
|
274
|
+
wait(taskId: string, options?: SupaCloudTaskWaitOptions): Promise<SupaCloudTaskDetail<unknown>>;
|
|
275
|
+
waitTyped<TResult>(taskId: string, decoder: SupaCloudTaskResultDecoder<TResult>, options?: SupaCloudTaskWaitOptions): Promise<SupaCloudTaskDetail<TResult>>;
|
|
276
|
+
waitTyped<TResult>(taskId: string, options: SupaCloudTaskWaitOptions, decoder: SupaCloudTaskResultDecoder<TResult>): Promise<SupaCloudTaskDetail<TResult>>;
|
|
277
|
+
subscribe(taskId: string, options: SupaCloudTaskSubscribeOptions): SupaCloudTaskSubscription;
|
|
278
|
+
subscribeTyped<TResult>(taskId: string, decoder: SupaCloudTaskResultDecoder<TResult>, options: SupaCloudTaskSubscribeOptions<TResult>): SupaCloudTaskSubscription;
|
|
279
|
+
subscribeTyped<TResult>(taskId: string, options: SupaCloudTaskSubscribeOptions<TResult>, decoder: SupaCloudTaskResultDecoder<TResult>): SupaCloudTaskSubscription;
|
|
280
|
+
private subscribeTypedInternal;
|
|
281
|
+
private subscribeInternal;
|
|
376
282
|
}
|
|
377
283
|
declare class SupaCloudQueueClient<TClient extends SupabaseClient = SupabaseClient> extends SupaCloudManagementClient<TClient> {
|
|
378
284
|
private readonly name;
|
|
379
285
|
constructor(options: Required<SupaCloudClientOptions<TClient>>, name: string);
|
|
380
286
|
private get encodedName();
|
|
381
287
|
private rpc;
|
|
382
|
-
send(payload?:
|
|
383
|
-
sendBatch(messages:
|
|
288
|
+
send(payload?: SupaCloudQueueJson, options?: SupaCloudQueueSendOptions): Promise<SupaCloudQueueSendResult>;
|
|
289
|
+
sendBatch(messages: SupaCloudQueueJson[], options?: SupaCloudQueueSendOptions): Promise<SupaCloudQueueSendResult[]>;
|
|
384
290
|
read(options?: SupaCloudQueueReceiveOptions): Promise<SupaCloudQueueMessage[]>;
|
|
385
291
|
receive(options?: SupaCloudQueueReceiveOptions): Promise<SupaCloudQueueMessage | null>;
|
|
386
292
|
pop(): Promise<SupaCloudQueueMessage | null>;
|
|
@@ -417,48 +323,21 @@ declare class SupaCloudQueuesClient<TClient extends SupabaseClient = SupabaseCli
|
|
|
417
323
|
create(queueName: string, options?: SupaCloudQueueCreateOptions): Promise<SupaCloudQueueInfo>;
|
|
418
324
|
drop(queueName: string): Promise<void>;
|
|
419
325
|
}
|
|
420
|
-
declare class SupaCloudOAuthServerClient<TClient extends SupabaseClient = SupabaseClient> extends SupaCloudManagementClient<TClient> {
|
|
421
|
-
getStatus(): Promise<SupaCloudOAuthServerStatus>;
|
|
422
|
-
migrateToOidc(options?: {
|
|
423
|
-
allowDynamicRegistration?: boolean;
|
|
424
|
-
authorizationPath?: string;
|
|
425
|
-
}): Promise<SupaCloudOAuthServerStatus>;
|
|
426
|
-
getDiscovery(): Promise<Record<string, unknown>>;
|
|
427
|
-
getJwks(): Promise<Record<string, unknown>>;
|
|
428
|
-
buildAuthorizeUrl(options: SupaCloudAuthorizeUrlOptions): Promise<string>;
|
|
429
|
-
}
|
|
430
|
-
declare class SupaCloudOAuthClientsClient<TClient extends SupabaseClient = SupabaseClient> extends SupaCloudManagementClient<TClient> {
|
|
431
|
-
list(): Promise<SupaCloudOAuthClientList>;
|
|
432
|
-
create(input: SupaCloudOAuthClientCreate): Promise<SupaCloudOAuthClient>;
|
|
433
|
-
get(clientId: string): Promise<SupaCloudOAuthClient>;
|
|
434
|
-
update(clientId: string, patch: SupaCloudOAuthClientUpdate): Promise<SupaCloudOAuthClient>;
|
|
435
|
-
delete(clientId: string): Promise<void>;
|
|
436
|
-
regenerateSecret(clientId: string): Promise<SupaCloudOAuthClient>;
|
|
437
|
-
}
|
|
438
|
-
declare class SupaCloudSupAuthClient<TClient extends SupabaseClient = SupabaseClient> extends SupaCloudManagementClient<TClient> {
|
|
439
|
-
private get basePath();
|
|
440
|
-
provision(options?: SupaCloudSupAuthProvisionOptions): Promise<SupaCloudSupAuthProvisionResult>;
|
|
441
|
-
reconcile(options?: SupaCloudSupAuthReconcileOptions): Promise<SupaCloudSupAuthReconcileResult>;
|
|
442
|
-
rollback(): Promise<SupaCloudSupAuthRollbackResult>;
|
|
443
|
-
getClientConfig(): Promise<SupaCloudSupAuthClientConfig>;
|
|
444
|
-
verify(): Promise<SupaCloudSupAuthVerification>;
|
|
445
|
-
}
|
|
446
326
|
export declare function createSupaCloudClient<TClient extends SupabaseClient = SupabaseClient>(options: SupaCloudClientOptions<TClient>): {
|
|
447
327
|
supabase: TClient;
|
|
448
328
|
projectRef: string;
|
|
449
329
|
managementApiUrl: string;
|
|
450
330
|
auth: {
|
|
451
|
-
oauthServer: SupaCloudOAuthServerClient
|
|
452
|
-
oauthClients: SupaCloudOAuthClientsClient
|
|
331
|
+
oauthServer: SupaCloudOAuthServerClient;
|
|
332
|
+
oauthClients: SupaCloudOAuthClientsClient;
|
|
453
333
|
};
|
|
454
334
|
tasks: SupaCloudTasksClient<TClient>;
|
|
455
335
|
workflows: SupaCloudWorkflowsClient<TClient>;
|
|
456
336
|
commands: SupaCloudCommandsClient<TClient>;
|
|
457
337
|
artifacts: SupaCloudArtifactsClient<TClient>;
|
|
458
|
-
supauth: SupaCloudSupAuthClient<TClient>;
|
|
459
338
|
queues: SupaCloudQueuesClient<TClient>;
|
|
460
339
|
queue: (name: string) => SupaCloudQueueClient<TClient>;
|
|
461
340
|
functions: {
|
|
462
|
-
invokeBackground: (functionName: string, submitOptions?: SupaCloudTaskSubmitOptions) => Promise<SupaCloudTaskReceipt
|
|
341
|
+
invokeBackground: (functionName: string, submitOptions?: SupaCloudTaskSubmitOptions) => Promise<SupaCloudTaskReceipt<unknown>>;
|
|
463
342
|
};
|
|
464
343
|
};
|