provident-storeroom 0.3.0 → 0.4.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/README.md +65 -25
- package/index.d.ts +40 -5
- package/index.mjs +581 -34
- package/package.json +7 -6
- package/src/constraint-kernel.mjs +390 -2
package/README.md
CHANGED
|
@@ -22,9 +22,17 @@ artefact — so the count of SITES stays four and the count of artefacts CARRYIN
|
|
|
22
22
|
## The one entry
|
|
23
23
|
|
|
24
24
|
```js
|
|
25
|
-
import { storeCreate
|
|
25
|
+
import { storeCreate } from 'provident-storeroom';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
**⟶ AND THIS BLOCK'S SUPERSEDED FORM IS NAMED SO IT IS NOT READ AS THE ENTRY: it once printed
|
|
29
|
+
`import { storeCreate, read, readLiteral, write, delete as remove, rollback, listen, unlisten }` — EIGHT module
|
|
30
|
+
names, seven of which are no longer exports at all. THE MODULE NAMESPACE IS ONE NAME**, and the seven that left it
|
|
31
|
+
are the instance's own methods, `delete` among them spelled `a.delete(address, tier?)` on the receiver (the
|
|
32
|
+
`delete as remove` binding was the MODULE-side workaround for a reserved word and is not the consumer spelling).
|
|
33
|
+
**These are the `0.2.0`-era names; the `8 → 1` is `A127`'s** (`surface.md §2.9` item 1's `A127` clause;
|
|
34
|
+
`docs/guides/package-use.md` `§1.1-bis`).
|
|
35
|
+
|
|
28
36
|
**The `exports` map publishes EXACTLY ONE arms-bearing entry — the ESM one** (`package.md §1.3`, `DD-24`):
|
|
29
37
|
there is no wildcard export, no deep import to the addon and no CJS arm. **The addon is reached INTERNALLY
|
|
30
38
|
by the package's own `createRequire`-style step and is not an entry point**: a consumer that spells the
|
|
@@ -32,33 +40,60 @@ addon's path directly is outside every clause of this contract.
|
|
|
32
40
|
|
|
33
41
|
## The surface
|
|
34
42
|
|
|
35
|
-
**
|
|
36
|
-
member set is the
|
|
43
|
+
**ONE module name — `storeCreate` — and NOTHING ELSE** (`surface.md §2.9` item 1's `A127` clause; the namespace's
|
|
44
|
+
`8 → 1`), **plus the instance `storeCreate` returned — whose own member set is the TWELVE the table below prints,
|
|
45
|
+
`10 + 1 + 1 = 12` ✓** (`surface.md §2.4` item 9 (f)'s `A127` clause; the member set's `4 → 12`).
|
|
46
|
+
|
|
47
|
+
**⟶ WITHDRAWN 2026-10-17 — THE SENTENCE THIS ONE REPLACES READ *"The eight verbs of `surface.md §2` and NOTHING
|
|
48
|
+
ELSE"*, plus an instance whose own member set was *"the FOUR the dated clause below prints"*: BOTH FIGURES ARE THE
|
|
49
|
+
`0.2.0`-ERA READING AND NEITHER DESCRIBES A SURFACE THAT EXISTS. The operative figures are the ONE module name and
|
|
50
|
+
the TWELVE own members above, whose home is `docs/guides/package-use.md` `§1.1-bis`.**
|
|
51
|
+
|
|
52
|
+
**AND THE LEADING `instance` POSITION IS DROPPED AT EVERY METHOD** (`surface.md §2.1` (e) item 3's one-spelling
|
|
53
|
+
and receiver rule): **the receiver IS the store, so `a.write(address, tier, value, commit?)` is the shape every
|
|
54
|
+
method takes and an `instance` passed first is a SUPERSEDED SPELLING — wrong, not redundant.**
|
|
37
55
|
|
|
38
56
|
| The member | Its answer |
|
|
39
57
|
| --- | --- |
|
|
40
|
-
| `storeCreate(cfg)` | the package's own instance handle — `cfg` carries the store's four declared keys and no fifth |
|
|
41
|
-
| `read(
|
|
42
|
-
| `readLiteral(
|
|
43
|
-
| `write(
|
|
44
|
-
| `delete(
|
|
45
|
-
| `rollback(
|
|
46
|
-
| `listen(
|
|
47
|
-
| `unlisten(
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
| `storeCreate(cfg)` | the package's own instance handle — `cfg` carries the store's four declared keys and no fifth; the four are `filePath` · `journalLength` · `listeners` · `constraints`, and `listeners` is an ARRAY |
|
|
59
|
+
| `read(address, tier?)` | a leaf's literal, a branch's assembled value, the empty address's whole register |
|
|
60
|
+
| `readLiteral(address, tier?)` | the same, narrowed to a leaf (`ReadTargetIsBranch` on a branch) |
|
|
61
|
+
| `write(address, tier, value, commit?)` | `{op, watched, triggered}` — the fifth argument OPTIONAL and declared LAST; its absence is in domain |
|
|
62
|
+
| `delete(address, tier?)` | `{address, tiers, triggered}` |
|
|
63
|
+
| `rollback(opId)` | `{opId, undoneOps, restoredTo}` |
|
|
64
|
+
| `listen(address)` | a fresh opaque handle — the registration route is `listen` **then** `register` |
|
|
65
|
+
| `unlisten(handle)` | `undefined` — the withdrawal: the store-side removal AND this package's own registry removal; a no-op success for every value outside the domain |
|
|
66
|
+
| `addConstraint(pair, constraint)` | the constraint's identity — the ADD route, which CARRIES the function and OVERWRITES if the id already exists |
|
|
67
|
+
| `constraintOn(pair, constraint)` | `undefined` — ENABLE; idempotent, and it throws at a pair the store does not carry |
|
|
68
|
+
| `constraintOff(pair, constraint)` | `undefined` — DISABLE; idempotent, and it throws at a pair the store does not carry |
|
|
69
|
+
| `register(handle, listener)` | `undefined`; a non-function listener or a handle this instance never minted throws a `TypeError` |
|
|
70
|
+
| `settle(record)` | `undefined` — the ordering seam: the one member THE KERNEL CALLS, and the arm that performs the `file`-tier save |
|
|
71
|
+
|
|
72
|
+
**⟶ AND THE `on` AND `off` ROWS THIS TABLE ONCE CARRIED ARE WITHDRAWN, NOT MOVED AND NOT COUNTED: both members
|
|
73
|
+
were MERGED AWAY** (`surface.md §2.4` item 9 (e) items 2 and 3; `A127`). **`on(address, listener)` was a SECOND
|
|
74
|
+
SPELLING of `listen` then `register`, and both admissions are now methods, so the pair of calls `a.listen(address)`
|
|
75
|
+
then `a.register(handle, listener)` carries its whole subject; `off(handle)`'s withdrawal IS `a.unlisten(handle)`'s,
|
|
76
|
+
and the registry entry's own standing is `unlisten`'s rule, not a call.** **`on` and `off` are therefore NOT
|
|
77
|
+
members of the product and NOTHING above declares them as one** — the listener pair the guide at `§1.1-bis` calls
|
|
78
|
+
`on`/`off`-shaped is the CONSTRAINT toggles, which are `constraintOn`/`constraintOff` and a DIFFERENT subject.
|
|
79
|
+
|
|
80
|
+
**AND A `tier` IS OPTIONAL BY OMISSION ALONE: a SUPPLIED `undefined` tier is a PRESENT value and takes the
|
|
81
|
+
`AddressMalformed` refusal, while only the call that supplies nothing there — `a.read(address)` — folds to the
|
|
82
|
+
absent tier** (`parameter-semantics.md §2.6`'s `PAR-JS-6`, its in-writing adjudication of 2026-10-16).
|
|
83
|
+
|
|
84
|
+
**⟶ AMENDED 2026-10-15 — THE TABLE ABOVE IS READ AT THE FOUR-KEY CONSTRUCTION AND THE
|
|
54
85
|
WRITE'S FIFTH ARGUMENT** (`surface.md §2.1`'s dated clause of 2026-10-15 and its `cfg` block; `§2.2`'s dated
|
|
55
86
|
clause of the same date and its clause 4; `§2.11`; `parameter-semantics.md §2.20` = `PAR-JS-20` and `§2.21` =
|
|
56
|
-
`PAR-JS-21`; `docs/decisions.md` · `A116`). **THE
|
|
87
|
+
`PAR-JS-21`; `docs/decisions.md` · `A116`). **THE CELLS IT RE-SPELLS, EACH NAMED BY ITS OWN WORDS: the
|
|
57
88
|
cells above are ALREADY RE-SPELLED IN PLACE, so the table stands in its OPERATIVE form and the as-filed wording
|
|
58
89
|
is the one NAMED here — *"the store's three declared keys and no fourth"* READS *"the store's four declared keys
|
|
59
90
|
and no fifth"*; *"plus the one member of the object `storeCreate` returned"* READS *"plus the instance
|
|
60
|
-
`storeCreate` returned — whose own member set is the
|
|
61
|
-
*"`write(instance, address, tier, value)`"* READS *"`write(
|
|
91
|
+
`storeCreate` returned — whose own member set is the TWELVE printed above"*; and the `write` cell's
|
|
92
|
+
*"`write(instance, address, tier, value)`"* READS *"`write(address, tier, value, commit?)`"*.**
|
|
93
|
+
**⟶ AND THE *"FOURTH OWN MEMBER"* THIS CLAUSE WAS FILED WITH, AND ITS *"whose own member set is the FOUR printed
|
|
94
|
+
above"*, ARE BOTH WITHDRAWN 2026-10-17 AND ARE READ AT THE TWELVE, `10 + 1 + 1 = 12` ✓** — the `A116`/`0.2.0`
|
|
95
|
+
member figure this pass supersedes (`surface.md §2.4` item 9 (f)'s `A127` clause; `A127`), **and the
|
|
96
|
+
`instance` FIRST POSITION the as-filed `write` spelling carries is DROPPED with it** (`§2.1` (e) item 3).
|
|
62
97
|
|
|
63
98
|
1. **THE FOUR DECLARED KEYS, AND NO FIFTH.** **They are `filePath` · `journalLength` · `listeners` ·
|
|
64
99
|
`constraints` — `4` — each passed through WITHOUT a default, a rename or a key of the package's own, and
|
|
@@ -69,11 +104,16 @@ and no fifth"*; *"plus the one member of the object `storeCreate` returned"* REA
|
|
|
69
104
|
IS IGNORED AND PRODUCES NO CODE** — *"no fifth"* is a constraint on the PACKAGE's own passing and never a
|
|
70
105
|
refusal of the caller's extra key (`parameter-semantics.md §2.21`; `docs/specs/storeroom-native/contract.md
|
|
71
106
|
§7.1`).
|
|
72
|
-
2. **THE INSTANCE'S OWN MEMBERS ARE
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
107
|
+
2. **THE INSTANCE'S OWN MEMBERS ARE TWELVE: `{ read, readLiteral, write, delete, rollback, listen, unlisten,
|
|
108
|
+
addConstraint, constraintOn, constraintOff, register, settle }`, AND NOTHING ELSE** — `10 + 1 + 1 = 12` ✓
|
|
109
|
+
(`surface.md §2.4` item 9 (f)'s `A127` clause of 2026-10-16). **`register` is the registration site, reached
|
|
110
|
+
after `listen`; the withdrawal is `unlisten`; the listener pair `on`/`off` is MERGED AWAY and is no member of
|
|
111
|
+
this set; and `settle(record) -> undefined` is THE ORDERING SEAM the kernel calls at the two instants of a
|
|
112
|
+
kernel-driven write** (`surface.md §2.4` item 9 (e) items 1–3; `§2.4` item 9 (f); `A127`). **AND NO RELEASE VERB
|
|
113
|
+
IS ONE OF THEM** — none of the twelve releases the instance. **⟶ WITHDRAWN 2026-10-17: THIS CLAUSE ONCE READ
|
|
114
|
+
*"THE INSTANCE'S OWN MEMBERS ARE FOUR: `{ register, on, off, settle }`, AND NOTHING ELSE"* — the `A116`/`0.2.0`
|
|
115
|
+
figure, superseded in BOTH of its halves, the set's `4 → 12` and the `on`/`off` merge; the operative figure is
|
|
116
|
+
the TWELVE above and its home is `docs/guides/package-use.md` `§1.1-bis`.**
|
|
77
117
|
3. **THE WRITE'S DECLARED ARITY IS `4` REQUIRED ARGUMENTS WITH A FIFTH OPTIONAL `commit`, DECLARED LAST**, and
|
|
78
118
|
the declaration governs over the flow's own order: the `commit` is the kernel's own `{ attempt, op,
|
|
79
119
|
triggered, pending }` record — `K-2 commit`'s return — and **AN ABSENT `commit` IS IN DOMAIN**, because the
|
package/index.d.ts
CHANGED
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
// `constraintOn(pair, constraint)` · `constraintOff(pair, constraint)`, **PLUS `register(handle, listener)
|
|
18
18
|
// -> undefined` and `settle(record) -> undefined`** — the last being THE ORDERING SEAM the kernel calls and
|
|
19
19
|
// the entry implements; and (3) the failure surface, a thrown plain object with exactly
|
|
20
|
-
// `{status, message}
|
|
20
|
+
// `{status, message, log}` — **THREE MEMBERS FROM 2026-10-16, `2 → 3`, on the architect's ruling *"Bubble
|
|
21
|
+
// the message log to the client on failure, override any clauses that forbid this."*** (`surface.md §2.5`'s
|
|
22
|
+
// clause of that date, the crossing form's ONE home; **the ONE figure that moves is the arity, and
|
|
23
|
+
// `storeCreate` remains the namespace's one name and the product its twelve own members**).
|
|
21
24
|
//
|
|
22
25
|
// **THE TEN METHODS TAKE THE RECEIVER'S OWN POSITION AWAY: `8 → 1` ✓ AND `4 → 12` ✓** (`surface.md §2.9`
|
|
23
26
|
// item 1's and `§2.4` item 9 (f)'s `A127` clauses). The seven verbs that reach the store are METHODS of the
|
|
@@ -188,14 +191,46 @@ export type StoreStatus =
|
|
|
188
191
|
| (string & {});
|
|
189
192
|
|
|
190
193
|
/**
|
|
191
|
-
* **THE
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
194
|
+
* **THE KERNEL'S OWN LOG ENTRY** — *"exactly six members — `seq` · `kind` · `id` · `message` · `opId` ·
|
|
195
|
+
* `state`"* (`docs/specs/storeroom-constraints/kernel-surface.md §2.5` item 1, whose member set is CLOSED:
|
|
196
|
+
* *"a seventh member of `LogEntry` … is not a variation, it is a different shape"*). **DECLARED HERE ONLY
|
|
197
|
+
* AS THE ELEMENT SHAPE OF THE FAILURE'S `log` MEMBER, AND MINTED BY NO CLAUSE OF THIS UNIT**: an attempt's
|
|
198
|
+
* message log entries are the KERNEL'S records, carried VERBATIM, and no flattening is declared — a client
|
|
199
|
+
* that reads one reads the kernel's own entry.
|
|
200
|
+
*
|
|
201
|
+
* `kind` is the kernel's closed four-member `LogKind` set, and `state` is the kernel's own `KC` token on the
|
|
202
|
+
* one `outcome` entry and `null` on the three non-`outcome` kinds.
|
|
203
|
+
*/
|
|
204
|
+
export interface LogEntry {
|
|
205
|
+
readonly seq: number;
|
|
206
|
+
readonly kind: 'constraint-check' | 'repair-run' | 'commit' | 'outcome';
|
|
207
|
+
readonly id: string | null;
|
|
208
|
+
readonly message: string;
|
|
209
|
+
readonly opId: string | null;
|
|
210
|
+
readonly state: string | null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* **THE SINGLE FAILURE SURFACE** (`contract.md §1.4`; `distribution.md §5.2` item 3) — **AND ITS MEMBER SET
|
|
215
|
+
* MOVES `2 → 3` FROM 2026-10-16 ON THE ARCHITECT'S RULING *"Bubble the message log to the client on failure,
|
|
216
|
+
* override any clauses that forbid this."*** (`surface.md §2.5`'s clause of that date, whose items 1–10 are
|
|
217
|
+
* the crossing form's ONE home). A THROWN plain object carrying exactly `{status, message, log}` — never an
|
|
218
|
+
* `Error` subclass, never a returned tagged union and never a `Promise` rejection. **The status is carried
|
|
219
|
+
* VERBATIM from the store's own closed set and the message is the store's own generated string**; this
|
|
220
|
+
* package mints neither.
|
|
221
|
+
*
|
|
222
|
+
* **`log` IS AN ORDINARY OWN ENUMERABLE DATA MEMBER OF THAT SAME PLAIN OBJECT** (item 9): *"written with an
|
|
223
|
+
* object literal, not `Object.defineProperty`, not a getter, not on a prototype and not behind a `Symbol`"* —
|
|
224
|
+
* so `Object.keys(caught)` reads exactly `["log","message","status"]` and its length is `3` on EVERY arm. **IT
|
|
225
|
+
* IS NEVER ABSENT, NEVER `null` AND NEVER A NON-ARRAY** (item 9), **and `[]` is its declared value where the
|
|
226
|
+
* failure's cause has no attempt at all** (item 4: the empty array, never an absent member and never a
|
|
227
|
+
* placeholder entry) — **while every failure whose attempt exists carries that attempt's own entries, taken
|
|
228
|
+
* BEFORE the attempt is disposed of** (item 10 (iii)).
|
|
195
229
|
*/
|
|
196
230
|
export interface StoreRefusal {
|
|
197
231
|
readonly status: StoreStatus;
|
|
198
232
|
readonly message: string;
|
|
233
|
+
readonly log: LogEntry[];
|
|
199
234
|
}
|
|
200
235
|
|
|
201
236
|
/** The opaque handle a listener registration is keyed by: the package's own value for one registration. */
|