@voltro/protocol 0.69.1 → 0.71.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/CHANGELOG.md +1369 -111
- package/dist/apikey.d.ts +5 -0
- package/dist/index.d.ts +770 -23
- package/dist/index.js +615 -567
- package/dist/inspect.d.ts +100 -0
- package/dist/inspect.js +160 -0
- package/dist/jwt.d.ts +5 -0
- package/dist/rest.d.ts +464 -21
- package/dist/rest.js +408 -174
- package/dist/restFormat-ChSVyufA.js +287 -0
- package/dist/{scopes-DVtiKKsm.js → scopes-CW9_LbDO.js} +69 -40
- package/dist/session.d.ts +19 -8
- package/dist/session.js +6 -6
- package/package.json +9 -4
- package/dist/serverErrorBus-BTnTpMqj.js +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"description": "The Voltro wire + plugin contract — defineQuery/Mutation/Action/Stream, definePlugin, sessions / JWT / API-keys, and the RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -48,7 +48,12 @@
|
|
|
48
48
|
"import": "./dist/identity.js",
|
|
49
49
|
"default": "./dist/identity.js"
|
|
50
50
|
},
|
|
51
|
-
"./package.json": "./package.json"
|
|
51
|
+
"./package.json": "./package.json",
|
|
52
|
+
"./inspect": {
|
|
53
|
+
"types": "./dist/inspect.d.ts",
|
|
54
|
+
"import": "./dist/inspect.js",
|
|
55
|
+
"default": "./dist/inspect.js"
|
|
56
|
+
}
|
|
52
57
|
},
|
|
53
58
|
"main": "./dist/index.js",
|
|
54
59
|
"module": "./dist/index.js",
|
|
@@ -59,8 +64,8 @@
|
|
|
59
64
|
},
|
|
60
65
|
"dependencies": {
|
|
61
66
|
"@effect/sql": "^0.52.1",
|
|
62
|
-
"@voltro/database": "0.
|
|
63
|
-
"@voltro/logger": "0.
|
|
67
|
+
"@voltro/database": "0.71.0",
|
|
68
|
+
"@voltro/logger": "0.71.0",
|
|
64
69
|
"jose": "^6.2.10"
|
|
65
70
|
},
|
|
66
71
|
"peerDependencies": {
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Schema as e } from "effect";
|
|
2
|
-
//#region src/idempotency.ts
|
|
3
|
-
var t = (e, t, n) => `${e ?? "(global)"}|${t.toUpperCase()}|${n}`, n = (e, t, n, r) => r === void 0 ? `${e ?? "(global)"}|${t ?? "(anon)"}|WS|${n}` : `WS-connection:${JSON.stringify([
|
|
4
|
-
e ?? null,
|
|
5
|
-
t ?? null,
|
|
6
|
-
n,
|
|
7
|
-
r
|
|
8
|
-
])}`, r = class extends e.TaggedError()("MutationConnectionRequired", { traceId: e.String }) {
|
|
9
|
-
get message() {
|
|
10
|
-
return "this mutation requires a live native WebSocket connection";
|
|
11
|
-
}
|
|
12
|
-
}, i = async (e, t, n, r, i) => {
|
|
13
|
-
let a = await e.claim(t, n, i, r);
|
|
14
|
-
return a === "claimed" ? { kind: "fresh" } : a.status === "completed" && a.response ? {
|
|
15
|
-
kind: "replay",
|
|
16
|
-
response: a.response
|
|
17
|
-
} : { kind: "conflict" };
|
|
18
|
-
}, a = (e, t, n, r, i) => e.complete(t, n, r, i), o = (e, t, n) => e.release(t, n), s = () => {
|
|
19
|
-
let e = /* @__PURE__ */ new Map(), t = (e, t) => `${e}\u0000${t}`;
|
|
20
|
-
return {
|
|
21
|
-
get: async (n, r) => e.get(t(n, r)) ?? null,
|
|
22
|
-
claim: async (n, r, i, a) => {
|
|
23
|
-
let o = e.get(t(n, r));
|
|
24
|
-
return o && i - o.createdAt < a ? o : (e.set(t(n, r), {
|
|
25
|
-
scope: n,
|
|
26
|
-
key: r,
|
|
27
|
-
status: "in_flight",
|
|
28
|
-
response: null,
|
|
29
|
-
createdAt: i
|
|
30
|
-
}), "claimed");
|
|
31
|
-
},
|
|
32
|
-
complete: async (n, r, i, a) => {
|
|
33
|
-
e.set(t(n, r), {
|
|
34
|
-
scope: n,
|
|
35
|
-
key: r,
|
|
36
|
-
status: "completed",
|
|
37
|
-
response: i,
|
|
38
|
-
createdAt: a
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
release: async (n, r) => {
|
|
42
|
-
e.delete(t(n, r));
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}, c = class extends e.TaggedError()("MutationInFlight", {
|
|
46
|
-
traceId: e.String,
|
|
47
|
-
retryAfterMs: e.Number
|
|
48
|
-
}) {
|
|
49
|
-
get message() {
|
|
50
|
-
return `a request with this idempotency key is still in flight — replay the same key after ${this.retryAfterMs}ms`;
|
|
51
|
-
}
|
|
52
|
-
}, l = 1e3, u = /* @__PURE__ */ new Set(), d = (e) => {
|
|
53
|
-
for (let t of u) try {
|
|
54
|
-
t(e);
|
|
55
|
-
} catch {}
|
|
56
|
-
}, f = (e) => (u.add(e), () => {
|
|
57
|
-
u.delete(e);
|
|
58
|
-
});
|
|
59
|
-
//#endregion
|
|
60
|
-
export { c as a, a as c, n as d, r as i, t as l, f as n, i as o, l as r, o as s, d as t, s as u };
|