nervur 0.23.0 → 0.24.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/CONTRIBUTING.md +13 -0
- package/LICENSE +55 -202
- package/NOTICE +3 -8
- package/README.md +14 -156
- package/RELEASING.md +15 -0
- package/SECURITY.md +9 -0
- package/bin/nervur.js +6 -0
- package/package.json +26 -81
- package/AUTHORING.md +0 -935
- package/COMMAND.md +0 -179
- package/FACES.md +0 -280
- package/FACULTIES.md +0 -578
- package/GROUNDS.md +0 -315
- package/KIT-SPEC.md +0 -304
- package/WORLD.md +0 -195
- package/dist/app/app-ground.d.ts +0 -18
- package/dist/app/app-ground.js +0 -23
- package/dist/app/index.d.ts +0 -2
- package/dist/app/index.js +0 -5
- package/dist/app/native.d.ts +0 -11
- package/dist/app/native.js +0 -13
- package/dist/being/being.d.ts +0 -306
- package/dist/being/being.js +0 -20
- package/dist/being/covers.d.ts +0 -9
- package/dist/being/covers.js +0 -21
- package/dist/being/index.d.ts +0 -4
- package/dist/being/index.js +0 -6
- package/dist/being/need.d.ts +0 -49
- package/dist/being/need.js +0 -33
- package/dist/being/schema.d.ts +0 -100
- package/dist/being/schema.js +0 -132
- package/dist/being/table.d.ts +0 -48
- package/dist/being/table.js +0 -344
- package/dist/bench/bench-ground.d.ts +0 -73
- package/dist/bench/bench-ground.js +0 -153
- package/dist/bench/bench.d.ts +0 -101
- package/dist/bench/bench.js +0 -368
- package/dist/bench/fake-clock.d.ts +0 -17
- package/dist/bench/fake-clock.js +0 -34
- package/dist/bench/fake-memory.d.ts +0 -16
- package/dist/bench/fake-memory.js +0 -46
- package/dist/bench/fake-network.d.ts +0 -66
- package/dist/bench/fake-network.js +0 -222
- package/dist/bench/fake-unlock.d.ts +0 -6
- package/dist/bench/fake-unlock.js +0 -10
- package/dist/bench/index.d.ts +0 -3
- package/dist/bench/index.js +0 -5
- package/dist/bench/seeded.d.ts +0 -11
- package/dist/bench/seeded.js +0 -37
- package/dist/bench/settle.d.ts +0 -2
- package/dist/bench/settle.js +0 -49
- package/dist/bench/stewards.d.ts +0 -169
- package/dist/bench/stewards.js +0 -128
- package/dist/bodies/class-list.d.ts +0 -14
- package/dist/bodies/class-list.js +0 -33
- package/dist/bodies/joined-carry.d.ts +0 -29
- package/dist/bodies/joined-carry.js +0 -48
- package/dist/bodies/kept.d.ts +0 -44
- package/dist/bodies/kept.js +0 -91
- package/dist/bodies/noble-crypto.d.ts +0 -22
- package/dist/bodies/noble-crypto.js +0 -88
- package/dist/bodies/seed-keys.d.ts +0 -10
- package/dist/bodies/seed-keys.js +0 -42
- package/dist/bodies/strict-tools.d.ts +0 -10
- package/dist/bodies/strict-tools.js +0 -306
- package/dist/bodies/vouch.d.ts +0 -20
- package/dist/bodies/vouch.js +0 -71
- package/dist/bodies/web-carry.d.ts +0 -72
- package/dist/bodies/web-carry.js +0 -245
- package/dist/bodies/web-clock.d.ts +0 -12
- package/dist/bodies/web-clock.js +0 -33
- package/dist/browser/browser-ground.d.ts +0 -76
- package/dist/browser/browser-ground.js +0 -294
- package/dist/browser/index.d.ts +0 -4
- package/dist/browser/index.js +0 -7
- package/dist/browser/indexeddb-memory.d.ts +0 -17
- package/dist/browser/indexeddb-memory.js +0 -97
- package/dist/browser/locked-unlock.d.ts +0 -24
- package/dist/browser/locked-unlock.js +0 -85
- package/dist/browser/origin-classes.d.ts +0 -7
- package/dist/browser/origin-classes.js +0 -31
- package/dist/edge/durable-clock.d.ts +0 -19
- package/dist/edge/durable-clock.js +0 -61
- package/dist/edge/durable-memory.d.ts +0 -5
- package/dist/edge/durable-memory.js +0 -11
- package/dist/edge/durable.d.ts +0 -18
- package/dist/edge/durable.js +0 -24
- package/dist/edge/edge-ground.d.ts +0 -49
- package/dist/edge/edge-ground.js +0 -223
- package/dist/edge/index.d.ts +0 -7
- package/dist/edge/index.js +0 -9
- package/dist/edge/native-crypto.d.ts +0 -8
- package/dist/edge/native-crypto.js +0 -102
- package/dist/edge/secret-unlock.d.ts +0 -7
- package/dist/edge/secret-unlock.js +0 -13
- package/dist/edge/socket-carry.d.ts +0 -39
- package/dist/edge/socket-carry.js +0 -111
- package/dist/foundation.d.ts +0 -162
- package/dist/foundation.js +0 -4
- package/dist/ground/dock.d.ts +0 -1460
- package/dist/ground/dock.js +0 -1159
- package/dist/ground/ground.d.ts +0 -239
- package/dist/ground/ground.js +0 -787
- package/dist/ground/views.d.ts +0 -76
- package/dist/ground/views.js +0 -208
- package/dist/house/crossing.d.ts +0 -50
- package/dist/house/crossing.js +0 -153
- package/dist/house/house.d.ts +0 -88
- package/dist/house/house.js +0 -2069
- package/dist/house/rows-shape.d.ts +0 -110
- package/dist/house/rows-shape.js +0 -12
- package/dist/house/rows.d.ts +0 -27
- package/dist/house/rows.js +0 -185
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -29
- package/dist/node/bridge.d.ts +0 -20
- package/dist/node/bridge.js +0 -284
- package/dist/node/cli.d.ts +0 -2
- package/dist/node/cli.js +0 -225
- package/dist/node/file-memory.d.ts +0 -13
- package/dist/node/file-memory.js +0 -86
- package/dist/node/folder-classes.d.ts +0 -5
- package/dist/node/folder-classes.js +0 -40
- package/dist/node/gone.d.ts +0 -2
- package/dist/node/gone.js +0 -7
- package/dist/node/hand.d.ts +0 -39
- package/dist/node/hand.js +0 -107
- package/dist/node/http.d.ts +0 -11
- package/dist/node/http.js +0 -90
- package/dist/node/index.d.ts +0 -11
- package/dist/node/index.js +0 -13
- package/dist/node/ledger-memory.d.ts +0 -17
- package/dist/node/ledger-memory.js +0 -152
- package/dist/node/lock.d.ts +0 -10
- package/dist/node/lock.js +0 -78
- package/dist/node/node-ground.d.ts +0 -26
- package/dist/node/node-ground.js +0 -228
- package/dist/node/notify.d.ts +0 -1
- package/dist/node/notify.js +0 -18
- package/dist/node/shell.d.ts +0 -11
- package/dist/node/shell.js +0 -35
- package/dist/node/sync-folder.d.ts +0 -6
- package/dist/node/sync-folder.js +0 -18
- package/dist/node/tcp-carry.d.ts +0 -42
- package/dist/node/tcp-carry.js +0 -193
- package/dist/node/unlock.d.ts +0 -17
- package/dist/node/unlock.js +0 -86
- package/dist/node/websocket.d.ts +0 -12
- package/dist/node/websocket.js +0 -134
- package/dist/quo/frame.d.ts +0 -33
- package/dist/quo/frame.js +0 -92
- package/dist/quo/index.d.ts +0 -1
- package/dist/quo/index.js +0 -5
- package/dist/quo/room.d.ts +0 -154
- package/dist/quo/room.js +0 -362
- package/dist/serve/index.d.ts +0 -45
- package/dist/serve/index.js +0 -71
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { Json, Notes } from '../being/being.ts';
|
|
2
|
-
import type { Occupant as QuoOccupant, Standing as QuoStanding } from '../quo/index.ts';
|
|
3
|
-
/** A JSON value copied, as every row and cell is JSON. */
|
|
4
|
-
export declare const copy: <T>(value: T) => T;
|
|
5
|
-
export type Answer = {
|
|
6
|
-
readonly result: Json;
|
|
7
|
-
} | {
|
|
8
|
-
readonly error: {
|
|
9
|
-
readonly message: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The ward's own place: the bound, and the index of its beings. Only the
|
|
14
|
-
* steward writes it, so no other being's write waits on it.
|
|
15
|
-
*/
|
|
16
|
-
export interface WardRow {
|
|
17
|
-
bound: string;
|
|
18
|
-
beings: Record<string, {
|
|
19
|
-
kind: string;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* An heir's place, or a token's, one a place: whose occupant it reaches. A
|
|
24
|
-
* mint writes a place of its own, so no two beings' mints meet.
|
|
25
|
-
*/
|
|
26
|
-
export interface OwnerRow {
|
|
27
|
-
being: string;
|
|
28
|
-
occupant: string;
|
|
29
|
-
/** A token's: the blueprint of the faculty it was handed to, which alone calls it. */
|
|
30
|
-
faculty?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface OccupantRow {
|
|
33
|
-
notes: Notes;
|
|
34
|
-
steward: Notes;
|
|
35
|
-
/** A handle: the one ask it is admitted to. */
|
|
36
|
-
ask?: string;
|
|
37
|
-
bind?: Json;
|
|
38
|
-
once?: boolean;
|
|
39
|
-
/** The heirs minted for it, each the door's end of a relation. */
|
|
40
|
-
quo?: Record<string, QuoOccupant>;
|
|
41
|
-
/** The addresses each heir's holder last heard, in its invitation or in a reply. */
|
|
42
|
-
told?: Record<string, readonly string[]>;
|
|
43
|
-
/** Each heir still unspent that has a time, and the time after which it never binds. */
|
|
44
|
-
until?: Record<string, number>;
|
|
45
|
-
/** The tokens minted for it, which faculties call. */
|
|
46
|
-
tokens?: string[];
|
|
47
|
-
}
|
|
48
|
-
export interface StandingRow {
|
|
49
|
-
notes: Notes;
|
|
50
|
-
steward: Notes;
|
|
51
|
-
/** A standing on a being of this house, bound at once. */
|
|
52
|
-
local?: {
|
|
53
|
-
being: string;
|
|
54
|
-
occupant: string;
|
|
55
|
-
};
|
|
56
|
-
/** A standing on a far ward. */
|
|
57
|
-
quo?: QuoStanding;
|
|
58
|
-
/** The address of hers that last answered: where each ask goes first. */
|
|
59
|
-
route?: string;
|
|
60
|
-
/** The domains that vouch for a far standing's ward, read once its take landed and again when it moves. */
|
|
61
|
-
vouched?: string[];
|
|
62
|
-
}
|
|
63
|
-
/** Where an effect goes. */
|
|
64
|
-
export type Target = {
|
|
65
|
-
need: string;
|
|
66
|
-
} | {
|
|
67
|
-
standing: string;
|
|
68
|
-
} | {
|
|
69
|
-
being: string;
|
|
70
|
-
};
|
|
71
|
-
export interface OutboxEntry {
|
|
72
|
-
id: string;
|
|
73
|
-
to: Target;
|
|
74
|
-
method: string;
|
|
75
|
-
args: Json;
|
|
76
|
-
reply?: string;
|
|
77
|
-
/** A watch: the digest of the answer she holds, and how long the far side may hold it. */
|
|
78
|
-
after?: string;
|
|
79
|
-
wait?: number;
|
|
80
|
-
queued: number;
|
|
81
|
-
deadline: number;
|
|
82
|
-
next: number;
|
|
83
|
-
tries: number;
|
|
84
|
-
}
|
|
85
|
-
export interface DeadLetter {
|
|
86
|
-
ask: string;
|
|
87
|
-
args: Json;
|
|
88
|
-
at: number;
|
|
89
|
-
why: string;
|
|
90
|
-
}
|
|
91
|
-
export interface BeingRow {
|
|
92
|
-
kind: string;
|
|
93
|
-
cells: Record<string, Json>;
|
|
94
|
-
/** The args of her `born`, until it has run. */
|
|
95
|
-
born?: Json;
|
|
96
|
-
occupants: Record<string, OccupantRow>;
|
|
97
|
-
standings: Record<string, StandingRow>;
|
|
98
|
-
outbox: OutboxEntry[];
|
|
99
|
-
alarms: Record<string, {
|
|
100
|
-
at: number;
|
|
101
|
-
ask: string;
|
|
102
|
-
args: Json;
|
|
103
|
-
}>;
|
|
104
|
-
dead: DeadLetter[];
|
|
105
|
-
calls: Record<string, {
|
|
106
|
-
answer: Answer;
|
|
107
|
-
at: number;
|
|
108
|
-
}>;
|
|
109
|
-
}
|
|
110
|
-
export declare const emptyRow: (kind: string, cells: Record<string, Json>) => BeingRow;
|
package/dist/house/rows-shape.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** A JSON value copied, as every row and cell is JSON. */
|
|
2
|
-
export const copy = (value) => (value === undefined ? value : JSON.parse(JSON.stringify(value)));
|
|
3
|
-
export const emptyRow = (kind, cells) => ({
|
|
4
|
-
kind,
|
|
5
|
-
cells,
|
|
6
|
-
occupants: {},
|
|
7
|
-
standings: {},
|
|
8
|
-
outbox: [],
|
|
9
|
-
alarms: {},
|
|
10
|
-
dead: [],
|
|
11
|
-
calls: {},
|
|
12
|
-
});
|
package/dist/house/rows.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Crypto, Keys, Memory, Tools } from '../foundation.ts';
|
|
2
|
-
/** A transaction's view: rows read once, changed as drafts, written together. */
|
|
3
|
-
export interface Draft {
|
|
4
|
-
get<T>(place: string): Promise<T | null>;
|
|
5
|
-
set(place: string, row: unknown): void;
|
|
6
|
-
}
|
|
7
|
-
export declare class Rows {
|
|
8
|
-
#private;
|
|
9
|
-
private constructor();
|
|
10
|
-
static open(memory: Memory, keys: Keys, crypto: Crypto, tools: Tools): Promise<Rows>;
|
|
11
|
-
/** The place a name is kept at: a digest that says nothing of the name. */
|
|
12
|
-
place(name: string): Promise<string>;
|
|
13
|
-
/** A row as it stands, or `null`. */
|
|
14
|
-
get<T>(place: string): Promise<T | null>;
|
|
15
|
-
/** What is told each row as it lands: its place, and the row, or `null` where it went. */
|
|
16
|
-
whenLanded(told: (place: string, row: unknown) => void): void;
|
|
17
|
-
/** Every place memory lists. */
|
|
18
|
-
list(): Promise<readonly string[]>;
|
|
19
|
-
/**
|
|
20
|
-
* One transaction. Its change runs on drafts of the rows it reads, and it
|
|
21
|
-
* lands holding those rows alone, so writes on other rows land beside it.
|
|
22
|
-
* Where another write of this house landed on a row it read, its change
|
|
23
|
-
* runs again on the rows as they stand. `false` where memory refused the
|
|
24
|
-
* write or failed; the rows it read are read again next time.
|
|
25
|
-
*/
|
|
26
|
-
transact(change: (draft: Draft) => Promise<void> | void): Promise<boolean>;
|
|
27
|
-
}
|
package/dist/house/rows.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { copy } from './rows-shape.js';
|
|
2
|
-
const ENTRY = 'row';
|
|
3
|
-
// The runs a change gets where other writes keep moving the rows it read, before it counts as refused.
|
|
4
|
-
const RUNS = 64;
|
|
5
|
-
export class Rows {
|
|
6
|
-
#memory;
|
|
7
|
-
#crypto;
|
|
8
|
-
#tools;
|
|
9
|
-
#names;
|
|
10
|
-
#key;
|
|
11
|
-
#held = new Map();
|
|
12
|
-
#placeNames = new Map();
|
|
13
|
-
/** The last write holding each row, which the next one to hold it waits for. */
|
|
14
|
-
#holds = new Map();
|
|
15
|
-
// How many times each row's cache has moved, so a read overtaken by a write never lands behind it.
|
|
16
|
-
#moves = new Map();
|
|
17
|
-
#landed;
|
|
18
|
-
constructor(memory, crypto, tools, names, key) {
|
|
19
|
-
this.#memory = memory;
|
|
20
|
-
this.#crypto = crypto;
|
|
21
|
-
this.#tools = tools;
|
|
22
|
-
this.#names = names;
|
|
23
|
-
this.#key = key;
|
|
24
|
-
}
|
|
25
|
-
static async open(memory, keys, crypto, tools) {
|
|
26
|
-
return new Rows(memory, crypto, tools, await keys.derive('place-names', 32), await keys.derive('rows', 32));
|
|
27
|
-
}
|
|
28
|
-
/** The place a name is kept at: a digest that says nothing of the name. */
|
|
29
|
-
async place(name) {
|
|
30
|
-
let place = this.#placeNames.get(name);
|
|
31
|
-
if (place === undefined) {
|
|
32
|
-
const digest = await this.#crypto.sha256(new Uint8Array([...this.#names, ...this.#tools.utf8(name)]));
|
|
33
|
-
place = this.#tools.hex(digest.subarray(0, 16));
|
|
34
|
-
this.#placeNames.set(name, place);
|
|
35
|
-
}
|
|
36
|
-
return place;
|
|
37
|
-
}
|
|
38
|
-
// A row's cache moved, by a write that landed or one refused: a read in flight across it is behind.
|
|
39
|
-
#moved(place) {
|
|
40
|
-
this.#moves.set(place, (this.#moves.get(place) ?? 0) + 1);
|
|
41
|
-
}
|
|
42
|
-
#forget(place) {
|
|
43
|
-
this.#moved(place);
|
|
44
|
-
this.#held.delete(place);
|
|
45
|
-
}
|
|
46
|
-
async #read(place) {
|
|
47
|
-
for (;;) {
|
|
48
|
-
const cached = this.#held.get(place);
|
|
49
|
-
if (cached !== undefined)
|
|
50
|
-
return cached;
|
|
51
|
-
const move = this.#moves.get(place) ?? 0;
|
|
52
|
-
const { entries, version } = await this.#memory.read({ place });
|
|
53
|
-
const sealed = entries[ENTRY];
|
|
54
|
-
let held = { row: null, text: null, version };
|
|
55
|
-
if (sealed !== undefined) {
|
|
56
|
-
const opened = await this.#crypto.open(this.#key, sealed.subarray(0, 12), sealed.subarray(12), this.#tools.utf8(place));
|
|
57
|
-
const text = opened === null ? null : this.#tools.text(opened);
|
|
58
|
-
if (text === null)
|
|
59
|
-
throw new Error('a row does not open under these keys');
|
|
60
|
-
held = { row: JSON.parse(text), text, version };
|
|
61
|
-
}
|
|
62
|
-
// A write that moved the row while this read was in flight wins, and this read looks again.
|
|
63
|
-
if ((this.#moves.get(place) ?? 0) !== move)
|
|
64
|
-
continue;
|
|
65
|
-
this.#held.set(place, held);
|
|
66
|
-
return held;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/** A row as it stands, or `null`. */
|
|
70
|
-
async get(place) {
|
|
71
|
-
return copy((await this.#read(place)).row);
|
|
72
|
-
}
|
|
73
|
-
/** What is told each row as it lands: its place, and the row, or `null` where it went. */
|
|
74
|
-
whenLanded(told) {
|
|
75
|
-
this.#landed = told;
|
|
76
|
-
}
|
|
77
|
-
/** Every place memory lists. */
|
|
78
|
-
list() {
|
|
79
|
-
return this.#memory.list();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* One transaction. Its change runs on drafts of the rows it reads, and it
|
|
83
|
-
* lands holding those rows alone, so writes on other rows land beside it.
|
|
84
|
-
* Where another write of this house landed on a row it read, its change
|
|
85
|
-
* runs again on the rows as they stand. `false` where memory refused the
|
|
86
|
-
* write or failed; the rows it read are read again next time.
|
|
87
|
-
*/
|
|
88
|
-
async transact(change) {
|
|
89
|
-
for (let run = 0; run < RUNS; run++) {
|
|
90
|
-
const landed = await this.#transact(change);
|
|
91
|
-
if (landed !== 'moved')
|
|
92
|
-
return landed;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
// The rows named, each held in the order of its place, so two writes never wait on each other.
|
|
97
|
-
async #hold(places) {
|
|
98
|
-
const releases = [];
|
|
99
|
-
for (const place of [...places].sort()) {
|
|
100
|
-
const before = this.#holds.get(place) ?? Promise.resolve();
|
|
101
|
-
let release;
|
|
102
|
-
const mine = new Promise((resolve) => (release = resolve));
|
|
103
|
-
const tail = before.then(() => mine);
|
|
104
|
-
this.#holds.set(place, tail);
|
|
105
|
-
await before;
|
|
106
|
-
releases.push(() => {
|
|
107
|
-
release();
|
|
108
|
-
if (this.#holds.get(place) === tail)
|
|
109
|
-
this.#holds.delete(place);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return () => {
|
|
113
|
-
for (const release of releases)
|
|
114
|
-
release();
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
async #transact(change) {
|
|
118
|
-
const read = new Map();
|
|
119
|
-
const drafts = new Map();
|
|
120
|
-
const draft = {
|
|
121
|
-
get: async (place) => {
|
|
122
|
-
if (drafts.has(place))
|
|
123
|
-
return drafts.get(place);
|
|
124
|
-
const held = await this.#read(place);
|
|
125
|
-
read.set(place, held);
|
|
126
|
-
const drafted = copy(held.row);
|
|
127
|
-
drafts.set(place, drafted);
|
|
128
|
-
return drafted;
|
|
129
|
-
},
|
|
130
|
-
set: (place, row) => {
|
|
131
|
-
drafts.set(place, row);
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
await change(draft);
|
|
135
|
-
const release = await this.#hold([...new Set([...read.keys(), ...drafts.keys()])]);
|
|
136
|
-
try {
|
|
137
|
-
// A row this change read moved since: it runs again on the row as it stands.
|
|
138
|
-
for (const [place, held] of read)
|
|
139
|
-
if (this.#held.get(place) !== held)
|
|
140
|
-
return 'moved';
|
|
141
|
-
const writes = {};
|
|
142
|
-
// Every row read is expected as it was read, so memory refuses a write on rows another writer moved.
|
|
143
|
-
const expect = Object.fromEntries([...read].map(([place, held]) => [place, held.version]));
|
|
144
|
-
const landed = new Map();
|
|
145
|
-
for (const [place, row] of drafts) {
|
|
146
|
-
const before = read.get(place) ?? (await this.#read(place));
|
|
147
|
-
const text = row === null ? null : this.#tools.canonical(row);
|
|
148
|
-
if (text === before.text)
|
|
149
|
-
continue;
|
|
150
|
-
expect[place] = before.version;
|
|
151
|
-
if (text === null)
|
|
152
|
-
writes[place] = { [ENTRY]: null };
|
|
153
|
-
else {
|
|
154
|
-
const nonce = this.#crypto.random(12);
|
|
155
|
-
const sealed = await this.#crypto.seal(this.#key, nonce, this.#tools.utf8(text), this.#tools.utf8(place));
|
|
156
|
-
writes[place] = { [ENTRY]: new Uint8Array([...nonce, ...sealed]) };
|
|
157
|
-
}
|
|
158
|
-
landed.set(place, { row: text === null ? null : JSON.parse(text), text, version: null });
|
|
159
|
-
}
|
|
160
|
-
if (Object.keys(writes).length === 0)
|
|
161
|
-
return true;
|
|
162
|
-
let versions = null;
|
|
163
|
-
try {
|
|
164
|
-
versions = await this.#memory.write({ writes, expect });
|
|
165
|
-
}
|
|
166
|
-
catch {
|
|
167
|
-
versions = null;
|
|
168
|
-
}
|
|
169
|
-
if (versions === null) {
|
|
170
|
-
for (const place of Object.keys(expect))
|
|
171
|
-
this.#forget(place);
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
for (const [place, held] of landed) {
|
|
175
|
-
this.#moved(place);
|
|
176
|
-
this.#held.set(place, { ...held, version: versions[place] ?? null });
|
|
177
|
-
this.#landed?.(place, held.row);
|
|
178
|
-
}
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
release();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Carry, Classes, Clock, Crypto, Keys, Memory, Tools } from './foundation.ts';
|
|
2
|
-
import { type Offer, type Opened } from './house/house.ts';
|
|
3
|
-
export type { Carry, Classes, Clock, Crypto, Keys, Memory, Sent, Tools } from './foundation.ts';
|
|
4
|
-
export { JoinedCarry } from './bodies/joined-carry.ts';
|
|
5
|
-
export { WebCarry, type Handler } from './bodies/web-carry.ts';
|
|
6
|
-
export { vouchesOf } from './bodies/vouch.ts';
|
|
7
|
-
export type { FacultyContext, Offer, Opened } from './house/house.ts';
|
|
8
|
-
export { Ground, type Body, type Faculty, type FacultyEntry, type ForHouse, type Hooked, type Registry, type Serves, type Takes, type Unlock, type Up } from './ground/ground.ts';
|
|
9
|
-
export { DockPilot } from './ground/dock.ts';
|
|
10
|
-
export { ClassList } from './bodies/class-list.ts';
|
|
11
|
-
export { NobleCrypto } from './bodies/noble-crypto.ts';
|
|
12
|
-
export { SeedKeys } from './bodies/seed-keys.ts';
|
|
13
|
-
export { StrictTools } from './bodies/strict-tools.ts';
|
|
14
|
-
export { WebClock } from './bodies/web-clock.ts';
|
|
15
|
-
/** The house: opened on its foundation and its offers, and the ground's bound on every ask. */
|
|
16
|
-
export declare const House: Readonly<{
|
|
17
|
-
/**
|
|
18
|
-
* `clock`, `crypto` and `tools` take the library's defaults where the
|
|
19
|
-
* ground hands none. `wait` bounds every ask here, where the ground can
|
|
20
|
-
* hold less than an entry asks.
|
|
21
|
-
*/
|
|
22
|
-
open(foundation: {
|
|
23
|
-
keys: Keys;
|
|
24
|
-
memory: Memory;
|
|
25
|
-
classes: Classes;
|
|
26
|
-
carry: Carry;
|
|
27
|
-
clock?: Clock;
|
|
28
|
-
crypto?: Crypto;
|
|
29
|
-
tools?: Tools;
|
|
30
|
-
}, offers?: readonly Offer[], options?: {
|
|
31
|
-
readonly wait?: number;
|
|
32
|
-
}): Promise<Opened>;
|
|
33
|
-
}>;
|
package/dist/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// `nervur`: what a ground's author imports on any engine. The house, the
|
|
3
|
-
// blueprints of its foundation and the ground's unlock, and the bodies
|
|
4
|
-
// that fill them anywhere.
|
|
5
|
-
import { NobleCrypto } from './bodies/noble-crypto.js';
|
|
6
|
-
import { StrictTools } from './bodies/strict-tools.js';
|
|
7
|
-
import { WebClock } from './bodies/web-clock.js';
|
|
8
|
-
import { openHouse } from './house/house.js';
|
|
9
|
-
export { JoinedCarry } from './bodies/joined-carry.js';
|
|
10
|
-
export { WebCarry } from './bodies/web-carry.js';
|
|
11
|
-
export { vouchesOf } from './bodies/vouch.js';
|
|
12
|
-
export { Ground } from './ground/ground.js';
|
|
13
|
-
export { DockPilot } from './ground/dock.js';
|
|
14
|
-
export { ClassList } from './bodies/class-list.js';
|
|
15
|
-
export { NobleCrypto } from './bodies/noble-crypto.js';
|
|
16
|
-
export { SeedKeys } from './bodies/seed-keys.js';
|
|
17
|
-
export { StrictTools } from './bodies/strict-tools.js';
|
|
18
|
-
export { WebClock } from './bodies/web-clock.js';
|
|
19
|
-
/** The house: opened on its foundation and its offers, and the ground's bound on every ask. */
|
|
20
|
-
export const House = Object.freeze({
|
|
21
|
-
/**
|
|
22
|
-
* `clock`, `crypto` and `tools` take the library's defaults where the
|
|
23
|
-
* ground hands none. `wait` bounds every ask here, where the ground can
|
|
24
|
-
* hold less than an entry asks.
|
|
25
|
-
*/
|
|
26
|
-
open(foundation, offers = [], options = {}) {
|
|
27
|
-
return openHouse({ ...foundation, clock: foundation.clock ?? new WebClock(), crypto: foundation.crypto ?? new NobleCrypto(), tools: foundation.tools ?? new StrictTools() }, offers, options);
|
|
28
|
-
},
|
|
29
|
-
});
|
package/dist/node/bridge.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Memory } from '../foundation.ts';
|
|
2
|
-
import type { Body } from '../ground/ground.ts';
|
|
3
|
-
export interface BridgeOptions {
|
|
4
|
-
/** The program, by path or by a name the ground's PATH finds. */
|
|
5
|
-
readonly command: string;
|
|
6
|
-
readonly args?: readonly string[];
|
|
7
|
-
/** Everything the program's environment holds. The ground's own is never passed. */
|
|
8
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
9
|
-
readonly cwd?: string;
|
|
10
|
-
/** The faculty's own memory, which the program reads and writes by its memory lines. */
|
|
11
|
-
readonly memory?: Memory;
|
|
12
|
-
/** How long its `describe` may take, in milliseconds. */
|
|
13
|
-
readonly wait?: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A program in any language, raised as a body: its blueprint and its
|
|
17
|
-
* window from its own `describe`, and an object whose every method is a
|
|
18
|
-
* line to it. It answers once the program has described itself.
|
|
19
|
-
*/
|
|
20
|
-
export declare const bridge: (options: BridgeOptions) => Promise<Body>;
|