nervur 0.19.2 → 0.20.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 +156 -104
- package/dist/being/being.d.ts +8 -15
- package/dist/being/being.js +20 -67
- package/dist/being/digest.d.ts +1 -1
- package/dist/being/digest.js +7 -27
- package/dist/being/faculty.d.ts +10 -0
- package/dist/being/faculty.js +74 -0
- package/dist/being/index.d.ts +5 -5
- package/dist/being/index.js +6 -5
- package/dist/being/kind.d.ts +4 -0
- package/dist/being/kind.js +28 -0
- package/dist/being/types.d.ts +35 -63
- package/dist/being/types.js +3 -57
- package/dist/being/words.d.ts +13 -0
- package/dist/being/words.js +14 -0
- package/dist/cli/command.d.ts +13 -0
- package/dist/cli/command.js +194 -0
- package/dist/cli/harbor.d.ts +21 -0
- package/dist/cli/harbor.js +141 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +14 -0
- package/dist/contract/index.d.ts +39 -0
- package/dist/contract/index.js +33 -0
- package/dist/crypto/aes.d.ts +3 -0
- package/dist/crypto/aes.js +24 -0
- package/dist/crypto/bytes.d.ts +6 -0
- package/dist/crypto/bytes.js +33 -0
- package/dist/crypto/ed25519.d.ts +3 -0
- package/dist/crypto/ed25519.js +85 -0
- package/dist/crypto/hash.d.ts +2 -0
- package/dist/crypto/hash.js +11 -0
- package/dist/crypto/index.d.ts +7 -0
- package/dist/crypto/index.js +10 -0
- package/dist/crypto/json.d.ts +8 -0
- package/dist/crypto/json.js +250 -0
- package/dist/crypto/mlkem.d.ts +12 -0
- package/dist/crypto/mlkem.js +36 -0
- package/dist/crypto/subtle.d.ts +10 -0
- package/dist/crypto/subtle.js +29 -0
- package/dist/crypto/x25519.d.ts +2 -0
- package/dist/crypto/x25519.js +21 -0
- package/dist/folder/index.d.ts +14 -0
- package/dist/folder/index.js +87 -0
- package/dist/harbor/catalogue.d.ts +25 -0
- package/dist/harbor/catalogue.js +93 -0
- package/dist/harbor/dock.d.ts +29 -0
- package/dist/harbor/dock.js +122 -0
- package/dist/harbor/harbor.d.ts +31 -0
- package/dist/harbor/harbor.js +146 -0
- package/dist/harbor/index.d.ts +7 -10
- package/dist/harbor/index.js +9 -18
- package/dist/harbor/package.d.ts +10 -0
- package/dist/harbor/package.js +115 -0
- package/dist/harbor/registry.d.ts +9 -0
- package/dist/harbor/registry.js +78 -0
- package/dist/harbor/root-line.d.ts +9 -0
- package/dist/harbor/root-line.js +36 -0
- package/dist/harbor/terrain.d.ts +9 -0
- package/dist/harbor/terrain.js +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +14 -0
- package/dist/pointer/bodies.d.ts +26 -0
- package/dist/pointer/bodies.js +64 -0
- package/dist/pointer/index.d.ts +2 -0
- package/dist/pointer/index.js +4 -0
- package/dist/pointer/world.d.ts +35 -0
- package/dist/pointer/world.js +85 -0
- package/dist/quo/door.d.ts +34 -0
- package/dist/quo/door.js +172 -0
- package/dist/quo/index.d.ts +8 -0
- package/dist/quo/index.js +11 -0
- package/dist/quo/invitation.d.ts +7 -0
- package/dist/quo/invitation.js +15 -0
- package/dist/quo/keys.d.ts +40 -0
- package/dist/quo/keys.js +79 -0
- package/dist/quo/payload.d.ts +15 -0
- package/dist/quo/payload.js +55 -0
- package/dist/quo/relations.d.ts +40 -0
- package/dist/quo/relations.js +33 -0
- package/dist/quo/reply.d.ts +13 -0
- package/dist/quo/reply.js +35 -0
- package/dist/quo/seal.d.ts +42 -0
- package/dist/quo/seal.js +78 -0
- package/dist/quo/standing.d.ts +39 -0
- package/dist/quo/standing.js +90 -0
- package/dist/tcp/frame.d.ts +29 -0
- package/dist/tcp/frame.js +74 -0
- package/dist/tcp/index.d.ts +18 -0
- package/dist/tcp/index.js +164 -0
- package/dist/ward/allowance.d.ts +13 -9
- package/dist/ward/allowance.js +28 -67
- package/dist/ward/cells.d.ts +6 -6
- package/dist/ward/cells.js +67 -179
- package/dist/ward/index.d.ts +6 -10
- package/dist/ward/index.js +7 -13
- package/dist/ward/partition.d.ts +44 -60
- package/dist/ward/partition.js +56 -285
- package/dist/ward/pilot.d.ts +8 -0
- package/dist/ward/pilot.js +50 -0
- package/dist/ward/stance.d.ts +27 -20
- package/dist/ward/stance.js +174 -406
- package/dist/ward/ward-being.d.ts +35 -0
- package/dist/ward/ward-being.js +82 -0
- package/dist/ward/ward.d.ts +45 -11
- package/dist/ward/ward.js +239 -357
- package/package.json +24 -31
- package/src/being/being.ts +35 -78
- package/src/being/digest.ts +7 -35
- package/src/being/faculty.ts +73 -0
- package/src/being/index.ts +6 -6
- package/src/being/kind.ts +30 -0
- package/src/being/types.ts +50 -146
- package/src/being/words.ts +31 -0
- package/src/cli/command.ts +188 -0
- package/src/cli/harbor.ts +137 -0
- package/src/cli/main.ts +13 -0
- package/src/contract/index.ts +73 -0
- package/src/crypto/aes.ts +26 -0
- package/src/crypto/bytes.ts +37 -0
- package/src/crypto/ed25519.ts +84 -0
- package/src/crypto/hash.ts +14 -0
- package/src/crypto/index.ts +10 -0
- package/src/crypto/json.ts +241 -0
- package/src/crypto/mlkem.ts +38 -0
- package/src/crypto/subtle.ts +33 -0
- package/src/crypto/x25519.ts +21 -0
- package/src/folder/index.ts +92 -0
- package/src/harbor/catalogue.ts +110 -0
- package/src/harbor/dock.ts +137 -0
- package/src/harbor/harbor.ts +180 -0
- package/src/harbor/index.ts +9 -19
- package/src/harbor/package.ts +131 -0
- package/src/harbor/registry.ts +73 -0
- package/src/harbor/root-line.ts +36 -0
- package/src/harbor/terrain.ts +15 -0
- package/src/index.ts +20 -0
- package/src/pointer/bodies.ts +65 -0
- package/src/pointer/index.ts +4 -0
- package/src/pointer/world.ts +94 -0
- package/src/quo/door.ts +178 -0
- package/src/quo/index.ts +11 -0
- package/src/quo/invitation.ts +15 -0
- package/src/quo/keys.ts +91 -0
- package/src/quo/payload.ts +61 -0
- package/src/quo/relations.ts +62 -0
- package/src/quo/reply.ts +38 -0
- package/src/quo/seal.ts +101 -0
- package/src/quo/standing.ts +111 -0
- package/src/stand/main.ts +20 -0
- package/src/stand/stand.ts +220 -0
- package/src/tcp/frame.ts +78 -0
- package/src/tcp/index.ts +173 -0
- package/src/ward/allowance.ts +37 -75
- package/src/ward/cells.ts +63 -176
- package/src/ward/index.ts +7 -17
- package/src/ward/partition.ts +86 -326
- package/src/ward/pilot.ts +50 -0
- package/src/ward/stance.ts +186 -420
- package/src/ward/ward-being.ts +103 -0
- package/src/ward/ward.ts +256 -359
- package/dist/being/lent.d.ts +0 -32
- package/dist/being/lent.js +0 -72
- package/dist/being/silence.d.ts +0 -12
- package/dist/being/silence.js +0 -41
- package/dist/conformance/assert.d.ts +0 -11
- package/dist/conformance/assert.js +0 -106
- package/dist/conformance/beings.d.ts +0 -199
- package/dist/conformance/beings.js +0 -188
- package/dist/conformance/estate.d.ts +0 -5
- package/dist/conformance/estate.js +0 -388
- package/dist/conformance/index.d.ts +0 -80
- package/dist/conformance/index.js +0 -819
- package/dist/conformance/reach.d.ts +0 -10
- package/dist/conformance/reach.js +0 -72
- package/dist/conformance/store.d.ts +0 -5
- package/dist/conformance/store.js +0 -113
- package/dist/harbor/box.d.ts +0 -121
- package/dist/harbor/box.js +0 -121
- package/dist/harbor/core.d.ts +0 -55
- package/dist/harbor/core.js +0 -662
- package/dist/harbor/dial.d.ts +0 -9
- package/dist/harbor/dial.js +0 -81
- package/dist/harbor/memory.d.ts +0 -29
- package/dist/harbor/memory.js +0 -104
- package/dist/harbor/reach.d.ts +0 -36
- package/dist/harbor/reach.js +0 -199
- package/dist/harbor/store.d.ts +0 -35
- package/dist/harbor/store.js +0 -62
- package/dist/vector/cases.d.ts +0 -42
- package/dist/vector/cases.js +0 -223
- package/dist/vector/index.d.ts +0 -6
- package/dist/vector/index.js +0 -8
- package/dist/vector/stand.d.ts +0 -9
- package/dist/vector/stand.js +0 -77
- package/dist/vector/world.d.ts +0 -144
- package/dist/vector/world.js +0 -209
- package/dist/ward/arithmetic.d.ts +0 -31
- package/dist/ward/arithmetic.js +0 -249
- package/dist/ward/door.d.ts +0 -18
- package/dist/ward/door.js +0 -186
- package/dist/ward/ground.d.ts +0 -29
- package/dist/ward/ground.js +0 -56
- package/dist/ward/heirs.d.ts +0 -13
- package/dist/ward/heirs.js +0 -117
- package/dist/ward/json.d.ts +0 -2
- package/dist/ward/json.js +0 -163
- package/dist/ward/owner.d.ts +0 -13
- package/dist/ward/owner.js +0 -220
- package/dist/ward/seal.d.ts +0 -52
- package/dist/ward/seal.js +0 -150
- package/src/being/lent.ts +0 -72
- package/src/being/silence.ts +0 -46
- package/src/conformance/assert.ts +0 -100
- package/src/conformance/beings.ts +0 -188
- package/src/conformance/estate.ts +0 -412
- package/src/conformance/index.ts +0 -965
- package/src/conformance/reach.ts +0 -83
- package/src/conformance/store.ts +0 -125
- package/src/harbor/box.ts +0 -131
- package/src/harbor/core.ts +0 -699
- package/src/harbor/dial.ts +0 -112
- package/src/harbor/memory.ts +0 -123
- package/src/harbor/reach.ts +0 -221
- package/src/harbor/store.ts +0 -91
- package/src/vector/cases.ts +0 -257
- package/src/vector/index.ts +0 -11
- package/src/vector/stand.ts +0 -76
- package/src/vector/world.ts +0 -232
- package/src/ward/arithmetic.ts +0 -251
- package/src/ward/door.ts +0 -186
- package/src/ward/ground.ts +0 -142
- package/src/ward/heirs.ts +0 -116
- package/src/ward/json.ts +0 -144
- package/src/ward/owner.ts +0 -214
- package/src/ward/seal.ts +0 -178
package/dist/ward/cells.js
CHANGED
|
@@ -1,186 +1,74 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// nesting that forty levels deep is inside the depth bound and is a trillion
|
|
8
|
-
// values once written down. What is walked here is the object graph, which is
|
|
9
|
-
// small; what a harbor keeps is the tree it expands to, which is not. So the
|
|
10
|
-
// walk counts the tree while it proves the graph, and refuses a value nobody
|
|
11
|
-
// could write down. This is a bound on what a being holds, so it is this
|
|
12
|
-
// kit's number and no word of the spec.
|
|
13
|
-
export const BREADTH = 1 << 20;
|
|
14
|
-
// Text a harbor can write down: every surrogate in a pair. A lone one is a
|
|
15
|
-
// code unit with no character, which JSON escapes and UTF-8 cannot encode at
|
|
16
|
-
// all, so a harbor that keeps strings as bytes loses it and one that keeps
|
|
17
|
-
// the object does not. I-JSON says a string is text, and this is that rule
|
|
18
|
-
// where the value is written rather than where it is read.
|
|
19
|
-
const WELL_FORMED = /^(?:[^\uD800-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/;
|
|
20
|
-
// I-JSON, all the way down. A number that JSON cannot write is not a number
|
|
21
|
-
// a harbor can keep, a key on the prototype is not a key she wrote, and a
|
|
22
|
-
// hole in a list, or a key named `__proto__`, is a thing JSON writes one way
|
|
23
|
-
// and a runtime reads another.
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// A being's cells, guarded. Her cells are kept by whatever memory her
|
|
3
|
+
// terrain gives, and a memory that writes JSON would hand back something
|
|
4
|
+
// other than what she wrote if she wrote anything JSON cannot hold. So a
|
|
5
|
+
// write that is not a value throws where she wrote it, in her own frame,
|
|
6
|
+
// and her answer becomes silence like any throw.
|
|
24
7
|
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (typeof v === 'string')
|
|
32
|
-
return WELL_FORMED.test(v) ? 1 : `${path} carries a lone surrogate, which is no text a harbor can write down`;
|
|
33
|
-
if (typeof v === 'number') {
|
|
34
|
-
if (!Number.isFinite(v))
|
|
35
|
-
return `${path} is ${String(v)}, which no harbor can write down`;
|
|
36
|
-
// Minus zero is a number JSON writes as `0` and reads back as `0`. A
|
|
37
|
-
// harbor that keeps values would hand her the sign she wrote and one that
|
|
38
|
-
// writes JSON would not, and she is never told which she is standing in.
|
|
39
|
-
return Object.is(v, -0) ? `${path} is minus zero, which comes back as zero from every harbor that writes JSON` : 1;
|
|
40
|
-
}
|
|
41
|
-
if (typeof v !== 'object')
|
|
42
|
-
return `${path} is a ${typeof v}, which is not a value`;
|
|
43
|
-
if (seen.has(v))
|
|
44
|
-
return `${path} refers back to itself`;
|
|
45
|
-
const counted = sized.get(v);
|
|
46
|
-
if (counted !== undefined)
|
|
47
|
-
return counted;
|
|
48
|
-
if (depth >= DEPTH)
|
|
49
|
-
return `${path} is nested past ${DEPTH} levels, which no harbor can keep`;
|
|
50
|
-
seen.add(v);
|
|
51
|
-
try {
|
|
52
|
-
let size = 1;
|
|
53
|
-
const under = (where, x) => {
|
|
54
|
-
const r = walk(x, where, seen, sized, depth + 1);
|
|
55
|
-
if (typeof r === 'string')
|
|
56
|
-
return r;
|
|
57
|
-
size += r;
|
|
58
|
-
return size > BREADTH ? `${path} writes out to more than ${BREADTH} values, which no harbor can keep` : null;
|
|
59
|
-
};
|
|
60
|
-
if (Array.isArray(v)) {
|
|
61
|
-
for (let i = 0; i < v.length; i += 1) {
|
|
62
|
-
if (!(i in v))
|
|
63
|
-
return `${path}[${i}] is a hole, which no harbor can write down`;
|
|
64
|
-
const f = under(`${path}[${i}]`, v[i]);
|
|
65
|
-
if (f)
|
|
66
|
-
return f;
|
|
67
|
-
}
|
|
68
|
-
sized.set(v, size);
|
|
69
|
-
return size;
|
|
70
|
-
}
|
|
71
|
-
const proto = Object.getPrototypeOf(v);
|
|
72
|
-
if (proto !== Object.prototype && proto !== null)
|
|
73
|
-
return `${path} is a ${(v).constructor?.name ?? 'object'}, which is not a value`;
|
|
74
|
-
for (const k of Object.keys(v)) {
|
|
75
|
-
if (k === '__proto__')
|
|
76
|
-
return `${path}.__proto__ is a key no harbor can keep`;
|
|
77
|
-
const f = under(`${path}.${k}`, v[k]);
|
|
78
|
-
if (f)
|
|
79
|
-
return f;
|
|
80
|
-
}
|
|
81
|
-
sized.set(v, size);
|
|
82
|
-
return size;
|
|
83
|
-
}
|
|
84
|
-
finally {
|
|
85
|
-
seen.delete(v);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
export const cellFault = (v, path) => {
|
|
89
|
-
const out = walk(v, path, new Set(), new Map(), 0);
|
|
90
|
-
return typeof out === 'string' ? out : null;
|
|
91
|
-
};
|
|
92
|
-
// The three keys at the root of her cells that are the ward's: it writes
|
|
93
|
-
// them, she reads them, and a write of hers there is refused like a non-value.
|
|
94
|
-
const WARDS = new Set(['standings', 'occupants', 'class']);
|
|
95
|
-
// The guard is one proxy at the root and one for every container read through
|
|
96
|
-
// it, so a write nested three deep is refused the same way a write at the top
|
|
97
|
-
// is. Wrappers are remembered, so reading the same array twice is the same
|
|
98
|
-
// object twice and a being may still compare what she holds.
|
|
99
|
-
const wrapped = new WeakMap();
|
|
100
|
-
const targets = new WeakMap();
|
|
101
|
-
const guards = new WeakSet();
|
|
102
|
-
// A name no partition can hold, wherever it appears. It is here beside the
|
|
103
|
-
// guard that refuses it, because the ward refuses it too: a relation named
|
|
104
|
-
// this one would be written into the bind table and then throw on her cells,
|
|
105
|
-
// which is half a relation and a throw where a null is promised. One rule,
|
|
106
|
-
// one place, read by the guard and by the stance.
|
|
107
|
-
export const unkeepable = (k) => k === '__proto__';
|
|
108
|
-
// A key a write may land on: a string that is not `__proto__`, and not one
|
|
109
|
-
// of the ward's at the root. A symbol key is a thing JSON never writes.
|
|
8
|
+
// What passes is stored as a fresh copy of its JSON text, so a reference
|
|
9
|
+
// she kept to what she wrote is not a way around the guard. Every key lands
|
|
10
|
+
// as an own key, `__proto__` included. A list grows at its end: a slot or a
|
|
11
|
+
// length past it would leave a hole.
|
|
12
|
+
import { writeValue } from '../crypto/index.js';
|
|
13
|
+
export const DEPTH = 64;
|
|
110
14
|
const refuse = (why) => {
|
|
111
15
|
throw new TypeError(`cells hold values: ${why}`);
|
|
112
16
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// length set past what she wrote, or a slot beyond it, would leave holes.
|
|
123
|
-
if (Array.isArray(t)) {
|
|
124
|
-
if (k === 'length') {
|
|
125
|
-
if (typeof v !== 'number' || v > t.length)
|
|
126
|
-
refuse(`${path}.length set past what she wrote would leave holes`);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const i = Number(k);
|
|
130
|
-
if (Number.isInteger(i) && i > t.length)
|
|
131
|
-
refuse(`${path}[${i}] would leave a hole`);
|
|
17
|
+
const copy = (value, room, where) => {
|
|
18
|
+
const text = writeValue(value, room);
|
|
19
|
+
return text === undefined ? refuse(`${where} is not a value JSON keeps, within ${room} levels`) : JSON.parse(text);
|
|
20
|
+
};
|
|
21
|
+
export class Cells {
|
|
22
|
+
#guards = new WeakMap();
|
|
23
|
+
#wrote;
|
|
24
|
+
constructor(wrote) {
|
|
25
|
+
this.#wrote = wrote;
|
|
132
26
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
refuse(f);
|
|
162
|
-
const ok = Reflect.defineProperty(t, k, d);
|
|
163
|
-
wrote();
|
|
164
|
-
return ok;
|
|
165
|
-
},
|
|
166
|
-
deleteProperty(t, k) {
|
|
167
|
-
if (root && typeof k === 'string' && WARDS.has(k))
|
|
168
|
-
refuse(`${path}.${k} is the ward's to keep`);
|
|
169
|
-
const ok = Reflect.deleteProperty(t, k);
|
|
170
|
-
wrote();
|
|
27
|
+
// The guarded view of a being's cells.
|
|
28
|
+
guard(cells) {
|
|
29
|
+
return this.#guard(cells, 'cells', 1);
|
|
30
|
+
}
|
|
31
|
+
#guard(target, path, level) {
|
|
32
|
+
const had = this.#guards.get(target);
|
|
33
|
+
if (had)
|
|
34
|
+
return had;
|
|
35
|
+
const room = DEPTH - level;
|
|
36
|
+
const place = (t, k, value) => {
|
|
37
|
+
if (typeof k !== 'string')
|
|
38
|
+
return refuse(`${path} takes no symbol key`);
|
|
39
|
+
const where = `${path}.${k}`;
|
|
40
|
+
if (Array.isArray(t)) {
|
|
41
|
+
if (k === 'length') {
|
|
42
|
+
if (typeof value !== 'number' || value > t.length)
|
|
43
|
+
refuse(`${where} past its end would leave a hole`);
|
|
44
|
+
t.length = value;
|
|
45
|
+
this.#wrote();
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (!/^(0|[1-9]\d*)$/.test(k))
|
|
49
|
+
refuse(`${where} is not a slot of a list`);
|
|
50
|
+
if (Number(k) > t.length)
|
|
51
|
+
refuse(`${where} would leave a hole`);
|
|
52
|
+
}
|
|
53
|
+
const ok = Reflect.defineProperty(t, k, { value: copy(value, room, where), enumerable: true, writable: true, configurable: true });
|
|
54
|
+
this.#wrote();
|
|
171
55
|
return ok;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
56
|
+
};
|
|
57
|
+
const proxy = new Proxy(target, {
|
|
58
|
+
get: (t, k, r) => {
|
|
59
|
+
const v = Reflect.get(t, k, r);
|
|
60
|
+
return typeof k === 'string' && Object.hasOwn(t, k) && typeof v === 'object' && v !== null ? this.#guard(v, `${path}.${k}`, level + 1) : v;
|
|
61
|
+
},
|
|
62
|
+
set: (t, k, v) => place(t, k, v),
|
|
63
|
+
defineProperty: (t, k, d) => ('value' in d ? place(t, k, d.value) : refuse(`${path}.${String(k)} is an accessor`)),
|
|
64
|
+
deleteProperty: (t, k) => {
|
|
65
|
+
const ok = Reflect.deleteProperty(t, k);
|
|
66
|
+
this.#wrote();
|
|
67
|
+
return ok;
|
|
68
|
+
},
|
|
69
|
+
setPrototypeOf: () => refuse(`${path} keeps its prototype`),
|
|
70
|
+
});
|
|
71
|
+
this.#guards.set(target, proxy);
|
|
72
|
+
return proxy;
|
|
73
|
+
}
|
|
178
74
|
}
|
|
179
|
-
// Her cells, guarded. Called once per being at boot; the guarded object is
|
|
180
|
-
// what goes into the partition and what the stance hands her, so there is no
|
|
181
|
-
// second door onto the same cells. Every write that passes says so to the
|
|
182
|
-
// ward, which says so to its harbor.
|
|
183
|
-
export const guardCells = (cells, wrote = () => { }) => guard(cells, 'cells', wrote, true);
|
|
184
|
-
// The cells behind the guard, for the ward alone: the one writer of the
|
|
185
|
-
// three keys that are its own.
|
|
186
|
-
export const unguarded = (cells) => (targets.get(cells) ?? cells);
|
package/dist/ward/index.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export * as seal from './seal.ts';
|
|
8
|
-
export * as arithmetic from './arithmetic.ts';
|
|
9
|
-
export { allow, spent, DEFAULT, CEILING } from './allowance.ts';
|
|
10
|
-
export type { Allowance } from './allowance.ts';
|
|
1
|
+
export { allow, CEILING, DEFAULT } from './allowance.ts';
|
|
2
|
+
export { HEAD_ROW, Partition, type BeingRow, type Head, type StandingRow } from './partition.ts';
|
|
3
|
+
export { DEPTH } from './stance.ts';
|
|
4
|
+
export { DOCK, Ward, type Catalogue, type Lender, type WardParts } from './ward.ts';
|
|
5
|
+
export { ownerAsk, pilots, WardBeing, type Steward, type WardBeingStance } from './ward-being.ts';
|
|
6
|
+
export { Pilot } from './pilot.ts';
|
package/dist/ward/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
//
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
// bytes against, and for tests that speak to a door directly.
|
|
10
|
-
export * as seal from './seal.js';
|
|
11
|
-
export * as arithmetic from './arithmetic.js';
|
|
12
|
-
// The allowance every ask carries, for a kit in another language and for
|
|
13
|
-
// tests that speak to a door directly.
|
|
14
|
-
export { allow, spent, DEFAULT, CEILING } from './allowance.js';
|
|
2
|
+
// The ward: its partition, its stances, its ward-being, and the ward.
|
|
3
|
+
export { allow, CEILING, DEFAULT } from './allowance.js';
|
|
4
|
+
export { HEAD_ROW, Partition } from './partition.js';
|
|
5
|
+
export { DEPTH } from './stance.js';
|
|
6
|
+
export { DOCK, Ward } from './ward.js';
|
|
7
|
+
export { ownerAsk, pilots, WardBeing } from './ward-being.js';
|
|
8
|
+
export { Pilot } from './pilot.js';
|
package/dist/ward/partition.d.ts
CHANGED
|
@@ -1,65 +1,49 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
seq: number;
|
|
14
|
-
reply: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export type StandingKeys = {
|
|
18
|
-
ward: string;
|
|
19
|
-
heir: string | null;
|
|
20
|
-
current: string;
|
|
21
|
-
next: string | null;
|
|
22
|
-
seq: number;
|
|
23
|
-
};
|
|
24
|
-
export type Bind = {
|
|
25
|
-
standings: Record<string, StandingKeys>;
|
|
26
|
-
occupants: Record<string, string>;
|
|
27
|
-
knocks: Record<string, {
|
|
28
|
-
current: string;
|
|
29
|
-
next: string | null;
|
|
30
|
-
spoke: boolean;
|
|
31
|
-
sent: boolean;
|
|
32
|
-
seq: number;
|
|
1
|
+
import type { Lock } from '../crypto/index.ts';
|
|
2
|
+
import { type HeirRecord, type Invitation, type KeptLock, type Relations, type StandingState } from '../quo/index.ts';
|
|
3
|
+
import type { Rows } from '../contract/index.ts';
|
|
4
|
+
import type { JsonObject } from '../being/index.ts';
|
|
5
|
+
export declare const HEAD_ROW = "";
|
|
6
|
+
export type Head = {
|
|
7
|
+
lock?: KeptLock;
|
|
8
|
+
heirs: Record<string, HeirRecord>;
|
|
9
|
+
gone: string[];
|
|
10
|
+
bind: Record<string, {
|
|
11
|
+
being: string;
|
|
12
|
+
id: string;
|
|
33
13
|
}>;
|
|
34
|
-
|
|
35
|
-
minted: string[];
|
|
14
|
+
public: string | null;
|
|
36
15
|
};
|
|
37
|
-
export type
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
export type StandingRow = {
|
|
17
|
+
invitation: Invitation;
|
|
18
|
+
state: StandingState;
|
|
19
|
+
seen: string | null;
|
|
40
20
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
beings: Record<string, Cells & {
|
|
48
|
-
class?: string;
|
|
21
|
+
export type BeingRow = {
|
|
22
|
+
class: string;
|
|
23
|
+
cells: JsonObject;
|
|
24
|
+
occupants: Record<string, {
|
|
25
|
+
heir: string;
|
|
26
|
+
notes: JsonObject;
|
|
49
27
|
}>;
|
|
50
|
-
|
|
51
|
-
heirs: Record<string, Heir>;
|
|
52
|
-
gone: Record<string, Gone>;
|
|
53
|
-
public: string | null;
|
|
28
|
+
standings: Record<string, StandingRow>;
|
|
54
29
|
};
|
|
55
|
-
export declare
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export declare
|
|
30
|
+
export declare class Partition {
|
|
31
|
+
readonly memory: Rows;
|
|
32
|
+
constructor(memory: Rows);
|
|
33
|
+
get head(): Head;
|
|
34
|
+
get beings(): Record<string, BeingRow>;
|
|
35
|
+
being(key: string): BeingRow | undefined;
|
|
36
|
+
told(key: string): void;
|
|
37
|
+
toldHead(): void;
|
|
38
|
+
kept(): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
export declare class PartitionRelations implements Relations {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(partition: Partition);
|
|
43
|
+
lock(): Lock | undefined;
|
|
44
|
+
setLock(lock: Lock): void;
|
|
45
|
+
get(heir: string): HeirRecord | undefined;
|
|
46
|
+
set(heir: string, record: HeirRecord): void;
|
|
47
|
+
delete(heir: string): void;
|
|
48
|
+
kept(): Promise<boolean>;
|
|
49
|
+
}
|