@supacloud/js 0.35.0 → 0.36.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/COMPATIBILITY.md +84 -0
- package/dist/api-error.d.mts +6 -0
- package/dist/{artifact-fetch.d.ts → artifact-fetch.d.cts} +1 -1
- package/dist/artifact-fetch.d.mts +6 -0
- package/dist/{artifact-link.d.ts → artifact-link.d.cts} +2 -2
- package/dist/artifact-link.d.mts +8 -0
- package/dist/{artifact-read.d.ts → artifact-read.d.cts} +2 -2
- package/dist/artifact-read.d.mts +13 -0
- package/dist/{artifact-register.d.ts → artifact-register.d.cts} +2 -2
- package/dist/artifact-register.d.mts +14 -0
- package/dist/{artifact-rpc.d.ts → artifact-rpc.d.cts} +1 -1
- package/dist/artifact-rpc.d.mts +2 -0
- package/dist/{artifacts.d.ts → artifacts.d.cts} +4 -4
- package/dist/artifacts.d.mts +53 -0
- package/dist/auth-fetch.d.mts +27 -0
- package/dist/bounded-rpc-fetch.d.mts +2 -0
- package/dist/{command-fetch.d.ts → command-fetch.d.cts} +1 -1
- package/dist/command-fetch.d.mts +6 -0
- package/dist/{commands.d.ts → commands.d.cts} +1 -1
- package/dist/commands.d.mts +44 -0
- package/dist/contracts.cjs +48 -0
- package/dist/contracts.d.mts +1 -0
- package/dist/index.cjs +3732 -0
- package/dist/{index.d.ts → index.d.cts} +20 -20
- package/dist/index.d.mts +360 -0
- package/dist/{oauth-clients.d.ts → oauth-clients.d.cts} +1 -1
- package/dist/oauth-clients.d.mts +95 -0
- package/dist/{oauth-server.d.ts → oauth-server.d.cts} +1 -1
- package/dist/oauth-server.d.mts +104 -0
- package/dist/{queue-rpc.d.ts → queue-rpc.d.cts} +1 -1
- package/dist/queue-rpc.d.mts +54 -0
- package/dist/reactive.cjs +119 -0
- package/dist/{reactive.d.ts → reactive.d.cts} +1 -1
- package/dist/reactive.d.mts +26 -0
- package/dist/{service-role-rpc.d.ts → service-role-rpc.d.cts} +1 -1
- package/dist/service-role-rpc.d.mts +2 -0
- package/dist/supabase-types.d.cts +9 -0
- package/dist/supabase-types.d.mts +9 -0
- package/dist/task-events.cjs +352 -0
- package/dist/task-events.d.mts +66 -0
- package/dist/{workflow-advance.d.ts → workflow-advance.d.cts} +2 -2
- package/dist/workflow-advance.d.mts +8 -0
- package/dist/{workflow-attempt.d.ts → workflow-attempt.d.cts} +1 -1
- package/dist/workflow-attempt.d.mts +4 -0
- package/dist/{workflow-cancel.d.ts → workflow-cancel.d.cts} +2 -2
- package/dist/workflow-cancel.d.mts +14 -0
- package/dist/{workflow-claim.d.ts → workflow-claim.d.cts} +2 -2
- package/dist/workflow-claim.d.mts +12 -0
- package/dist/{workflow-complete.d.ts → workflow-complete.d.cts} +2 -2
- package/dist/workflow-complete.d.mts +8 -0
- package/dist/{workflow-events.d.ts → workflow-events.d.cts} +2 -2
- package/dist/workflow-events.d.mts +14 -0
- package/dist/{workflow-fail.d.ts → workflow-fail.d.cts} +2 -2
- package/dist/workflow-fail.d.mts +8 -0
- package/dist/{workflow-fetch.d.ts → workflow-fetch.d.cts} +1 -1
- package/dist/workflow-fetch.d.mts +9 -0
- package/dist/workflow-json.d.mts +2 -0
- package/dist/{workflow-retry.d.ts → workflow-retry.d.cts} +2 -2
- package/dist/workflow-retry.d.mts +8 -0
- package/dist/{workflow-rpc.d.ts → workflow-rpc.d.cts} +1 -1
- package/dist/workflow-rpc.d.mts +6 -0
- package/dist/{workflow-run.d.ts → workflow-run.d.cts} +2 -2
- package/dist/workflow-run.d.mts +8 -0
- package/dist/{workflow-start.d.ts → workflow-start.d.cts} +2 -2
- package/dist/workflow-start.d.mts +8 -0
- package/dist/workflow-timestamp.d.mts +1 -0
- package/dist/{workflows.d.ts → workflows.d.cts} +10 -10
- package/dist/workflows.d.mts +141 -0
- package/package.json +48 -21
- /package/dist/{api-error.d.ts → api-error.d.cts} +0 -0
- /package/dist/{auth-fetch.d.ts → auth-fetch.d.cts} +0 -0
- /package/dist/{bounded-rpc-fetch.d.ts → bounded-rpc-fetch.d.cts} +0 -0
- /package/dist/{contracts.d.ts → contracts.d.cts} +0 -0
- /package/dist/{contracts.js → contracts.mjs} +0 -0
- /package/dist/{index.js → index.mjs} +0 -0
- /package/dist/{reactive.js → reactive.mjs} +0 -0
- /package/dist/{task-events.d.ts → task-events.d.cts} +0 -0
- /package/dist/{task-events.js → task-events.mjs} +0 -0
- /package/dist/{workflow-json.d.ts → workflow-json.d.cts} +0 -0
- /package/dist/{workflow-timestamp.d.ts → workflow-timestamp.d.cts} +0 -0
package/COMPATIBILITY.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# SDK module compatibility
|
|
2
|
+
|
|
3
|
+
## Supported loading contract
|
|
4
|
+
|
|
5
|
+
`@supacloud/js` publishes native ESM (`.mjs`) and CommonJS (`.cjs`) builds for
|
|
6
|
+
its root, `/task-events`, `/contracts` and `/reactive` entrypoints.
|
|
7
|
+
`@supacloud/contracts` publishes both formats for its root, `/client` and
|
|
8
|
+
`/browser` entrypoints. Both builds come from the same TypeScript source.
|
|
9
|
+
|
|
10
|
+
Each export selects `.mjs` with `.d.mts` declarations under `import`, and `.cjs`
|
|
11
|
+
with `.d.cts` declarations under `require`. Legacy `main`, `module` and `types`
|
|
12
|
+
fields point to CJS, MJS and ESM declarations respectively. Consumers should
|
|
13
|
+
use public package specifiers instead of internal `dist` paths.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
// ESM
|
|
17
|
+
import { createClient } from '@supabase/supabase-js';
|
|
18
|
+
import { createSupaCloudClient } from '@supacloud/js';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// CommonJS: synchronous, without an ESM loader bridge.
|
|
23
|
+
const { createClient } = require('@supabase/supabase-js');
|
|
24
|
+
const { createSupaCloudClient } = require('@supacloud/js');
|
|
25
|
+
const { TaskEventError } = require('@supacloud/js/task-events');
|
|
26
|
+
const { createCommandScope } = require('@supacloud/js/contracts');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The supported SDK Node floor remains **22.12.0**; native CJS output does not
|
|
30
|
+
lower dependency runtime requirements. CI also covers Node 24, Node 26 and
|
|
31
|
+
Bun 1.4.2. These checks do not certify older Node, Electron, React Native/Hermes
|
|
32
|
+
or every browser/bundler combination.
|
|
33
|
+
|
|
34
|
+
Client creation remains synchronous. Network methods retain their Promise
|
|
35
|
+
contracts, transport behavior and caller-owned authentication configuration.
|
|
36
|
+
Module loading does not create another client or introduce retries.
|
|
37
|
+
Service-role workflow and command operations remain server-only.
|
|
38
|
+
|
|
39
|
+
## Module identity
|
|
40
|
+
|
|
41
|
+
The formats have equivalent public APIs but distinct function and class
|
|
42
|
+
identities. Do not rely on cross-format `instanceof` or reference equality.
|
|
43
|
+
Repeated loading of the same entrypoint in the same format preserves identity.
|
|
44
|
+
The SDK contracts facade externalizes `@supacloud/contracts/client`, preserving
|
|
45
|
+
shared protocol identity within each format. Mixed-format applications should
|
|
46
|
+
exchange data or caller-owned clients rather than rely on class identity.
|
|
47
|
+
Independently installed package copies and separate JavaScript realms also
|
|
48
|
+
have independent identities.
|
|
49
|
+
|
|
50
|
+
## Type compatibility
|
|
51
|
+
|
|
52
|
+
The type-only Supabase bridge explicitly selects both upstream declaration
|
|
53
|
+
graphs with `resolution-mode: import` and `resolution-mode: require`.
|
|
54
|
+
Both SDK declaration formats accept either upstream client and preserve the
|
|
55
|
+
caller's exact client/database type without casts or type erasure.
|
|
56
|
+
|
|
57
|
+
Installed `.mts` and `.cts` NodeNext consumers check normal and opposite-format
|
|
58
|
+
Supabase clients, task generics, table-name inference and reactive query types.
|
|
59
|
+
TypeScript 5.8.3 checks the complete declaration graph with `skipLibCheck: false`.
|
|
60
|
+
TypeScript 7 checks the consumers and ESNext/bundler surface with
|
|
61
|
+
`skipLibCheck: true`: upstream auth-js `PublicKeyCredentialFuture<T>` currently
|
|
62
|
+
conflicts with the newer DOM WebAuthn declarations (TS2430). This is not a
|
|
63
|
+
successful TS7 full-library declaration audit.
|
|
64
|
+
|
|
65
|
+
Framework packages such as `@supacloud/app` and `@supacloud/compiler` remain
|
|
66
|
+
ESM-only. The dual-format policy exception is restricted to SDK and Contracts.
|
|
67
|
+
|
|
68
|
+
## Verification
|
|
69
|
+
|
|
70
|
+
Build Contracts before the SDK, then run:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
bun run --cwd packages/supacloud-js check:package
|
|
74
|
+
node .github/scripts/esm-package.acceptance.mjs --sdk-only
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Acceptance installs actual candidate tarballs outside the checkout, with no
|
|
78
|
+
workspace links. It checks cold require-first/import-first processes under
|
|
79
|
+
Node and Bun, all seven public entries, API parity, per-format identity,
|
|
80
|
+
Supabase HTTP error/Response preservation and one-attempt transport behavior.
|
|
81
|
+
The minimum peer is installed with strict engine enforcement. TypeScript runs
|
|
82
|
+
against the installed declarations, and a browser-target bundle includes all
|
|
83
|
+
SDK public entries. The full acceptance job additionally checks app/compiler
|
|
84
|
+
integration. CI must pass on the candidate commit before merging.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FetchTransport } from "./bounded-rpc-fetch.mjs";
|
|
2
|
+
export interface SupaCloudArtifactFetchOptions {
|
|
3
|
+
fetch?: FetchTransport;
|
|
4
|
+
}
|
|
5
|
+
/** Bound artifact RPC receipts without imposing limits on Storage file transfers. */
|
|
6
|
+
export declare function createSupaCloudArtifactFetch(options?: SupaCloudArtifactFetchOptions): FetchTransport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SupaCloudApiError } from "./api-error.
|
|
2
|
-
import type { SupaCloudArtifact, SupaCloudArtifactLinkRequest } from "./artifacts.
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.cjs";
|
|
2
|
+
import type { SupaCloudArtifact, SupaCloudArtifactLinkRequest } from "./artifacts.cjs";
|
|
3
3
|
export declare class SupaCloudArtifactLinkError extends SupaCloudApiError {
|
|
4
4
|
readonly mutationMayHaveApplied: boolean;
|
|
5
5
|
constructor(mutationMayHaveApplied?: boolean);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.mjs";
|
|
2
|
+
import type { SupaCloudArtifact, SupaCloudArtifactLinkRequest } from "./artifacts.mjs";
|
|
3
|
+
export declare class SupaCloudArtifactLinkError extends SupaCloudApiError {
|
|
4
|
+
readonly mutationMayHaveApplied: boolean;
|
|
5
|
+
constructor(mutationMayHaveApplied?: boolean);
|
|
6
|
+
}
|
|
7
|
+
export declare function captureArtifactLink(value: unknown): Required<SupaCloudArtifactLinkRequest>;
|
|
8
|
+
export declare function decodeArtifactLink(value: unknown, request: Required<SupaCloudArtifactLinkRequest>): SupaCloudArtifact;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SupaCloudApiError } from "./api-error.
|
|
2
|
-
import type { SupaCloudArtifact } from "./artifacts.
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.cjs";
|
|
2
|
+
import type { SupaCloudArtifact } from "./artifacts.cjs";
|
|
3
3
|
export declare class SupaCloudArtifactReadError extends SupaCloudApiError {
|
|
4
4
|
readonly mutationMayHaveApplied = false;
|
|
5
5
|
constructor(input?: boolean);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.mjs";
|
|
2
|
+
import type { SupaCloudArtifact } from "./artifacts.mjs";
|
|
3
|
+
export declare class SupaCloudArtifactReadError extends SupaCloudApiError {
|
|
4
|
+
readonly mutationMayHaveApplied = false;
|
|
5
|
+
constructor(input?: boolean);
|
|
6
|
+
}
|
|
7
|
+
export declare function captureArtifactId(value: unknown): string;
|
|
8
|
+
export declare function artifactText(value: unknown, min?: number, max?: number): string;
|
|
9
|
+
export declare function artifactKey(value: unknown): string;
|
|
10
|
+
export declare function artifactTimestampMicros(value: string): bigint;
|
|
11
|
+
export declare function artifactSize(value: unknown): string;
|
|
12
|
+
export declare function artifactPath(value: unknown): string;
|
|
13
|
+
export declare function decodeArtifactRead(value: unknown, artifactId: string, allowIdempotent?: boolean): SupaCloudArtifact | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SupaCloudApiError } from "./api-error.
|
|
2
|
-
import type { SupaCloudArtifact, SupaCloudArtifactRegisterRequest } from "./artifacts.
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.cjs";
|
|
2
|
+
import type { SupaCloudArtifact, SupaCloudArtifactRegisterRequest } from "./artifacts.cjs";
|
|
3
3
|
export declare class SupaCloudArtifactRegisterError extends SupaCloudApiError {
|
|
4
4
|
readonly mutationMayHaveApplied: boolean;
|
|
5
5
|
constructor(mutationMayHaveApplied?: boolean);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SupaCloudApiError } from "./api-error.mjs";
|
|
2
|
+
import type { SupaCloudArtifact, SupaCloudArtifactRegisterRequest } from "./artifacts.mjs";
|
|
3
|
+
export declare class SupaCloudArtifactRegisterError extends SupaCloudApiError {
|
|
4
|
+
readonly mutationMayHaveApplied: boolean;
|
|
5
|
+
constructor(mutationMayHaveApplied?: boolean);
|
|
6
|
+
}
|
|
7
|
+
type CapturedRegister = Omit<Required<SupaCloudArtifactRegisterRequest>, "sizeBytes" | "retentionUntil" | "createdBy"> & {
|
|
8
|
+
sizeBytes: string;
|
|
9
|
+
retentionUntil: string | null;
|
|
10
|
+
createdBy: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare function captureArtifactRegister(value: unknown): CapturedRegister;
|
|
13
|
+
export declare function decodeArtifactRegister(value: unknown, request: CapturedRegister): SupaCloudArtifact;
|
|
14
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SupabaseClient } from "
|
|
1
|
+
import type { SupabaseClient } from "./supabase-types.cjs";
|
|
2
2
|
export declare function invokeArtifactRpc(supabase: SupabaseClient, name: "supacloud_artifact_get" | "supacloud_artifact_register" | "supacloud_artifact_link", request: object, failure: () => Error): Promise<unknown>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { SupabaseClient } from "./supabase-types.mjs";
|
|
2
|
+
export declare function invokeArtifactRpc(supabase: SupabaseClient, name: "supacloud_artifact_get" | "supacloud_artifact_register" | "supacloud_artifact_link", request: object, failure: () => Error): Promise<unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { SupabaseClient } from "
|
|
2
|
-
export { SupaCloudArtifactReadError } from "./artifact-read.
|
|
3
|
-
export { SupaCloudArtifactRegisterError } from "./artifact-register.
|
|
4
|
-
export { SupaCloudArtifactLinkError } from "./artifact-link.
|
|
1
|
+
import type { SupabaseClient } from "./supabase-types.cjs";
|
|
2
|
+
export { SupaCloudArtifactReadError } from "./artifact-read.cjs";
|
|
3
|
+
export { SupaCloudArtifactRegisterError } from "./artifact-register.cjs";
|
|
4
|
+
export { SupaCloudArtifactLinkError } from "./artifact-link.cjs";
|
|
5
5
|
export type SupaCloudArtifactJson = Record<string, unknown>;
|
|
6
6
|
export interface SupaCloudArtifactParent {
|
|
7
7
|
artifactId: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SupabaseClient } from "./supabase-types.mjs";
|
|
2
|
+
export { SupaCloudArtifactReadError } from "./artifact-read.mjs";
|
|
3
|
+
export { SupaCloudArtifactRegisterError } from "./artifact-register.mjs";
|
|
4
|
+
export { SupaCloudArtifactLinkError } from "./artifact-link.mjs";
|
|
5
|
+
export type SupaCloudArtifactJson = Record<string, unknown>;
|
|
6
|
+
export interface SupaCloudArtifactParent {
|
|
7
|
+
artifactId: string;
|
|
8
|
+
relationType: string;
|
|
9
|
+
metadata: SupaCloudArtifactJson;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SupaCloudArtifact {
|
|
13
|
+
artifactId: string;
|
|
14
|
+
bucketId: string;
|
|
15
|
+
objectPath: string;
|
|
16
|
+
objectVersion: string;
|
|
17
|
+
artifactType: string;
|
|
18
|
+
sha256: string;
|
|
19
|
+
sizeBytes: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
metadata: SupaCloudArtifactJson;
|
|
22
|
+
retentionUntil: string | null;
|
|
23
|
+
createdBy: string | null;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
idempotent: boolean;
|
|
26
|
+
parents: SupaCloudArtifactParent[];
|
|
27
|
+
}
|
|
28
|
+
export interface SupaCloudArtifactRegisterRequest {
|
|
29
|
+
artifactId: string;
|
|
30
|
+
bucketId: string;
|
|
31
|
+
objectPath: string;
|
|
32
|
+
artifactType: string;
|
|
33
|
+
sha256: string;
|
|
34
|
+
sizeBytes: string | number;
|
|
35
|
+
mimeType: string;
|
|
36
|
+
metadata?: SupaCloudArtifactJson;
|
|
37
|
+
retentionUntil?: string;
|
|
38
|
+
createdBy?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SupaCloudArtifactLinkRequest {
|
|
41
|
+
parentArtifactId: string;
|
|
42
|
+
childArtifactId: string;
|
|
43
|
+
relationType: string;
|
|
44
|
+
metadata?: SupaCloudArtifactJson;
|
|
45
|
+
}
|
|
46
|
+
/** Service-role-only immutable Storage artifact registry client. */
|
|
47
|
+
export declare class SupaCloudArtifactsClient<TClient extends SupabaseClient = SupabaseClient> {
|
|
48
|
+
private readonly supabase;
|
|
49
|
+
constructor(supabase: TClient);
|
|
50
|
+
register(request: SupaCloudArtifactRegisterRequest): Promise<SupaCloudArtifact>;
|
|
51
|
+
get(artifactId: string): Promise<SupaCloudArtifact | null>;
|
|
52
|
+
link(request: SupaCloudArtifactLinkRequest): Promise<SupaCloudArtifact>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type FetchTransport = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
export type SupaCloudOAuthFetchOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Public OAuth client identifier registered with SupAuth. Leave empty for a
|
|
5
|
+
* standard single-project Supabase deployment; the transport then becomes a
|
|
6
|
+
* transparent pass-through.
|
|
7
|
+
*/
|
|
8
|
+
clientId?: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* OAuth token endpoint. When omitted, `/auth/v1/oauth/token` is derived from
|
|
11
|
+
* the Supabase Auth refresh URL origin.
|
|
12
|
+
*/
|
|
13
|
+
tokenEndpoint?: string;
|
|
14
|
+
/** Injectable transport for tests or runtimes with a custom fetch. */
|
|
15
|
+
fetch?: FetchTransport;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Adapts Supabase Auth's built-in refresh request to SupAuth's OAuth token
|
|
19
|
+
* contract while leaving every other supabase-js request untouched.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* createClient(authUrl, anonKey, {
|
|
23
|
+
* global: { fetch: createSupaCloudOAuthFetch({ clientId }) },
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSupaCloudOAuthFetch(options?: SupaCloudOAuthFetchOptions): FetchTransport;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FetchTransport } from "./bounded-rpc-fetch.mjs";
|
|
2
|
+
export interface SupaCloudCommandFetchOptions {
|
|
3
|
+
fetch?: FetchTransport;
|
|
4
|
+
}
|
|
5
|
+
/** Install in Supabase's global.fetch to bound command responses before JSON parsing. */
|
|
6
|
+
export declare function createSupaCloudCommandFetch(options?: SupaCloudCommandFetchOptions): FetchTransport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CommandLookup, type CommandStatus } from "@supacloud/contracts";
|
|
2
|
-
import { SupaCloudApiError } from "./api-error.
|
|
2
|
+
import { SupaCloudApiError } from "./api-error.cjs";
|
|
3
3
|
export declare class SupaCloudCommandReadError extends SupaCloudApiError {
|
|
4
4
|
readonly mutationMayHaveApplied = false;
|
|
5
5
|
constructor();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CommandLookup, type CommandStatus } from "@supacloud/contracts";
|
|
2
|
+
import { SupaCloudApiError } from "./api-error.mjs";
|
|
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
|
+
}
|
|
21
|
+
export interface SupaCloudCommandSubmitRequest {
|
|
22
|
+
commandId: string;
|
|
23
|
+
commandType: string;
|
|
24
|
+
targetType: string;
|
|
25
|
+
targetId: string;
|
|
26
|
+
actorId?: string;
|
|
27
|
+
/** Required, together with actorId, when binding a submission to a durable executor. */
|
|
28
|
+
tenantId?: string;
|
|
29
|
+
payload?: Record<string, unknown>;
|
|
30
|
+
maxAttempts?: number;
|
|
31
|
+
}
|
|
32
|
+
export type SupaCloudCommandReceipt = CommandStatus;
|
|
33
|
+
/**
|
|
34
|
+
* Service-role-only transactional command receipt client. Application-owned
|
|
35
|
+
* database RPCs can call `supacloud_commands.submit` directly inside a larger
|
|
36
|
+
* transaction when the domain write and durable enqueue must commit together.
|
|
37
|
+
*/
|
|
38
|
+
export declare class SupaCloudCommandsClient<TClient extends CommandRpcClient = CommandRpcClient> {
|
|
39
|
+
private readonly supabase;
|
|
40
|
+
constructor(supabase: TClient);
|
|
41
|
+
submit(request: SupaCloudCommandSubmitRequest): Promise<SupaCloudCommandReceipt>;
|
|
42
|
+
get(lookup: string | CommandLookup): Promise<SupaCloudCommandReceipt | null>;
|
|
43
|
+
private request;
|
|
44
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
function __accessProp(key) {
|
|
6
|
+
return this[key];
|
|
7
|
+
}
|
|
8
|
+
var __toCommonJS = (from) => {
|
|
9
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
+
if (entry)
|
|
11
|
+
return entry;
|
|
12
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(entry, key))
|
|
16
|
+
__defProp(entry, key, {
|
|
17
|
+
get: __accessProp.bind(from, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
__moduleCache.set(from, entry);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
var __moduleCache;
|
|
25
|
+
var __returnValue = (v) => v;
|
|
26
|
+
function __exportSetter(name, newValue) {
|
|
27
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
+
}
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
set: __exportSetter.bind(all, name)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/contracts.ts
|
|
40
|
+
var exports_contracts = {};
|
|
41
|
+
__export(exports_contracts, {
|
|
42
|
+
CommandAuthenticationError: () => import_client.CommandAuthenticationError,
|
|
43
|
+
createAuthenticatedFetch: () => import_client.createAuthenticatedFetch,
|
|
44
|
+
createAuthoritativeCommandClient: () => import_client.createAuthoritativeCommandClient,
|
|
45
|
+
createCommandScope: () => import_client.createCommandScope
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(exports_contracts);
|
|
48
|
+
var import_client = require("@supacloud/contracts/client");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createAuthoritativeCommandClient, createAuthenticatedFetch, createCommandScope, CommandAuthenticationError, type AuthoritativeCommandContract, type AuthoritativeCommandOutcome, type AuthoritativeCommandTransport, type CommandAcknowledgement, type CommandDiagnostic, type CommandAttempt, type CommandScope, type SingleAttemptFetch, } from "@supacloud/contracts/client";
|