@niscorp/strata 0.1.4 → 0.1.6
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 +43 -0
- package/DESIGN.md +8 -2
- package/README.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @niscorp/strata
|
|
2
2
|
|
|
3
|
+
## 0.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- de2a757: DESIGN.md no longer reads as if moss's `initIntegrations` and `initSessions` were still there to call. Moss stopped exporting both (see the moss changeset): its integration tables are part of `MOSS_SEQUENCE`, and the sessions table is made where a deployment keeps moss's stored sessions (`session: 'sessions'`); `createServer` and `migrateTables` run both. The paragraph that names it is the record of what moved when strata landed, and it now says what has changed since. No code changed.
|
|
8
|
+
|
|
9
|
+
**What to change:** nothing.
|
|
10
|
+
|
|
11
|
+
## 0.1.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- f834f3f: `evaluate` checks a config object once and only evaluates it after that; `prismTransform` is gone. **Breaking.**
|
|
16
|
+
|
|
17
|
+
BREAKING — approved by moccadroid, 2026-10-09: replace `prismTransform` with `evaluate` (`transform: evaluate`), and pass limits as `{ limits: … }`.
|
|
18
|
+
|
|
19
|
+
Prism had three ways to run a config, and the one a host was told to hand to its seam (`prismTransform`) was the one that reported worst, while the hosts on a hot path each wrapped `evaluate`, which checked the config on every call. There are two now, with one job each.
|
|
20
|
+
|
|
21
|
+
**`evaluate(config, source, options?)`** — for a config a program holds.
|
|
22
|
+
- The first time it is handed a config object it checks it and keeps its tree; the second time it prepares the tree as `compile` would; from then on a call only evaluates. Four fields picked and renamed, the same config object again: 3.5 µs before, 0.4 µs now. A nested choice on two fields: 18 µs before, 0.7 µs now. A config that is a new object on every call costs what it did.
|
|
23
|
+
- It is kept **by the object**: a config changed in place after its first call is not read again. Hand over a new object.
|
|
24
|
+
- Both arguments are `unknown`, so it is what a host's transform seam takes: `createTide({ transform: evaluate })`, `createUpgrader(grammars, { transform: evaluate })`.
|
|
25
|
+
- The third argument is `{ limits?, check? }`. Limits were the third argument themselves: `evaluate(config, source, { maxSteps: 100 })` is now `evaluate(config, source, { limits: { maxSteps: 100 } })`.
|
|
26
|
+
- `check: 'always'` is for writing a config, for tests and for tools: nothing is kept, the config is checked on every call, and the source must be plain JSON (a source holding `undefined`, a function, a `Date` or a non-finite number is refused with `E_TYPE`).
|
|
27
|
+
- An invalid config is a `PrismError` (`E_SCHEMA`) naming the part that is wrong, however deep the config. `prismTransform` threw zod's own error, and a `RangeError` for a config nested far past the limit.
|
|
28
|
+
|
|
29
|
+
`evaluateSafe` takes the same arguments.
|
|
30
|
+
|
|
31
|
+
**`compile` and `execute`** — for a config that is stored. Unchanged.
|
|
32
|
+
|
|
33
|
+
**`prismTransform` is removed**, from `@niscorp/prism` and from `@niscorp/prism/migrations`. What it added over `evaluate` was a check that the source is plain JSON; that check is now `check: 'always'`, and a seam's source is taken as it is.
|
|
34
|
+
|
|
35
|
+
**moss, nova, vex, loom, nisc, create-nisc and the cli move with it.** Each has Prism as a peer or a dependency, or has one of those that do, and a Prism at 0.3 is outside the range their last versions accept: an app takes them together. Nothing in vex, loom or the cli changed beyond that range.
|
|
36
|
+
|
|
37
|
+
moss's shell and nova's `$prism` binding called `evaluate` on every use and so paid the check each time: an endpoint's request and response under moss, and a `$prism` value on each draw and for each row of a list, are 8 to 45 times faster for the configs measured. tide's and strata's documentation name `evaluate` where they named `prismTransform`.
|
|
38
|
+
|
|
39
|
+
**What to change**
|
|
40
|
+
- `import { prismTransform } from '@niscorp/prism'` or `'@niscorp/prism/migrations'` → `import { evaluate } from '@niscorp/prism'`, and `transform: prismTransform` → `transform: evaluate`. Every app made by `create-nisc` has this in `src/dev/strata.ts`; the app's typecheck and `npm run strata` both stop on that line until it is changed.
|
|
41
|
+
- A third argument of limits becomes `{ limits: … }`.
|
|
42
|
+
- A wrapper that parsed the config before calling `evaluate` (`evaluate(ConfigSchema.parse(config), …)`) makes a new object on every call and so is checked on every call: hand `evaluate` the config itself.
|
|
43
|
+
- Code that changes a config object in place and evaluates it again must hand over a new object, or pass `{ check: 'always' }`.
|
|
44
|
+
- A host that relied on `prismTransform` refusing a source that is not plain JSON checks it itself, or passes `{ check: 'always' }`.
|
|
45
|
+
|
|
3
46
|
## 0.1.4
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
package/DESIGN.md
CHANGED
|
@@ -77,8 +77,14 @@ it replaced were. Two consequences, named rather than discovered later:
|
|
|
77
77
|
check builds the universe the way boot does, and `*.read` roles deny the
|
|
78
78
|
engine's tables. Any app granting a data wildcard should do the same.
|
|
79
79
|
- `initIntegrations`, `initSessions`, `cache.init()` and the tide store's
|
|
80
|
-
`migrate`
|
|
81
|
-
not moss's server gets the same guarantees.
|
|
80
|
+
`migrate` kept their names and went through the ledger from then on, so a
|
|
81
|
+
host that is not moss's server gets the same guarantees. (Since then
|
|
82
|
+
`initIntegrations` and `initSessions` have gone from what moss exports: the
|
|
83
|
+
integration tables are part of `MOSS_SEQUENCE`, and the sessions table is
|
|
84
|
+
made where a deployment keeps moss's stored sessions (`session:
|
|
85
|
+
'sessions'`); `createServer` and `migrateTables` run both. The other two
|
|
86
|
+
are as they were, and the tide store is tide's own,
|
|
87
|
+
`@niscorp/tide/postgres`.)
|
|
82
88
|
|
|
83
89
|
## Documents (S2)
|
|
84
90
|
|
package/README.md
CHANGED
|
@@ -181,7 +181,7 @@ works out EXACTLY what each must become, and holds the edit to it.
|
|
|
181
181
|
```ts
|
|
182
182
|
// the app's src/dev/strata.ts — it lists its artifacts; strata does the rest
|
|
183
183
|
import { runSourceUpgrade } from '@niscorp/strata/node';
|
|
184
|
-
process.exit(await runSourceUpgrade({ root, grammars, transform:
|
|
184
|
+
process.exit(await runSourceUpgrade({ root, grammars, transform: evaluate, schemas, documents }, process.argv.slice(2)));
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niscorp/strata",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Migrations for nisc — one ledger for the tables a database holds and the documents stored in them, applied in order, recorded once, refused when edited.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|