@niscorp/moss 0.7.0 → 0.8.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 +44 -0
- package/DOCS.md +95 -58
- package/dist/{chunk-F45SFR7W.cjs → chunk-3DCTQKPQ.cjs} +56 -16
- package/dist/chunk-3DCTQKPQ.cjs.map +1 -0
- package/dist/{chunk-X2Q546EB.js → chunk-3T422CCN.js} +9 -3
- package/dist/chunk-3T422CCN.js.map +1 -0
- package/dist/{chunk-MYGVHWS5.js → chunk-6XC2MD7S.js} +51 -15
- package/dist/chunk-6XC2MD7S.js.map +1 -0
- package/dist/{chunk-Z2VA6AOE.cjs → chunk-I4UOWER3.cjs} +11 -5
- package/dist/chunk-I4UOWER3.cjs.map +1 -0
- package/dist/{chunk-C2DNDIQX.cjs → chunk-PVZMCEBX.cjs} +2 -2
- package/dist/chunk-PVZMCEBX.cjs.map +1 -0
- package/dist/{chunk-IMZZB4JE.js → chunk-QAHDSRPK.js} +2 -2
- package/dist/chunk-QAHDSRPK.js.map +1 -0
- package/dist/{chunk-DSTHFSTO.cjs → chunk-TMDKNZYL.cjs} +349 -159
- package/dist/chunk-TMDKNZYL.cjs.map +1 -0
- package/dist/{chunk-MTC46PGQ.js → chunk-YZILOVCR.js} +301 -111
- package/dist/chunk-YZILOVCR.js.map +1 -0
- package/dist/{document-AbQUbQaP.d.ts → document-BYAY-Qle.d.ts} +9 -9
- package/dist/{document-wHHxIXJz.d.cts → document-DAE71J27.d.cts} +9 -9
- package/dist/{index-Dml1klpZ.d.cts → index-CSEo7Tys.d.cts} +1 -0
- package/dist/{index-Dml1klpZ.d.ts → index-CSEo7Tys.d.ts} +1 -0
- package/dist/index.cjs +14 -14
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.d.cts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.js +1 -1
- package/dist/node.cjs +8 -8
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +4 -4
- package/dist/tide.d.cts +1 -1
- package/dist/tide.d.ts +1 -1
- package/dist/unverified.cjs +3 -3
- package/dist/unverified.js +2 -2
- package/dist/vite.cjs +9 -9
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +4 -4
- package/package.json +8 -8
- package/dist/chunk-C2DNDIQX.cjs.map +0 -1
- package/dist/chunk-DSTHFSTO.cjs.map +0 -1
- package/dist/chunk-F45SFR7W.cjs.map +0 -1
- package/dist/chunk-IMZZB4JE.js.map +0 -1
- package/dist/chunk-MTC46PGQ.js.map +0 -1
- package/dist/chunk-MYGVHWS5.js.map +0 -1
- package/dist/chunk-X2Q546EB.js.map +0 -1
- package/dist/chunk-Z2VA6AOE.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @niscorp/moss
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2076f80: `session.draft.add` is what `session.draft.put` was. **Breaking.**
|
|
8
|
+
|
|
9
|
+
BREAKING — approved by moccadroid, 2026-10-18: rename `session.draft.put(...)` to `session.draft.add(...)`. Nothing else about it changes: it takes what `save` takes, what is added is in that one shell when the add answers, and `save`, `discard`, `show`, `remove` and `list` are as they were.
|
|
10
|
+
|
|
11
|
+
- cdc89cc: `server.checkFunctions()` reads the app's functions and refuses what is wrong with them before anyone is served. **Breaking.**
|
|
12
|
+
|
|
13
|
+
BREAKING — approved by moccadroid, 2026-10-18: `serve` of `@niscorp/moss/node`, and `nisc dev`, `nisc build`, `nisc check` and `nisc start`, refuse to come up on an action that calls a function the app has no function of, a charter `functions` deny that matches nothing, or two functions under one id. An app that hands a function only to signed-in sessions, with a shipped action calling it, hands it to every session (the function refuses whom it must), or is refused.
|
|
14
|
+
|
|
15
|
+
An app's functions are known only once a session is: `functions(session)` is called for each shell, and a session hook may reach for the server object, which the app holds only once `createServer` has answered. So the check is the app's to call, once it holds the server and before it listens; `serve` of `@niscorp/moss/node` calls it, and so do `nisc dev`, `nisc build`, `nisc check` and `nisc start` after the project's `boot`; each closes what it built where it refuses. It builds nobody's shell once, after everything is in force, and drops it. What that call returned is checked, and it refuses on:
|
|
16
|
+
- **an action, or a fragment a shell ships, that calls a function the app does not have**: `"home" calls "auth.leave", which the app has no function of`. Before, the call failed when a person pressed the button. An app with no `functions` has none. A set of actions handed over while the app runs is held to the same at that refresh.
|
|
17
|
+
- **a charter `functions` deny that matches nothing**: `Charter is incoherent over the app’s functions — refusing to serve:`.
|
|
18
|
+
- **two functions under one id**: `moss: functions(session) returned "auth.leave" twice.`
|
|
19
|
+
|
|
20
|
+
What the charter only warns of (a grant that names no function, a function no role grants), the functions with no description, and a map of handlers are said at that point, once.
|
|
21
|
+
|
|
22
|
+
The cost is one anonymous shell built, as any visitor who is not signed in causes. Every check reads nobody's functions: an app that hands a function only to signed-in sessions is refused where an action calls it.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- edd3271: `session.answerIntent(writers, asked)` also replays a query that exists: `asked` may be `{ fingerprint, context }`.
|
|
27
|
+
|
|
28
|
+
It is answered as the caller, as an intent is, with what vex knows of the query: the context keys it binds, the ones the call left out (`meta.missingContext`), its warnings. The wire answers a replay with the rows alone. A model that proves a query before it builds on it learns from this why a replay came back empty.
|
|
29
|
+
|
|
30
|
+
- f461b98: What a person generated and nobody has used for long enough is deleted, with `runtime.artifactsUnusedMs`.
|
|
31
|
+
- A version of an artifact a person saved is stamped as used (`artifacts.last_used_at`, migration `nisc.moss/6`) when a shell is built for them, once an hour at most, through the same vex entries and row rule as the save itself.
|
|
32
|
+
- A sweep runs as the server comes up and then every hour: every artifact of a person whose newest version was neither saved nor used within `artifactsUnusedMs` is deleted, every version of it, and the saves left empty with them. What is published for everybody (`*`) never ages; what the build ships is not a row.
|
|
33
|
+
- Without the setting nothing is deleted. `0` or less refuses the boot.
|
|
34
|
+
- The sweep is one raw statement in moss (`data/aging.ts`), entered in the raw-SQL ledger: vex keeps every statement of its own to one principal's rows, and the sweep crosses them all.
|
|
35
|
+
|
|
36
|
+
- 37422bf: `server.defaults(publisher)` publishes every kind a person saves: an action, a fragment and a read, beside a layout.
|
|
37
|
+
- **An action or a fragment is given its id by whoever publishes it**, as a shipped one has one: `server.defaults(who).save([{ kind: 'action', id: 'promo', body }])`. One without an id is refused (`moss: a published action is given its id by whoever publishes it: name it.`), and so is one under `generated.`. The charter grants it by that id: a new id needs a grant, and one that is a shipped action's or fragment's replaces the build's for everybody until it is reset.
|
|
38
|
+
- **A read vex wrote is published under its fingerprint**, `save([{ kind: 'read', id: '<fingerprint>' }])`, and is answered to everybody, nobody signed in included, after what the caller saved themselves. One under the fingerprint of a shipped entry is refused. A generated action anybody saves may replay it.
|
|
39
|
+
- **Checked as a person's save is, as the publisher, and then as a manifest.** An action's `fn:` calls are ones the publisher's roles grant and its reads ones they may replay; then the whole set in force is verified as a set handed over is, and a holder whose roles do not grant a call refuses the publish: `Publish refused — actions call functions the app does not have, or that their holders’ charter does not grant:`.
|
|
40
|
+
- **A default that no longer passes under a new build is left out, and the build's copies stand**, with a line said once per read of the rows: `[moss] what is published for everybody is left out, and the build’s copies stand: …`.
|
|
41
|
+
- `publishedArtifacts(saved, publisher)` of the running manifest takes who publishes, for the roles and reads a publish is held to; `server.defaults` resolves them from the publisher's principal.
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [63b9ab5]
|
|
44
|
+
- Updated dependencies [6a62604]
|
|
45
|
+
- @niscorp/nova@0.5.0
|
|
46
|
+
|
|
3
47
|
## 0.7.0
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
package/DOCS.md
CHANGED
|
@@ -107,40 +107,48 @@ Every field is an artifact (authored data) except the code seams — `scope`,
|
|
|
107
107
|
endpoint name, `execute` is what an `fn:` endpoint calls, `(data, signal) =>
|
|
108
108
|
Promise<unknown>`, and `description` says what it does and what to send, for
|
|
109
109
|
the model that writes a call to it (`session.functions()` lists it). Two
|
|
110
|
-
under one id are refused
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
under one id are refused: `moss: functions(session) returned "auth.leave"
|
|
111
|
+
twice.` A map of handlers by id still works and is deprecated.
|
|
112
|
+
**`server.checkFunctions()`** builds nobody's shell once, drops it, and reads
|
|
113
|
+
what its `functions(session)` returned, so what is wrong with the functions
|
|
114
|
+
is refused or said before anyone is served. The app calls it once it holds
|
|
115
|
+
the server and before it listens, as a session hook may reach for the
|
|
116
|
+
server: `serve` of `@niscorp/moss/node` does, and so do `nisc dev`, `nisc
|
|
117
|
+
build`, `nisc check` and `nisc start` after the project's `boot`. It says: `[moss] functions(session)
|
|
118
|
+
returned a map of handlers, which is deprecated: return a list of { id,
|
|
119
|
+
description, execute }.`, or `[moss] functions with no description:
|
|
120
|
+
auth.leave. Give each a description.` An empty description counts as none,
|
|
121
|
+
and a function given by a map has none. **A shell holds only the functions
|
|
118
122
|
its principal's roles grant**, in the charter's `functions` part (names or
|
|
119
123
|
globs, with `extends` and `deny`, as `actions`): a role with none may call
|
|
120
124
|
none, and an `fn:` endpoint to one it does not grant fails when it is called.
|
|
121
125
|
What a living shell holds follows the roles an adopt answers, as its actions
|
|
122
126
|
do.
|
|
123
127
|
- **The boot is refused** where somebody holds an action that calls a
|
|
124
|
-
function their roles do not grant
|
|
125
|
-
|
|
128
|
+
function their roles do not grant, and **`server.checkFunctions()` refuses**
|
|
129
|
+
where an action, or a fragment the shells ship, calls a function the app
|
|
130
|
+
does not have (`"home" calls "auth.leave", which the app has no function
|
|
131
|
+
of`); an app with no `functions` has none. It reads the `fn:` endpoints of
|
|
132
|
+
the actions held by each role on its own, each combination `wearable` or
|
|
126
133
|
`assignments` lists, and `public`, and of the fragments the shells ship,
|
|
127
134
|
and lists every call that is missing: `"member" hold "chrome.topbar",
|
|
128
|
-
which calls "auth.leave": their functions do not grant it`. A
|
|
129
|
-
|
|
130
|
-
the shell's map
|
|
135
|
+
which calls "auth.leave": their functions do not grant it`. A set handed
|
|
136
|
+
over while the app runs is held to the same. A name with a template in it
|
|
137
|
+
(`fn: '{{$.saveFn}}'`) is worked out when it is called, and the shell's map
|
|
138
|
+
decides then.
|
|
131
139
|
- **`functions: ['*']`** grants every function, as an app had before this
|
|
132
140
|
part existed. The boot says so for each role that has it: `role "member"
|
|
133
141
|
allows every function ('*'): the generated actions of the people who hold
|
|
134
142
|
it, or a role that extends it, may call any it does not deny`. Grant each
|
|
135
143
|
role the functions it calls.
|
|
136
|
-
- **
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
`
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
- **The charter's own checks over the functions run in `checkFunctions`
|
|
145
|
+
too**, against what nobody's shell was given: a deny that matches nothing
|
|
146
|
+
refuses (`Charter is incoherent over the app’s functions — refusing to
|
|
147
|
+
serve:`), and a grant that names no function or a function no role grants
|
|
148
|
+
is said (`[moss] charter: role "member" allows "notes.ad" (functions)
|
|
149
|
+
which matches nothing`). Every check reads nobody's functions: an app that
|
|
150
|
+
hands a function only to signed-in sessions is refused where an action
|
|
151
|
+
calls it, and a later session that adds one is not read again.
|
|
144
152
|
- `onSession(session)` — called once per living app shell, for session code
|
|
145
153
|
that is not an endpoint (an observer, a roster). It runs before the shell
|
|
146
154
|
finishes building, so it must not touch `session.shell` synchronously. Its
|
|
@@ -440,10 +448,18 @@ functions: (session) => [
|
|
|
440
448
|
catalog: `/catalog`, the socket's hello and `server.catalogOf` answer what
|
|
441
449
|
the charter grants. What somebody generated is listed by
|
|
442
450
|
`session.artifacts.list('action')`.
|
|
451
|
+
- **It ages out when nobody uses it.** With `runtime.artifactsUnusedMs`, a
|
|
452
|
+
version of an artifact a person saved is stamped as used when a shell is
|
|
453
|
+
built for them (`last_used_at`, once an hour at most), and every artifact of
|
|
454
|
+
theirs whose newest version was neither saved nor used within that time is
|
|
455
|
+
deleted, every version of it, by a sweep that runs as the server comes up and
|
|
456
|
+
then every hour. What is published for everybody never ages, and what the
|
|
457
|
+
build ships is not a row. Without the setting nothing is deleted. A limit of
|
|
458
|
+
`0` or less refuses the boot.
|
|
443
459
|
- **It reaches its owner's open shells a moment after the save answers**, as a
|
|
444
460
|
saved layout does, and not before: a function that saves an action and
|
|
445
461
|
opens it in the same call finds it not there yet. One that is to be seen at
|
|
446
|
-
once is
|
|
462
|
+
once is added to the draft (`session.draft`, below), which answers when the
|
|
447
463
|
shell has it.
|
|
448
464
|
- **What it defines replays reads, and calls the functions its owner's roles
|
|
449
465
|
grant.** An `fn:` endpoint names a function its owner's roles grant in the
|
|
@@ -544,7 +560,7 @@ its mapping, its shape and its intent.
|
|
|
544
560
|
replay is refused, where one over such an entry the app ships is left out.
|
|
545
561
|
- **A generated action may replay a read its owner saved**, as it may an entry
|
|
546
562
|
the app ships that its owner may replay. A draft takes a read too, and an
|
|
547
|
-
action
|
|
563
|
+
action added to the same draft may replay it.
|
|
548
564
|
- **What is refused**, in a sentence: a read with no id, or with a body; one
|
|
549
565
|
under the fingerprint of an entry the app ships or was handed; one vex did
|
|
550
566
|
not write for a request; a write; one whose mapping vex kept no config for
|
|
@@ -681,7 +697,7 @@ is (a reset, an idle shell that was dropped, a restart).
|
|
|
681
697
|
|
|
682
698
|
```typescript
|
|
683
699
|
type SessionDraft = {
|
|
684
|
-
|
|
700
|
+
add: (artifacts: readonly { kind: ArtifactKind; id?: string; body: unknown }[]) => Promise<{ step: number; artifacts: readonly { kind: ArtifactKind; id: string }[] }>;
|
|
685
701
|
list: () => readonly { kind: ArtifactKind; id: string; body: unknown }[];
|
|
686
702
|
remove: (kind: ArtifactKind, id: string) => Promise<{ step: number }>;
|
|
687
703
|
show: (step: number) => Promise<void>;
|
|
@@ -696,37 +712,37 @@ functions: (session) => [
|
|
|
696
712
|
id: 'screen.try',
|
|
697
713
|
description: 'Shows an action the person is trying out, without keeping it. Send { action }.',
|
|
698
714
|
execute: async ({ action }) => {
|
|
699
|
-
const
|
|
700
|
-
session.shell.push('main',
|
|
715
|
+
const added = await session.draft.add([{ kind: 'action', body: action }]);
|
|
716
|
+
session.shell.push('main', added.artifacts[0].id);
|
|
701
717
|
},
|
|
702
718
|
},
|
|
703
719
|
{ id: 'screen.keep', description: 'Keeps what the person is trying out.', execute: async () => session.draft.save() },
|
|
704
720
|
],
|
|
705
721
|
```
|
|
706
722
|
|
|
707
|
-
- **`
|
|
723
|
+
- **`add` takes what `session.artifacts.save` takes and refuses what it
|
|
708
724
|
refuses**, with the same sentences. Each artifact is checked beside what is
|
|
709
725
|
in force for the principal with the draft laid over, so a layout may be for
|
|
710
726
|
an action that is itself in the draft. A draft is one shell's, so what is
|
|
711
|
-
|
|
727
|
+
added to it is held to the components of that shell, where a save is held to
|
|
712
728
|
those of any shell of the app. A new action or fragment gets its
|
|
713
729
|
`generated.` id here, and keeps it when the draft is saved. An `id` names
|
|
714
730
|
one in the draft, or one the principal saved: a new take of it, which stands
|
|
715
731
|
in for the saved one in this shell until the draft is saved or the take is
|
|
716
|
-
taken out.
|
|
732
|
+
taken out. An add that marks a layout `use: true` takes the mark off the
|
|
717
733
|
draft's others for that ref, as a save does.
|
|
718
|
-
- **
|
|
734
|
+
- **What is added is in the shell when the add answers.** The function that added an action
|
|
719
735
|
opens it on its next line. An open screen follows a drafted layout with what
|
|
720
|
-
was typed into it kept, as it follows a saved one.
|
|
736
|
+
was typed into it kept, as it follows a saved one. An add the shell could not
|
|
721
737
|
take rejects, and the draft is as it was.
|
|
722
738
|
- **What the shell draws**: what is in the draft, then what `session.artifacts`
|
|
723
739
|
would draw. A drafted layout marked `use: true` is drawn in place of a saved
|
|
724
740
|
one that is marked for the same ref.
|
|
725
741
|
- **`list`** answers what the draft holds, and **`remove`** takes one out of
|
|
726
742
|
it; what is under it is drawn again. **`discard`** empties it.
|
|
727
|
-
- **Each
|
|
743
|
+
- **Each add or removal is a numbered step**, from 1. **`show(step)`** has the
|
|
728
744
|
shell show the draft as it was after that step, and `show(0)` none of it. A
|
|
729
|
-
|
|
745
|
+
add or a removal while an earlier step is shown goes on from that step: the
|
|
730
746
|
steps after it are dropped. The steps are the draft's and are saved nowhere.
|
|
731
747
|
- **`save`** is one save of what the draft holds, as the principal's own and
|
|
732
748
|
under the ids it had, checked once more. The draft is then empty and the
|
|
@@ -753,6 +769,7 @@ type NiscRuntime = {
|
|
|
753
769
|
migrations?: 'apply' | 'verify'; // the boot's ledgered run; default 'apply'
|
|
754
770
|
tables?: readonly Sequence[]; // the app's own table sequences, in that same run
|
|
755
771
|
shellIdleMs?: number; // idle shell eviction; default 30 min, `0` disables
|
|
772
|
+
artifactsUnusedMs?: number; // delete what a person generated once nobody has loaded it for this long; default never
|
|
756
773
|
anonymousShellMax?: number; // shells for nobody signed in alive at once; default 1,000, `Infinity` is no limit
|
|
757
774
|
endpointTimeoutMs?: number; // a server shell's endpoint call, and the build of a shell; default nova's, 30s
|
|
758
775
|
sessionRevalidateMs?: number; // live-socket re-verify; default 60s, `0` disables
|
|
@@ -1249,17 +1266,24 @@ It's a Hono app — mount it, extend it, or hand it to a listener.
|
|
|
1249
1266
|
a set changes through `replaceActions`.
|
|
1250
1267
|
- `defaults(publisher): SessionArtifacts` — what is published for everybody,
|
|
1251
1268
|
with the five calls a session's `artifacts` has (`save`, `list`, `history`,
|
|
1252
|
-
`restore`, `reset`) and the same
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
layout
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1269
|
+
`restore`, `reset`), the same kinds and the same bodies. A published default
|
|
1270
|
+
is drawn, opened or replayed by everybody, nobody signed in included, under
|
|
1271
|
+
what a person has of their own; every publish is a version, and a `reset`
|
|
1272
|
+
shows the build's again. **A layout:** `server.defaults(who).save([{ kind:
|
|
1273
|
+
'layout', body: { ref: 'action/<id>', layout, use: true } }])` is drawn under
|
|
1274
|
+
that action's ref unless its principal has a layout of their own in use or
|
|
1275
|
+
their roles hold a layout variant; `ref: 'frame'` and `ref: 'canvas/<id>'`
|
|
1276
|
+
publish the layouts of the app's own shell. **An action or a fragment** is
|
|
1277
|
+
given its id by whoever publishes it, as a shipped one has one: `save([{
|
|
1278
|
+
kind: 'action', id: 'promo', body }])`; one without an id is refused, and so
|
|
1279
|
+
is one under `generated.`. The charter grants it by that id, so a new id
|
|
1280
|
+
needs a grant and one that is a shipped action's or fragment's replaces the
|
|
1281
|
+
build's for everybody until it is reset. **A read** vex wrote is published
|
|
1282
|
+
under its fingerprint, `save([{ kind: 'read', id: '<fingerprint>' }])`, and is
|
|
1283
|
+
answered to everybody after what the caller saved themselves; one under the
|
|
1284
|
+
fingerprint of a shipped entry is refused. `publisher` is who the publish is
|
|
1285
|
+
made by, kept with the save (`artifact_saves.created_by`); an empty one is
|
|
1286
|
+
refused.
|
|
1263
1287
|
**No session can publish.** The rows are those of one principal no caller
|
|
1264
1288
|
is (`*`), and every write a session makes carries its own `userId`: vex's
|
|
1265
1289
|
row rule, the one a person's own rows are under. Only the app's own code on
|
|
@@ -1268,20 +1292,33 @@ It's a Hono app — mount it, extend it, or hand it to a listener.
|
|
|
1268
1292
|
the session's principal as `publisher`, and grants the action that calls
|
|
1269
1293
|
that function to the roles that may. A function is declared before the
|
|
1270
1294
|
server exists, so the app keeps the server where its functions can reach it.
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1295
|
+
**What is published is checked three times.** At the publish, as a person's
|
|
1296
|
+
save is: a layout against every action in force and every shell's kit, an
|
|
1297
|
+
action or a fragment as a generated one is, as the publisher (its `fn:`
|
|
1298
|
+
calls are ones the publisher's roles grant, its reads ones they may replay,
|
|
1299
|
+
no write), and then the whole as a manifest, as a set handed over is:
|
|
1300
|
+
`Publish refused — actions call functions the app does not have, or that
|
|
1301
|
+
their holders’ charter does not grant:` lists a holder whose roles do not
|
|
1302
|
+
grant a call. When the rows are read, the same again, and what does not pass
|
|
1303
|
+
any more is left out with a line, said once for each read of the rows: a
|
|
1304
|
+
layout, an action or a fragment on its own where its own check refuses it
|
|
1305
|
+
(`[moss] the action "…" published for everybody is left out: …`), and the
|
|
1306
|
+
actions and fragments all together where the manifest refuses them (`[moss]
|
|
1307
|
+
what is published for everybody is left out, and the build’s copies stand:
|
|
1308
|
+
…`). Once `checkFunctions` has read the app's functions, the rows are read
|
|
1309
|
+
again against them: a published action calling a function a new build
|
|
1310
|
+
dropped is left out, and the boot is not refused. When a shell is built, for
|
|
1311
|
+
that shell and that principal: a layout for an action they do not hold is
|
|
1312
|
+
not loaded, and a published fragment a shell cannot draw is left out of that
|
|
1313
|
+
shell (`[moss] the fragment "…" published for everybody is left out of a
|
|
1314
|
+
shell that cannot draw it: …`).
|
|
1315
|
+
One read of the rows answers every shell a process builds, and every save a
|
|
1316
|
+
session makes. A boot makes it, and fails if it cannot. The first shell built
|
|
1317
|
+
after this process publishes, or after the generation pointer moves, makes it
|
|
1318
|
+
again, and a read that fails fails that shell and is made again by the next.
|
|
1319
|
+
A publish has every living shell adopt, as `refresh` does, and moves the
|
|
1320
|
+
pointer, whether or not the rows can be read back: every other process on
|
|
1321
|
+
the same database follows the pointer and reads them.
|
|
1285
1322
|
- `catalogOf(principal): Promise<{ ids, hash }>` — what a principal holds of the
|
|
1286
1323
|
actions in force: `{ ids, hash }`, the granted action ids sorted, with a
|
|
1287
1324
|
content-hash version token (equal hash, equal application). The principal is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPVZMCEBX_cjs = require('./chunk-PVZMCEBX.cjs');
|
|
4
4
|
var chunk3RIWTXGI_cjs = require('./chunk-3RIWTXGI.cjs');
|
|
5
5
|
var charter = require('@niscorp/charter');
|
|
6
6
|
var nova = require('@niscorp/nova');
|
|
@@ -66,6 +66,11 @@ var candidateOf = (shipped, inForce, grants) => ({
|
|
|
66
66
|
entries: inForce.entries,
|
|
67
67
|
profiles: vex.scopeProfiles(shipped.behaviors ?? {})
|
|
68
68
|
});
|
|
69
|
+
var withFragments = (candidate, fragments) => ({
|
|
70
|
+
...candidate,
|
|
71
|
+
fragmentIds: /* @__PURE__ */ new Set([...candidate.fragmentIds, ...Object.keys(fragments)]),
|
|
72
|
+
fragmentCalls: [...candidate.fragmentCalls, ...Object.entries(fragments).map(([id, fragment]) => ({ id, calls: functionsCalledBy(fragment) }))]
|
|
73
|
+
});
|
|
69
74
|
var unreadActions = (actions) => Object.entries(actions).flatMap(([id, definition]) => {
|
|
70
75
|
if (strata.exceedsDepth(definition)) return [{ id, why: strata.depthRefusal() }];
|
|
71
76
|
const parsed = nova.ActionDefinitionSchema.safeParse(definition);
|
|
@@ -95,7 +100,7 @@ var generatedIdErrors = (actions) => Object.entries(actions).flatMap(([listed, d
|
|
|
95
100
|
});
|
|
96
101
|
var fragmentIdErrors = (actions, fragmentIds) => Object.entries(actions).flatMap(([listed, definition]) => {
|
|
97
102
|
const taken = [listed, definition.id].find((id) => fragmentIds.has(id));
|
|
98
|
-
return taken === void 0 ? [] : [`"${taken}" is the id of an action and of a fragment
|
|
103
|
+
return taken === void 0 ? [] : [`"${taken}" is the id of an action and of a fragment: an id names one of the two`];
|
|
99
104
|
});
|
|
100
105
|
var reachErrors = (entries, profiles) => {
|
|
101
106
|
const unknown = entries.flatMap((entry2) => entry2.reach !== void 0 && !profiles.has(entry2.reach) ? [`${entry2.fingerprint} declares reach "${entry2.reach}"`] : []);
|
|
@@ -129,6 +134,14 @@ var functionGrantErrors = (candidate) => {
|
|
|
129
134
|
}
|
|
130
135
|
return [...errors];
|
|
131
136
|
};
|
|
137
|
+
var unknownFunctionErrors = (candidate) => {
|
|
138
|
+
const known = candidate.functionIds;
|
|
139
|
+
if (known === void 0) return [];
|
|
140
|
+
return [
|
|
141
|
+
...Object.entries(candidate.actions).flatMap(([id, definition]) => functionsCalledBy(definition).map((fn) => ({ by: `"${id}"`, fn }))),
|
|
142
|
+
...candidate.fragmentCalls.flatMap(({ id, calls }) => calls.map((fn) => ({ by: `the fragment "${id}"`, fn })))
|
|
143
|
+
].flatMap(({ by, fn }) => known.has(fn) ? [] : [`${by} calls "${fn}", which the app has no function of`]);
|
|
144
|
+
};
|
|
132
145
|
var everyFunctionGranted = (charter$1) => Object.entries(charter$1).flatMap(
|
|
133
146
|
([role, def]) => charter.normalizeRole(def, "functions").allow.includes("*") ? [`role "${role}" allows every function ('*'): the generated actions of the people who hold it, or a role that extends it, may call any it does not deny`] : []
|
|
134
147
|
);
|
|
@@ -151,7 +164,7 @@ var verifyManifest = (candidate) => {
|
|
|
151
164
|
...found("actions", generatedIdErrors(read.actions)),
|
|
152
165
|
...found("actions", fragmentIdErrors(read.actions, read.fragmentIds)),
|
|
153
166
|
...found("charter", charter$1.errors.map((error) => `${error.rule}: ${error.detail}`)),
|
|
154
|
-
...found("functions", functionGrantErrors(read)),
|
|
167
|
+
...found("functions", [...unknownFunctionErrors(read), ...functionGrantErrors(read)]),
|
|
155
168
|
...found("reach", reachErrors(read.entries, read.profiles)),
|
|
156
169
|
...found("variants", verifyVariants(read))
|
|
157
170
|
],
|
|
@@ -162,19 +175,42 @@ var verifyManifest = (candidate) => {
|
|
|
162
175
|
charter: charter$1
|
|
163
176
|
};
|
|
164
177
|
};
|
|
178
|
+
var verifiedAtBoot = (candidate) => {
|
|
179
|
+
const report = verifyManifest(candidate);
|
|
180
|
+
for (const line of report.said) console.error(`[moss] ${line}`);
|
|
181
|
+
const refused = refusalOf(report, "boot");
|
|
182
|
+
if (refused !== void 0) throw new Error(refused);
|
|
183
|
+
return report;
|
|
184
|
+
};
|
|
185
|
+
var charterOverFunctions = (charter$1, universes, ids) => {
|
|
186
|
+
const before = charter.verifyCharter(charter$1, universes);
|
|
187
|
+
const known = new Set([...before.errors, ...before.warnings].map((issue) => issue.detail));
|
|
188
|
+
const after = charter.verifyCharter(charter$1, { ...universes, functions: ids });
|
|
189
|
+
return {
|
|
190
|
+
errors: after.errors.flatMap((issue) => known.has(issue.detail) ? [] : [`${issue.rule}: ${issue.detail}`]),
|
|
191
|
+
warnings: after.warnings.flatMap((issue) => known.has(issue.detail) ? [] : [issue.detail])
|
|
192
|
+
};
|
|
193
|
+
};
|
|
165
194
|
var verifyApp = (app, grants) => verifyManifest(candidateOf(app, { actions: app.actions, entries: entriesOf(app) }, grants));
|
|
166
195
|
var HEADLINES = {
|
|
167
196
|
boot: {
|
|
168
197
|
actions: "Actions are not ones nova reads \u2014 refusing to serve:",
|
|
169
198
|
charter: "Charter is incoherent \u2014 refusing to serve:",
|
|
170
|
-
functions: "
|
|
199
|
+
functions: "Actions call functions the app does not have, or that their holders\u2019 charter does not grant \u2014 refusing to serve:",
|
|
171
200
|
reach: "Entries declare a reach no table offers \u2014 refusing to serve:",
|
|
172
201
|
variants: "Layout variants are incoherent \u2014 refusing to serve:"
|
|
173
202
|
},
|
|
203
|
+
publish: {
|
|
204
|
+
actions: "Publish refused \u2014 actions nova does not read:",
|
|
205
|
+
charter: "Publish refused \u2014 charter incoherent over what is published:",
|
|
206
|
+
functions: "Publish refused \u2014 actions call functions the app does not have, or that their holders\u2019 charter does not grant:",
|
|
207
|
+
reach: "Publish refused \u2014 entries declare a reach no table offers:",
|
|
208
|
+
variants: "Publish refused \u2014 layout variants incoherent:"
|
|
209
|
+
},
|
|
174
210
|
refresh: {
|
|
175
211
|
actions: "Refresh refused \u2014 actions nova does not read:",
|
|
176
212
|
charter: "Refresh refused \u2014 charter incoherent over the new artifacts:",
|
|
177
|
-
functions: "Refresh refused \u2014
|
|
213
|
+
functions: "Refresh refused \u2014 actions call functions the app does not have, or that their holders\u2019 charter does not grant:",
|
|
178
214
|
reach: "Refresh refused \u2014 entries declare a reach no table offers:",
|
|
179
215
|
variants: "Refresh refused \u2014 layout variants incoherent:"
|
|
180
216
|
}
|
|
@@ -423,10 +459,10 @@ var sessionDraftOn = ({ saving, liveOf, adopt }) => {
|
|
|
423
459
|
return steps.length;
|
|
424
460
|
};
|
|
425
461
|
return {
|
|
426
|
-
|
|
462
|
+
add: (artifacts) => inTurn(async () => {
|
|
427
463
|
const live = standing();
|
|
428
|
-
const answered = await savingOrRefuse().
|
|
429
|
-
return { step: await stepped(live, answered.drafted), artifacts: answered.
|
|
464
|
+
const answered = await savingOrRefuse().add(artifacts, draftedIn(live.draft));
|
|
465
|
+
return { step: await stepped(live, answered.drafted), artifacts: answered.added };
|
|
430
466
|
}),
|
|
431
467
|
list: () => draftedIn(standing().draft),
|
|
432
468
|
remove: (kind, id) => inTurn(async () => {
|
|
@@ -593,7 +629,7 @@ var instrumentFunctions = (fns, emit, principal) => Object.fromEntries(
|
|
|
593
629
|
Object.entries(fns).map(([name, handler]) => [
|
|
594
630
|
name,
|
|
595
631
|
async (data, signal) => {
|
|
596
|
-
const clock =
|
|
632
|
+
const clock = chunkPVZMCEBX_cjs.spanClock();
|
|
597
633
|
const hasPrincipal = principal !== null;
|
|
598
634
|
try {
|
|
599
635
|
const out = await handler(data, signal);
|
|
@@ -761,10 +797,10 @@ var mountedCanvases = (declared, granted, inputs, given) => declared.map((canvas
|
|
|
761
797
|
}
|
|
762
798
|
const action = typeof seed === "string" ? seed : seed.action;
|
|
763
799
|
const staticInput = typeof seed === "string" ? {} : seed.input ?? {};
|
|
764
|
-
const
|
|
800
|
+
const withFragments2 = typeof seed === "string" ? void 0 : seed.with;
|
|
765
801
|
return {
|
|
766
802
|
...canvas,
|
|
767
|
-
initial: { action, input: { ...staticInput, ...inputs[canvas.id] ?? {}, ...given?.[canvas.id] ?? {} }, ...
|
|
803
|
+
initial: { action, input: { ...staticInput, ...inputs[canvas.id] ?? {}, ...given?.[canvas.id] ?? {} }, ...withFragments2 !== void 0 ? { with: withFragments2 } : {} }
|
|
768
804
|
};
|
|
769
805
|
});
|
|
770
806
|
var seedCanvases = (live, declaredSeeds, granted) => {
|
|
@@ -776,9 +812,9 @@ var seedCanvases = (live, declaredSeeds, granted) => {
|
|
|
776
812
|
const action = typeof seed === "string" ? seed : seed.action;
|
|
777
813
|
if (!granted.has(action)) continue;
|
|
778
814
|
const input = typeof seed === "string" ? void 0 : seed.input;
|
|
779
|
-
const
|
|
815
|
+
const withFragments2 = typeof seed === "string" ? void 0 : seed.with;
|
|
780
816
|
try {
|
|
781
|
-
live.shell.push(canvasId, action, input,
|
|
817
|
+
live.shell.push(canvasId, action, input, withFragments2, { history: false });
|
|
782
818
|
} catch (error) {
|
|
783
819
|
console.error(`[moss/shells] the seed "${action}" on canvas "${canvasId}" could not be pushed, and was skipped:`, error);
|
|
784
820
|
}
|
|
@@ -792,7 +828,7 @@ var buildShell = async (host, asked) => {
|
|
|
792
828
|
const { config, emit, kept, delta } = host;
|
|
793
829
|
const { hooks } = config;
|
|
794
830
|
const { token, principal, opening, reset, wanted } = asked;
|
|
795
|
-
const buildClock = emit === void 0 ? void 0 :
|
|
831
|
+
const buildClock = emit === void 0 ? void 0 : chunkPVZMCEBX_cjs.spanClock();
|
|
796
832
|
const made = await config.composition(principal);
|
|
797
833
|
if (!wanted()) return void 0;
|
|
798
834
|
const ids = Object.keys(made.actions);
|
|
@@ -877,6 +913,7 @@ exports.buildShell = buildShell;
|
|
|
877
913
|
exports.candidateOf = candidateOf;
|
|
878
914
|
exports.canvasLayoutRef = canvasLayoutRef;
|
|
879
915
|
exports.canvasesOf = canvasesOf;
|
|
916
|
+
exports.charterOverFunctions = charterOverFunctions;
|
|
880
917
|
exports.defineApp = defineApp;
|
|
881
918
|
exports.draftedIn = draftedIn;
|
|
882
919
|
exports.endShell = endShell;
|
|
@@ -884,6 +921,7 @@ exports.endlessChains = endlessChains;
|
|
|
884
921
|
exports.entriesOf = entriesOf;
|
|
885
922
|
exports.entryMisfits = entryMisfits;
|
|
886
923
|
exports.freezeDeep = freezeDeep;
|
|
924
|
+
exports.functionsIn = functionsIn;
|
|
887
925
|
exports.functionsWarning = functionsWarning;
|
|
888
926
|
exports.holdGranted = holdGranted;
|
|
889
927
|
exports.layoutMisfits = layoutMisfits;
|
|
@@ -894,10 +932,12 @@ exports.refusalOf = refusalOf;
|
|
|
894
932
|
exports.sessionOn = sessionOn;
|
|
895
933
|
exports.treeOf = treeOf;
|
|
896
934
|
exports.variantLayouts = variantLayouts;
|
|
935
|
+
exports.verifiedAtBoot = verifiedAtBoot;
|
|
897
936
|
exports.verifyApp = verifyApp;
|
|
898
937
|
exports.verifyManifest = verifyManifest;
|
|
899
938
|
exports.wholeShellOf = wholeShellOf;
|
|
939
|
+
exports.withFragments = withFragments;
|
|
900
940
|
exports.withLayoutInPlace = withLayoutInPlace;
|
|
901
941
|
exports.withVariants = withVariants;
|
|
902
|
-
//# sourceMappingURL=chunk-
|
|
903
|
-
//# sourceMappingURL=chunk-
|
|
942
|
+
//# sourceMappingURL=chunk-3DCTQKPQ.cjs.map
|
|
943
|
+
//# sourceMappingURL=chunk-3DCTQKPQ.cjs.map
|