@niscorp/moss 0.3.0 → 0.3.2
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 +58 -0
- package/DESIGN.md +8 -2
- package/DOCS.md +20 -5
- package/README.md +5 -0
- package/dist/{chunk-DPFWL7BS.js → chunk-SUVDISEG.js} +3 -3
- package/dist/{chunk-DPFWL7BS.js.map → chunk-SUVDISEG.js.map} +1 -1
- package/dist/{chunk-3CJCJKKY.js → chunk-ZP3C53AC.js} +6 -3
- package/dist/chunk-ZP3C53AC.js.map +1 -0
- package/dist/{document-Jhfii6kd.d.cts → document-D9khv9jI.d.cts} +2 -1
- package/dist/{document-Jhfii6kd.d.ts → document-D9khv9jI.d.ts} +2 -1
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/node.cjs +3 -0
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/package.json +15 -14
- package/dist/chunk-3CJCJKKY.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @niscorp/moss
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a7d4de4: `server.charterReport()` — the charter report the server was verified by.
|
|
8
|
+
|
|
9
|
+
`createServer` runs `verifyCharter` at boot and again on every `refresh`, refuses on the report's `errors`, and read nothing else of it. The rest was computed and dropped: the `warnings` (an action no role grants, an `allow` that matches nothing) and each role's closure `issues`. A host that wanted them had to run `verifyCharter` itself, over a data universe it built by hand.
|
|
10
|
+
|
|
11
|
+
`charterReport()` returns that report: boot's, then that of each `refresh` that passed. A refresh that is refused leaves the one the server is still serving on. Nothing is printed, and boot refuses exactly what it refused before.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const server = await createServer(app, runtime);
|
|
15
|
+
for (const warning of server.charterReport().warnings)
|
|
16
|
+
console.warn(`${warning.rule}: ${warning.detail}`);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
DOCS.md says one thing about what it holds: a push whose target is a binding (`@event.payload`, `$.target`) is listed among a role's `issues` as "not in the catalog", though it is resolved when the step runs.
|
|
20
|
+
|
|
21
|
+
**What to change:** nothing.
|
|
22
|
+
|
|
23
|
+
- f70d461: DOCS and DESIGN say what boot refuses. `createServer` refuses on `verifyCharter`'s errors. The closure audit's findings are filed under each role's `issues` in the report and are neither refused nor printed: a role granted an action that pushes one it is not granted boots, and the press does nothing. Two source comments now say the same. No code changed.
|
|
24
|
+
|
|
25
|
+
**What to change:** nothing.
|
|
26
|
+
|
|
27
|
+
- a7d4de4: The docs say a charter defines a role named `public`. A request with no session, and a signed-in principal with no assignment, resolve to that role, and the name is fixed. A charter without it still boots and nothing is said; those requests then fail with `Unknown role "public"` (a 500, a socket closed `4500`, a page served undrawn). `public: []` grants nothing. README, DOCS and DESIGN now say so, and a test holds it. No code changed.
|
|
28
|
+
|
|
29
|
+
**What to change:** nothing, for a charter that has the role. One that names its visitor role something else adds `public` beside it.
|
|
30
|
+
|
|
31
|
+
- 979b3e3: `src/principal.ts` is text again. One separator in `wearableOf` was written as a raw NUL byte where the same file writes the escape `'\0'` two functions down, so git treated the whole file as binary: its diffs showed `Bin`, and a text search (`git grep -I`) skipped the file that defines `wearableOf`, `resolveFor` and `verifyCharter`.
|
|
32
|
+
|
|
33
|
+
The byte is now the escape. The string it produces is the same one, and the built package is the same code: every built file is identical apart from the names of two chunks, which are hashes that take the embedded source text in.
|
|
34
|
+
|
|
35
|
+
**What to change:** nothing.
|
|
36
|
+
|
|
37
|
+
## 0.3.1
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- fe30458: Every package exports its `package.json`, so an app can say which version of a package it runs by reading it from the package:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import prism from '@niscorp/prism/package.json' with { type: 'json' };
|
|
45
|
+
prism.version; // the version that is installed, not the range that asked for it
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Until now the `exports` map hid it, and the only way to the version was a path into `node_modules`. `check:packages` installs the tarballs and reads every package's version this way.
|
|
49
|
+
|
|
50
|
+
**What to change:** nothing. An app that read a version by path can read it by name.
|
|
51
|
+
|
|
52
|
+
- 1e6d55d: A pool's `query` and `transaction` are called on the pool, and a transaction's `query` on the transaction — never taken off the object first. A driver's own object has them as methods that need their receiver, and taken off they failed inside the driver, on a property nothing in nisc names:
|
|
53
|
+
- **strata** — `migrate` and `upgradeStore` over a `PGlite` threw `Cannot read properties of undefined (reading '_checkReady')`; `status` and `readLedger` did too, once a ledger existed. A pool whose `transaction` hands a checked-out `pg` client through as the transaction failed in `migrate` the same way.
|
|
54
|
+
- **moss** — `createTideStore` took `query` off the transaction. Over a pool that hands its client through, every transaction of the store failed inside the driver, and tide recorded the run as deferred: nothing threw, and the effect never ran.
|
|
55
|
+
- **vex** — `createPostgresAdapter` with a read limit set (`limitReads`) threw on a pool whose `transaction` is a method.
|
|
56
|
+
|
|
57
|
+
A `PGlite` now works as a pool as it is, and so does a `pg` wrapper that passes its client through. A pool built from closures (`createPglitePool`, a wrapper that builds its own `query`) behaves as before.
|
|
58
|
+
|
|
59
|
+
**What to change:** nothing.
|
|
60
|
+
|
|
3
61
|
## 0.3.0
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
package/DESIGN.md
CHANGED
|
@@ -107,7 +107,10 @@ The organizing principle: an app hands over **artifacts** and an
|
|
|
107
107
|
live in the terminal.
|
|
108
108
|
- **Coherence is refused, not documented.** `createServer` runs `verifyCharter`
|
|
109
109
|
(with nova's closure audit injected over effective definitions) and
|
|
110
|
-
`verifyVariants`, and throws on errors.
|
|
110
|
+
`verifyVariants`, and throws on errors. The closure audit's findings are not
|
|
111
|
+
errors: they are filed under each role's `issues` in the report, and boot
|
|
112
|
+
neither refuses on them nor prints them. If it boots, the charter and the
|
|
113
|
+
variants are coherent; a push to an ungranted action can still be in it.
|
|
111
114
|
|
|
112
115
|
The test of the principle: moss adds no new vocabulary. Reads are vex, writes are
|
|
113
116
|
vex, compute is functions, UI is actions, permissions are the charter. The server
|
|
@@ -304,7 +307,10 @@ the shell for the life of the process.
|
|
|
304
307
|
The shell is built from the manifest: canvases and fragments are data; a canvas's
|
|
305
308
|
`initial` may be a candidate list, and the first action the principal holds
|
|
306
309
|
mounts — so login is the anonymous principal's application (the charter's
|
|
307
|
-
`public` grant) by derivation, not a special case.
|
|
310
|
+
`public` grant) by derivation, not a special case. The role name is fixed and
|
|
311
|
+
the charter has to define it, as `public: []` if it grants nothing: boot does
|
|
312
|
+
not check that it is there, and a request that resolves to a missing `public`
|
|
313
|
+
fails. `inputs(session)` and
|
|
308
314
|
`seeds(session)` are the app's per-principal boot hooks — boot data and boot
|
|
309
315
|
instances. Endpoint calls ride the server's own HTTP surfaces
|
|
310
316
|
with the session's token — the server shell is just another principal-bound
|
package/DOCS.md
CHANGED
|
@@ -301,12 +301,14 @@ harness wants and a deployment must opt into out loud.
|
|
|
301
301
|
#### `createServer(app, runtime): Promise<MossServer>`
|
|
302
302
|
|
|
303
303
|
Stands up the data layer, **refuses to boot** on an incoherent charter
|
|
304
|
-
(`verifyCharter`
|
|
304
|
+
(`verifyCharter`'s errors), memoizes per-principal policy,
|
|
305
305
|
catalogs, and ring-2 variant bindings, mounts the vex surfaces and `/catalog`, and — when the manifest
|
|
306
306
|
declares a shell — the shell host behind the socket. Also refused at boot: an
|
|
307
307
|
entry whose `reach` names no profile the behaviors declare, and two pages that
|
|
308
|
-
could answer one path.
|
|
309
|
-
|
|
308
|
+
could answer one path. A broken closure is not among them: the closure audit's
|
|
309
|
+
findings land in the report's `perRole[].issues`, which boot does not read. A
|
|
310
|
+
role granted an action that pushes one it is not granted boots, and the press
|
|
311
|
+
does nothing. Returns a Hono app extended with the `MossServer` members below.
|
|
310
312
|
|
|
311
313
|
What the server answers over HTTP:
|
|
312
314
|
|
|
@@ -330,7 +332,7 @@ is the anonymous principal. There is no `/fns` surface.
|
|
|
330
332
|
#### `MossServer`
|
|
331
333
|
|
|
332
334
|
`Hono<Env> & { socket: SocketAccept; shells?: ShellHost; principalOf; page; pages;
|
|
333
|
-
refresh; invalidateIdentity; invalidateTenant; identity; executeAs;
|
|
335
|
+
refresh; charterReport; invalidateIdentity; invalidateTenant; identity; executeAs;
|
|
334
336
|
callIntegration; nudge; generation; close; identities? }`.
|
|
335
337
|
It's a Hono app — mount it, extend it, or hand it to a listener.
|
|
336
338
|
|
|
@@ -351,6 +353,15 @@ It's a Hono app — mount it, extend it, or hand it to a listener.
|
|
|
351
353
|
on an incoherent charter or variant set, and the old resolution keeps
|
|
352
354
|
serving. It also moves the generation pointer, so every other process on the
|
|
353
355
|
same database does the same within one poll.
|
|
356
|
+
- `charterReport(): VerifyReport` — the report `verifyCharter` gave this server:
|
|
357
|
+
boot's, then that of each `refresh` that passed. `{ errors, warnings,
|
|
358
|
+
perRole }`, over the universes boot resolved against. Boot and `refresh` read
|
|
359
|
+
`errors` alone and print nothing of the rest, so this is where a host reads
|
|
360
|
+
it, to draw, log or hold a deploy on: `warnings` (an action no role grants, an
|
|
361
|
+
`allow` that matches nothing) and each role's closure `issues`. `errors` is
|
|
362
|
+
always empty here. A push whose target is a binding (`@event.payload`,
|
|
363
|
+
`$.target`) is listed among the `issues` as "not in the catalog", though it is
|
|
364
|
+
resolved when the step runs; a `{{…}}` target is not listed.
|
|
354
365
|
- `generation(): number` — the generation this process last observed (`-1`
|
|
355
366
|
before the first read).
|
|
356
367
|
- `invalidateIdentity(principal): boolean` — forget one principal's identity
|
|
@@ -684,7 +695,11 @@ measures the end.
|
|
|
684
695
|
### Resolution (exposed for tools)
|
|
685
696
|
|
|
686
697
|
- `resolveRoles(app, principal): readonly string[]` — assignment rows; anonymous/
|
|
687
|
-
unassigned wears `['public']`.
|
|
698
|
+
unassigned wears `['public']`. The name is fixed, and the charter has to
|
|
699
|
+
define it (`public: []` grants nothing). Where it does not, the server still
|
|
700
|
+
boots and nothing is said; then every request with no session, and every
|
|
701
|
+
signed-in principal with no assignment, fails with `Unknown role "public"` —
|
|
702
|
+
a 500, a socket closed `4500`, a page served undrawn.
|
|
688
703
|
- `resolvePolicy(app, grants, principal): ScopePolicy` — the compiled vex policy
|
|
689
704
|
this principal reads and writes under. **One policy per role, merged** — a
|
|
690
705
|
person may wear several (an instructor who also trains here), and reach belongs
|
package/README.md
CHANGED
|
@@ -51,6 +51,11 @@ const server = await serve(app, { pool, db, session: 'sessions', port: 3000 });
|
|
|
51
51
|
// boot refusal here (createServer runs inside serve); HTTP + ws in one
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
The charter defines a role named `public`. It is what a request with no session
|
|
55
|
+
resolves to, and a signed-in principal with no assignment. `public: []` grants
|
|
56
|
+
nothing. A charter without the role still boots, and those requests then fail
|
|
57
|
+
with `Unknown role "public"`.
|
|
58
|
+
|
|
54
59
|
## The first screen can arrive with the page
|
|
55
60
|
|
|
56
61
|
A page request can be answered with the screen itself: the caller's shell is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { renderDocument, createServer } from './chunk-
|
|
1
|
+
import { renderDocument, createServer } from './chunk-ZP3C53AC.js';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
3
|
import { relative, extname, join } from 'path';
|
|
4
4
|
import { serve as serve$1 } from '@hono/node-server';
|
|
@@ -60,5 +60,5 @@ var serve = async (app, runtime) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export { MOSS_PATHS, attachSocket, mountSite, serve };
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-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AAO,MAAM,cAAA,CAAe;AAAA,MAChC,GAAG,OAAA;AAAA,MACH,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAS,EAAE,IAAA,EAAM,CAAA,CAAE,GAAA,CAAI,SAAS,aAAA,GAAgB,GAAA,GAAM,CAAA,CAAE,GAAA,CAAI,MAAM,MAAA,EAAQ,CAAA,CAAE,IAAI,MAAA,CAAO,QAAQ,KAAK,IAAA;AAAK,KAC1G,CAAA;AACD,IAAA,OAAO,EAAE,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,GAAA,EAAK,KAAK,OAAO,CAAA;AAAA,EAC5C,CAAC,CAAA;AACH;AAEO,IAAM,KAAA,GAAQ,OAAO,GAAA,EAAc,OAAA,KAAkE;AAC1G,EAAA,MAAM,MAAA,GAAS,MAAM,YAAA,CAAa,GAAA,EAAK,OAAO,CAAA;AAC9C,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,IAAQ,IAAA;AAC7B,EAAA,MAAM,aAAaA,OAAA,CAAO,EAAE,OAAO,MAAA,CAAO,KAAA,EAAO,MAAM,CAAA;AACvD,EAAA,YAAA,CAAa,YAAY,MAAA,CAAO,MAAA,EAAQ,SAAA,EAAW,EAAE,GAAI,OAAA,CAAQ,iBAAA,KAAsB,MAAA,GAAY,EAAE,aAAa,OAAA,CAAQ,iBAAA,EAAkB,GAAI,IAAK,CAAA;AACrJ,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,8BAAA,EAAiC,IAAI,CAAA,CAAE,CAAA;AACnD,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,oGAAA,EAA8F,IAAI,CAAA,OAAA,CAAS,CAAA;AACvH,EAAA,OAAO,MAAA;AACT","file":"chunk-SUVDISEG.js","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { serve as listen } from '@hono/node-server';\nimport { serveStatic } from '@hono/node-server/serve-static';\nimport { WebSocketServer } from 'ws';\nimport type { IncomingMessage } from 'node:http';\nimport type { Duplex } from 'node:stream';\nimport { createServer } from './server';\nimport type { MossServer } from './server';\nimport type { NiscApp } from './app';\nimport type { NiscRuntime } from './runtime';\nimport type { SocketAccept } from './socket';\nimport { renderDocument } from './document';\nimport type { DocumentConfig } from './document';\n\n// ═══════════════════════════════════════════════════════════════\n// The Node entry — runtime-specific by design: the transport is a seam, so\n// the Bun flip swaps this file, never the app. Two exports: the\n// websocket transport for hosts that run their own listener (the dev\n// checks, vite), and the batteries-included `serve`.\n// ═══════════════════════════════════════════════════════════════\n\n// Anything that emits Node upgrade events — http.Server structurally, so\n// the @hono/node-server return type needs no narrowing.\ntype Upgradeable = {\n on: (event: 'upgrade', handler: (req: IncomingMessage, socket: Duplex, head: Buffer) => void) => unknown;\n};\n\n// The `ws` half of the transport seam: RFC 6455 stays library-handled\n// (permessage-deflate on by default — see `runtime.socketCompression`); the\n// protocol above the seam is nisc's own (../socket.ts) and identical on every\n// runtime.\nexport const attachSocket = (\n httpServer: Upgradeable,\n accept: SocketAccept,\n path = '/socket',\n options?: { compression?: boolean | Record<string, unknown> },\n): void => {\n const wss = new WebSocketServer({ noServer: true, perMessageDeflate: options?.compression ?? true });\n httpServer.on('upgrade', (req, socket, head) => {\n const url = req.url ?? '/';\n // Not ours: leave it for whichever other listener owns it (vite's HMR\n // upgrade rides the same server in dev).\n if (new URL(url, 'http://nisc.local').pathname !== path) return;\n wss.handleUpgrade(req, socket, head, (ws) => {\n // accept promises to handle its own failures (see socket.ts). This is\n // the floor under that promise: an await added there without a guard\n // degrades to one logged close here instead of an unhandled rejection\n // taking every session on the box down with it.\n accept(url, {\n send: (text) => ws.send(text),\n close: (code, reason) => ws.close(code, reason),\n onMessage: (fn) => ws.on('message', (data) => fn(String(data))),\n onClose: (fn) => ws.on('close', () => fn()),\n }).catch((error: unknown) => {\n console.error('[moss/node] a connection escaped accept:', error);\n try {\n ws.close(1011, 'accept failed');\n } catch {\n // already gone\n }\n });\n });\n });\n};\n\n// THE BUILT TERMINAL, served by the same process as the app — one origin, so the\n// socket is `/socket` wherever the page came from.\n//\n// `dist` is what the app's bundler wrote: index.html and its assets. Every GET\n// that nothing registered earlier answers is a file from it, or a PAGE:\n// index.html with the caller's screen drawn into it (./document) — the app's own\n// for `/`, one of the manifest's pages for a path that leads to one. index.html\n// itself is never served as a file: it is the template, and goes out drawn.\n//\n// A name with an extension that is neither a file in `dist` nor a page of the\n// manifest is a MISSING FILE, and is answered 404 — not with a screen. A browser\n// holding a page from before a deploy asks for that page's script by its old\n// name; what it needs back is \"gone\", not a document that is not a script.\n//\n// Register the app's own routes FIRST; this is the catch-all. `owned` names the\n// prefixes that are never a page (default: moss's own surfaces) — an unknown\n// path under one is a 404, not a screen.\nexport type SiteConfig = Pick<DocumentConfig, 'draw' | 'htmlAttributes' | 'site' | 'tokenKey' | 'waitMs'> & {\n dist: string;\n owned?: RegExp;\n};\n\n// The paths the app server answers itself; everything else is the site's.\nexport const MOSS_PATHS = /^\\/(api|catalog|socket|operator|integrations)(\\/|$)/;\n\nexport const mountSite = (server: MossServer, config: SiteConfig): void => {\n const { dist, owned = MOSS_PATHS, ...drawing } = config;\n // serveStatic resolves `root` against the working directory.\n const root = relative(process.cwd(), dist) || '.';\n const files = serveStatic({ root });\n server.use('/*', async (c, next) => {\n const path = c.req.path;\n if (owned.test(path) || path === '/' || path === '/index.html' || server.page(path) !== undefined) return next();\n return files(c, next);\n });\n server.get('*', async (c) => {\n if (owned.test(c.req.path)) return c.notFound();\n // the static server above found no such file, and no page is at this path\n if (extname(c.req.path) !== '' && c.req.path !== '/index.html' && server.page(c.req.path) === undefined) return c.notFound();\n const template = await readFile(join(dist, 'index.html'), 'utf8');\n const page = await renderDocument({\n ...drawing,\n server,\n template,\n request: { path: c.req.path === '/index.html' ? '/' : c.req.path, cookie: c.req.header('cookie') ?? null },\n });\n return c.html(page.html, 200, page.headers);\n });\n};\n\nexport const serve = async (app: NiscApp, runtime: NiscRuntime & { port?: number }): Promise<MossServer> => {\n const server = await createServer(app, runtime);\n const port = runtime.port ?? 8787;\n const httpServer = listen({ fetch: server.fetch, port });\n attachSocket(httpServer, server.socket, '/socket', { ...(runtime.socketCompression !== undefined ? { compression: runtime.socketCompression } : {}) });\n console.log(`moss serving http://localhost:${port}`);\n console.log(`surfaces: GET /catalog · GET|POST /api/vex · GET|POST /api/<resource>/vex · ws://localhost:${port}/socket`);\n return server;\n};\n"]}
|
|
@@ -502,7 +502,7 @@ var createTideStore = (pool, options = {}) => {
|
|
|
502
502
|
await ready;
|
|
503
503
|
if (client.transaction === void 0)
|
|
504
504
|
throw new Error("tide store: this pool cannot transact \u2014 fan-out and attempt recording are transactions, not conventions");
|
|
505
|
-
return client.transaction((tx) => fn(build({ ...client, query: tx.query })));
|
|
505
|
+
return client.transaction((tx) => fn(build({ ...client, query: (text, values) => tx.query(text, values) })));
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
508
|
return store;
|
|
@@ -2434,6 +2434,7 @@ var createServer = async (app, runtime) => {
|
|
|
2434
2434
|
throw new Error(`Charter is incoherent \u2014 refusing to serve:
|
|
2435
2435
|
${report.errors.map((e) => ` ${e.rule}: ${e.detail}`).join("\n")}`);
|
|
2436
2436
|
}
|
|
2437
|
+
let verifiedReport = report;
|
|
2437
2438
|
for (const cycle of chainCycles(app.actions)) {
|
|
2438
2439
|
console.error(`[moss] a chain of steps that never ends: ${cycle.path} \u2014 nova stops it at its budget when it runs (RUNAWAY_CHAIN)`);
|
|
2439
2440
|
}
|
|
@@ -3154,6 +3155,7 @@ ${nextReport.errors.map((e) => ` ${e.rule}: ${e.detail}`).join("\n")}`);
|
|
|
3154
3155
|
throw new Error(`Refresh refused \u2014 layout variants incoherent:
|
|
3155
3156
|
${nextVariantErrors.map((e) => ` ${e}`).join("\n")}`);
|
|
3156
3157
|
}
|
|
3158
|
+
verifiedReport = nextReport;
|
|
3157
3159
|
identities?.invalidateAll();
|
|
3158
3160
|
policies.clear();
|
|
3159
3161
|
reachPolicies.clear();
|
|
@@ -3191,6 +3193,7 @@ ${nextVariantErrors.map((e) => ` ${e}`).join("\n")}`);
|
|
|
3191
3193
|
pages: Object.entries(pageManifests).map(([name, manifest]) => ({ name, path: manifest.path })),
|
|
3192
3194
|
...shells !== void 0 ? { shells } : {},
|
|
3193
3195
|
refresh,
|
|
3196
|
+
charterReport: () => verifiedReport,
|
|
3194
3197
|
generation: () => generation?.current() ?? -1,
|
|
3195
3198
|
// Every timer this server owns, stopped once. Absent pieces (an app with no
|
|
3196
3199
|
// identity seam, no shells) simply have nothing to stop — the `?.` is the
|
|
@@ -3314,5 +3317,5 @@ var exportDocuments = async (config) => {
|
|
|
3314
3317
|
};
|
|
3315
3318
|
|
|
3316
3319
|
export { DEFAULT_GENERATION_POLL_MS, DEFAULT_IDENTITY_IDLE_MS, DEFAULT_IDENTITY_MAX, DEFAULT_IDLE_MS, GENERATION_DDL, MOSS_SEQUENCE, SESSIONS_SEQUENCE, SNAPSHOT_ELEMENT_ID, TIDE_DDL, TIDE_SEQUENCE, TIDE_TABLES, auditClosure, buildContract, callIntegrationWith, contractAsMarkdown, copyPress, createAssertionSigner, createDataLayer, createGeneration, createIdentityCache, createPageRouter, createServer, createShellHost, createTideStore, describePlacements, devSession, documentHeaders, embedSnapshot, exportDocuments, filterInstalled, hashIntegrationKey, initIntegrations, initSessions, integrationByKey, integrationOfAction, listAttachments, listIntegrations, listPlacements, loadIntegrationActions, memoKeyOf, mintDevToken, mintIntegrationKey, mintSession, mintWrites, renderDocument, resolveCatalog, resolveCatalogForRoles, resolvePolicy, resolvePolicyAtReach, resolvePolicyForRoles, resolveRoles, resolveVariants, resolveVariantsForRoles, revokeAllFor, revokeSession, runIntake, sessionOf, sessionVerifierOf, shellNeedOf, tokenFromCookie, verifyAssertion, verifyVariants, wearableOf, wireFabric };
|
|
3317
|
-
//# sourceMappingURL=chunk-
|
|
3318
|
-
//# sourceMappingURL=chunk-
|
|
3320
|
+
//# sourceMappingURL=chunk-ZP3C53AC.js.map
|
|
3321
|
+
//# sourceMappingURL=chunk-ZP3C53AC.js.map
|