@invisible-labs/sdk 0.6.0-devnet.1
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 +210 -0
- package/dist/chunk-7DSVN3MV.js +1145 -0
- package/dist/chunk-7DSVN3MV.js.map +1 -0
- package/dist/chunk-JNNVPZEU.js +599 -0
- package/dist/chunk-JNNVPZEU.js.map +1 -0
- package/dist/chunk-JRMKCE3S.js +50 -0
- package/dist/chunk-JRMKCE3S.js.map +1 -0
- package/dist/chunk-LBC7ALYO.js +3783 -0
- package/dist/chunk-LBC7ALYO.js.map +1 -0
- package/dist/chunk-NCY4FCYU.js +1911 -0
- package/dist/chunk-NCY4FCYU.js.map +1 -0
- package/dist/chunk-OHIM2YWU.js +126 -0
- package/dist/chunk-OHIM2YWU.js.map +1 -0
- package/dist/chunk-SZAYO2L5.js +123 -0
- package/dist/chunk-SZAYO2L5.js.map +1 -0
- package/dist/chunk-TQNNTV5F.js +17 -0
- package/dist/chunk-TQNNTV5F.js.map +1 -0
- package/dist/chunk-VR6T6OJS.js +24 -0
- package/dist/chunk-VR6T6OJS.js.map +1 -0
- package/dist/chunk-XUWBGET5.js +221 -0
- package/dist/chunk-XUWBGET5.js.map +1 -0
- package/dist/coordinator-7Y45MCCZ.js +4 -0
- package/dist/coordinator-7Y45MCCZ.js.map +1 -0
- package/dist/createSession-D3ym-Ira.d.ts +177 -0
- package/dist/dkgWorker.d.ts +2 -0
- package/dist/dkgWorker.js +61 -0
- package/dist/dkgWorker.js.map +1 -0
- package/dist/events.d.ts +54 -0
- package/dist/events.js +143 -0
- package/dist/events.js.map +1 -0
- package/dist/frostRuntime-JESDHN6O.js +4 -0
- package/dist/frostRuntime-JESDHN6O.js.map +1 -0
- package/dist/index.d.ts +499 -0
- package/dist/index.js +132 -0
- package/dist/index.js.map +1 -0
- package/dist/lp.d.ts +388 -0
- package/dist/lp.js +1711 -0
- package/dist/lp.js.map +1 -0
- package/dist/presets.d.ts +43 -0
- package/dist/presets.js +70 -0
- package/dist/presets.js.map +1 -0
- package/dist/session-DFuy54C-.d.ts +31 -0
- package/dist/stats.d.ts +47 -0
- package/dist/stats.js +21 -0
- package/dist/stats.js.map +1 -0
- package/dist/storage.d.ts +82 -0
- package/dist/storage.js +246 -0
- package/dist/storage.js.map +1 -0
- package/dist/types-ZhV7TIQY.d.ts +76 -0
- package/dist/types.generated-CHGSbmLp.d.ts +67 -0
- package/dist/user.d.ts +377 -0
- package/dist/user.js +1225 -0
- package/dist/user.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ensureFrostWasm, loadFrost } from './chunk-JNNVPZEU.js';
|
|
2
|
+
import './chunk-VR6T6OJS.js';
|
|
3
|
+
|
|
4
|
+
// src/lp/dkgWorker.ts
|
|
5
|
+
var LP_ID = 1;
|
|
6
|
+
var TEE_ID = 2;
|
|
7
|
+
var round1ById = /* @__PURE__ */ new Map();
|
|
8
|
+
self.onmessage = (event) => {
|
|
9
|
+
void run(event.data).catch((error) => {
|
|
10
|
+
post({
|
|
11
|
+
id: event.data.id,
|
|
12
|
+
type: "error",
|
|
13
|
+
error: errorMessage(error, "LP DKG worker failed.")
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
async function run(input) {
|
|
18
|
+
await ensureFrostWasm();
|
|
19
|
+
const { dkgRound1 } = await loadFrost();
|
|
20
|
+
if (input.type === "round1") {
|
|
21
|
+
const lpRound12 = dkgRound1(LP_ID);
|
|
22
|
+
round1ById.set(input.id, lpRound12);
|
|
23
|
+
post({
|
|
24
|
+
id: input.id,
|
|
25
|
+
type: "round1",
|
|
26
|
+
package: Array.from(lpRound12.round1PackageBytes())
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const lpRound1 = round1ById.get(input.id);
|
|
31
|
+
if (lpRound1 === void 0) {
|
|
32
|
+
throw new Error("LP DKG round1 state not found");
|
|
33
|
+
}
|
|
34
|
+
round1ById.delete(input.id);
|
|
35
|
+
const teeRound1 = Uint8Array.from(input.teeRound1);
|
|
36
|
+
const teeRound2ForLp = Uint8Array.from(input.teeRound2ForLp);
|
|
37
|
+
const lpRound2 = lpRound1.intoRound2(TEE_ID, teeRound1);
|
|
38
|
+
const lpRound2Bytes = lpRound2.round2PackageBytesFor(TEE_ID);
|
|
39
|
+
const lpKeyHandle = lpRound2.intoRound3(TEE_ID, teeRound1, teeRound2ForLp);
|
|
40
|
+
try {
|
|
41
|
+
post({
|
|
42
|
+
id: input.id,
|
|
43
|
+
type: "round2",
|
|
44
|
+
package: Array.from(lpRound2Bytes),
|
|
45
|
+
delegatedShare: Array.from(lpKeyHandle.secretShareBytes()),
|
|
46
|
+
jointPubkey: Array.from(lpKeyHandle.groupPublicKeyBytes())
|
|
47
|
+
});
|
|
48
|
+
} finally {
|
|
49
|
+
lpKeyHandle.abort();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function post(message) {
|
|
53
|
+
self.postMessage(message);
|
|
54
|
+
}
|
|
55
|
+
function errorMessage(error, fallback) {
|
|
56
|
+
if (error instanceof Error && error.message.length > 0) return error.message;
|
|
57
|
+
if (typeof error === "string" && error.length > 0) return error;
|
|
58
|
+
return fallback;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=dkgWorker.js.map
|
|
61
|
+
//# sourceMappingURL=dkgWorker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lp/dkgWorker.ts"],"names":["lpRound1"],"mappings":";;;;AAGA,IAAM,KAAA,GAAQ,CAAA;AACd,IAAM,MAAA,GAAS,CAAA;AAiCf,IAAM,UAAA,uBAAiB,GAAA,EAA4B;AAEnD,IAAA,CAAK,SAAA,GAAY,CAAC,KAAA,KAA4C;AAC5D,EAAA,KAAK,IAAI,KAAA,CAAM,IAAI,CAAA,CAAE,KAAA,CAAM,CAAC,KAAA,KAAU;AACpC,IAAA,IAAA,CAAK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,WAAA,GAAc,QAAA,CAAS,UAAA,CAAW,MAAA,EAAQ,WAAW,cAAc,CAAA;AACzE,EAAA,IAAI;AACF,IAAA,IAAA,CAAK;AAAA,MACH,IAAI,KAAA,CAAM,EAAA;AAAA,MACV,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS,KAAA,CAAM,IAAA,CAAK,aAAa,CAAA;AAAA,MACjC,cAAA,EAAgB,KAAA,CAAM,IAAA,CAAK,WAAA,CAAY,kBAAkB,CAAA;AAAA,MACzD,WAAA,EAAa,KAAA,CAAM,IAAA,CAAK,WAAA,CAAY,qBAAqB;AAAA,KAC1D,CAAA;AAAA,EACH,CAAA,SAAE;AACA,IAAA,WAAA,CAAY,KAAA,EAAM;AAAA,EACpB;AACF;AAEA,SAAS,KAAK,OAAA,EAAoC;AAChD,EAAA,IAAA,CAAK,YAAY,OAAO,CAAA;AAC1B;AAEA,SAAS,YAAA,CAAa,OAAgB,QAAA,EAA0B;AAC9D,EAAA,IAAI,iBAAiB,KAAA,IAAS,KAAA,CAAM,QAAQ,MAAA,GAAS,CAAA,SAAU,KAAA,CAAM,OAAA;AACrE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,MAAA,GAAS,GAAG,OAAO,KAAA;AAC1D,EAAA,OAAO,QAAA;AACT","file":"dkgWorker.js","sourcesContent":["import type { DkgRound1State } from \"frost\";\nimport { ensureFrostWasm, loadFrost } from \"../frost/frostRuntime.js\";\n\nconst LP_ID = 1;\nconst TEE_ID = 2;\n\ntype LpDkgWorkerRequest =\n | {\n id: string;\n type: \"round1\";\n }\n | {\n id: string;\n type: \"round2\";\n teeRound1: number[];\n teeRound2ForLp: number[];\n };\n\ntype LpDkgWorkerResponse =\n | {\n id: string;\n type: \"round1\";\n package: number[];\n }\n | {\n id: string;\n type: \"round2\";\n package: number[];\n delegatedShare: number[];\n jointPubkey: number[];\n }\n | {\n id: string;\n type: \"error\";\n error: string;\n };\n\nconst round1ById = new Map<string, DkgRound1State>();\n\nself.onmessage = (event: MessageEvent<LpDkgWorkerRequest>) => {\n void run(event.data).catch((error) => {\n post({\n id: event.data.id,\n type: \"error\",\n error: errorMessage(error, \"LP DKG worker failed.\"),\n });\n });\n};\n\nasync function run(input: LpDkgWorkerRequest): Promise<void> {\n await ensureFrostWasm();\n const { dkgRound1 } = await loadFrost();\n if (input.type === \"round1\") {\n const lpRound1 = dkgRound1(LP_ID);\n round1ById.set(input.id, lpRound1);\n post({\n id: input.id,\n type: \"round1\",\n package: Array.from(lpRound1.round1PackageBytes()),\n });\n return;\n }\n\n const lpRound1 = round1ById.get(input.id);\n if (lpRound1 === undefined) {\n throw new Error(\"LP DKG round1 state not found\");\n }\n round1ById.delete(input.id);\n\n const teeRound1 = Uint8Array.from(input.teeRound1);\n const teeRound2ForLp = Uint8Array.from(input.teeRound2ForLp);\n const lpRound2 = lpRound1.intoRound2(TEE_ID, teeRound1);\n const lpRound2Bytes = lpRound2.round2PackageBytesFor(TEE_ID);\n const lpKeyHandle = lpRound2.intoRound3(TEE_ID, teeRound1, teeRound2ForLp);\n try {\n post({\n id: input.id,\n type: \"round2\",\n package: Array.from(lpRound2Bytes),\n delegatedShare: Array.from(lpKeyHandle.secretShareBytes()),\n jointPubkey: Array.from(lpKeyHandle.groupPublicKeyBytes()),\n });\n } finally {\n lpKeyHandle.abort();\n }\n}\n\nfunction post(message: LpDkgWorkerResponse): void {\n self.postMessage(message);\n}\n\nfunction errorMessage(error: unknown, fallback: string): string {\n if (error instanceof Error && error.message.length > 0) return error.message;\n if (typeof error === \"string\" && error.length > 0) return error;\n return fallback;\n}\n"]}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { S as Session } from './session-DFuy54C-.js';
|
|
2
|
+
import { U as Unsubscribe } from './types-ZhV7TIQY.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `@invisible-labs/sdk/events` - sync subscriptions (spec section 4.6).
|
|
6
|
+
*
|
|
7
|
+
* Handlers receive only routing and refresh metadata, never status payloads.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type SyncRequiredWireSubjectKind = "contract" | "lp_position";
|
|
11
|
+
declare const SUBJECT_TYPE_TO_WIRE_KIND: {
|
|
12
|
+
readonly transfer: "contract";
|
|
13
|
+
readonly lpPosition: "lp_position";
|
|
14
|
+
};
|
|
15
|
+
type EventSubjectType = keyof typeof SUBJECT_TYPE_TO_WIRE_KIND;
|
|
16
|
+
type ContractSyncRequiredEventKind = "contract_requested" | "request_expired" | "contract_activated" | "match_requested" | "reserved" | "settlement_pending" | "partially_fulfilled" | "fulfilled" | "refund_requested" | "refunded" | "source_liquidity_updated" | "withdrawal_requested" | "withdrawal_finalized";
|
|
17
|
+
type LpPositionSyncRequiredEventKind = "match_requested" | "reserved" | "withdrawal_requested" | "withdrawal_finalized" | "reimbursement_finalized";
|
|
18
|
+
type SyncRequiredEventKind = ContractSyncRequiredEventKind | LpPositionSyncRequiredEventKind;
|
|
19
|
+
type SyncRequiredPayload = {
|
|
20
|
+
readonly subject: {
|
|
21
|
+
readonly kind: SyncRequiredWireSubjectKind;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
};
|
|
24
|
+
readonly event_kind: SyncRequiredEventKind;
|
|
25
|
+
readonly state_version: number;
|
|
26
|
+
readonly created_at_ms: number;
|
|
27
|
+
readonly sync_required: true;
|
|
28
|
+
};
|
|
29
|
+
/** The authorized subject of a subscription. */
|
|
30
|
+
interface EventSubject {
|
|
31
|
+
readonly subjectType: EventSubjectType;
|
|
32
|
+
readonly subjectId: string;
|
|
33
|
+
}
|
|
34
|
+
/** Routing and refresh metadata delivered to subscribers. Carries no status payload. */
|
|
35
|
+
interface EventEnvelope {
|
|
36
|
+
readonly subjectType: EventSubjectType;
|
|
37
|
+
readonly subjectId: string;
|
|
38
|
+
readonly stateVersion: number;
|
|
39
|
+
readonly eventKind: SyncRequiredPayload["event_kind"];
|
|
40
|
+
readonly createdAtMs: number;
|
|
41
|
+
readonly syncRequired: true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Subscribe to live sync-required hints for an authorized subject.
|
|
45
|
+
*/
|
|
46
|
+
declare function subscribe(session: Session, subject: EventSubject, handler: (envelope: EventEnvelope) => void): Unsubscribe;
|
|
47
|
+
/**
|
|
48
|
+
* Detach all handlers registered through this module for a subject.
|
|
49
|
+
*/
|
|
50
|
+
declare function unsubscribe(session: Session, subject: EventSubject): void;
|
|
51
|
+
/** Reconnect notifications are deferred until same-session re-establishment exists. */
|
|
52
|
+
declare function onReconnect(_session: Session, _handler: () => void): Unsubscribe;
|
|
53
|
+
|
|
54
|
+
export { type EventEnvelope, type EventSubject, onReconnect, subscribe, unsubscribe };
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { onEnvelope, EnvelopeKind, CoordinatorMessageType } from './chunk-XUWBGET5.js';
|
|
2
|
+
import './chunk-JRMKCE3S.js';
|
|
3
|
+
import { NotImplementedError } from './chunk-OHIM2YWU.js';
|
|
4
|
+
import './chunk-VR6T6OJS.js';
|
|
5
|
+
|
|
6
|
+
// src/events/index.ts
|
|
7
|
+
var SUBJECT_TYPE_TO_WIRE_KIND = {
|
|
8
|
+
transfer: "contract",
|
|
9
|
+
lpPosition: "lp_position"
|
|
10
|
+
};
|
|
11
|
+
var ON_RECONNECT_COMMAND = "events.onReconnect";
|
|
12
|
+
var CONTRACT_SYNC_REQUIRED_EVENT_KIND_VALUES = [
|
|
13
|
+
"contract_requested",
|
|
14
|
+
"request_expired",
|
|
15
|
+
"contract_activated",
|
|
16
|
+
"match_requested",
|
|
17
|
+
"reserved",
|
|
18
|
+
"settlement_pending",
|
|
19
|
+
"partially_fulfilled",
|
|
20
|
+
"fulfilled",
|
|
21
|
+
"refund_requested",
|
|
22
|
+
"refunded",
|
|
23
|
+
"source_liquidity_updated",
|
|
24
|
+
"withdrawal_requested",
|
|
25
|
+
"withdrawal_finalized"
|
|
26
|
+
];
|
|
27
|
+
var LP_POSITION_SYNC_REQUIRED_EVENT_KIND_VALUES = [
|
|
28
|
+
"match_requested",
|
|
29
|
+
"reserved",
|
|
30
|
+
"withdrawal_requested",
|
|
31
|
+
"withdrawal_finalized",
|
|
32
|
+
"reimbursement_finalized"
|
|
33
|
+
];
|
|
34
|
+
var SYNC_REQUIRED_EVENT_KINDS_BY_WIRE_KIND = {
|
|
35
|
+
contract: new Set(CONTRACT_SYNC_REQUIRED_EVENT_KIND_VALUES),
|
|
36
|
+
lp_position: new Set(LP_POSITION_SYNC_REQUIRED_EVENT_KIND_VALUES)
|
|
37
|
+
};
|
|
38
|
+
var subscriptionRegistry = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
function subscribe(session, subject, handler) {
|
|
40
|
+
assertSubject(subject);
|
|
41
|
+
const expectedWireKind = SUBJECT_TYPE_TO_WIRE_KIND[subject.subjectType];
|
|
42
|
+
const unsubscribeEnvelope = onEnvelope(session, (envelope) => {
|
|
43
|
+
if (envelope.kind !== EnvelopeKind.PUSH || envelope.type !== CoordinatorMessageType.SyncRequired) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const payload = envelope.payload;
|
|
47
|
+
if (!isSyncRequiredPayload(payload)) return;
|
|
48
|
+
if (payload.subject.kind !== expectedWireKind || payload.subject.id !== subject.subjectId)
|
|
49
|
+
return;
|
|
50
|
+
notifyEventHandler(handler, {
|
|
51
|
+
subjectType: subject.subjectType,
|
|
52
|
+
subjectId: subject.subjectId,
|
|
53
|
+
stateVersion: payload.state_version,
|
|
54
|
+
eventKind: payload.event_kind,
|
|
55
|
+
createdAtMs: payload.created_at_ms,
|
|
56
|
+
syncRequired: true
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
registerSubscription(session, subject, unsubscribeEnvelope);
|
|
60
|
+
return () => {
|
|
61
|
+
unregisterSubscription(session, subject, unsubscribeEnvelope);
|
|
62
|
+
unsubscribeEnvelope();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function unsubscribe(session, subject) {
|
|
66
|
+
assertSubject(subject);
|
|
67
|
+
const subscriptions = subscriptionRegistry.get(session);
|
|
68
|
+
const subjectKey = subscriptionKey(subject);
|
|
69
|
+
const unsubscribers = subscriptions?.get(subjectKey);
|
|
70
|
+
if (!subscriptions || !unsubscribers) return;
|
|
71
|
+
subscriptions.delete(subjectKey);
|
|
72
|
+
for (const unsubscribeEnvelope of unsubscribers) unsubscribeEnvelope();
|
|
73
|
+
if (subscriptions.size === 0) subscriptionRegistry.delete(session);
|
|
74
|
+
}
|
|
75
|
+
function onReconnect(_session, _handler) {
|
|
76
|
+
throw new NotImplementedError(ON_RECONNECT_COMMAND);
|
|
77
|
+
}
|
|
78
|
+
function assertSubject(subject) {
|
|
79
|
+
if (!(subject.subjectType in SUBJECT_TYPE_TO_WIRE_KIND)) {
|
|
80
|
+
throw new TypeError(`unknown event subject type: ${String(subject.subjectType)}`);
|
|
81
|
+
}
|
|
82
|
+
if (subject.subjectId.length === 0) {
|
|
83
|
+
throw new TypeError("event subject id is required");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function isSyncRequiredPayload(payload) {
|
|
87
|
+
if (typeof payload !== "object" || payload === null) return false;
|
|
88
|
+
if (!("subject" in payload) || typeof payload.subject !== "object" || payload.subject === null) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (!("kind" in payload.subject) || typeof payload.subject.kind !== "string") return false;
|
|
92
|
+
if (!isSyncRequiredWireSubjectKind(payload.subject.kind)) return false;
|
|
93
|
+
if (!("id" in payload.subject) || typeof payload.subject.id !== "string") return false;
|
|
94
|
+
if (!("event_kind" in payload) || typeof payload.event_kind !== "string") return false;
|
|
95
|
+
if (!isAllowedSyncRequiredEventKind(payload.subject.kind, payload.event_kind)) return false;
|
|
96
|
+
return "state_version" in payload && typeof payload.state_version === "number" && "created_at_ms" in payload && typeof payload.created_at_ms === "number" && "sync_required" in payload && payload.sync_required === true;
|
|
97
|
+
}
|
|
98
|
+
function isSyncRequiredWireSubjectKind(kind) {
|
|
99
|
+
return Object.values(SUBJECT_TYPE_TO_WIRE_KIND).includes(kind);
|
|
100
|
+
}
|
|
101
|
+
function isAllowedSyncRequiredEventKind(subjectKind, eventKind) {
|
|
102
|
+
return SYNC_REQUIRED_EVENT_KINDS_BY_WIRE_KIND[subjectKind].has(eventKind);
|
|
103
|
+
}
|
|
104
|
+
function notifyEventHandler(handler, envelope) {
|
|
105
|
+
try {
|
|
106
|
+
handler(envelope);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
reportEventHandlerError(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function reportEventHandlerError(error) {
|
|
112
|
+
const reportError = globalThis.reportError;
|
|
113
|
+
if (typeof reportError !== "function") return;
|
|
114
|
+
try {
|
|
115
|
+
reportError(error);
|
|
116
|
+
} catch {
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function registerSubscription(session, subject, unsubscribeEnvelope) {
|
|
120
|
+
const subscriptions = subscriptionRegistry.get(session) ?? /* @__PURE__ */ new Map();
|
|
121
|
+
const subjectKey = subscriptionKey(subject);
|
|
122
|
+
const unsubscribers = subscriptions.get(subjectKey) ?? /* @__PURE__ */ new Set();
|
|
123
|
+
unsubscribers.add(unsubscribeEnvelope);
|
|
124
|
+
subscriptions.set(subjectKey, unsubscribers);
|
|
125
|
+
subscriptionRegistry.set(session, subscriptions);
|
|
126
|
+
}
|
|
127
|
+
function unregisterSubscription(session, subject, unsubscribeEnvelope) {
|
|
128
|
+
const subscriptions = subscriptionRegistry.get(session);
|
|
129
|
+
if (!subscriptions) return;
|
|
130
|
+
const subjectKey = subscriptionKey(subject);
|
|
131
|
+
const unsubscribers = subscriptions.get(subjectKey);
|
|
132
|
+
if (!unsubscribers) return;
|
|
133
|
+
unsubscribers.delete(unsubscribeEnvelope);
|
|
134
|
+
if (unsubscribers.size === 0) subscriptions.delete(subjectKey);
|
|
135
|
+
if (subscriptions.size === 0) subscriptionRegistry.delete(session);
|
|
136
|
+
}
|
|
137
|
+
function subscriptionKey(subject) {
|
|
138
|
+
return `${subject.subjectType}:${subject.subjectId}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { onReconnect, subscribe, unsubscribe };
|
|
142
|
+
//# sourceMappingURL=events.js.map
|
|
143
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/events/index.ts"],"names":[],"mappings":";;;;;;AAqBA,IAAM,yBAAA,GAA4B;AAAA,EAChC,QAAA,EAAU,UAAA;AAAA,EACV,UAAA,EAAY;AACd,CAAA;AAEA,IAAM,oBAAA,GAAuB,oBAAA;AA4B7B,IAAM,wCAAA,GAA2C;AAAA,EAC/C,oBAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AAAA,EACA,iBAAA;AAAA,EACA,UAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,UAAA;AAAA,EACA,0BAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,2CAAA,GAA8C;AAAA,EAClD,iBAAA;AAAA,EACA,UAAA;AAAA,EACA,sBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA;AA0BA,IAAM,sCAAA,GAGF;AAAA,EACF,QAAA,EAAU,IAAI,GAAA,CAAY,wCAAwC,CAAA;AAAA,EAClE,WAAA,EAAa,IAAI,GAAA,CAAY,2CAA2C;AAC1E,CAAA;AAEA,IAAM,oBAAA,uBAA2B,OAAA,EAAgD;AAqB1E,SAAS,SAAA,CACd,OAAA,EACA,OAAA,EACA,OAAA,EACa;AACb,EAAA,aAAA,CAAc,OAAO,CAAA;AACrB,EAAA,MAAM,gBAAA,GAAmB,yBAAA,CAA0B,OAAA,CAAQ,WAAW,CAAA;AACtE,EAAA,MAAM,mBAAA,GAAsB,UAAA,CAAW,OAAA,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,EAAA,MAAM,gBAAgB,aAAA,CAAc,GAAA,CAAI,UAAU,CAAA,wBAAS,GAAA,EAAiB;AAC5E,EAAA,aAAA,CAAc,IAAI,mBAAmB,CAAA;AACrC,EAAA,aAAA,CAAc,GAAA,CAAI,YAAY,aAAa,CAAA;AAC3C,EAAA,oBAAA,CAAqB,GAAA,CAAI,SAAS,aAAa,CAAA;AACjD;AAEA,SAAS,sBAAA,CACP,OAAA,EACA,OAAA,EACA,mBAAA,EACM;AACN,EAAA,MAAM,aAAA,GAAgB,oBAAA,CAAqB,GAAA,CAAI,OAAO,CAAA;AACtD,EAAA,IAAI,CAAC,aAAA,EAAe;AACpB,EAAA,MAAM,UAAA,GAAa,gBAAgB,OAAO,CAAA;AAC1C,EAAA,MAAM,aAAA,GAAgB,aAAA,CAAc,GAAA,CAAI,UAAU,CAAA;AAClD,EAAA,IAAI,CAAC,aAAA,EAAe;AAEpB,EAAA,aAAA,CAAc,OAAO,mBAAmB,CAAA;AACxC,EAAA,IAAI,aAAA,CAAc,IAAA,KAAS,CAAA,EAAG,aAAA,CAAc,OAAO,UAAU,CAAA;AAC7D,EAAA,IAAI,aAAA,CAAc,IAAA,KAAS,CAAA,EAAG,oBAAA,CAAqB,OAAO,OAAO,CAAA;AACnE;AAEA,SAAS,gBAAgB,OAAA,EAA+B;AACtD,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,WAAW,CAAA,CAAA,EAAI,QAAQ,SAAS,CAAA,CAAA;AACpD","file":"events.js","sourcesContent":["/**\n * `@invisible-labs/sdk/events` - sync subscriptions (spec section 4.6).\n *\n * Handlers receive only routing and refresh metadata, never status payloads.\n */\n\nimport { CoordinatorMessageType, EnvelopeKind, onEnvelope } from \"../coordinator/protocolClient.js\";\nimport { NotImplementedError } from \"../core/errors.js\";\nimport type { Session } from \"../core/session.js\";\nimport type { Unsubscribe } from \"../transport/types.js\";\nimport type { SyncRequiredPayload as ProtocolSyncRequiredPayload } from \"protocol/coordinator\";\n\ntype AssertExactProtocolType<ProtocolType, SdkType> = [\n Exclude<ProtocolType, SdkType>,\n Exclude<SdkType, ProtocolType>,\n] extends [never, never]\n ? true\n : never;\n\ntype SyncRequiredWireSubjectKind = \"contract\" | \"lp_position\";\n\nconst SUBJECT_TYPE_TO_WIRE_KIND = {\n transfer: \"contract\",\n lpPosition: \"lp_position\",\n} as const satisfies Record<string, SyncRequiredWireSubjectKind>;\n\nconst ON_RECONNECT_COMMAND = \"events.onReconnect\";\n\ntype EventSubjectType = keyof typeof SUBJECT_TYPE_TO_WIRE_KIND;\n\ntype ContractSyncRequiredEventKind =\n | \"contract_requested\"\n | \"request_expired\"\n | \"contract_activated\"\n | \"match_requested\"\n | \"reserved\"\n | \"settlement_pending\"\n | \"partially_fulfilled\"\n | \"fulfilled\"\n | \"refund_requested\"\n | \"refunded\"\n | \"source_liquidity_updated\"\n | \"withdrawal_requested\"\n | \"withdrawal_finalized\";\n\ntype LpPositionSyncRequiredEventKind =\n | \"match_requested\"\n | \"reserved\"\n | \"withdrawal_requested\"\n | \"withdrawal_finalized\"\n | \"reimbursement_finalized\";\n\ntype SyncRequiredEventKind = ContractSyncRequiredEventKind | LpPositionSyncRequiredEventKind;\n\nconst CONTRACT_SYNC_REQUIRED_EVENT_KIND_VALUES = [\n \"contract_requested\",\n \"request_expired\",\n \"contract_activated\",\n \"match_requested\",\n \"reserved\",\n \"settlement_pending\",\n \"partially_fulfilled\",\n \"fulfilled\",\n \"refund_requested\",\n \"refunded\",\n \"source_liquidity_updated\",\n \"withdrawal_requested\",\n \"withdrawal_finalized\",\n] as const satisfies readonly ContractSyncRequiredEventKind[];\n\nconst LP_POSITION_SYNC_REQUIRED_EVENT_KIND_VALUES = [\n \"match_requested\",\n \"reserved\",\n \"withdrawal_requested\",\n \"withdrawal_finalized\",\n \"reimbursement_finalized\",\n] as const satisfies readonly LpPositionSyncRequiredEventKind[];\n\ntype SyncRequiredPayload = {\n readonly subject: {\n readonly kind: SyncRequiredWireSubjectKind;\n readonly id: string;\n };\n readonly event_kind: SyncRequiredEventKind;\n readonly state_version: number;\n readonly created_at_ms: number;\n readonly sync_required: true;\n};\ntype _SyncRequiredSubjectKindMatchesProtocol = AssertExactProtocolType<\n ProtocolSyncRequiredPayload[\"subject\"][\"kind\"],\n SyncRequiredWireSubjectKind\n>;\ntype _SyncRequiredEventKindMatchesProtocol = AssertExactProtocolType<\n ProtocolSyncRequiredPayload[\"event_kind\"],\n SyncRequiredEventKind\n>;\nconst PROTOCOL_SYNC_REQUIRED_TYPE_CHECKS: [\n _SyncRequiredSubjectKindMatchesProtocol,\n _SyncRequiredEventKindMatchesProtocol,\n] = [true, true];\nvoid PROTOCOL_SYNC_REQUIRED_TYPE_CHECKS;\n\nconst SYNC_REQUIRED_EVENT_KINDS_BY_WIRE_KIND: Record<\n SyncRequiredWireSubjectKind,\n ReadonlySet<string>\n> = {\n contract: new Set<string>(CONTRACT_SYNC_REQUIRED_EVENT_KIND_VALUES),\n lp_position: new Set<string>(LP_POSITION_SYNC_REQUIRED_EVENT_KIND_VALUES),\n};\n\nconst subscriptionRegistry = new WeakMap<Session, Map<string, Set<Unsubscribe>>>();\n\n/** The authorized subject of a subscription. */\nexport interface EventSubject {\n readonly subjectType: EventSubjectType;\n readonly subjectId: string;\n}\n\n/** Routing and refresh metadata delivered to subscribers. Carries no status payload. */\nexport interface EventEnvelope {\n readonly subjectType: EventSubjectType;\n readonly subjectId: string;\n readonly stateVersion: number;\n readonly eventKind: SyncRequiredPayload[\"event_kind\"];\n readonly createdAtMs: number;\n readonly syncRequired: true;\n}\n\n/**\n * Subscribe to live sync-required hints for an authorized subject.\n */\nexport function subscribe(\n session: Session,\n subject: EventSubject,\n handler: (envelope: EventEnvelope) => void,\n): Unsubscribe {\n assertSubject(subject);\n const expectedWireKind = SUBJECT_TYPE_TO_WIRE_KIND[subject.subjectType];\n const unsubscribeEnvelope = onEnvelope(session, (envelope) => {\n if (\n envelope.kind !== EnvelopeKind.PUSH ||\n envelope.type !== CoordinatorMessageType.SyncRequired\n ) {\n return;\n }\n const payload = envelope.payload as SyncRequiredPayload;\n if (!isSyncRequiredPayload(payload)) return;\n if (payload.subject.kind !== expectedWireKind || payload.subject.id !== subject.subjectId)\n return;\n\n notifyEventHandler(handler, {\n subjectType: subject.subjectType,\n subjectId: subject.subjectId,\n stateVersion: payload.state_version,\n eventKind: payload.event_kind,\n createdAtMs: payload.created_at_ms,\n syncRequired: true,\n });\n });\n\n registerSubscription(session, subject, unsubscribeEnvelope);\n return () => {\n unregisterSubscription(session, subject, unsubscribeEnvelope);\n unsubscribeEnvelope();\n };\n}\n\n/**\n * Detach all handlers registered through this module for a subject.\n */\nexport function unsubscribe(session: Session, subject: EventSubject): void {\n assertSubject(subject);\n const subscriptions = subscriptionRegistry.get(session);\n const subjectKey = subscriptionKey(subject);\n const unsubscribers = subscriptions?.get(subjectKey);\n if (!subscriptions || !unsubscribers) return;\n\n subscriptions.delete(subjectKey);\n for (const unsubscribeEnvelope of unsubscribers) unsubscribeEnvelope();\n if (subscriptions.size === 0) subscriptionRegistry.delete(session);\n}\n\n/** Reconnect notifications are deferred until same-session re-establishment exists. */\nexport function onReconnect(_session: Session, _handler: () => void): Unsubscribe {\n throw new NotImplementedError(ON_RECONNECT_COMMAND);\n}\n\nfunction assertSubject(subject: EventSubject): void {\n if (!(subject.subjectType in SUBJECT_TYPE_TO_WIRE_KIND)) {\n throw new TypeError(`unknown event subject type: ${String(subject.subjectType)}`);\n }\n if (subject.subjectId.length === 0) {\n throw new TypeError(\"event subject id is required\");\n }\n}\n\nfunction isSyncRequiredPayload(payload: unknown): payload is SyncRequiredPayload {\n if (typeof payload !== \"object\" || payload === null) return false;\n if (!(\"subject\" in payload) || typeof payload.subject !== \"object\" || payload.subject === null) {\n return false;\n }\n if (!(\"kind\" in payload.subject) || typeof payload.subject.kind !== \"string\") return false;\n if (!isSyncRequiredWireSubjectKind(payload.subject.kind)) return false;\n if (!(\"id\" in payload.subject) || typeof payload.subject.id !== \"string\") return false;\n if (!(\"event_kind\" in payload) || typeof payload.event_kind !== \"string\") return false;\n if (!isAllowedSyncRequiredEventKind(payload.subject.kind, payload.event_kind)) return false;\n\n return (\n \"state_version\" in payload &&\n typeof payload.state_version === \"number\" &&\n \"created_at_ms\" in payload &&\n typeof payload.created_at_ms === \"number\" &&\n \"sync_required\" in payload &&\n payload.sync_required === true\n );\n}\n\nfunction isSyncRequiredWireSubjectKind(kind: string): kind is SyncRequiredWireSubjectKind {\n return Object.values(SUBJECT_TYPE_TO_WIRE_KIND).includes(kind as SyncRequiredWireSubjectKind);\n}\n\nfunction isAllowedSyncRequiredEventKind(\n subjectKind: SyncRequiredWireSubjectKind,\n eventKind: string,\n): eventKind is SyncRequiredEventKind {\n return SYNC_REQUIRED_EVENT_KINDS_BY_WIRE_KIND[subjectKind].has(eventKind);\n}\n\nfunction notifyEventHandler(\n handler: (envelope: EventEnvelope) => void,\n envelope: EventEnvelope,\n): void {\n try {\n handler(envelope);\n } catch (error) {\n reportEventHandlerError(error);\n }\n}\n\nfunction reportEventHandlerError(error: unknown): void {\n const reportError = (globalThis as { reportError?: (error: unknown) => void }).reportError;\n if (typeof reportError !== \"function\") return;\n\n try {\n reportError(error);\n } catch {\n // Do not let diagnostics re-enter the protocol frame dispatch path.\n }\n}\n\nfunction registerSubscription(\n session: Session,\n subject: EventSubject,\n unsubscribeEnvelope: Unsubscribe,\n): void {\n const subscriptions = subscriptionRegistry.get(session) ?? new Map<string, Set<Unsubscribe>>();\n const subjectKey = subscriptionKey(subject);\n const unsubscribers = subscriptions.get(subjectKey) ?? new Set<Unsubscribe>();\n unsubscribers.add(unsubscribeEnvelope);\n subscriptions.set(subjectKey, unsubscribers);\n subscriptionRegistry.set(session, subscriptions);\n}\n\nfunction unregisterSubscription(\n session: Session,\n subject: EventSubject,\n unsubscribeEnvelope: Unsubscribe,\n): void {\n const subscriptions = subscriptionRegistry.get(session);\n if (!subscriptions) return;\n const subjectKey = subscriptionKey(subject);\n const unsubscribers = subscriptions.get(subjectKey);\n if (!unsubscribers) return;\n\n unsubscribers.delete(unsubscribeEnvelope);\n if (unsubscribers.size === 0) subscriptions.delete(subjectKey);\n if (subscriptions.size === 0) subscriptionRegistry.delete(session);\n}\n\nfunction subscriptionKey(subject: EventSubject): string {\n return `${subject.subjectType}:${subject.subjectId}`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"frostRuntime-JESDHN6O.js"}
|