@supacloud/js 0.32.0 → 0.34.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 +30 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.js +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -21,6 +21,36 @@ It does **not** replace [`@supabase/supabase-js`](https://www.npmjs.com/package/
|
|
|
21
21
|
npm install @supacloud/js @supabase/supabase-js
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Browser Command Contracts
|
|
25
|
+
|
|
26
|
+
Applications that already use this SDK can import the existing framework-neutral
|
|
27
|
+
command client from `@supacloud/js/contracts`. This optional browser entrypoint
|
|
28
|
+
re-exports selected `@supacloud/contracts/client` APIs without loading the platform
|
|
29
|
+
SDK, Supabase, Angular, Svelte, a database driver or browser storage.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import {
|
|
33
|
+
createAuthoritativeCommandClient,
|
|
34
|
+
createAuthenticatedFetch,
|
|
35
|
+
createCommandScope,
|
|
36
|
+
} from "@supacloud/js/contracts";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
There is no second command engine or new transport protocol. Input, acknowledgement
|
|
40
|
+
and authoritative result decoders remain application-owned. The client sends at
|
|
41
|
+
most one write and performs at most one read-only confirmation per invocation;
|
|
42
|
+
an `unknown` outcome never authorizes a write retry.
|
|
43
|
+
|
|
44
|
+
This is **not** `supacloud.commands`: that namespace calls service-role-only
|
|
45
|
+
database RPCs and must not be wired into a browser admin action. Keep credentials,
|
|
46
|
+
authorization, transactions, receipts and idempotency on the trusted server.
|
|
47
|
+
The SDK root and existing task adapters are unchanged.
|
|
48
|
+
|
|
49
|
+
See [svadmin integration](../../docs/svadmin-sdk-integration.md) for ownership,
|
|
50
|
+
Svelte lifecycle integration, SDK compatibility gates and the next contract
|
|
51
|
+
generation steps. This entrypoint is additive; it does not make an older svadmin
|
|
52
|
+
peer range compatible with a newer SDK.
|
|
53
|
+
|
|
24
54
|
## Quick Start
|
|
25
55
|
|
|
26
56
|
```ts
|
|
@@ -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";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/contracts.ts
|
|
2
|
+
import {
|
|
3
|
+
createAuthoritativeCommandClient,
|
|
4
|
+
createAuthenticatedFetch,
|
|
5
|
+
createCommandScope,
|
|
6
|
+
CommandAuthenticationError
|
|
7
|
+
} from "@supacloud/contracts/client";
|
|
8
|
+
export {
|
|
9
|
+
CommandAuthenticationError,
|
|
10
|
+
createAuthenticatedFetch,
|
|
11
|
+
createAuthoritativeCommandClient,
|
|
12
|
+
createCommandScope
|
|
13
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2504,7 +2504,7 @@ function createQueryString(filters = {}) {
|
|
|
2504
2504
|
} catch {
|
|
2505
2505
|
throw new Error("Invalid task list filters");
|
|
2506
2506
|
}
|
|
2507
|
-
if (Object.keys(captured).some((key) => !["status", "taskType", "functionSlug", "dlq", "limit"].includes(key))) {
|
|
2507
|
+
if (Object.keys(captured).some((key) => !["status", "taskType", "functionSlug", "correlationId", "businessTaskId", "dlq", "limit"].includes(key))) {
|
|
2508
2508
|
throw new Error("Invalid task list filters");
|
|
2509
2509
|
}
|
|
2510
2510
|
const text = (value, commaAllowed = false) => {
|
|
@@ -2531,6 +2531,10 @@ function createQueryString(filters = {}) {
|
|
|
2531
2531
|
params.set("task_type", values(captured.taskType).join(","));
|
|
2532
2532
|
if (Object.hasOwn(captured, "functionSlug"))
|
|
2533
2533
|
params.set("function_slug", text(captured.functionSlug, true));
|
|
2534
|
+
if (Object.hasOwn(captured, "correlationId"))
|
|
2535
|
+
params.set("correlation_id", text(captured.correlationId));
|
|
2536
|
+
if (Object.hasOwn(captured, "businessTaskId"))
|
|
2537
|
+
params.set("business_task_id", text(captured.businessTaskId));
|
|
2534
2538
|
if (Object.hasOwn(captured, "dlq")) {
|
|
2535
2539
|
if (typeof captured.dlq !== "boolean")
|
|
2536
2540
|
throw new Error("Invalid task list filters");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Platform SDK for SupaCloud, built on top of supabase-js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/task-events.d.ts",
|
|
17
17
|
"import": "./dist/task-events.js",
|
|
18
18
|
"default": "./dist/task-events.js"
|
|
19
|
+
},
|
|
20
|
+
"./contracts": {
|
|
21
|
+
"types": "./dist/contracts.d.ts",
|
|
22
|
+
"import": "./dist/contracts.js",
|
|
23
|
+
"default": "./dist/contracts.js"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
"scripts": {
|
|
26
31
|
"test": "bun test",
|
|
27
32
|
"build": "bun run clean && bun run build:js && bun run build:types",
|
|
28
|
-
"build:js": "bun build src/index.ts src/task-events.ts --outdir dist --target node --external @supabase/supabase-js --external @supacloud/contracts",
|
|
33
|
+
"build:js": "bun build src/index.ts src/task-events.ts --outdir dist --target node --external @supabase/supabase-js --external @supacloud/contracts && bun build src/contracts.ts --outdir dist --target browser --external @supacloud/contracts",
|
|
29
34
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
30
35
|
"clean": "rm -rf dist",
|
|
31
36
|
"prepublishOnly": "bun run build",
|
|
@@ -50,7 +55,7 @@
|
|
|
50
55
|
"@supabase/supabase-js": "^2.115.0"
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
53
|
-
"@supacloud/contracts": "0.
|
|
58
|
+
"@supacloud/contracts": "0.5.0"
|
|
54
59
|
},
|
|
55
60
|
"devDependencies": {
|
|
56
61
|
"@types/bun": "^1.4.2",
|