@niscorp/moss 0.8.1 → 0.9.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/CHANGELOG.md +31 -0
- package/DOCS.md +87 -26
- package/README.md +9 -8
- package/dist/{chunk-3DCTQKPQ.cjs → chunk-E6YAYR7G.cjs} +22 -5
- package/dist/chunk-E6YAYR7G.cjs.map +1 -0
- package/dist/{chunk-TMDKNZYL.cjs → chunk-L2GHVTJW.cjs} +103 -71
- package/dist/chunk-L2GHVTJW.cjs.map +1 -0
- package/dist/{chunk-I4UOWER3.cjs → chunk-LKTS4PCD.cjs} +5 -5
- package/dist/{chunk-I4UOWER3.cjs.map → chunk-LKTS4PCD.cjs.map} +1 -1
- package/dist/{chunk-3T422CCN.js → chunk-UUOATPZ7.js} +3 -3
- package/dist/{chunk-3T422CCN.js.map → chunk-UUOATPZ7.js.map} +1 -1
- package/dist/{chunk-6XC2MD7S.js → chunk-WTWRLOPK.js} +22 -5
- package/dist/chunk-WTWRLOPK.js.map +1 -0
- package/dist/{chunk-YZILOVCR.js → chunk-Y7PRASR3.js} +49 -18
- package/dist/chunk-Y7PRASR3.js.map +1 -0
- package/dist/{document-BYAY-Qle.d.ts → document-C3aS9uiW.d.ts} +2 -1
- package/dist/{document-DAE71J27.d.cts → document-deAs7Dre.d.cts} +2 -1
- package/dist/index.cjs +17 -13
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +2 -2
- package/dist/integrations.cjs +12 -5
- package/dist/integrations.cjs.map +1 -1
- package/dist/integrations.js +12 -5
- package/dist/integrations.js.map +1 -1
- package/dist/node.cjs +7 -7
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/unverified.cjs +2 -2
- package/dist/unverified.js +1 -1
- package/dist/vite.cjs +8 -8
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +3 -3
- package/package.json +12 -12
- package/dist/chunk-3DCTQKPQ.cjs.map +0 -1
- package/dist/chunk-6XC2MD7S.js.map +0 -1
- package/dist/chunk-TMDKNZYL.cjs.map +0 -1
- package/dist/chunk-YZILOVCR.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @niscorp/moss
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2780c56: A real database's tables change only through `nisc migrate`. `migrations` on the runtime defaults to `'verify'`: `createServer` — and so `nisc dev`, `nisc build` and `nisc start` — checks the tables and refuses to start while a migration is pending, naming each one and the two commands that apply it (`npx nisc migrate --check`, then `npx nisc migrate`). On a database that is up to date the check only reads the ledger, so the app's database role needs `SELECT` on `strata_ledger` and no right to change tables. A runtime whose database starts empty every time (PGlite in memory) writes `migrations: 'apply'` and is migrated at boot as before.
|
|
8
|
+
|
|
9
|
+
The boot and `migrateTables` refuse a database whose ledger records a sequence they do not name (`UNKNOWN_SEQUENCE`): a sequence that has run stays in `runtime.tables`.
|
|
10
|
+
|
|
11
|
+
`migrateTables` and `nisc migrate` refuse a run that removes a table or a column, or changes a column's type, unless `allowRemoval` / `--allow-removal` is given; the refusal names each. A run that applied nothing, because another run had already applied it, is not refused.
|
|
12
|
+
|
|
13
|
+
`tableStatus(runtime, app)` and `nisc migrate --status`: what is applied and what is pending, read and nothing else.
|
|
14
|
+
|
|
15
|
+
BREAKING — approved by moccadroid, 2026-11-07: a runtime on a real database runs `nisc migrate` before the app starts (on Railway, the service's pre-deploy command `pnpm exec nisc migrate`); a runtime on in-memory PGlite writes `migrations: 'apply'`; every sequence that has run on the database is in `runtime.tables` (`TIDE_SEQUENCE` with the store made `migrate: false`), and the runtime migrates nothing itself and calls no `cache.init()`; a database that has not yet run `nisc.moss/4` is migrated once with `--allow-removal`.
|
|
16
|
+
|
|
17
|
+
## 0.8.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 5e07fbb: An app can hand moss the functions that reconcile its canvases: `NiscApp.reconcilers`, nova `Reconciler`s by name, and a canvas's `reconcile` naming one — in the app's shell and in a page's. Every shell moss builds holds them (the app's and each page's, the one a document is drawn from and the socket's), and a reconciler is handed the shell `session.shell` is, which refuses what would change what the shell is made of. The boot is refused where a canvas names a reconciler the app does not hand over. A manifest without `reconcilers`, and a canvas without `reconcile`, are read and served as before.
|
|
22
|
+
- 98695fb: Resets of a shell that arrive while another waits for its turn are answered by that one: a burst of `reset` messages costs two builds at most, the one under way and one more. A reset is still never answered by the build already under way.
|
|
23
|
+
|
|
24
|
+
Before, every `reset` message from any terminal, signed in or not, queued a whole build of its own: 200 messages were 200 builds, each asking who the person is and what they hold, and running the app's `inputs`, `phrases`, `functions` and `seeds`.
|
|
25
|
+
|
|
26
|
+
- b43afd8: Integration intake holds an endpoint's URL to where it is routed. A path under `/integrations/<id>/` is refused when it resolves anywhere else (`..`, `.`, `%2e`, `\`) or holds a `{{…}}` template before its `?`, and a call to the app is refused unless it is one of the app's vex routes (`/api/vex`, `/api/<resource>/vex`).
|
|
27
|
+
|
|
28
|
+
Before, intake read only the start of the URL as written, while the in-process wire resolves it before routing: an approved integration could reach another integration's proxy, or any route of the app, as the signed-in person. An integration whose bundle has such an endpoint is refused, with a sentence for each, when it is next registered; one imported before this release keeps the endpoints it was imported with until then.
|
|
29
|
+
|
|
30
|
+
- 6ba0eeb: `server.invalidateTag(tag)` has every living shell adopt, in this process and in every other one the fabric reaches, as `refresh` does: a function or an action the new roles do not grant is no longer held, and no shell is reset.
|
|
31
|
+
|
|
32
|
+
Before, it only forgot the identity records, so after a role change applied through it a connected person kept calling the `fn:` endpoints their shell was built with until they disconnected. Each call now asks the app's `identity` again for every signed-in person with a living shell whose record is not held.
|
|
33
|
+
|
|
3
34
|
## 0.8.1
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/DOCS.md
CHANGED
|
@@ -67,6 +67,7 @@ type NiscApp = {
|
|
|
67
67
|
functions?: (session: FunctionSession) => readonly FunctionDefinition[] | Record<string, FunctionHandler>;
|
|
68
68
|
onSession?: (session: FunctionSession) => void;
|
|
69
69
|
runs?: RunSink;
|
|
70
|
+
reconcilers?: Record<string, Reconciler>; // what reconciles a canvas that names one
|
|
70
71
|
reactions?: readonly { table; op?; run }[]; // see "Reacting to writes"
|
|
71
72
|
// what is added to moss that is not its core (see "Features"); `Feature` is not exported
|
|
72
73
|
features?: readonly Feature[];
|
|
@@ -74,8 +75,8 @@ type NiscApp = {
|
|
|
74
75
|
```
|
|
75
76
|
|
|
76
77
|
Every field is an artifact (authored data) except the code seams — `scope`,
|
|
77
|
-
`identity`, `phrases`, `functions`, `onSession`, `runs`, a
|
|
78
|
-
— and `features`. Absent `shell`, the app serves data only
|
|
78
|
+
`identity`, `phrases`, `functions`, `onSession`, `runs`, `reconcilers`, a
|
|
79
|
+
reaction's `run` — and `features`. Absent `shell`, the app serves data only
|
|
79
80
|
(no server shells). Absent `functions`, `fn:` endpoints fail loudly.
|
|
80
81
|
|
|
81
82
|
- `assignments` is optional: an app that declares `identity` answers roles per
|
|
@@ -175,6 +176,19 @@ Every field is an artifact (authored data) except the code seams — `scope`,
|
|
|
175
176
|
answer from.
|
|
176
177
|
- `session` is the session that recorded the run, so a sink can write the
|
|
177
178
|
record through `session.wire`, as the caller.
|
|
179
|
+
- `reconcilers` — nova `Reconciler`s by name. A canvas whose `reconcile` names
|
|
180
|
+
one, in the app's shell or a page's, is reconciled by it whenever a
|
|
181
|
+
`reconcile` step aims at it (nova's SHELL_DOCS.md, "A canvas that names its
|
|
182
|
+
own reconciler"): handed each row as written, it decides what is kept,
|
|
183
|
+
matched, moved and removed — several cards of one action on one list canvas,
|
|
184
|
+
matched by a key and kept in the list's order. Every shell moss builds holds
|
|
185
|
+
them, the app's and each page's, the one a document is drawn from and the
|
|
186
|
+
socket's: from one seed, a reconciler that answers the same rows the same
|
|
187
|
+
way places the same instances in both. A reconciler
|
|
188
|
+
is handed the shell `session.shell` is: what would change what the shell is
|
|
189
|
+
made of throws there. **The boot is refused** where a canvas names one the
|
|
190
|
+
app does not hand over: ``shell.canvases.1.reconcile: "keyed" is not a
|
|
191
|
+
reconciler the app hands over in `reconcilers` ``.
|
|
178
192
|
- `grammars` — strata sequences for documents only this app defines the shape
|
|
179
193
|
of (its kit's component props). See "Documents are read in this code's
|
|
180
194
|
grammars" below.
|
|
@@ -214,7 +228,8 @@ A `CanvasSeed` is an action id or `{ action, input?, with? }`, and a
|
|
|
214
228
|
`ShellCanvas` is nova's canvas config with `initial` widened to one seed or a
|
|
215
229
|
list of candidates. Neither type is exported by name: `ShellManifest['canvases']`
|
|
216
230
|
carries both. Of a list of candidates, the first action the principal holds
|
|
217
|
-
mounts; a canvas none of whose candidates they hold starts empty.
|
|
231
|
+
mounts; a canvas none of whose candidates they hold starts empty. A canvas's
|
|
232
|
+
`reconcile` names one of the app's `reconcilers`.
|
|
218
233
|
|
|
219
234
|
`components` is the kit as the server knows it: each component's name, with
|
|
220
235
|
its `meta` (a `description`, and `propsSchema`, the zod schema of its props).
|
|
@@ -771,7 +786,7 @@ type NiscRuntime = {
|
|
|
771
786
|
vexConfig?: QueryEngineConfig['config']; // the query engine's settings (limits, read timeout); default vex's own
|
|
772
787
|
session: SessionVerifier | 'sessions' | 'dev-open'; // REQUIRED — no default
|
|
773
788
|
origins?: readonly string[]; // origins that are the app's own page, beside the host a request names (a proxy that rewrites `Host`)
|
|
774
|
-
migrations?: 'apply' | 'verify'; // the boot's ledgered run; default '
|
|
789
|
+
migrations?: 'apply' | 'verify'; // the boot's ledgered run; default 'verify'
|
|
775
790
|
tables?: readonly Sequence[]; // the app's own table sequences, in that same run
|
|
776
791
|
shellIdleMs?: number; // idle shell eviction; default 30 min, `0` disables
|
|
777
792
|
artifactsUnusedMs?: number; // delete what a person generated once nobody has loaded it for this long; default never
|
|
@@ -938,11 +953,16 @@ await revokeAllFor(runtime.pool, 'usr_ada');
|
|
|
938
953
|
integrations, their actions, the generation pointer, the two tables of what
|
|
939
954
|
was saved) and the sessions table's
|
|
940
955
|
(`nisc.moss.sessions`; the sequence itself is not exported) — and
|
|
941
|
-
`createServer`
|
|
942
|
-
one ledgered run before introspection:
|
|
943
|
-
|
|
944
|
-
runtime picks the posture: `'
|
|
945
|
-
refuses to boot
|
|
956
|
+
`createServer` checks them with the vex cache's sequence in
|
|
957
|
+
one ledgered run before introspection: refused if the ledger was edited, written
|
|
958
|
+
by newer code, or records a sequence the run does not name (strata's
|
|
959
|
+
`complete`). `migrations` on the runtime picks the posture: `'verify'` (default)
|
|
960
|
+
refuses to boot while anything is pending, naming each migration and the two
|
|
961
|
+
commands that apply it (`npx nisc migrate --check`, then `npx nisc migrate`) —
|
|
962
|
+
a real database's tables change only through `nisc migrate`; `'apply'` runs what
|
|
963
|
+
is pending, for a database that starts empty every time (PGlite in memory).
|
|
964
|
+
On a database that is up to date the check only reads the ledger, so the app's
|
|
965
|
+
database role needs no right to change tables.
|
|
946
966
|
|
|
947
967
|
The run's order is: `MOSS_SEQUENCE`, the sessions table's under
|
|
948
968
|
`session: 'sessions'`, the vex cache's, the tables the app's features keep (in
|
|
@@ -950,12 +970,15 @@ the order the app named the features), then `runtime.tables`.
|
|
|
950
970
|
|
|
951
971
|
`tables` on the runtime hands over the app's own table sequences. They join
|
|
952
972
|
that run last — one transaction, one lock, one posture, so `'verify'`
|
|
953
|
-
covers them.
|
|
954
|
-
owner's tables the app keeps
|
|
955
|
-
|
|
956
|
-
|
|
973
|
+
covers them. Every sequence that has run on the database is named there:
|
|
974
|
+
another owner's tables the app keeps (tide's: `TIDE_SEQUENCE`, from
|
|
975
|
+
`@niscorp/tide/postgres`, with the store made `migrate: false`), and a sequence
|
|
976
|
+
the app no longer uses — a removed feature's, or the sessions table's after the
|
|
977
|
+
app stopped storing sessions. To remove a sequence's tables, append a migration
|
|
978
|
+
that drops them. The runtime migrates nothing itself and calls no
|
|
979
|
+
`cache.init()`: the server does both, in that order.
|
|
957
980
|
|
|
958
|
-
#### `migrateTables(runtime, app, { dryRun? })`
|
|
981
|
+
#### `migrateTables(runtime, app, { dryRun?, allowRemoval? })`
|
|
959
982
|
|
|
960
983
|
The step that changes tables, for a deployment that migrates before it starts
|
|
961
984
|
(`nisc migrate` calls it). It applies everything pending in the one run,
|
|
@@ -984,6 +1007,21 @@ columns the run takes away), `retyped` (columns whose type it changes, as
|
|
|
984
1007
|
`table.column (was → now)`) and `alreadyBroken`. `dryRun` does all of it and
|
|
985
1008
|
rolls it back.
|
|
986
1009
|
|
|
1010
|
+
A run that removes a table or a column, or changes a column's type, is refused
|
|
1011
|
+
(`DOES_NOT_FIT`, a sentence each) unless `allowRemoval` is given. It sees what
|
|
1012
|
+
vex reads off the schema: not rows a step deletes, not keys a step takes out of
|
|
1013
|
+
a document. The picture before the run is read before the run's lock, so a
|
|
1014
|
+
removal another run made meanwhile can be refused here too; running again
|
|
1015
|
+
passes. moss's own sequence removes columns (`nisc.moss/4`): a database that
|
|
1016
|
+
has not run it needs `allowRemoval` once.
|
|
1017
|
+
|
|
1018
|
+
#### `tableStatus(runtime, app) : Plan`
|
|
1019
|
+
|
|
1020
|
+
What `migrateTables` would act on, read and nothing else — no lock, no
|
|
1021
|
+
transaction, nothing created: strata's plan (`applied` per sequence, `pending`
|
|
1022
|
+
in order, `problems`) over the same sequences. `nisc migrate --status` prints
|
|
1023
|
+
it.
|
|
1024
|
+
|
|
987
1025
|
It sees entries and nothing else: not SQL written by hand, not a column a scope
|
|
988
1026
|
rule stamps, not what a value means.
|
|
989
1027
|
|
|
@@ -1354,8 +1392,16 @@ It's a Hono app — mount it, extend it, or hand it to a listener.
|
|
|
1354
1392
|
app keeps for them, and the one a page built for each connection of theirs.
|
|
1355
1393
|
`false` = no record was held.
|
|
1356
1394
|
- `invalidateTag(tag): number` — forget every identity record wearing the
|
|
1357
|
-
tag the app put on it (`IdentityRecord.tag`); answers how many.
|
|
1358
|
-
|
|
1395
|
+
tag the app put on it (`IdentityRecord.tag`); answers how many. Then every
|
|
1396
|
+
living shell adopts, as after `refresh` ("A change is the server's", under
|
|
1397
|
+
`shells` below): it is brought level with what its principal holds now, in
|
|
1398
|
+
place, so a function or an action their new roles do not grant is no longer
|
|
1399
|
+
held. No shell is reset: what people were in the middle of stays. Every
|
|
1400
|
+
living shell, not only those of the records forgotten: a record can be
|
|
1401
|
+
dropped while its shell lives (past `runtime.identityMax`, or unread for
|
|
1402
|
+
`runtime.identityIdleMs`), and no tag finds it then. So each call asks the app's
|
|
1403
|
+
`identity` again for every signed-in person with a living shell whose
|
|
1404
|
+
record is not held.
|
|
1359
1405
|
- `identity(principal): Promise<IdentityRecord>` — who one principal is,
|
|
1360
1406
|
resolved the way a request resolves it: `{ roles, scope, installed? }`,
|
|
1361
1407
|
through the same cache the request path uses. `null` is nobody signed in.
|
|
@@ -1716,9 +1762,10 @@ it answers `undefined`, nothing is minted.
|
|
|
1716
1762
|
`createTideStore(pool, options?)`, `TIDE_SEQUENCE`, `TIDE_TABLES` and
|
|
1717
1763
|
`TIDE_DDL` are exported by `@niscorp/tide/postgres`. They were moss's, and do
|
|
1718
1764
|
what they did: see tide's [DOCS.md](../tide/DOCS.md), "The driver" and "The
|
|
1719
|
-
Postgres store". `createTideStore(runtime.pool)` takes the
|
|
1720
|
-
holds,
|
|
1721
|
-
|
|
1765
|
+
Postgres store". `createTideStore(runtime.pool, { migrate: false })` takes the
|
|
1766
|
+
pool the runtime holds, with `TIDE_SEQUENCE` in `runtime.tables`, and its tables
|
|
1767
|
+
are ordinary tables to moss: migrated by `nisc migrate`, introspected,
|
|
1768
|
+
grantable, and scoped by a behavior like any other.
|
|
1722
1769
|
|
|
1723
1770
|
### Features
|
|
1724
1771
|
|
|
@@ -1924,7 +1971,7 @@ for (const error of report.errors) console.error(`${error.check}: ${error.detail
|
|
|
1924
1971
|
over it the layout of their own they marked in use), the
|
|
1925
1972
|
fragments, the entries, the component names), the
|
|
1926
1973
|
app's code a shell calls (`inputs`, `seeds`, `phrases`, `functions`,
|
|
1927
|
-
`onSession`, `runs`), the wire for a token, and its limits. Everything in
|
|
1974
|
+
`onSession`, `runs`, `reconcilers`), the wire for a token, and its limits. Everything in
|
|
1928
1975
|
that answer but who somebody is comes from the running manifest, which is
|
|
1929
1976
|
asked once for each build and once for each adopt
|
|
1930
1977
|
(`artifactsFor`, `src/artifactory/running.ts`): an action, a layout, a fragment and an entry
|
|
@@ -2015,9 +2062,13 @@ for (const error of report.errors) console.error(`${error.check}: ${error.detail
|
|
|
2015
2062
|
`false` = they hold no shell, which is an answer, not an error. The
|
|
2016
2063
|
replacement is built from what the shell was opened with (for a page's,
|
|
2017
2064
|
the inputs of its path and its id seed), and a shell's resets run one
|
|
2018
|
-
after another. A reset
|
|
2019
|
-
|
|
2020
|
-
the
|
|
2065
|
+
after another. A reset that arrives while another waits for its turn is
|
|
2066
|
+
answered by that one, whose build has read nothing yet; it is never
|
|
2067
|
+
answered by the build under way, which may have read what it builds from
|
|
2068
|
+
before the change the later reset is for. So a burst of resets costs two
|
|
2069
|
+
builds at most: the one under way and one more. A reset whose build
|
|
2070
|
+
throws, or has not landed within `runtime.endpointTimeoutMs`, is logged
|
|
2071
|
+
and leaves the shell that stood; the reset after it goes ahead.
|
|
2021
2072
|
- What `ShellHost.session(token, principal)` returns (a type that is not
|
|
2022
2073
|
exported by name: `Awaited<ReturnType<ShellHost['session']>>`):
|
|
2023
2074
|
`{ shell, attach, detach, resync, dispatch, publish, back, popTo, reset }`. The living nova `Shell`,
|
|
@@ -2136,7 +2187,12 @@ server.nudge('usr_ada', 'notes-changed');
|
|
|
2136
2187
|
canvases are the broken thing, so it must not travel through one. It is
|
|
2137
2188
|
protocol-level, not app-level — no action declares it and no charter grants
|
|
2138
2189
|
it — and it is answered by the frames it produces, not by an envelope of its
|
|
2139
|
-
own.
|
|
2190
|
+
own. Any terminal may send it, signed in or not, and each one that is acted
|
|
2191
|
+
on is a whole build: who somebody is, what they hold, and the app's
|
|
2192
|
+
`inputs`, `phrases`, `functions` and `seeds`. Resets that arrive while one
|
|
2193
|
+
waits for its turn are answered by it (`reset(principal)`, under `shells`),
|
|
2194
|
+
so a burst costs two builds at most. Nothing limits how often: a terminal
|
|
2195
|
+
that sends one each time a build lands keeps one build of its shell running.
|
|
2140
2196
|
- `back` names no canvas either, and for a related reason: back is one gesture
|
|
2141
2197
|
over the whole shell, and the terminal that sends it has no idea which canvas
|
|
2142
2198
|
moved last — it is served trees, not stacks. The shell decides what back
|
|
@@ -2620,9 +2676,14 @@ hash of one key (a unique index on `integrations.key_hash`).
|
|
|
2620
2676
|
**What intake holds a bundle to**, before any of it is kept. It is upgraded by
|
|
2621
2677
|
its grammar stamps and read by the bundle's schema. Each action is named
|
|
2622
2678
|
`ext.<audience>.<integration>.<name>` under the integration's own id; each of
|
|
2623
|
-
its endpoints is a fingerprint the app serves
|
|
2679
|
+
its endpoints is a fingerprint the app serves, called on one of the app's vex
|
|
2680
|
+
routes (`/api/vex`, `/api/<resource>/vex`), or a URL under
|
|
2624
2681
|
`/integrations/<id>/` (and not under `hook/`, the door that asks for no
|
|
2625
|
-
session), and none is `fn
|
|
2682
|
+
session), and none is `fn:`. The path of that URL, up to its `?`, is written
|
|
2683
|
+
as it resolves, because the path a URL parser reads is the one that is
|
|
2684
|
+
routed: a `..`, `.`, `%2e` or `\` that would move it is refused, and so is a
|
|
2685
|
+
`{{…}}` template, which is filled in when the endpoint is called; one in the
|
|
2686
|
+
query is taken. Its layout composes what the app's kit has; and no
|
|
2626
2687
|
chain of its steps, laid over the app's own actions, runs for ever. Then
|
|
2627
2688
|
`extension` is read by the app's schema and held to the app's `check`. Every
|
|
2628
2689
|
reason, moss's and the app's, is reported together, and any one refuses the
|
package/README.md
CHANGED
|
@@ -178,14 +178,15 @@ never in moss core.
|
|
|
178
178
|
|
|
179
179
|
moss creates no table on its own: its tables (`MOSS_SEQUENCE`, plus the
|
|
180
180
|
sessions table's sequence when the runtime's `session` is `'sessions'`), the
|
|
181
|
-
vex cache's
|
|
182
|
-
[strata](../strata/README.md)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
`migrations: '
|
|
188
|
-
|
|
181
|
+
vex cache's, the ones the app's features keep and the app's own
|
|
182
|
+
(`runtime.tables`) are [strata](../strata/README.md) sequences in one ledger.
|
|
183
|
+
A real database's tables change only through `nisc migrate`; a boot checks
|
|
184
|
+
them and refuses to start while a migration is pending, or when the ledger was
|
|
185
|
+
edited, written by newer code, or records a sequence nobody names. A runtime
|
|
186
|
+
whose database starts empty every time (PGlite in memory) writes
|
|
187
|
+
`migrations: 'apply'` and is migrated at boot. Tide's tables are tide's
|
|
188
|
+
(`TIDE_SEQUENCE`, from `@niscorp/tide/postgres`): the app hands the sequence
|
|
189
|
+
over in `runtime.tables` and makes the store `migrate: false`. Stored integration actions carry
|
|
189
190
|
a grammar stamp and are upgraded at boot, at intake and on read — through
|
|
190
191
|
nova's and Prism's grammars plus the app's own (`NiscApp.grammars`); a bundle or
|
|
191
192
|
row written by newer grammars is refused. See [DOCS.md](DOCS.md).
|
|
@@ -333,7 +333,8 @@ var CanvasSchema = zod.z.object({
|
|
|
333
333
|
id: zod.z.string(),
|
|
334
334
|
mode: zod.z.enum(["stack", "list"]).optional(),
|
|
335
335
|
actionLayout: zod.z.union([zod.z.string(), layout]).optional(),
|
|
336
|
-
initial: zod.z.union([CanvasSeedSchema, zod.z.array(CanvasSeedSchema)]).optional()
|
|
336
|
+
initial: zod.z.union([CanvasSeedSchema, zod.z.array(CanvasSeedSchema)]).optional(),
|
|
337
|
+
reconcile: zod.z.string().optional()
|
|
337
338
|
}).strict();
|
|
338
339
|
var ComponentContractSchema = zod.z.looseObject({ meta: zod.z.looseObject({ description: zod.z.string().optional() }).optional() });
|
|
339
340
|
var storedLayoutName = zod.z.string().superRefine((name, ctx) => {
|
|
@@ -388,9 +389,18 @@ var fields = {
|
|
|
388
389
|
functions: seam.optional(),
|
|
389
390
|
onSession: seam.optional(),
|
|
390
391
|
runs: seam.optional(),
|
|
392
|
+
reconcilers: zod.z.record(zod.z.string(), seam).optional(),
|
|
391
393
|
reactions: zod.z.array(ReactionSchema).readonly().optional()
|
|
392
394
|
};
|
|
393
|
-
var ManifestSchema = zod.z.object(fields).strict()
|
|
395
|
+
var ManifestSchema = zod.z.object(fields).strict().superRefine((app, ctx) => {
|
|
396
|
+
const shells = [{ at: ["shell"], shell: app.shell }, ...Object.entries(app.pages ?? {}).map(([name, page]) => ({ at: ["pages", name], shell: page }))];
|
|
397
|
+
for (const { at, shell: shell2 } of shells) {
|
|
398
|
+
for (const [index, canvas] of (shell2?.canvases ?? []).entries()) {
|
|
399
|
+
if (canvas.reconcile === void 0 || Object.hasOwn(app.reconcilers ?? {}, canvas.reconcile)) continue;
|
|
400
|
+
ctx.addIssue({ code: "custom", path: [...at, "canvases", index, "reconcile"], message: `"${canvas.reconcile}" is not a reconciler the app hands over in \`reconcilers\`` });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
394
404
|
var placesOf = (issue, under) => {
|
|
395
405
|
const path = [...under, ...issue.path];
|
|
396
406
|
if (issue.code === "invalid_key") return [{ path, message: issue.issues[0]?.message ?? issue.message }];
|
|
@@ -855,6 +865,12 @@ var buildShell = async (host, asked) => {
|
|
|
855
865
|
if (kept) hooks.onSession?.(session);
|
|
856
866
|
const layoutStore = nova.createLayoutStore();
|
|
857
867
|
for (const [refId, node] of Object.entries(made.layoutStore ?? {})) layoutStore.set(refId, node);
|
|
868
|
+
let guarded;
|
|
869
|
+
const guardedOf = (shell3) => guarded ??= sessionShellOf(shell3);
|
|
870
|
+
const reconcilers = {};
|
|
871
|
+
for (const [name, reconcile] of Object.entries(hooks.reconcilers ?? {})) {
|
|
872
|
+
reconcilers[name] = (reconciled, canvasId, desired, options) => reconcile(guardedOf(reconciled), canvasId, desired, options);
|
|
873
|
+
}
|
|
858
874
|
let minted = 0;
|
|
859
875
|
const idSeed = opening?.seed;
|
|
860
876
|
const shell2 = nova.createShell({
|
|
@@ -868,12 +884,13 @@ var buildShell = async (host, asked) => {
|
|
|
868
884
|
transform: (config2, source) => prism.evaluate(config2, source !== null && typeof source === "object" && !Array.isArray(source) ? { ...source, userId, today: today() } : source),
|
|
869
885
|
fetch: wire,
|
|
870
886
|
functions: functions.held,
|
|
887
|
+
...hooks.reconcilers === void 0 ? {} : { reconcilers },
|
|
871
888
|
...config.limits?.endpointTimeoutMs === void 0 ? {} : { endpointTimeoutMs: config.limits.endpointTimeoutMs },
|
|
872
889
|
// An empty book is withheld: nova runs its phrase pass whenever one is given.
|
|
873
890
|
...Object.keys(phrases).length === 0 ? {} : { phrases },
|
|
874
891
|
...config.phraseKeys === void 0 ? {} : { phraseKeys: config.phraseKeys }
|
|
875
892
|
});
|
|
876
|
-
const sessionShell =
|
|
893
|
+
const sessionShell = guardedOf(shell2);
|
|
877
894
|
shellRef.shell = shell2;
|
|
878
895
|
shellRef.sessionShell = sessionShell;
|
|
879
896
|
const live = {
|
|
@@ -939,5 +956,5 @@ exports.wholeShellOf = wholeShellOf;
|
|
|
939
956
|
exports.withFragments = withFragments;
|
|
940
957
|
exports.withLayoutInPlace = withLayoutInPlace;
|
|
941
958
|
exports.withVariants = withVariants;
|
|
942
|
-
//# sourceMappingURL=chunk-
|
|
943
|
-
//# sourceMappingURL=chunk-
|
|
959
|
+
//# sourceMappingURL=chunk-E6YAYR7G.cjs.map
|
|
960
|
+
//# sourceMappingURL=chunk-E6YAYR7G.cjs.map
|