@supacloud/js 0.33.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 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/js",
3
- "version": "0.33.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",