@northtalk/ts 0.8.0 → 0.10.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/{binary-value-B93hEK7l.d.ts → binary-value-B8W4W_e1.d.ts} +1 -1
- package/{checker-Q4w7rLXk.js → checker-hkWO1UbN.js} +2 -2
- package/{core-BBPI6EhG.d.ts → core-Dwec7SRy.d.ts} +1 -1
- package/{debug-s6QIovKS.d.ts → debug-2yfUZYzF.d.ts} +7 -0
- package/debug.d.ts +1 -1
- package/debug.js +1 -1
- package/{driver-D5yrK3Nu.d.ts → driver-CT-ksM-N.d.ts} +1 -1
- package/driver.d.ts +1 -1
- package/driver.js +1 -1
- package/{encoding-B7MCQ4ii.js → encoding-DlMqlP2Y.js} +2 -2
- package/{engine-OL1BveVZ.js → engine-CxcONfhv.js} +6 -6
- package/{engine-Dy-BCoiw.d.ts → engine-DP_lqWfI.d.ts} +2 -2
- package/{errors-VuwK669R.js → errors-CNc-xY_9.js} +1 -1
- package/{group-Ccuqwq12.js → group--dcl0em8.js} +83 -24
- package/{http-fetch--O27xjSW.js → http-fetch-CLAeEXVi.js} +2 -2
- package/http.d.ts +1 -1
- package/http.js +4 -4
- package/index-CBuczWK0.d.ts +9 -0
- package/index.d.ts +6 -12
- package/index.js +15 -15
- package/{lean-BjhQvHyr.js → lean-BtbKWkXA.js} +10 -10
- package/{lean-D6DQfbqH.d.ts → lean-DU_muGpT.d.ts} +134 -5
- package/lean.d.ts +5 -6
- package/lean.js +15 -15
- package/{manifest-BeViDIoy.js → manifest-CRpUahPt.js} +3 -3
- package/message-layer.d.ts +2 -2
- package/message-layer.js +2 -2
- package/notify.d.ts +1 -1
- package/notify.js +1 -1
- package/{objects-q0lnCK-4.d.ts → objects-DoyEohtr.d.ts} +1 -1
- package/{objects-TarIKBL8.js → objects-OKVLH190.js} +1 -1
- package/{operations-BAELnqwf.js → operations-DrsedOvj.js} +116 -13
- package/package.json +1 -1
- package/{peer-capability-B8eKbljR.js → peer-capability-RMdN4OHj.js} +4 -4
- package/peer.d.ts +1 -1
- package/peer.js +4 -4
- package/{readers-BG8g59qS.js → readers-G1lHqrPl.js} +1 -1
- package/{readers-AeB1bJ--.d.ts → readers-IhVpgXkj.d.ts} +1 -1
- package/{request-pump-binary-87klb6sX.js → request-pump-binary-P8m6kLfB.js} +231 -53
- package/{router-DXoJ_2Z4.d.ts → router-2vjYbqx3.d.ts} +2 -2
- package/{router-DXmPA-qi.js → router-C_Fjc2as.js} +5 -5
- package/session.d.ts +2 -2
- package/session.js +23 -22
- package/setup.d.ts +2 -2
- package/setup.js +5 -5
- package/sha256-C5Lqj5U7.js +197 -0
- package/sqlite.d.ts +2 -2
- package/sqlite.js +5 -5
- package/{store-DzpyWjt2.js → store-_af2DPoK.js} +2 -2
- package/{store-capability-CxQJ_Huz.js → store-capability-Db6v_dw9.js} +3 -3
- package/store.d.ts +2 -2
- package/store.js +2 -2
- package/{user-capability-ClYd8Vln.js → user-capability-CzoLN3RK.js} +3 -3
- package/wasm.d.ts +5 -5
- package/wasm.js +88 -48
- package/{inline-grants-DmOdgSoK.js → zone-rules-Cn-f9u_Z.js} +88 -5
- package/manifest-l07K7nW-.d.ts +0 -124
- package/sha256-9CGf5BS_.js +0 -168
package/session.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
import { H as num, J as range, L as map, P as listValues, Qt as parseInstant, V as nothing, i as ScriptError, it as text, l as Value, n as LoadError, nn as characterBoundaries, on as lower, pn as builtins, qt as formatInstant, t as HostError, u as bool } from "./errors-
|
|
3
|
-
import { C as registeredStdlib, T as stdlibSource, a as recordLine, h as defaultLimits, i as restore, l as compileLibrary, o as traceValue } from "./group
|
|
4
|
-
import { o as stateOf, t as defineObjectKind } from "./objects-
|
|
5
|
-
import { Dt as shape, Et as operationDeclarations, H as textForm$1, U as waitUs, jt as validStaticMessageName, tt as functionHead, ut as compareText, x as integerValue, xt as defineValueCapability } from "./operations-
|
|
6
|
-
import { _ as viewSource, c as parseSource, f as declarationDocs, h as leadingDoc, m as functionDoc, s as parseEntry, t as checkSource } from "./checker-
|
|
7
|
-
import { n as exportManifest, o as shapeData, t as canonicalJSON } from "./manifest-
|
|
8
|
-
import { c as readDisplay, l as readOrderedJSON, r as decodeValue } from "./readers-
|
|
9
|
-
import { a as clockCapability, i as calendarCapability, n as quoteJSON, o as consoleCapability, t as encodeValue } from "./encoding-
|
|
10
|
-
import { n as localeCapability, t as userCapability } from "./user-capability-
|
|
11
|
-
import { r as storeCapability } from "./store-capability-
|
|
2
|
+
import { H as num, J as range, L as map, P as listValues, Qt as parseInstant, V as nothing, i as ScriptError, it as text, l as Value, n as LoadError, nn as characterBoundaries, on as lower, pn as builtins, qt as formatInstant, t as HostError, u as bool } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { C as registeredStdlib, T as stdlibSource, a as recordLine, h as defaultLimits, i as restore, l as compileLibrary, o as traceValue } from "./group--dcl0em8.js";
|
|
4
|
+
import { o as stateOf, t as defineObjectKind } from "./objects-OKVLH190.js";
|
|
5
|
+
import { Dt as shape, Et as operationDeclarations, H as textForm$1, U as waitUs, jt as validStaticMessageName, tt as functionHead, ut as compareText, x as integerValue, xt as defineValueCapability } from "./operations-DrsedOvj.js";
|
|
6
|
+
import { _ as viewSource, c as parseSource, f as declarationDocs, h as leadingDoc, m as functionDoc, s as parseEntry, t as checkSource } from "./checker-hkWO1UbN.js";
|
|
7
|
+
import { n as exportManifest, o as shapeData, t as canonicalJSON } from "./manifest-CRpUahPt.js";
|
|
8
|
+
import { c as readDisplay, l as readOrderedJSON, r as decodeValue } from "./readers-G1lHqrPl.js";
|
|
9
|
+
import { a as clockCapability, i as calendarCapability, n as quoteJSON, o as consoleCapability, t as encodeValue } from "./encoding-DlMqlP2Y.js";
|
|
10
|
+
import { n as localeCapability, t as userCapability } from "./user-capability-CzoLN3RK.js";
|
|
11
|
+
import { r as storeCapability } from "./store-capability-Db6v_dw9.js";
|
|
12
12
|
import { buildSetupGroup, capabilityOperations, immutableSetup, shapeOf } from "./setup.js";
|
|
13
|
-
import { a as encodeContents, i as decodeContents, o as sessionQuotas, t as StoreContentsError } from "./engine-
|
|
14
|
-
import { i as memoryStores } from "./store-
|
|
13
|
+
import { a as encodeContents, i as decodeContents, o as sessionQuotas, t as StoreContentsError } from "./engine-CxcONfhv.js";
|
|
14
|
+
import { i as memoryStores } from "./store-_af2DPoK.js";
|
|
15
15
|
//#region src/session/objects.ts
|
|
16
16
|
const externalCollection = () => {
|
|
17
17
|
throw new Error("external collection callback in replay");
|
|
@@ -502,16 +502,13 @@ var SessionObjects = class {
|
|
|
502
502
|
}
|
|
503
503
|
preload() {
|
|
504
504
|
this.registrations();
|
|
505
|
-
if (this.nextType() !== "setup") {
|
|
506
|
-
if (this.replay?.length) malformed("missing setup");
|
|
507
|
-
return {};
|
|
508
|
-
}
|
|
505
|
+
if (this.nextType() !== "setup") return {};
|
|
509
506
|
const e = this.consume("setup");
|
|
510
507
|
return Object.fromEntries(Object.entries(recordObject(e.objects)).map(([name, o]) => [name, this.objectRef(o)]));
|
|
511
508
|
}
|
|
512
509
|
initial(bindings) {
|
|
513
510
|
if (this.replay) return;
|
|
514
|
-
if (!this.enabled) return;
|
|
511
|
+
if (!this.enabled || Object.keys(bindings).length === 0) return;
|
|
515
512
|
this.emit({
|
|
516
513
|
type: "setup",
|
|
517
514
|
objects: Object.fromEntries(Object.entries(bindings).map(([k, o]) => [k, {
|
|
@@ -1227,11 +1224,11 @@ const builtinDocs = {
|
|
|
1227
1224
|
},
|
|
1228
1225
|
"toCivil": {
|
|
1229
1226
|
"call": "toCivil(i, offset)",
|
|
1230
|
-
"gives": "The date-time on the wall clock at `offset` from UTC
|
|
1227
|
+
"gives": "The date-time on the wall clock at the Instant `i`, at `offset` from UTC or under the Zone Rules `offset`"
|
|
1231
1228
|
},
|
|
1232
1229
|
"toInstant": {
|
|
1233
|
-
"call": "toInstant(c, offset)",
|
|
1234
|
-
"gives": "The Instant at which the wall clock at `offset` from UTC reads the date-time `c`"
|
|
1230
|
+
"call": "toInstant(c, offset, disambiguation = nothing)",
|
|
1231
|
+
"gives": "The Instant at which the wall clock, at `offset` from UTC or under the Zone Rules `offset`, reads the date-time `c`"
|
|
1235
1232
|
},
|
|
1236
1233
|
"pi": {
|
|
1237
1234
|
"call": "3.141592653589793238462643383279503",
|
|
@@ -2731,12 +2728,16 @@ var SessionHost = class {
|
|
|
2731
2728
|
if (word === "advance") {
|
|
2732
2729
|
if (this.virtual === null) refuse("clock is real");
|
|
2733
2730
|
let us;
|
|
2731
|
+
let negative;
|
|
2734
2732
|
try {
|
|
2735
|
-
|
|
2733
|
+
const duration = display(arg);
|
|
2734
|
+
us = waitUs(duration);
|
|
2735
|
+
const amount = duration.asQuantityRef().number.toString();
|
|
2736
|
+
negative = amount.startsWith("-") && /[1-9]/.test(amount.split("e")[0]);
|
|
2736
2737
|
} catch {
|
|
2737
2738
|
return refuse("bad arguments");
|
|
2738
2739
|
}
|
|
2739
|
-
if (
|
|
2740
|
+
if (negative) refuse("bad arguments");
|
|
2740
2741
|
this.virtual += us;
|
|
2741
2742
|
return this.pump();
|
|
2742
2743
|
}
|
package/setup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { Qt as operationDeclarations } from "./debug-
|
|
3
|
-
import { A as shapeOf, C as Setup, D as capabilityOperations, E as buildSetupGroup, M as tsCore, O as immutableSetup, S as OperationSpec, T as ShapeSpec, b as MissingCapabilityError, j as shapeSpec, k as musicalClockOf, w as SetupGroup, x as ObjectRefSpec, y as CaseCore } from "./objects-
|
|
2
|
+
import { Qt as operationDeclarations } from "./debug-2yfUZYzF.js";
|
|
3
|
+
import { A as shapeOf, C as Setup, D as capabilityOperations, E as buildSetupGroup, M as tsCore, O as immutableSetup, S as OperationSpec, T as ShapeSpec, b as MissingCapabilityError, j as shapeSpec, k as musicalClockOf, w as SetupGroup, x as ObjectRefSpec, y as CaseCore } from "./objects-DoyEohtr.js";
|
|
4
4
|
export { CaseCore, MissingCapabilityError, ObjectRefSpec, OperationSpec, Setup, SetupGroup, ShapeSpec, buildSetupGroup, capabilityOperations, immutableSetup, musicalClockOf, operationDeclarations, shapeOf, shapeSpec, tsCore };
|
package/setup.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as LoadError } from "./errors-
|
|
3
|
-
import { i as restore, l as compileLibrary, r as newGroup, u as replacementLibraries } from "./group
|
|
4
|
-
import { t as defineObjectKind } from "./objects-
|
|
5
|
-
import { Dt as shape, Et as operationDeclarations } from "./operations-
|
|
6
|
-
import { r as MUSICAL_CLOCK } from "./encoding-
|
|
2
|
+
import { n as LoadError } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { i as restore, l as compileLibrary, r as newGroup, u as replacementLibraries } from "./group--dcl0em8.js";
|
|
4
|
+
import { t as defineObjectKind } from "./objects-OKVLH190.js";
|
|
5
|
+
import { Dt as shape, Et as operationDeclarations } from "./operations-DrsedOvj.js";
|
|
6
|
+
import { r as MUSICAL_CLOCK } from "./encoding-DlMqlP2Y.js";
|
|
7
7
|
//#region src/setup.ts
|
|
8
8
|
const tsCore = {
|
|
9
9
|
compileLibrary,
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/sha256.ts
|
|
3
|
+
const K = new Uint32Array([
|
|
4
|
+
1116352408,
|
|
5
|
+
1899447441,
|
|
6
|
+
3049323471,
|
|
7
|
+
3921009573,
|
|
8
|
+
961987163,
|
|
9
|
+
1508970993,
|
|
10
|
+
2453635748,
|
|
11
|
+
2870763221,
|
|
12
|
+
3624381080,
|
|
13
|
+
310598401,
|
|
14
|
+
607225278,
|
|
15
|
+
1426881987,
|
|
16
|
+
1925078388,
|
|
17
|
+
2162078206,
|
|
18
|
+
2614888103,
|
|
19
|
+
3248222580,
|
|
20
|
+
3835390401,
|
|
21
|
+
4022224774,
|
|
22
|
+
264347078,
|
|
23
|
+
604807628,
|
|
24
|
+
770255983,
|
|
25
|
+
1249150122,
|
|
26
|
+
1555081692,
|
|
27
|
+
1996064986,
|
|
28
|
+
2554220882,
|
|
29
|
+
2821834349,
|
|
30
|
+
2952996808,
|
|
31
|
+
3210313671,
|
|
32
|
+
3336571891,
|
|
33
|
+
3584528711,
|
|
34
|
+
113926993,
|
|
35
|
+
338241895,
|
|
36
|
+
666307205,
|
|
37
|
+
773529912,
|
|
38
|
+
1294757372,
|
|
39
|
+
1396182291,
|
|
40
|
+
1695183700,
|
|
41
|
+
1986661051,
|
|
42
|
+
2177026350,
|
|
43
|
+
2456956037,
|
|
44
|
+
2730485921,
|
|
45
|
+
2820302411,
|
|
46
|
+
3259730800,
|
|
47
|
+
3345764771,
|
|
48
|
+
3516065817,
|
|
49
|
+
3600352804,
|
|
50
|
+
4094571909,
|
|
51
|
+
275423344,
|
|
52
|
+
430227734,
|
|
53
|
+
506948616,
|
|
54
|
+
659060556,
|
|
55
|
+
883997877,
|
|
56
|
+
958139571,
|
|
57
|
+
1322822218,
|
|
58
|
+
1537002063,
|
|
59
|
+
1747873779,
|
|
60
|
+
1955562222,
|
|
61
|
+
2024104815,
|
|
62
|
+
2227730452,
|
|
63
|
+
2361852424,
|
|
64
|
+
2428436474,
|
|
65
|
+
2756734187,
|
|
66
|
+
3204031479,
|
|
67
|
+
3329325298
|
|
68
|
+
]);
|
|
69
|
+
const rotr = (x, n) => x >>> n | x << 32 - n;
|
|
70
|
+
const initial = [
|
|
71
|
+
1779033703,
|
|
72
|
+
3144134277,
|
|
73
|
+
1013904242,
|
|
74
|
+
2773480762,
|
|
75
|
+
1359893119,
|
|
76
|
+
2600822924,
|
|
77
|
+
528734635,
|
|
78
|
+
1541459225
|
|
79
|
+
];
|
|
80
|
+
const w = /* @__PURE__ */ new Uint32Array(64);
|
|
81
|
+
/** One 64-byte block of `view` at `block`, folded into `h`. */
|
|
82
|
+
const compress = (h, view, block) => {
|
|
83
|
+
for (let i = 0; i < 16; i++) w[i] = view.getUint32(block + i * 4);
|
|
84
|
+
for (let i = 16; i < 64; i++) {
|
|
85
|
+
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
|
|
86
|
+
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
|
|
87
|
+
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
88
|
+
}
|
|
89
|
+
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7];
|
|
90
|
+
for (let i = 0; i < 64; i++) {
|
|
91
|
+
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
92
|
+
const ch = e & f ^ ~e & g;
|
|
93
|
+
const t1 = hh + s1 + ch + K[i] + w[i] >>> 0;
|
|
94
|
+
const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
|
|
95
|
+
hh = g;
|
|
96
|
+
g = f;
|
|
97
|
+
f = e;
|
|
98
|
+
e = d + t1 >>> 0;
|
|
99
|
+
d = c;
|
|
100
|
+
c = b;
|
|
101
|
+
b = a;
|
|
102
|
+
a = t1 + t2 >>> 0;
|
|
103
|
+
}
|
|
104
|
+
h[0] = h[0] + a >>> 0;
|
|
105
|
+
h[1] = h[1] + b >>> 0;
|
|
106
|
+
h[2] = h[2] + c >>> 0;
|
|
107
|
+
h[3] = h[3] + d >>> 0;
|
|
108
|
+
h[4] = h[4] + e >>> 0;
|
|
109
|
+
h[5] = h[5] + f >>> 0;
|
|
110
|
+
h[6] = h[6] + g >>> 0;
|
|
111
|
+
h[7] = h[7] + hh >>> 0;
|
|
112
|
+
};
|
|
113
|
+
/** An incremental SHA-256: `update` with bytes, then `final` once. */
|
|
114
|
+
var Sha256 = class {
|
|
115
|
+
h = new Uint32Array(initial);
|
|
116
|
+
block = /* @__PURE__ */ new Uint8Array(64);
|
|
117
|
+
blockView = new DataView(this.block.buffer);
|
|
118
|
+
filled = 0;
|
|
119
|
+
length = 0;
|
|
120
|
+
done = false;
|
|
121
|
+
update(bytes) {
|
|
122
|
+
if (this.done) throw new Error("Sha256.update after final");
|
|
123
|
+
this.length += bytes.length;
|
|
124
|
+
let at = 0;
|
|
125
|
+
if (this.filled > 0) {
|
|
126
|
+
const take = Math.min(64 - this.filled, bytes.length);
|
|
127
|
+
this.block.set(bytes.subarray(0, take), this.filled);
|
|
128
|
+
this.filled += take;
|
|
129
|
+
at = take;
|
|
130
|
+
if (this.filled < 64) return this;
|
|
131
|
+
compress(this.h, this.blockView, 0);
|
|
132
|
+
this.filled = 0;
|
|
133
|
+
}
|
|
134
|
+
const whole = at + Math.floor((bytes.length - at) / 64) * 64;
|
|
135
|
+
if (whole > at) {
|
|
136
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
137
|
+
for (; at < whole; at += 64) compress(this.h, view, at);
|
|
138
|
+
}
|
|
139
|
+
this.block.set(bytes.subarray(at));
|
|
140
|
+
this.filled = bytes.length - at;
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
/** The 32-byte digest; the hash takes no more input after it. */
|
|
144
|
+
final() {
|
|
145
|
+
if (this.done) throw new Error("Sha256.final twice");
|
|
146
|
+
this.done = true;
|
|
147
|
+
return wordBytes(finish(this.h, this.block, this.filled, this.length));
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Pads the last `filled` bytes of `tail`, of `length` bytes hashed in all,
|
|
152
|
+
* and compresses them into `h`, which it returns.
|
|
153
|
+
*/
|
|
154
|
+
const finish = (h, tail, filled, length) => {
|
|
155
|
+
const padded = new Uint8Array(filled < 56 ? 64 : 128);
|
|
156
|
+
padded.set(tail.subarray(0, filled));
|
|
157
|
+
padded[filled] = 128;
|
|
158
|
+
const view = new DataView(padded.buffer);
|
|
159
|
+
view.setUint32(padded.length - 8, Math.floor(length / 536870912));
|
|
160
|
+
view.setUint32(padded.length - 4, length * 8 >>> 0);
|
|
161
|
+
for (let at = 0; at < padded.length; at += 64) compress(h, view, at);
|
|
162
|
+
return h;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* All of `bytes` hashed at once, as the eight state words. Every Load hashes
|
|
166
|
+
* a code identity, so this skips `Sha256`'s block buffering (#2230).
|
|
167
|
+
*/
|
|
168
|
+
const digest = (bytes) => {
|
|
169
|
+
const h = new Uint32Array(initial);
|
|
170
|
+
const whole = bytes.length - bytes.length % 64;
|
|
171
|
+
if (whole > 0) {
|
|
172
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
173
|
+
for (let at = 0; at < whole; at += 64) compress(h, view, at);
|
|
174
|
+
}
|
|
175
|
+
return finish(h, bytes.subarray(whole), bytes.length - whole, bytes.length);
|
|
176
|
+
};
|
|
177
|
+
const wordBytes = (h) => {
|
|
178
|
+
const out = /* @__PURE__ */ new Uint8Array(32);
|
|
179
|
+
const view = new DataView(out.buffer);
|
|
180
|
+
for (let i = 0; i < 8; i++) view.setUint32(i * 4, h[i]);
|
|
181
|
+
return out;
|
|
182
|
+
};
|
|
183
|
+
const encoder = new TextEncoder();
|
|
184
|
+
const hex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
185
|
+
/** The SHA-256 of `bytes`, as 32 bytes. */
|
|
186
|
+
const sha256Bytes = (bytes) => wordBytes(digest(bytes));
|
|
187
|
+
const sha256 = (input) => {
|
|
188
|
+
const h = digest(typeof input === "string" ? encoder.encode(input) : input);
|
|
189
|
+
let out = "";
|
|
190
|
+
for (let i = 0; i < 8; i++) {
|
|
191
|
+
const x = h[i];
|
|
192
|
+
out += hex[x >>> 24] + hex[x >>> 16 & 255] + hex[x >>> 8 & 255] + hex[x & 255];
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { sha256 as n, sha256Bytes as r, Sha256 as t };
|
package/sqlite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { Wt as SegmentCoordinator, _n as SqlParams, bn as SqliteBinding, bt as Call, mn as StoreImpl, vn as SqlRows, xn as SqliteImpl } from "./debug-
|
|
3
|
-
import { a as Stores, r as StoreQuotas } from "./engine-
|
|
2
|
+
import { Wt as SegmentCoordinator, _n as SqlParams, bn as SqliteBinding, bt as Call, mn as StoreImpl, vn as SqlRows, xn as SqliteImpl } from "./debug-2yfUZYzF.js";
|
|
3
|
+
import { a as Stores, r as StoreQuotas } from "./engine-DP_lqWfI.js";
|
|
4
4
|
//#region src/sqlite/database.d.ts
|
|
5
5
|
/** The table that keeps a database's Stores, which no `sqlite` Grant may use. */
|
|
6
6
|
export declare const STORE_TABLE = "store";
|
package/sqlite.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { b as dec, it as text, t as HostError } from "./errors-
|
|
3
|
-
import { r as decodeValue } from "./readers-
|
|
4
|
-
import { t as encodeValue } from "./encoding-
|
|
5
|
-
import { n as hostScriptError } from "./store-capability-
|
|
6
|
-
import { r as Stores, t as StoreContentsError } from "./engine-
|
|
2
|
+
import { b as dec, it as text, t as HostError } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { r as decodeValue } from "./readers-G1lHqrPl.js";
|
|
4
|
+
import { t as encodeValue } from "./encoding-DlMqlP2Y.js";
|
|
5
|
+
import { n as hostScriptError } from "./store-capability-Db6v_dw9.js";
|
|
6
|
+
import { r as Stores, t as StoreContentsError } from "./engine-CxcONfhv.js";
|
|
7
7
|
import { DatabaseSync } from "node:sqlite";
|
|
8
8
|
//#region src/sqlite/scan.ts
|
|
9
9
|
const isWordChar = (c) => /[\w$]/.test(c) || c.charCodeAt(0) > 127;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { ut as compareText } from "./operations-
|
|
3
|
-
import { a as encodeContents, i as decodeContents, n as StoreStateUnknownError, r as Stores, s as sessionWatchLimits } from "./engine-
|
|
2
|
+
import { ut as compareText } from "./operations-DrsedOvj.js";
|
|
3
|
+
import { a as encodeContents, i as decodeContents, n as StoreStateUnknownError, r as Stores, s as sessionWatchLimits } from "./engine-CxcONfhv.js";
|
|
4
4
|
//#region src/store/memory.ts
|
|
5
5
|
/** A backend that keeps nothing outside the engine's own copy. */
|
|
6
6
|
const memoryBackend = () => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { L as map, V as nothing, i as ScriptError, it as text, t as HostError, u as bool } from "./errors-
|
|
3
|
-
import { Dt as shape, ft as errorMessages, i as arithmetic, kt as validComputedMessageName, n as ScriptError$1, xt as defineValueCapability } from "./operations-
|
|
4
|
-
import { c as fixed, f as registerStandardChecks, s as costOf } from "./encoding-
|
|
2
|
+
import { L as map, V as nothing, i as ScriptError, it as text, t as HostError, u as bool } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { Dt as shape, ft as errorMessages, i as arithmetic, kt as validComputedMessageName, n as ScriptError$1, xt as defineValueCapability } from "./operations-DrsedOvj.js";
|
|
4
|
+
import { c as fixed, f as registerStandardChecks, s as costOf } from "./encoding-DlMqlP2Y.js";
|
|
5
5
|
//#region src/store-capability.ts
|
|
6
6
|
/** A Core-raised error as the Host sees it, with its catalogue message. */
|
|
7
7
|
const hostScriptError = (code, fields) => {
|
package/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { n as RouterOptions } from "./router-
|
|
3
|
-
import { a as Stores, c as sessionQuotas, i as StoreStateUnknownError, l as sessionWatchLimits, n as StoreContentsError, o as decodeContents, r as StoreQuotas, s as encodeContents, t as StoreBackend } from "./engine-
|
|
2
|
+
import { n as RouterOptions } from "./router-2vjYbqx3.js";
|
|
3
|
+
import { a as Stores, c as sessionQuotas, i as StoreStateUnknownError, l as sessionWatchLimits, n as StoreContentsError, o as decodeContents, r as StoreQuotas, s as encodeContents, t as StoreBackend } from "./engine-DP_lqWfI.js";
|
|
4
4
|
//#region src/store/memory.d.ts
|
|
5
5
|
/** A backend that keeps nothing outside the engine's own copy. */
|
|
6
6
|
export declare const memoryBackend: () => StoreBackend;
|
package/store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as encodeContents, i as decodeContents, n as StoreStateUnknownError, o as sessionQuotas, r as Stores, s as sessionWatchLimits, t as StoreContentsError } from "./engine-
|
|
3
|
-
import { i as memoryStores, n as webStorageStores, r as memoryBackend, t as webStorageBackend } from "./store-
|
|
2
|
+
import { a as encodeContents, i as decodeContents, n as StoreStateUnknownError, o as sessionQuotas, r as Stores, s as sessionWatchLimits, t as StoreContentsError } from "./engine-CxcONfhv.js";
|
|
3
|
+
import { i as memoryStores, n as webStorageStores, r as memoryBackend, t as webStorageBackend } from "./store-_af2DPoK.js";
|
|
4
4
|
export { StoreContentsError, StoreStateUnknownError, Stores, decodeContents, encodeContents, memoryBackend, memoryStores, sessionQuotas, sessionWatchLimits, webStorageBackend, webStorageStores };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { Dt as integerOf, L as map, Ot as isInteger, it as text, t as HostError, u as bool, x as decimalParts } from "./errors-
|
|
3
|
-
import { Dt as shape, n as ScriptError, xt as defineValueCapability } from "./operations-
|
|
4
|
-
import { c as fixed, f as registerStandardChecks, s as costOf } from "./encoding-
|
|
2
|
+
import { Dt as integerOf, L as map, Ot as isInteger, it as text, t as HostError, u as bool, x as decimalParts } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { Dt as shape, n as ScriptError, xt as defineValueCapability } from "./operations-DrsedOvj.js";
|
|
4
|
+
import { c as fixed, f as registerStandardChecks, s as costOf } from "./encoding-DlMqlP2Y.js";
|
|
5
5
|
//#region src/locale-tag.ts
|
|
6
6
|
const grandfathered = /^(?:en-gb-oed|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)|sgn-(?:be-fr|be-nl|ch-de))$/i;
|
|
7
7
|
const alpha = /^[a-z]+$/i;
|
package/wasm.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { $ as instant, $t as shape, At as FireOp, Bt as ReleaseHook, C as Report, Cn as LocaleImpl, Ct as ChargeRequest, Dn as Costs, Dt as EffectResult, E as RestoreResult, En as ConsoleImpl, Et as Cost, Fn as Library, Ft as Metering, G as RunStarted, Gt as SegmentGrant, H as RunAccounting, Hn as LimitName, Ht as ScopeDecl, It as Operation, J as Value, Jt as SuspendingOp, K as Decimal, Kt as SegmentLifecycle, Ln as LibrarySource, Lt as Operations, Mt as GrantContext, N as Settlement, Nt as ImmediateOp, On as MusicalClockImpl, Ot as ErrorDecl, Pt as LimitReached, Q as dec, Qt as operationDeclarations, R as Verdict, Rn as OperationRef, Rt as PlainArg, S as PumpedRequest, St as CapabilityDefiner, T as RestoreOptions, Tn as CalendarImpl, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Limits, Ut as SegmentContext, V as CausalWork, Vt as ReleaseReason, W as RunDiscarded, Wn as Outcome, Wt as SegmentCoordinator, X as bytes, Xt as defineCapability, Y as bool, Yt as conforms, Z as civilDate, Zt as explain, _ as LoadOptions, _n as SqlParams, _t as PropDef, an as PeerImpl, ar as LoadError, at as quantity, b as PumpOptions, bn as SqliteBinding, bt as Call, cn as HttpClientImpl, cr as SendFailedReason, d as Counters, dt as nowMicros, en as Core, f as Decided, fn as UserImpl, ft as parseInstant, g as Inspection, gt as ObjectKindDef, h as GroupOptions, hn as add, ht as ObjectKind, ir as LoadDiagnostic, it as num, jt as Grant, kn as TimerImpl, kt as FieldShape, l as CancellationOptions, ln as HttpImpl, lt as text, m as EffectFailure, mn as StoreImpl, mt as ObjectElements, nn as Script, nr as HostError, nt as map, or as MailboxFull, ot as range, p as Deciding, pt as HostObject, q as Kind, qt as Shape, rn as Versions, rr as HostErrorCode, rt as nothing, sr as ScriptError, st as record, tn as Group, tt as list, u as CarryOver, un as HttpServerImpl, ut as formatInstant, v as Message, vn as SqlRows, w as Requested, wt as ChargeResult, x as PumpResult, xn as SqliteImpl, xt as CapabilityDef, y as PendingCall, yn as SqlValue, yt as GrantDecls, zt as PlainResult } from "./debug-
|
|
3
|
-
import {
|
|
4
|
-
import { a as decodeValue, n as Json, o as readDisplay } from "./readers-
|
|
5
|
-
import { t as BinaryValueOptions } from "./binary-value-
|
|
2
|
+
import { $ as instant, $t as shape, At as FireOp, Bt as ReleaseHook, C as Report, Cn as LocaleImpl, Ct as ChargeRequest, Dn as Costs, Dt as EffectResult, E as RestoreResult, En as ConsoleImpl, Et as Cost, Fn as Library, Ft as Metering, G as RunStarted, Gt as SegmentGrant, H as RunAccounting, Hn as LimitName, Ht as ScopeDecl, It as Operation, J as Value, Jt as SuspendingOp, K as Decimal, Kt as SegmentLifecycle, Ln as LibrarySource, Lt as Operations, Mt as GrantContext, N as Settlement, Nt as ImmediateOp, On as MusicalClockImpl, Ot as ErrorDecl, Pt as LimitReached, Q as dec, Qt as operationDeclarations, R as Verdict, Rn as OperationRef, Rt as PlainArg, S as PumpedRequest, St as CapabilityDefiner, T as RestoreOptions, Tn as CalendarImpl, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Limits, Ut as SegmentContext, V as CausalWork, Vt as ReleaseReason, W as RunDiscarded, Wn as Outcome, Wt as SegmentCoordinator, X as bytes, Xt as defineCapability, Y as bool, Yt as conforms, Z as civilDate, Zt as explain, _ as LoadOptions, _n as SqlParams, _t as PropDef, an as PeerImpl, ar as LoadError, at as quantity, b as PumpOptions, bn as SqliteBinding, bt as Call, cn as HttpClientImpl, cr as SendFailedReason, d as Counters, dt as nowMicros, en as Core, f as Decided, fn as UserImpl, ft as parseInstant, g as Inspection, gt as ObjectKindDef, h as GroupOptions, hn as add, ht as ObjectKind, ir as LoadDiagnostic, it as num, jt as Grant, kn as TimerImpl, kt as FieldShape, l as CancellationOptions, ln as HttpImpl, lt as text, m as EffectFailure, mn as StoreImpl, mt as ObjectElements, nn as Script, nr as HostError, nt as map, or as MailboxFull, ot as range, p as Deciding, pt as HostObject, q as Kind, qt as Shape, rn as Versions, rr as HostErrorCode, rt as nothing, sr as ScriptError, st as record, tn as Group, tt as list, u as CarryOver, un as HttpServerImpl, ut as formatInstant, v as Message, vn as SqlRows, w as Requested, wt as ChargeResult, x as PumpResult, xn as SqliteImpl, xt as CapabilityDef, y as PendingCall, yn as SqlValue, yt as GrantDecls, zt as PlainResult } from "./debug-2yfUZYzF.js";
|
|
3
|
+
import { A as FromValueOptions, C as handlersOf, F as talk, M as ToValueOptions, N as fromValue, P as toValue, S as ScriptWithHandlers, T as encodeJson, b as createGroup, d as exportManifest, f as zoneRules, h as inlineGrants, j as PlainValue, k as encodeValue, l as ManifestSpec, m as InlineOperation, p as InlineFunction, u as MessageDecl, v as CreateGroupOptions, w as decodeJson, x as Handlers, y as DrivenGroup } from "./lean-DU_muGpT.js";
|
|
4
|
+
import { a as decodeValue, n as Json, o as readDisplay } from "./readers-IhVpgXkj.js";
|
|
5
|
+
import { t as BinaryValueOptions } from "./binary-value-B8W4W_e1.js";
|
|
6
6
|
//#region src/wasm/reactor.d.ts
|
|
7
7
|
/** Text the reactor writes to stdout or stderr, such as a fatal error. */
|
|
8
8
|
type Diagnostics = (line: string) => void;
|
|
@@ -253,4 +253,4 @@ export declare const defaultLimits: Readonly<{
|
|
|
253
253
|
cleanupBudget: number;
|
|
254
254
|
}>;
|
|
255
255
|
//#endregion
|
|
256
|
-
export { type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type ConsoleImpl, type CoordinatedLifecycle, type Core, type CoreOptions, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type DrivenGroup, type EffectFailure, type EffectResult, type ErrorDecl, type FieldShape, type FireOp, type FromValueOptions, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Kind, type Library, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type MusicalClockImpl, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operation, type OperationRef, type Operations, type Outcome, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, type RunAccounting, type RunAncestry, type RunDiscarded, type RunStarted, type ScopeDecl, type Script, ScriptError, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SendFailedReason, type Settlement, type Shape, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StoreImpl, type SuspendingOp, type TimerImpl, type ToValueOptions, type UserImpl, Value, type Verdict, type Versions, type WasmSource, add, bool, bytes, civilDate, conforms, createGroup, dec, decodeJson, decodeValue, encodeJson, encodeValue, explain, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, operationDeclarations, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue };
|
|
256
|
+
export { type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type ConsoleImpl, type CoordinatedLifecycle, type Core, type CoreOptions, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type DrivenGroup, type EffectFailure, type EffectResult, type ErrorDecl, type FieldShape, type FireOp, type FromValueOptions, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Kind, type Library, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type MusicalClockImpl, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operation, type OperationRef, type Operations, type Outcome, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, type RunAccounting, type RunAncestry, type RunDiscarded, type RunStarted, type ScopeDecl, type Script, ScriptError, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SendFailedReason, type Settlement, type Shape, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StoreImpl, type SuspendingOp, type TimerImpl, type ToValueOptions, type UserImpl, Value, type Verdict, type Versions, type WasmSource, add, bool, bytes, civilDate, conforms, createGroup, dec, decodeJson, decodeValue, encodeJson, encodeValue, explain, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, operationDeclarations, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue, zoneRules };
|
package/wasm.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
import { D as instant, G as patternValue, H as num, J as range, K as quantity, L as map, N as list, Qt as parseInstant, U as objectValue, V as nothing, X as requireArgs, Xt as nowMicros, Y as record, Z as requireValue, b as dec, c as Decimal, d as bytes, g as civilDate, i as ScriptError, it as text, l as Value, n as LoadError, o as invalidValue, qt as formatInstant, r as MailboxFull, s as sendFailed, t as HostError, u as bool, w as functionValue } from "./errors-
|
|
3
|
-
import { a as rebindObject, n as makeObject, t as defineObjectKind } from "./objects-
|
|
4
|
-
import { Dt as shape, Et as operationDeclarations, bt as defineCapability, gt as LimitReached, mt as limitDefaults, vt as conforms, wt as explain } from "./operations-
|
|
5
|
-
import { c as CallMeter, i as operationData, n as exportManifest, o as shapeData, s as invoke } from "./manifest-
|
|
2
|
+
import { D as instant, G as patternValue, H as num, J as range, K as quantity, L as map, N as list, Qt as parseInstant, U as objectValue, V as nothing, X as requireArgs, Xt as nowMicros, Y as record, Z as requireValue, b as dec, c as Decimal, d as bytes, g as civilDate, i as ScriptError, it as text, l as Value, n as LoadError, o as invalidValue, qt as formatInstant, r as MailboxFull, s as sendFailed, t as HostError, u as bool, w as functionValue } from "./errors-CNc-xY_9.js";
|
|
3
|
+
import { a as rebindObject, n as makeObject, t as defineObjectKind } from "./objects-OKVLH190.js";
|
|
4
|
+
import { Dt as shape, Et as operationDeclarations, bt as defineCapability, gt as LimitReached, mt as limitDefaults, vt as conforms, wt as explain } from "./operations-DrsedOvj.js";
|
|
5
|
+
import { c as CallMeter, i as operationData, n as exportManifest, o as shapeData, s as invoke } from "./manifest-CRpUahPt.js";
|
|
6
6
|
import { n as trackOperation } from "./operation-promises-ClA1BTaS.js";
|
|
7
7
|
import { n as toBase64, t as fromBase64 } from "./base64-CDO-a06R.js";
|
|
8
|
-
import { a as fromJson, c as readDisplay, l as readOrderedJSON, n as JsonObject, o as isJsonNumber, r as decodeValue, s as isJsonObject, t as JsonNumber } from "./readers-
|
|
9
|
-
import { a as clockCapability, d as timerCapability, i as calendarCapability, l as isMusicalClock, n as quoteJSON, o as consoleCapability, p as standardChecks, r as MUSICAL_CLOCK, t as encodeValue, u as musicalClockCapability } from "./encoding-
|
|
10
|
-
import { a as peerKind, i as peerCapability } from "./peer-capability-
|
|
11
|
-
import { a as
|
|
12
|
-
import { o as decodeJson, s as encodeJson } from "./http-fetch
|
|
13
|
-
import { n as localeCapability, t as userCapability } from "./user-capability-
|
|
14
|
-
import { r as storeCapability, t as add } from "./store-capability-
|
|
15
|
-
import { a as encodeResult, c as isRequestPumpBinary, d as valueNode, i as encodeBinaryFrame, l as placeholderValues, n as decodeBinaryFrame, o as heldValue, r as decodeNeed, s as isBinaryNeed, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-
|
|
8
|
+
import { a as fromJson, c as readDisplay, l as readOrderedJSON, n as JsonObject, o as isJsonNumber, r as decodeValue, s as isJsonObject, t as JsonNumber } from "./readers-G1lHqrPl.js";
|
|
9
|
+
import { a as clockCapability, d as timerCapability, i as calendarCapability, l as isMusicalClock, n as quoteJSON, o as consoleCapability, p as standardChecks, r as MUSICAL_CLOCK, t as encodeValue, u as musicalClockCapability } from "./encoding-DlMqlP2Y.js";
|
|
10
|
+
import { a as peerKind, i as peerCapability } from "./peer-capability-RMdN4OHj.js";
|
|
11
|
+
import { a as httpCapability, c as toValue, i as handlersOf, l as talk, n as inlineGrants, o as sqliteCapability, r as createGroup, s as fromValue, t as zoneRules } from "./zone-rules-Cn-f9u_Z.js";
|
|
12
|
+
import { o as decodeJson, s as encodeJson } from "./http-fetch-CLAeEXVi.js";
|
|
13
|
+
import { n as localeCapability, t as userCapability } from "./user-capability-CzoLN3RK.js";
|
|
14
|
+
import { r as storeCapability, t as add } from "./store-capability-Db6v_dw9.js";
|
|
15
|
+
import { a as encodeResult, c as isRequestPumpBinary, d as valueNode, f as envelopeJsonMessages, i as encodeBinaryFrame, l as placeholderValues, m as envelopeViews, n as decodeBinaryFrame, o as heldValue, p as envelopeMessages, r as decodeNeed, s as isBinaryNeed, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-P8m6kLfB.js";
|
|
16
16
|
//#region src/wasm/wire.ts
|
|
17
17
|
const raw = Symbol("raw JSON");
|
|
18
18
|
const sep = Symbol("separator");
|
|
@@ -361,6 +361,53 @@ var Reactor = class {
|
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
363
|
//#endregion
|
|
364
|
+
//#region src/wasm/envelope-json.ts
|
|
365
|
+
const fieldsOf = new Map([...envelopeMessages.filter((m) => m.layouts?.includes("json")).map((m) => [m.name, m.fields]), ...envelopeJsonMessages.map((m) => [m.name, m.fields])]);
|
|
366
|
+
/** Each view's fields by name, and its required ones. */
|
|
367
|
+
const views = new Map(envelopeViews.map((v) => [v.name, {
|
|
368
|
+
byName: new Map(v.fields.map((f) => [f.name, f])),
|
|
369
|
+
required: v.fields.filter((f) => f.required).map((f) => f.name)
|
|
370
|
+
}]));
|
|
371
|
+
/** A message's JSON fields, in catalogue order; absent fields are left out. */
|
|
372
|
+
const encodeJsonMessage = (m, record) => {
|
|
373
|
+
const given = record;
|
|
374
|
+
const out = {};
|
|
375
|
+
for (const f of fieldsOf.get(m)) if (f.name !== "ref" && f.name !== "group" && given[f.name] !== void 0) out[f.name] = given[f.name];
|
|
376
|
+
return out;
|
|
377
|
+
};
|
|
378
|
+
const uintOf = (j) => isJsonNumber(j) ? BigInt(j.source) : typeof j === "string" && /^\d+$/.test(j) ? BigInt(j) : void 0;
|
|
379
|
+
const decodeField = (f, j) => {
|
|
380
|
+
switch (f.kind) {
|
|
381
|
+
case "text":
|
|
382
|
+
case "instant": return textOf(j);
|
|
383
|
+
case "texts": return textsOf(j);
|
|
384
|
+
case "bool": return boolOf(j);
|
|
385
|
+
case "int": return intOf(j);
|
|
386
|
+
case "uint": return uintOf(j);
|
|
387
|
+
case "pairs": return listOf(j).map((p) => {
|
|
388
|
+
const [k, v] = listOf(p);
|
|
389
|
+
return [textOf(k) ?? "", v ?? null];
|
|
390
|
+
});
|
|
391
|
+
case "views": return listOf(j).map((x) => decodeView(f.view, x));
|
|
392
|
+
default: return j;
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
const decodeView = (name, j) => {
|
|
396
|
+
const { byName, required } = views.get(name);
|
|
397
|
+
const out = {};
|
|
398
|
+
for (const [k, v] of entriesOf(j)) {
|
|
399
|
+
const f = byName.get(k);
|
|
400
|
+
if (f) {
|
|
401
|
+
const decoded = decodeField(f, v);
|
|
402
|
+
if (decoded !== void 0) out[k] = decoded;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
for (const k of required) if (!(k in out)) throw new InstanceLostError(`The ${name} reply lacks ${k}`);
|
|
406
|
+
return out;
|
|
407
|
+
};
|
|
408
|
+
/** A reply view read from its JSON, typed by the catalogue. */
|
|
409
|
+
const decodeJsonView = (view, j) => decodeView(view, j);
|
|
410
|
+
//#endregion
|
|
364
411
|
//#region src/wasm/group.ts
|
|
365
412
|
const key = (kind, id) => `${kind}\u0000${id}`;
|
|
366
413
|
const isLimitReached = (error) => error instanceof Error && error.name === "LimitReached";
|
|
@@ -1054,19 +1101,20 @@ var WasmGroup = class {
|
|
|
1054
1101
|
...given,
|
|
1055
1102
|
[MUSICAL_CLOCK]: this.#musicalClock
|
|
1056
1103
|
} : given;
|
|
1057
|
-
const
|
|
1104
|
+
const load = {
|
|
1058
1105
|
name: o.name,
|
|
1059
1106
|
source: o.source,
|
|
1060
1107
|
grants: this.#grantHandles(grants),
|
|
1061
1108
|
grantsAsUsed: o.grantsAsUsed,
|
|
1062
|
-
forbidSuspension: o.forbidSuspension || void 0,
|
|
1063
1109
|
owner: o.owner ? this.#objectRef(o.owner) : void 0,
|
|
1064
1110
|
objects: o.objects ? Object.fromEntries(Object.entries(o.objects).map(([n, h]) => [n, this.#objectRef(h)])) : void 0,
|
|
1065
1111
|
limits: {
|
|
1066
1112
|
...limitDefaults,
|
|
1067
1113
|
...o.limits
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1114
|
+
},
|
|
1115
|
+
forbidSuspension: o.forbidSuspension || void 0
|
|
1116
|
+
};
|
|
1117
|
+
const ok = this.worker("load", encodeJsonMessage("load", load));
|
|
1070
1118
|
const name = textOf(field(ok, "script")) ?? o.name;
|
|
1071
1119
|
this.#bindings.set(name, new Map(Object.entries(grants)));
|
|
1072
1120
|
const script = new WasmScript(this, name);
|
|
@@ -1293,37 +1341,29 @@ var WasmGroup = class {
|
|
|
1293
1341
|
return bytesOfFrame(field(this.worker("state-fingerprint"), "stateFingerprint"));
|
|
1294
1342
|
}
|
|
1295
1343
|
inspect() {
|
|
1296
|
-
const ok = this.worker("inspect");
|
|
1297
|
-
return { scripts:
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
name: textOf(field(message, "name")),
|
|
1320
|
-
args: listOf(field(message, "args")).map((a) => decode(this.#codec, a)),
|
|
1321
|
-
...limits ? { limits } : {}
|
|
1322
|
-
}
|
|
1323
|
-
};
|
|
1324
|
-
})
|
|
1325
|
-
};
|
|
1326
|
-
}) };
|
|
1344
|
+
const ok = this.worker("inspect", encodeJsonMessage("inspect", {}));
|
|
1345
|
+
return { scripts: decodeJsonView("inspection", ok).scripts.map((s) => ({
|
|
1346
|
+
name: s.name,
|
|
1347
|
+
...s.disabledGrants?.length ? { disabledGrants: [...s.disabledGrants] } : {},
|
|
1348
|
+
...s.forbidSuspension ? { forbidSuspension: true } : {},
|
|
1349
|
+
vars: s.vars.map(([name, v]) => [name, decode(this.#codec, v)]),
|
|
1350
|
+
runs: s.runs.map((r) => ({
|
|
1351
|
+
id: r.id,
|
|
1352
|
+
status: r.status,
|
|
1353
|
+
handler: r.handler,
|
|
1354
|
+
...r.wait !== void 0 ? { wait: r.wait } : {},
|
|
1355
|
+
...r.until !== void 0 ? { until: parseInstant(r.until) } : {},
|
|
1356
|
+
...r.calls ? { calls: [...r.calls] } : {}
|
|
1357
|
+
})),
|
|
1358
|
+
mailbox: s.mailbox.map((item) => ({
|
|
1359
|
+
...item.delivery !== void 0 ? { delivery: item.delivery } : {},
|
|
1360
|
+
...item.from !== void 0 ? { from: item.from } : {},
|
|
1361
|
+
message: {
|
|
1362
|
+
name: textOf(field(item.message, "name")),
|
|
1363
|
+
args: listOf(field(item.message, "args")).map((a) => decode(this.#codec, a))
|
|
1364
|
+
}
|
|
1365
|
+
}))
|
|
1366
|
+
})) };
|
|
1327
1367
|
}
|
|
1328
1368
|
settle(callId, s) {
|
|
1329
1369
|
const pending = this.#restored.get(callId);
|
|
@@ -1795,4 +1835,4 @@ const createCore = async (o = {}) => new WasmCore(await compile(o.wasm ?? new UR
|
|
|
1795
1835
|
/** Chapter 9's default Limits, which the reactor shares. */
|
|
1796
1836
|
const defaultLimits = Object.freeze({ ...limitDefaults });
|
|
1797
1837
|
//#endregion
|
|
1798
|
-
export { Decimal, HostError, InstanceLostError, LimitReached, LoadError, MailboxFull, ScriptError, Value, WasmCore, WasmGroup, WasmScript, add, bool, bytes, civilDate, conforms, createCore, createGroup, dec, decodeJson, decodeValue, defaultLimits, encodeJson, encodeValue, explain, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, operationDeclarations, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue };
|
|
1838
|
+
export { Decimal, HostError, InstanceLostError, LimitReached, LoadError, MailboxFull, ScriptError, Value, WasmCore, WasmGroup, WasmScript, add, bool, bytes, civilDate, conforms, createCore, createGroup, dec, decodeJson, decodeValue, defaultLimits, encodeJson, encodeValue, explain, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, operationDeclarations, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue, zoneRules };
|