@texaryn/core 0.9.0 → 0.11.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 CHANGED
@@ -1,5 +1,121 @@
1
1
  # @texaryn/core
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8f2a2cd: Makes a disagreement between `default` declarations expressible when a
8
+ conditional branch carries one, closing #142.
9
+
10
+ `NodeProjection.defaultConflict` names the schema positions whose applicable
11
+ declarations disagree, present exactly where `AnnotationSet.default` was omitted
12
+ for that reason. Every conflict appears there, conditional or not, so a consumer
13
+ deciding what to do about a location reads one place.
14
+ `SchemaProjection.diagnostics` keeps `ambiguous-default` for the subset that
15
+ holds whatever the instance is, because a contradiction in the schema is worth
16
+ telling whoever wrote it, while one that comes and goes as a discriminator is
17
+ typed would make that channel flap.
18
+
19
+ Before this, a declaration carried by `oneOf`, `anyOf`, `if`/`then`/`else` or
20
+ `dependentSchemas` collapsed to whichever value the library's merge kept, so
21
+ the same schema and the same data produced different form data depending on
22
+ which adapter an application depended on. Measured through `createFormRuntime`
23
+ with `initialization: 'schema-defaults'`: a selected `oneOf` branch against the
24
+ base gave `'from-b'` against `'own'`, two matching `anyOf` branches gave
25
+ `'from-second'` against `'from-first'`, and a provisionally selected branch
26
+ against the base gave `'from-branch'` against `'base'`. All six now leave the
27
+ location absent and report the positions that disagreed.
28
+
29
+ Applicability for the node channel is exposure rather than validity: a
30
+ provisionally selected branch competes, though JSON Schema says it does not
31
+ apply, because ADR-003 fills from one and a disagreement has to be visible where
32
+ the fill would happen.
33
+
34
+ `@texaryn/core`'s initialization view reads conflicts from the node rather than
35
+ from the diagnostics channel. Nothing published changes shape; the diagnostics a
36
+ consumer already read are unchanged.
37
+ - 20d977f: Applies a root-level `default` where no `initialData` was supplied, closing
38
+ #150.
39
+
40
+ Omitting `initialData` and passing `{}` are two different inputs and now stay
41
+ two. The first states nothing about the root, so a root-level `default` applies
42
+ to it; the second is a root the caller supplied, and nothing is written over it.
43
+ Without a policy configured, both are `{}` as before.
44
+
45
+ The `{}` substitution stays, because `undefined` is not JSON and the hyperjump
46
+ adapter refuses it at the root. The absence travels beside the data instead, as
47
+ the same provisional location an `InsertItem` with no value already uses, so the
48
+ port receives `{}` at every moment while the pass reads the root as absent. If
49
+ nothing is declared at the root, the `{}` is what the caller gets.
50
+
51
+ A `Reset` restores a baseline that exists, so its target is never an unstated
52
+ root and a root default does not apply a second time over it.
53
+
54
+ ## 0.10.0
55
+
56
+ ### Minor Changes
57
+
58
+ - aa69a86: Initializes a row inserted with no value, closing #127.
59
+
60
+ Under `initialization: 'schema-defaults'`, `InsertItem` with no `value` now adds
61
+ a row carrying its item defaults: an object item arrives with its declared
62
+ properties filled, a scalar item holding the item default. An explicit `value`,
63
+ including `null`, is preserved exactly, and with no policy configured the row is
64
+ `null` as before.
65
+
66
+ `cmd.value ?? null` was never wrong about the element it produced. The defect was
67
+ that nothing downstream could tell an omitted value from an explicit `null`,
68
+ since both arrive as `null`. `CommandResult` therefore gained an optional
69
+ `provisional`, naming the locations a command created without a value being
70
+ stated for them, and `InsertItem` reports the row it added. The element in the
71
+ data is still `null`, because an array cannot hold a hole and `undefined` is not
72
+ JSON: the distinction travels beside the data rather than in it, so nothing but
73
+ JSON ever reaches the schema port.
74
+
75
+ Provisional status ends at the first write at or beneath the location. Held for
76
+ the run, an item declaring `default: 'seed'` would read as absent on every pass
77
+ and be written on every pass, exhausting the budget and discarding everything.
78
+ "At or beneath" rather than "at", because an object row is created by a write to
79
+ one of its properties.
80
+
81
+ A row whose seeding does not converge keeps the insert and holds `null`: the
82
+ insert establishes no baseline, so ADR-003 keeps it, while the seeding is
83
+ transactional and none of it survives.
84
+ - 0afa5a2: Accepts ADR-003 and wires its initialization pass to the runtime.
85
+
86
+ `FormRuntimeOptions.initialization: 'schema-defaults'` fills every reachable
87
+ location the schema declares a `default` for and the data leaves absent. The
88
+ default stays `'none'`: given `{}` the runtime's data is still `{}`, and
89
+ projection never mutates data.
90
+
91
+ A location is filled when it becomes reachable, so the pass runs again after
92
+ every edit that can change what is reachable. Clicking a discriminator fills the
93
+ branch it reveals, which is what the reference does and what the Backstage
94
+ template the adoption exercise uses needs.
95
+
96
+ Failure is delivered by call surface, because they can carry different things.
97
+ `createFormRuntime` returns a value, so a run that does not converge within its
98
+ budget **throws** and the caller never receives a runtime. `dispatch` returns
99
+ void and is typically called from an event handler, so it reports on the new
100
+ `FormRuntime.initialization` store instead. What is discarded there depends on
101
+ what the moment establishes: a `Reset` establishes a baseline, so it is refused
102
+ whole and nothing lands, while an ordinary edit establishes none, so the edit
103
+ lands and only the seeding is discarded.
104
+
105
+ `FormRuntime.initialization` holds an `InitializationReport` or `undefined` where
106
+ no policy is configured, carrying the locations left absent because their
107
+ applicable declarations disagreed and those left absent because filling would
108
+ have meant guessing or destroying.
109
+
110
+ It publishes a new report on every data-mutating dispatch under the policy, even
111
+ one where the pass wrote nothing, because each dispatch is a run and what a run
112
+ finds can change as the user types. Anything subscribed to it therefore updates
113
+ per edit.
114
+
115
+ Adding a member to `FormRuntime` breaks a hand-written implementation of it, such
116
+ as a test double, which has to supply `initialization`. Every value that comes
117
+ from `createFormRuntime` is unaffected.
118
+
3
119
  ## 0.9.0
4
120
 
5
121
  ### Minor Changes
@@ -2,4 +2,17 @@ import type { UIDocument } from '../ir/types.js';
2
2
  import type { RuntimeState } from '../ir/runtime-state.js';
3
3
  import type { Command, CommandResult } from './types.js';
4
4
  export declare function processCommand(state: RuntimeState, command: Command, document: UIDocument): CommandResult;
5
+ /** Reset replaces state wholesale: identity is re-matched, so nested arrays under a reordered row may be minted afresh. */
6
+ /**
7
+ * What a `Reset` establishes as the new baseline, before any policy runs over
8
+ * it.
9
+ *
10
+ * `data` is optional rather than nullable, so an explicit `null` is a reset to
11
+ * `null` and not a reset to the initial data. Exported because the runtime has
12
+ * to initialize that target before the command reaches this handler, and the
13
+ * two would drift if each decided separately what `undefined` means.
14
+ */
15
+ export declare function resetTarget(state: RuntimeState, cmd: {
16
+ data?: unknown;
17
+ }): unknown;
5
18
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/commands/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,wBAAwB,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAsBxD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,GACnB,aAAa,CAqBf"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/commands/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,wBAAwB,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAsBxD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,GACnB,aAAa,CAqBf;AAmJD,2HAA2H;AAC3H;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAEjF"}
@@ -70,11 +70,19 @@ function handleInsertItem(state, cmd, document) {
70
70
  const arr = getAtPointer(state.data, container.dataPointer) ?? [];
71
71
  if (cmd.index < 0 || cmd.index > arr.length)
72
72
  return { nextState: state, effects: [] };
73
- const newArr = [...arr.slice(0, cmd.index), cmd.value ?? null, ...arr.slice(cmd.index)];
73
+ // `undefined` rather than `?? null`, so an explicit `null` is a row holding
74
+ // `null` and not a row nobody stated a value for. Both put `null` in the
75
+ // array, because an array cannot hold a hole and `undefined` is not JSON, so
76
+ // the difference travels beside the data rather than in it.
77
+ const stated = cmd.value !== undefined;
78
+ const newArr = [...arr.slice(0, cmd.index), stated ? cmd.value : null, ...arr.slice(cmd.index)];
74
79
  const newData = setAtPointer(state.data, container.dataPointer, newArr);
75
80
  const { map: newIdentities } = insertItem(state.identities, key, cmd.index);
76
81
  return {
77
82
  nextState: { ...state, data: newData, identities: newIdentities },
83
+ provisional: stated
84
+ ? undefined
85
+ : [`${container.dataPointer}/${cmd.index}`],
78
86
  effects: [
79
87
  { type: 'recompile', reason: 'data-changed' },
80
88
  { type: 'validate', nodeIds: [cmd.containerId], trigger: 'change' },
@@ -150,10 +158,20 @@ function handleSubmit(state) {
150
158
  };
151
159
  }
152
160
  /** Reset replaces state wholesale: identity is re-matched, so nested arrays under a reordered row may be minted afresh. */
161
+ /**
162
+ * What a `Reset` establishes as the new baseline, before any policy runs over
163
+ * it.
164
+ *
165
+ * `data` is optional rather than nullable, so an explicit `null` is a reset to
166
+ * `null` and not a reset to the initial data. Exported because the runtime has
167
+ * to initialize that target before the command reaches this handler, and the
168
+ * two would drift if each decided separately what `undefined` means.
169
+ */
170
+ export function resetTarget(state, cmd) {
171
+ return cmd.data === undefined ? state.initialData : cmd.data;
172
+ }
153
173
  function handleReset(state, cmd, document) {
154
- // `data` is optional rather than nullable, so an explicit `null` is a reset
155
- // to `null` and not a reset to the initial data.
156
- const newData = cmd.data === undefined ? state.initialData : cmd.data;
174
+ const newData = resetTarget(state, cmd);
157
175
  const nodes = new Map();
158
176
  for (const [id] of state.nodes) {
159
177
  const node = document.nodes[id];
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/commands/handler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,E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H,CAAC;IAED,OAAO;QACL,SAAS,EAAE;YACT,GAAG,KAAK;YACR,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,OAAO;YACpB,KAAK;YACL,UAAU;YACV,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE;SAC5C;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;KACzD,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO;QACL,KAAK;QACL,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1C,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;KAC/E,CAAA;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { NodeId } from '../types.js';
1
+ import type { JsonPointer, NodeId } from '../types.js';
2
2
  import type { RuntimeState } from '../ir/runtime-state.js';
3
3
  export type Command = {
4
4
  type: 'SetValue';
@@ -46,5 +46,20 @@ export type Effect = {
46
46
  export interface CommandResult {
47
47
  nextState: RuntimeState;
48
48
  effects: Effect[];
49
+ /**
50
+ * Locations the command created without a value being stated for them.
51
+ *
52
+ * Today this is the row an `InsertItem` with no `value` adds. The element in
53
+ * the data is `null`, because an array cannot hold a hole and `undefined` is
54
+ * not JSON, and that `null` is indistinguishable from one a caller passed
55
+ * explicitly. An initialization policy needs the difference, so the handler
56
+ * says which it was rather than leaving the value to be interpreted.
57
+ *
58
+ * Reported here rather than derived by the caller because only the handler
59
+ * knows the command was applied: an out-of-range index is a no-op, and naming
60
+ * a location it declined to create would invite filling a row that does not
61
+ * exist.
62
+ */
63
+ provisional?: readonly JsonPointer[];
49
64
  }
50
65
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"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Q,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAEvD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CACrC"}
package/dist/index.d.ts CHANGED
@@ -8,8 +8,9 @@ export type { Store, WritableStore } from './state/index.js';
8
8
  export { createStore } from './state/index.js';
9
9
  export type { Command, Effect, CommandResult } from './commands/index.js';
10
10
  export { processCommand } from './commands/index.js';
11
- export type { FormRuntime, FormRuntimeOptions, NodeState } from './runtime/index.js';
11
+ export type { FormRuntime, FormRuntimeOptions, InitializationPolicy, InitializationReport, NodeState, } from './runtime/index.js';
12
12
  export { createFormRuntime } from './runtime/index.js';
13
+ export type { DefaultConflict, DefaultRefusal } from './initialization/index.js';
13
14
  export { getAtPointer, setAtPointer, parsePointer } from './json-pointer.js';
14
15
  export { createIdentityMap, registerArray, insertItem, removeItem, moveItem, resolvePointer, reconcile, identityKey, ROOT_IDENTITY_KEY, } from './identity/index.js';
15
16
  export type { ReconcileOptions, IdentityKey, IdentitySegment } from './identity/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAA;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iB,EAAE,MAAM,oBAAoB,CAAA;AAItD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAEzF,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAevC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAevC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AASpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAMtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export type { Location, InitializationView, ProjectView, DefaultConflict, DefaultRefusal, InitializationResult, InitializeOptions, } from './kernel.js';
2
+ export { initializeDefaults } from './kernel.js';
3
+ export { viewFromProjection } from './view.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initialization/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { initializeDefaults } from './kernel.js';
2
+ export { viewFromProjection } from './view.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/initialization/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,133 @@
1
+ import type { JsonPointer } from '../types.js';
2
+ /**
3
+ * The initialization pass from ADR-003, over a normalized view of a schema
4
+ * rather than a `SchemaProjection`.
5
+ *
6
+ * Reached through `FormRuntimeOptions.initialization`, which is the whole of the
7
+ * published surface. `initializeDefaults` itself is not exported: a caller who
8
+ * could run the pass over arbitrary data could produce a baseline the runtime
9
+ * never agreed to, and rule 6 makes what the pass wrote the baseline.
10
+ *
11
+ * The input stays a normalized view now that the port can supply one, because
12
+ * the two are different questions. What a projection says is `view.ts`, which
13
+ * is small and entirely about translation; what the pass does with it is here,
14
+ * and is the part ADR-003 argues.
15
+ *
16
+ * The view is a function of a data snapshot, so what applies is re-asked after
17
+ * every write. Rule 4 needs that: a default can reveal a branch whose own
18
+ * defaults were not reachable before it was written.
19
+ */
20
+ /**
21
+ * Where a default applies, as a JSON Pointer.
22
+ *
23
+ * A pointer is enough here because the pass carries no materialization history
24
+ * across edits: a location is an address within one snapshot, not the identity
25
+ * of a row over time. Persistent per-location state, if a later revision of the
26
+ * contract needs it, has to use core's stable item identity instead, because
27
+ * removing a row renumbers the pointers of the rows after it.
28
+ */
29
+ export type Location = JsonPointer;
30
+ /**
31
+ * What applies to one data snapshot.
32
+ *
33
+ * This is what a `SchemaProjection` says, restated as the three things the pass
34
+ * reads. A location appears in at most one of `defaults` and `conflicts`, which
35
+ * the port guarantees: it omits `AnnotationSet.default` exactly where it reports
36
+ * `ambiguous-default`.
37
+ */
38
+ export interface InitializationView {
39
+ /** Locations the schema exposes for the instance as it stands. */
40
+ readonly reachable: ReadonlySet<Location>;
41
+ /** The one value declared at a location, where the schema declares one. */
42
+ readonly defaults: ReadonlyMap<Location, unknown>;
43
+ /**
44
+ * Locations where declarations that apply whatever the instance is disagree,
45
+ * mapped to the schema positions that disagreed.
46
+ *
47
+ * Carried separately rather than as a list of candidates, because the port
48
+ * reports the disagreement without reporting the values: there is no merged
49
+ * value it could give, which is why it omits the annotation. Resolving
50
+ * declarations is therefore the port's job and not this pass's, and the pass
51
+ * needs only the fact, to leave the location alone and to stop a descendant
52
+ * creating it.
53
+ */
54
+ readonly conflicts: ReadonlyMap<Location, readonly string[]>;
55
+ }
56
+ export type ProjectView = (data: unknown) => InitializationView;
57
+ /** Two or more applicable declarations that do not agree. */
58
+ export interface DefaultConflict {
59
+ readonly location: Location;
60
+ /** The schema positions that disagreed, as the port reported them. */
61
+ readonly sources: readonly string[];
62
+ }
63
+ /**
64
+ * A default the pass declined to apply. Reported rather than skipped, because an
65
+ * absent location that nothing explains is the failure mode the applicator depth
66
+ * cap in #118 taught against.
67
+ */
68
+ export interface DefaultRefusal {
69
+ readonly location: Location;
70
+ readonly reason:
71
+ /** An ancestor holds a scalar, so writing would destroy it. */
72
+ 'non-container-ancestor'
73
+ /** An ancestor is absent and the pointer does not say what kind of container it is. */
74
+ | 'unknown-container-kind';
75
+ }
76
+ export type InitializationResult = {
77
+ readonly outcome: 'initialized';
78
+ readonly data: unknown;
79
+ /**
80
+ * Locations this run filled, in the order they were written.
81
+ *
82
+ * A seeding between construction and the next `Reset` happens against a
83
+ * baseline that is already fixed, so those locations are `modified` and
84
+ * nothing else can work that out: the runtime builds node state fresh or
85
+ * carries the answer from before the run.
86
+ */
87
+ readonly written: readonly Location[];
88
+ /** Locations left absent because their declarations disagreed. */
89
+ readonly conflicts: readonly DefaultConflict[];
90
+ /** Locations left absent because the pass would have had to guess or destroy. */
91
+ readonly refusals: readonly DefaultRefusal[];
92
+ readonly passes: number;
93
+ }
94
+ /**
95
+ * Nothing was written. ADR-003 makes exhaustion transactional: keeping the
96
+ * partial writes would make the resulting data depend on the budget, which is
97
+ * an arbitrary number.
98
+ */
99
+ | {
100
+ readonly outcome: 'budget-exhausted';
101
+ readonly passes: number;
102
+ };
103
+ export interface InitializeOptions {
104
+ /**
105
+ * A recursive schema can keep revealing locations, so passes are bounded.
106
+ * Monotonicity alone does not terminate: it only guarantees that a pass
107
+ * writing nothing is the end.
108
+ */
109
+ readonly maxPasses?: number;
110
+ /**
111
+ * Locations the caller created without stating a value for them, which read
112
+ * as absent until something is written.
113
+ *
114
+ * An `InsertItem` with no `value` adds a row holding `null`, because an array
115
+ * cannot hold a hole and `undefined` is not JSON. That `null` is a value by
116
+ * every rule here, so without this the row's own declarations are refused and
117
+ * the caller gets `null` where a default was declared.
118
+ *
119
+ * **Consumed by the first write at or beneath the location, never held for
120
+ * the run.** Held, an item declaring `default: 'seed'` would read as absent
121
+ * again on the next pass, be written again, and run to the budget, which
122
+ * discards everything. "At or beneath" rather than "at", because an object
123
+ * item is created by a write to one of its properties: a rule keyed on the
124
+ * row itself would leave it reading as absent while it holds a real object,
125
+ * which a later declaration could then overwrite.
126
+ *
127
+ * Keyed on the write rather than on the value, because a row that has just
128
+ * been filled with a declared `null` holds exactly what the placeholder does.
129
+ */
130
+ readonly provisional?: readonly Location[];
131
+ }
132
+ export declare function initializeDefaults(data: unknown, view: ProjectView, options?: InitializeOptions): InitializationResult;
133
+ //# sourceMappingURL=kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../src/initialization/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAA;AAElC;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACjD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;CAC7D;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,kBAAkB,CAAA;AAE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