@aventara/core 0.1.0-pilot.1 → 0.1.0-pilot.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.
Files changed (139) hide show
  1. package/dist/adapters/adapter-field.d.ts +4 -4
  2. package/dist/adapters/adapter-resource.d.ts +10 -12
  3. package/dist/adapters/adapter.interface.d.ts +20 -10
  4. package/dist/compiler/contract-compiler-diagnostic.d.ts +3 -4
  5. package/dist/compiler/contract.compiler.d.ts +5 -4
  6. package/dist/compiler/contract.compiler.js +0 -132
  7. package/dist/config/config.resolver.d.ts +2 -2
  8. package/dist/config/config.resolver.js +0 -5
  9. package/dist/config/config.validator.d.ts +3 -3
  10. package/dist/config/config.validator.js +0 -8
  11. package/dist/config/define-fields.d.ts +2 -7
  12. package/dist/config/define-fields.js +0 -15
  13. package/dist/config/effective-fields.d.ts +4 -8
  14. package/dist/config/entrypoint.normalizer.d.ts +7 -7
  15. package/dist/config/entrypoint.normalizer.js +0 -22
  16. package/dist/config/framework-behaviors-config.d.ts +6 -6
  17. package/dist/config/framework-config.d.ts +3 -5
  18. package/dist/config/framework-restrictions-config.d.ts +19 -29
  19. package/dist/config/pipeline-config.d.ts +8 -18
  20. package/dist/contracts/capability.d.ts +18 -21
  21. package/dist/contracts/capability.js +0 -75
  22. package/dist/contracts/client-contract-structure.validator.d.ts +15 -22
  23. package/dist/contracts/client-contract-structure.validator.js +0 -27
  24. package/dist/contracts/contract-canonicalizer.js +0 -96
  25. package/dist/contracts/contract-hash.js +0 -2
  26. package/dist/contracts/contract-limits.js +0 -1
  27. package/dist/contracts/contract-lookup.js +0 -10
  28. package/dist/contracts/contract-protocol.js +0 -10
  29. package/dist/contracts/field.d.ts +23 -26
  30. package/dist/contracts/field.js +0 -107
  31. package/dist/contracts/lifecycle-trait.js +0 -5
  32. package/dist/contracts/resource-operations.d.ts +17 -18
  33. package/dist/contracts/resource-operations.js +0 -63
  34. package/dist/contracts/scalar-value-type.d.ts +12 -22
  35. package/dist/contracts/scalar.js +0 -1
  36. package/dist/contracts/wire-scalar-format.d.ts +20 -20
  37. package/dist/contracts/wire-scalar-format.js +0 -26
  38. package/dist/framework/contract-view.d.ts +7 -8
  39. package/dist/framework/framework-construction.error.js +0 -1
  40. package/dist/framework/framework.d.ts +26 -27
  41. package/dist/framework/framework.factory.js +0 -49
  42. package/dist/framework/operation-facade.js +0 -17
  43. package/dist/operations/operation-arguments.d.ts +36 -46
  44. package/dist/operations/operation-boolean-nodes.js +0 -16
  45. package/dist/operations/operation-call.d.ts +4 -9
  46. package/dist/operations/operation-identity.js +0 -1
  47. package/dist/operations/operation-nesting.js +0 -5
  48. package/dist/operations/operation-result.d.ts +4 -4
  49. package/dist/operations/operation-validator-core.d.ts +2 -2
  50. package/dist/operations/operation-validator-core.js +6 -71
  51. package/dist/operations/operation-validator.d.ts +4 -4
  52. package/dist/operations/operation-validator.js +0 -12
  53. package/dist/operations/projection-scope.resolver.d.ts +8 -10
  54. package/dist/operations/projection-scope.resolver.js +0 -35
  55. package/dist/operations/validation-code.d.ts +11 -18
  56. package/dist/operations/validation-code.js +0 -24
  57. package/dist/operations/write-scope.resolver.d.ts +4 -7
  58. package/dist/operations/write-scope.resolver.js +0 -37
  59. package/dist/protocol/absent-route.responder.d.ts +33 -48
  60. package/dist/protocol/absent-route.responder.js +0 -55
  61. package/dist/protocol/av-protocol.d.ts +6 -6
  62. package/dist/protocol/av-protocol.js +0 -10
  63. package/dist/protocol/contract-document.responder.d.ts +15 -18
  64. package/dist/protocol/contract-document.responder.js +0 -33
  65. package/dist/protocol/http-request.decoder.d.ts +55 -61
  66. package/dist/protocol/http-request.decoder.js +0 -62
  67. package/dist/protocol/http-request.reader.d.ts +12 -13
  68. package/dist/protocol/http-request.reader.js +0 -45
  69. package/dist/protocol/http-response.encoder.d.ts +17 -18
  70. package/dist/protocol/http-response.encoder.js +0 -59
  71. package/dist/protocol/http-status.table.d.ts +7 -11
  72. package/dist/protocol/http-status.table.js +1 -15
  73. package/dist/protocol/index.d.ts +5 -5
  74. package/dist/protocol/index.js +0 -9
  75. package/dist/protocol/operation-response.guard.d.ts +12 -19
  76. package/dist/protocol/operation-response.guard.js +0 -29
  77. package/dist/protocol/protocol-failure.d.ts +21 -26
  78. package/dist/protocol/protocol-failure.js +0 -12
  79. package/dist/protocol/protocol-headers.d.ts +25 -30
  80. package/dist/protocol/protocol-headers.js +0 -66
  81. package/dist/protocol/protocol-surface.d.ts +25 -29
  82. package/dist/protocol/protocol-surface.js +0 -19
  83. package/dist/protocol/protocol.binder.d.ts +58 -71
  84. package/dist/protocol/protocol.binder.js +0 -8
  85. package/dist/protocol/protocol.handler.d.ts +28 -32
  86. package/dist/protocol/protocol.handler.js +0 -43
  87. package/dist/runtime/computed-read-runtime.js +0 -29
  88. package/dist/runtime/create-requirement.d.ts +65 -0
  89. package/dist/runtime/create-requirement.js +141 -0
  90. package/dist/runtime/decimal.d.ts +2 -2
  91. package/dist/runtime/decimal.js +0 -8
  92. package/dist/runtime/diagnostics-reporter.d.ts +6 -6
  93. package/dist/runtime/diagnostics-reporter.js +0 -35
  94. package/dist/runtime/error-boundary.d.ts +3 -3
  95. package/dist/runtime/error-boundary.js +2 -167
  96. package/dist/runtime/execution-options.d.ts +4 -4
  97. package/dist/runtime/field-behavior.d.ts +6 -9
  98. package/dist/runtime/framework-error.js +0 -4
  99. package/dist/runtime/mutation-planner.d.ts +5 -6
  100. package/dist/runtime/mutation-planner.js +0 -23
  101. package/dist/runtime/operation-response.d.ts +1 -1
  102. package/dist/runtime/operation-response.js +1 -17
  103. package/dist/runtime/operation-runtime.d.ts +24 -22
  104. package/dist/runtime/operation-runtime.js +18 -52
  105. package/dist/runtime/outcome-mapper.js +0 -22
  106. package/dist/runtime/output-validator.js +0 -1
  107. package/dist/runtime/pipe-output.validator.d.ts +48 -0
  108. package/dist/runtime/pipe-output.validator.js +79 -0
  109. package/dist/runtime/pipeline.d.ts +20 -26
  110. package/dist/runtime/referential-action.d.ts +14 -19
  111. package/dist/runtime/referential-action.js +0 -23
  112. package/dist/runtime/request-id.js +0 -21
  113. package/dist/runtime/scalar-runtime.d.ts +14 -16
  114. package/dist/runtime/scalar-runtime.js +12 -57
  115. package/dist/transactions/deferred-operation.d.ts +9 -14
  116. package/dist/transactions/operation-arguments-encoder.d.ts +0 -1
  117. package/dist/transactions/operation-arguments-encoder.js +0 -14
  118. package/dist/transactions/operation-fingerprint.js +0 -1
  119. package/dist/transactions/transaction-envelope.js +0 -14
  120. package/dist/transactions/transaction-integrity-error.d.ts +10 -11
  121. package/dist/transactions/transaction-integrity-error.js +0 -5
  122. package/dist/transactions/transaction-plan-assembler.d.ts +0 -1
  123. package/dist/transactions/transaction-plan-assembler.js +0 -35
  124. package/dist/transactions/transaction-plan-validator.d.ts +5 -5
  125. package/dist/transactions/transaction-plan-validator.js +0 -63
  126. package/dist/transactions/transaction-reference-resolver.d.ts +12 -13
  127. package/dist/transactions/transaction-reference-resolver.js +0 -16
  128. package/dist/transactions/transaction-reference-validator.js +0 -8
  129. package/dist/transactions/transaction-reference.d.ts +19 -43
  130. package/dist/transactions/transaction-reference.js +0 -11
  131. package/dist/transactions/transaction-request.d.ts +4 -5
  132. package/dist/transactions/transaction-response.d.ts +1 -1
  133. package/dist/transactions/transaction-runtime.d.ts +2 -3
  134. package/dist/transactions/transaction-runtime.js +5 -44
  135. package/dist/transactions/transaction-slot-path-error.d.ts +10 -11
  136. package/dist/transactions/transaction-slot-path-error.js +0 -7
  137. package/dist/transactions/transaction-slot-writer.d.ts +12 -12
  138. package/dist/transactions/transaction-slot-writer.js +0 -34
  139. package/package.json +2 -2
@@ -1,11 +1 @@
1
- /**
2
- * Aventara's external communication protocol version.
3
- *
4
- * This is intentionally independent from framework/package versions and from
5
- * application-specific Contract changes. Resource/field/configuration/database
6
- * changes are identified by the ClientContract hash and do not require a
7
- * protocol-version bump by themselves. Increment this value only when a
8
- * breaking change makes previous-protocol clients unable to correctly parse or
9
- * interpret Aventara's external protocol semantics.
10
- */
11
1
  export const AVENTARA_PROTOCOL_VERSION = 1;
@@ -11,12 +11,11 @@ export type ScalarFormat = string;
11
11
  * already acts on the difference, so the empty list has to be unrepresentable
12
12
  * rather than merely discouraged. An absent capability member is "not available at
13
13
  * all"; an empty list would say the same thing in a second encoding, which is one
14
- * semantic fact with two hashes (C-843).
14
+ * semantic fact with two hashes.
15
15
  *
16
16
  * **A scope list qualifies the TOP LEVEL of a projection only. It does not narrow
17
17
  * recursively** — see {@link ProjectionScope}, where the runtime measurement and
18
- * the reason are recorded. A reader who assumes recursion will write a rule that
19
- * refuses what the ORM accepts, which is C-855 with the sign flipped.
18
+ * the reason are recorded.
20
19
  */
21
20
  export type ProjectionScopes = readonly [ProjectionScope, ...ProjectionScope[]];
22
21
  /**
@@ -44,9 +43,7 @@ export type WriteScopes = readonly [WriteScope, ...WriteScope[]];
44
43
  *
45
44
  * The unqualified arm is retained deliberately: an adapter that has not measured
46
45
  * the axis must be able to say so, and a Contract that predates the measurement
47
- * must keep its meaning. It also means the canonicalizer, not the type, owns the
48
- * degenerate overlap — a list naming every scope says what `true` says, and C-843
49
- * makes collapsing it the canonicalizer's job.
46
+ * must keep its meaning.
50
47
  */
51
48
  export type RelationProjectionCapability = boolean | ProjectionScopes;
52
49
  /**
@@ -142,7 +139,6 @@ export declare function advertisedReducers(capability: RelationReducerCapability
142
139
  * `select`/`include` comparisons this function replaces read a measured
143
140
  * `["record"]` as **unavailable everywhere** — a to-many projection refused on
144
141
  * `update.first`, which is the single-record scope the adapter advertises it in.
145
- * Under-advertisement is C-855 with the sign flipped and it is the same defect.
146
142
  *
147
143
  * The parameter admits `boolean` as well as {@link ProjectionScopes} because the
148
144
  * unqualified arm means *holds in every scope*: an adapter that has not measured
@@ -150,10 +146,10 @@ export declare function advertisedReducers(capability: RelationReducerCapability
150
146
  * what they answered before. So `true` holds at every scope and `false`/absent at
151
147
  * none, and the qualified arm is consulted only where one exists.
152
148
  *
153
- * **A scope qualifies the TOP LEVEL of a projection only** — see
154
- * {@link ProjectionScope}, where the runtime measurement is recorded. A caller
155
- * that recurses must ask about the nested position with the unrestricted scope,
156
- * not with its own.
149
+ * **A scope qualifies the TOP LEVEL of a projection only** — see {@link
150
+ * ProjectionScope}, where the runtime measurement is recorded. A caller that
151
+ * recurses must ask about the nested position with the unrestricted scope, not
152
+ * with its own.
157
153
  */
158
154
  export declare function holdsAt(capability: RelationProjectionCapability | undefined, scope: ProjectionScope): boolean;
159
155
  /**
@@ -176,12 +172,13 @@ export declare function holdsInAnyScope(capability: RelationProjectionCapability
176
172
  * One call rather than two, because the two-call form is the defect. A reader that
177
173
  * asks {@link advertisedReducers} for the tokens and then has to remember a second
178
174
  * {@link holdsAt} call will forget it, and a forgotten scope check is a silent
179
- * over-advertisement (C-855). Here the scope cannot be forgotten: there is no way
180
- * to get the tokens without naming the position they are wanted in.
175
+ * over-advertisement. Here the scope cannot be forgotten: there is no way to get
176
+ * the tokens without naming the position they are wanted in.
181
177
  *
182
178
  * `undefined` is the same answer an absent member gives, which is correct — a
183
- * reducer that does not hold at this scope is not advertised at this scope — and it
184
- * keeps `[]` meaning what it means everywhere else: advertised, with no reducer.
179
+ * reducer that does not hold at this scope is not advertised at this scope — and
180
+ * it keeps `[]` meaning what it means everywhere else: advertised, with no
181
+ * reducer.
185
182
  */
186
183
  export declare function advertisedReducersAt(capability: RelationReducerCapability | undefined, scope: ProjectionScope): readonly RelationReducer[] | undefined;
187
184
  /**
@@ -197,10 +194,10 @@ export declare function advertisedReducersAt(capability: RelationReducerCapabili
197
194
  * direction — it counts inside a write that is about to be refused, and it can
198
195
  * never stop counting inside one that is admitted. An adapter's own write
199
196
  * translator is the other: it is handed the write site's verdict by whoever
200
- * dispatched it (C-818) and holds no advertised variant to resolve a scope from.
197
+ * dispatched it and holds no advertised variant to resolve a scope from.
201
198
  *
202
- * Every reader on the write axis that HAS a position wants
203
- * {@link advertisedDirectivesAt} instead.
199
+ * Every reader on the write axis that HAS a position wants {@link
200
+ * advertisedDirectivesAt} instead.
204
201
  *
205
202
  * See {@link advertisedReducers} for why the scopes are not returned beside them.
206
203
  */
@@ -208,29 +205,29 @@ export declare function advertisedDirectives(capability: RelationMutationCapabil
208
205
  /**
209
206
  * The mutation directives a relation advertises **at one write scope**: the
210
207
  * directives where the member holds there, and `undefined` where it does not —
211
- * **the one home of the scope-aware write read**, and the write mirror of
212
- * {@link advertisedReducersAt}.
208
+ * **the one home of the scope-aware write read**, and the write mirror of {@link
209
+ * advertisedReducersAt}.
213
210
  *
214
211
  * One call rather than two, for the reason {@link advertisedReducersAt} gives: a
215
212
  * reader that fetches the directives and then has to remember a separate scope
216
213
  * check will forget it, and a forgotten scope check is a silent
217
- * over-advertisement (C-855). Here the position cannot be forgotten, because
218
- * there is no way to reach the directives without naming it.
214
+ * over-advertisement. Here the position cannot be forgotten, because there is no
215
+ * way to reach the directives without naming it.
219
216
  *
220
217
  * `undefined` for a stage that does not hold at this scope is the same answer an
221
218
  * absent member gives, which is what the caller must say: a relation that is not
222
219
  * writable in this write position is *"not writable during <stage>"* there. That
223
220
  * keeps `[]` meaning what it means everywhere else — advertised, with no directive
224
221
  * — so the two live answers `V1006` already distinguishes stay two, and the scope
225
- * does not invent a third (C-843).
222
+ * does not invent a third.
226
223
  *
227
224
  * The unqualified arm is an array and means *holds in every write position*: an
228
225
  * adapter that has not measured the axis, and every Contract that predates the
229
226
  * measurement, keep the write surface they had.
230
227
  *
231
- * **A scope qualifies the TOP LEVEL of a write argument only** — see
232
- * {@link WriteScope}. A caller that recurses into a nested write must ask about
233
- * the nested position with the unrestricted scope, not with its own.
228
+ * **A scope qualifies the TOP LEVEL of a write argument only** — see {@link
229
+ * WriteScope}. A caller that recurses into a nested write must ask about the
230
+ * nested position with the unrestricted scope, not with its own.
234
231
  */
235
232
  export declare function advertisedDirectivesAt(capability: RelationMutationCapability | undefined, scope: WriteScope): readonly RelationMutationDirective[] | undefined;
236
233
  /** Atomic field from the API/query perspective, including enum-backed fields. */
@@ -1,43 +1,9 @@
1
- /**
2
- * The reducers a relation advertises, whichever arm the member is written in,
3
- * **ignoring the scope qualifier**.
4
- *
5
- * Scope-blind on purpose, and only for a reader on an axis the scope does not
6
- * qualify. `orderBy: { <to-many>: { $count: … } }` is the one such reader: ordering
7
- * was measured uniform across every variant that carries an `orderBy` argument, so
8
- * there is no projection position to ask about and asking would invent one.
9
- *
10
- * Every reader on the projection axis wants {@link advertisedReducersAt} instead.
11
- */
12
1
  export function advertisedReducers(capability) {
13
2
  if (capability === undefined) {
14
3
  return undefined;
15
4
  }
16
5
  return "scopes" in capability ? capability.reducers : capability;
17
6
  }
18
- /**
19
- * Whether a projection capability holds at one projection scope — **the one home
20
- * of the scope-aware capability read.**
21
- *
22
- * Every reader that has a scope asks this, and no reader compares a capability
23
- * member to `true` any more. That is not tidiness: a qualified member is an
24
- * object/array, so `member === true` is `false` for *every* scope, and the six
25
- * `select`/`include` comparisons this function replaces read a measured
26
- * `["record"]` as **unavailable everywhere** — a to-many projection refused on
27
- * `update.first`, which is the single-record scope the adapter advertises it in.
28
- * Under-advertisement is C-855 with the sign flipped and it is the same defect.
29
- *
30
- * The parameter admits `boolean` as well as {@link ProjectionScopes} because the
31
- * unqualified arm means *holds in every scope*: an adapter that has not measured
32
- * the axis, and every Contract that predates the measurement, must keep answering
33
- * what they answered before. So `true` holds at every scope and `false`/absent at
34
- * none, and the qualified arm is consulted only where one exists.
35
- *
36
- * **A scope qualifies the TOP LEVEL of a projection only** — see
37
- * {@link ProjectionScope}, where the runtime measurement is recorded. A caller
38
- * that recurses must ask about the nested position with the unrestricted scope,
39
- * not with its own.
40
- */
41
7
  export function holdsAt(capability, scope) {
42
8
  if (capability === undefined || capability === false) {
43
9
  return false;
@@ -47,38 +13,12 @@ export function holdsAt(capability, scope) {
47
13
  }
48
14
  return capability.includes(scope);
49
15
  }
50
- /**
51
- * Whether a projection capability holds in **any** scope — the scope-blind
52
- * question, for the one reader that legitimately has no scope to ask about.
53
- *
54
- * It exists so that reader does not hand-roll `=== true` either. The Contract
55
- * compiler's VIRTUAL lifecycle check asks whether a field is selectable *at all*
56
- * before requiring an effective read behavior; a field selectable in one scope
57
- * needs that behavior exactly as much as one selectable in every scope.
58
- *
59
- * A reader with a scope must use {@link holdsAt}. This one answers a strictly
60
- * weaker question and will over-advertise if used in its place.
61
- */
62
16
  export function holdsInAnyScope(capability) {
63
17
  if (capability === undefined || capability === false) {
64
18
  return false;
65
19
  }
66
20
  return capability === true || capability.length > 0;
67
21
  }
68
- /**
69
- * The reducers a relation advertises **at one projection scope**: the tokens where
70
- * the member holds there, and `undefined` where it does not.
71
- *
72
- * One call rather than two, because the two-call form is the defect. A reader that
73
- * asks {@link advertisedReducers} for the tokens and then has to remember a second
74
- * {@link holdsAt} call will forget it, and a forgotten scope check is a silent
75
- * over-advertisement (C-855). Here the scope cannot be forgotten: there is no way
76
- * to get the tokens without naming the position they are wanted in.
77
- *
78
- * `undefined` is the same answer an absent member gives, which is correct — a
79
- * reducer that does not hold at this scope is not advertised at this scope — and it
80
- * keeps `[]` meaning what it means everywhere else: advertised, with no reducer.
81
- */
82
22
  export function advertisedReducersAt(capability, scope) {
83
23
  if (capability === undefined) {
84
24
  return undefined;
@@ -88,59 +28,12 @@ export function advertisedReducersAt(capability, scope) {
88
28
  }
89
29
  return capability.scopes.includes(scope) ? capability.reducers : undefined;
90
30
  }
91
- /**
92
- * The mutation directives a relation advertises at one write stage, whichever arm
93
- * the member is written in, **ignoring the scope qualifier**. `undefined` and `[]`
94
- * stay distinct: the stage is unavailable, or available with no directive.
95
- *
96
- * Scope-blind on purpose, and only for a reader that has no write position to ask
97
- * about or whose answer may only be WIDER than the validator's. Two readers
98
- * qualify. `operation-boolean-nodes.ts`'s `maxBooleanNodes` walk descends a
99
- * relation mutation to count the filter nodes inside it; reading scope-blind makes
100
- * that walk a superset of what the grammar walk admits, which is the harmless
101
- * direction — it counts inside a write that is about to be refused, and it can
102
- * never stop counting inside one that is admitted. An adapter's own write
103
- * translator is the other: it is handed the write site's verdict by whoever
104
- * dispatched it (C-818) and holds no advertised variant to resolve a scope from.
105
- *
106
- * Every reader on the write axis that HAS a position wants
107
- * {@link advertisedDirectivesAt} instead.
108
- *
109
- * See {@link advertisedReducers} for why the scopes are not returned beside them.
110
- */
111
31
  export function advertisedDirectives(capability) {
112
32
  if (capability === undefined) {
113
33
  return undefined;
114
34
  }
115
35
  return "scopes" in capability ? capability.directives : capability;
116
36
  }
117
- /**
118
- * The mutation directives a relation advertises **at one write scope**: the
119
- * directives where the member holds there, and `undefined` where it does not —
120
- * **the one home of the scope-aware write read**, and the write mirror of
121
- * {@link advertisedReducersAt}.
122
- *
123
- * One call rather than two, for the reason {@link advertisedReducersAt} gives: a
124
- * reader that fetches the directives and then has to remember a separate scope
125
- * check will forget it, and a forgotten scope check is a silent
126
- * over-advertisement (C-855). Here the position cannot be forgotten, because
127
- * there is no way to reach the directives without naming it.
128
- *
129
- * `undefined` for a stage that does not hold at this scope is the same answer an
130
- * absent member gives, which is what the caller must say: a relation that is not
131
- * writable in this write position is *"not writable during <stage>"* there. That
132
- * keeps `[]` meaning what it means everywhere else — advertised, with no directive
133
- * — so the two live answers `V1006` already distinguishes stay two, and the scope
134
- * does not invent a third (C-843).
135
- *
136
- * The unqualified arm is an array and means *holds in every write position*: an
137
- * adapter that has not measured the axis, and every Contract that predates the
138
- * measurement, keep the write surface they had.
139
- *
140
- * **A scope qualifies the TOP LEVEL of a write argument only** — see
141
- * {@link WriteScope}. A caller that recurses into a nested write must ask about
142
- * the nested position with the unrestricted scope, not with its own.
143
- */
144
37
  export function advertisedDirectivesAt(capability, scope) {
145
38
  if (capability === undefined) {
146
39
  return undefined;
@@ -1,8 +1,3 @@
1
- /**
2
- * Lifecycle traits describe value ownership/derivation without implying
3
- * writability. Generated values are ORM/database-owned; computed values are
4
- * framework/developer-owned; virtual describes persistence only.
5
- */
6
1
  export const LIFECYCLE_TRAITS = [
7
2
  "DEFAULTED",
8
3
  "GENERATED_ON_CREATE",
@@ -6,12 +6,11 @@ import type { ProjectionScope, WriteScope } from "./capability.js";
6
6
  *
7
7
  * The variant-to-scope map is an ADAPTER fact, not a protocol constant — a
8
8
  * variant's projection position depends on which ORM call the adapter routes it to
9
- * — so the advertised variant carries the answer rather than core tabulating it
10
- * (D-802).
9
+ * — so the advertised variant carries the answer rather than core tabulating it.
11
10
  *
12
- * At least one scope must be stated. A descriptor stating neither says exactly what
13
- * `true` says, and one semantic fact with two encodings is one fact with two
14
- * hashes (C-843).
11
+ * At least one scope must be stated. A descriptor stating neither says exactly
12
+ * what `true` says, and one semantic fact with two encodings is one fact with two
13
+ * hashes.
15
14
  *
16
15
  * Named for the variant it qualifies, and deliberately not `OperationScopes`:
17
16
  * `OperationScope` is a public (now deprecated) alias of `RequestOrigin`, meaning
@@ -88,11 +87,11 @@ export declare function isOperationVariantAvailable(availability: unknown): avai
88
87
  * the widening in {@link OperationAvailability} non-breaking for a producer that
89
88
  * has not measured it.
90
89
  *
91
- * The map from variant to scope is **not** here and must never be: `update.first`'s
92
- * projection position is the single-record one only because an adapter chose to
93
- * route that variant to a single-record provider call, and an adapter that routes it
94
- * to a bulk one moves the answer. Core reads what the advertised variant carries
95
- * (D-802, §4 Q2) rather than tabulating one scope per variant name.
90
+ * The map from variant to scope is **not** here and must never be:
91
+ * `update.first`'s projection position is the single-record one only because an
92
+ * adapter chose to route that variant to a single-record provider call, and an
93
+ * adapter that routes it to a bulk one moves the answer. Core reads what the
94
+ * advertised variant carries rather than tabulating one scope per variant name.
96
95
  *
97
96
  * `unknown` for the same reason {@link isOperationVariantAvailable} takes it: the
98
97
  * caller holds the leaf keyed by an untrusted request string.
@@ -108,16 +107,16 @@ export declare function projectionScopeOf(availability: unknown): ProjectionScop
108
107
  * *nothing is narrowed here*, so a Contract written before the axis existed keeps
109
108
  * the write surface it had.
110
109
  *
111
- * The two axes are read by two functions, not one that returns a pair, because they
112
- * are measured and consulted separately — `WRITE_SCOPES` is a separate array from
113
- * `PROJECTION_SCOPES` for that reason — and a caller that needs only one position
114
- * should not be handed the other to discard.
110
+ * The two axes are read by two functions, not one that returns a pair, because
111
+ * they are measured and consulted separately — `WRITE_SCOPES` is a separate array
112
+ * from `PROJECTION_SCOPES` for that reason — and a caller that needs only one
113
+ * position should not be handed the other to discard.
115
114
  *
116
115
  * The mirror exists so that *"what does this descriptor mean?"* has one answer per
117
- * axis rather than one answer and one convention. The canonicalizer's collapse of a
118
- * redundant descriptor is keyed on these two functions' answer for `true`: a
116
+ * axis rather than one answer and one convention. The canonicalizer's collapse of
117
+ * a redundant descriptor is keyed on these two functions' answer for `true`: a
119
118
  * descriptor says nothing beyond `true` exactly when every reader answers for it
120
- * what it answers for `true` (C-843), and that test is only as honest as the readers
121
- * being the single statement of each axis's unqualified scope.
119
+ * what it answers for `true`, and that test is only as honest as the readers being
120
+ * the single statement of each axis's unqualified scope.
122
121
  */
123
122
  export declare function writeScopeOf(availability: unknown): WriteScope;
@@ -1,81 +1,18 @@
1
- /**
2
- * Whether one `ResourceOperations` leaf advertises an available variant.
3
- *
4
- * Availability is **presence**: the leaf is `true`, or it is the descriptor that
5
- * qualifies the variant's arguments. A descriptor states how the variant's
6
- * arguments are scoped — it never retracts the variant — so `leaf === true` is
7
- * the wrong question wherever availability is read, and the leaf's widening to
8
- * `true | OperationVariantScopes` made every hand-rolled copy of that question
9
- * silently wrong. The question has one home so the next widening of
10
- * `OperationAvailability` reaches every reader at once.
11
- *
12
- * The parameter is `unknown` because the readers are the request validator and
13
- * the Contract compiler, which hold the leaf as a Contract value keyed by an
14
- * untrusted or mid-compilation string. Descriptor *shape* is not judged here: a
15
- * present leaf is an available variant, and validating what the descriptor says
16
- * belongs to whoever owns the descriptor's own invariants.
17
- */
18
1
  export function isOperationVariantAvailable(availability) {
19
2
  return (availability === true ||
20
3
  (typeof availability === "object" &&
21
4
  availability !== null &&
22
5
  !Array.isArray(availability)));
23
6
  }
24
- /**
25
- * The projection position one advertised variant's projection arguments sit in.
26
- *
27
- * `"record"` — the unrestricted position — is the answer for `true`, for an absent
28
- * leaf and for a descriptor that qualifies only its write argument, because the
29
- * unqualified arm means *nothing is narrowed here*. A Contract written before the
30
- * axis existed therefore keeps validating exactly as it did, which is what makes
31
- * the widening in {@link OperationAvailability} non-breaking for a producer that
32
- * has not measured it.
33
- *
34
- * The map from variant to scope is **not** here and must never be: `update.first`'s
35
- * projection position is the single-record one only because an adapter chose to
36
- * route that variant to a single-record provider call, and an adapter that routes it
37
- * to a bulk one moves the answer. Core reads what the advertised variant carries
38
- * (D-802, §4 Q2) rather than tabulating one scope per variant name.
39
- *
40
- * `unknown` for the same reason {@link isOperationVariantAvailable} takes it: the
41
- * caller holds the leaf keyed by an untrusted request string.
42
- */
43
7
  export function projectionScopeOf(availability) {
44
8
  if (!isOperationVariantAvailable(availability) || availability === true) {
45
9
  return "record";
46
10
  }
47
- // The scope the descriptor STATES, never a scope matched against a list of
48
- // known ones: the axis is closed in `capability.ts` and a second enumeration
49
- // here would be a copy to keep in sync, and would answer `"record"` — the
50
- // permissive arm — for the member it had not heard of yet.
51
11
  return availability.projection ?? "record";
52
12
  }
53
- /**
54
- * The write position one advertised variant's data argument sits in, and the write
55
- * mirror of {@link projectionScopeOf}.
56
- *
57
- * `"nested"` — the unrestricted position — is the answer for `true`, for an absent
58
- * leaf and for a descriptor that qualifies only its projection argument, for the
59
- * same reason `"record"` is on the projection axis: the unqualified arm means
60
- * *nothing is narrowed here*, so a Contract written before the axis existed keeps
61
- * the write surface it had.
62
- *
63
- * The two axes are read by two functions, not one that returns a pair, because they
64
- * are measured and consulted separately — `WRITE_SCOPES` is a separate array from
65
- * `PROJECTION_SCOPES` for that reason — and a caller that needs only one position
66
- * should not be handed the other to discard.
67
- *
68
- * The mirror exists so that *"what does this descriptor mean?"* has one answer per
69
- * axis rather than one answer and one convention. The canonicalizer's collapse of a
70
- * redundant descriptor is keyed on these two functions' answer for `true`: a
71
- * descriptor says nothing beyond `true` exactly when every reader answers for it
72
- * what it answers for `true` (C-843), and that test is only as honest as the readers
73
- * being the single statement of each axis's unqualified scope.
74
- */
75
13
  export function writeScopeOf(availability) {
76
14
  if (!isOperationVariantAvailable(availability) || availability === true) {
77
15
  return "nested";
78
16
  }
79
- // The scope the descriptor STATES, for the reason given in `projectionScopeOf`.
80
17
  return availability.write ?? "nested";
81
18
  }
@@ -4,24 +4,16 @@ import type { Contract } from "./contract.js";
4
4
  import type { ScalarField } from "./field.js";
5
5
  import type { BuiltInScalar } from "./scalar.js";
6
6
  /**
7
- * A scalar-form map: the TypeScript type each built-in scalar takes on one side
8
- * of a boundary. Every built-in must be answered, so a map that forgets one fails
9
- * to compile where it is passed rather than typing that scalar as `unknown`.
7
+ * A scalar-form map: the TypeScript type each built-in scalar takes on one side of
8
+ * a boundary. Every built-in must be answered, so a map that forgets one fails to
9
+ * compile where it is passed rather than typing that scalar as `unknown`.
10
10
  *
11
11
  * It is a parameter rather than a fixed table because one derivation serves more
12
- * than one side (Q3 = 3a): the application forms below for an in-process caller,
13
- * and the wire forms for a transport or a generated client. Two derivations of one
14
- * rule is the drift F-701 exists to forbid.
12
+ * than one side: the application forms below for an in-process caller, and the
13
+ * wire forms for a transport or a generated client.
15
14
  *
16
- * **Naming.** The architect named the two maps below `ApplicationScalarForms` and
17
- * `WireScalarForms` (2026-10-04), and `@aventara/core` exports both. This
18
- * constraint is not exported: a map is checked for completeness where it is
19
- * passed, so a consumer never has to name it. A consumer substitutes one form by
20
- * replacing that key — a generated client, whose codec revives every scalar into
21
- * its §6.2 *generated runtime value* and which carries its own emitted `Decimal`,
22
- * passes `Omit<ApplicationScalarForms, "decimal"> & { readonly decimal:
23
- * EmittedDecimal }` (Phase 12-rest Q3, architect 2026-10-05): it reads and writes
24
- * `bigint`, `Date` and `Uint8Array`, never their wire strings.
15
+ * This constraint is not exported: a map is checked for completeness where it is
16
+ * passed, so a consumer never has to name it.
25
17
  */
26
18
  export type ScalarForms = {
27
19
  readonly [Scalar in BuiltInScalar]: unknown;
@@ -48,19 +40,17 @@ export type ApplicationScalarForms = {
48
40
  readonly datetime: Date;
49
41
  readonly bytes: Uint8Array;
50
42
  /**
51
- * U7, answered 2026-10-04: a {@link JsonValue} — without its top-level
52
- * `null`. `normalizeScalarFieldValue` refuses a field-level `null` on a
53
- * required field and on a list entry, and reads it as the field's absence
54
- * where `nullable: true`, so the `| null` comes from the Contract's
55
- * `nullable` like every other scalar's. A `null` INSIDE the value is JSON's.
43
+ * `normalizeScalarFieldValue` refuses a field-level `null` on a required field and
44
+ * on a list entry, and reads it as the field's absence where `nullable: true`, so
45
+ * the `| null` comes from the Contract's `nullable` like every other scalar's. A
46
+ * `null` INSIDE the value is JSON's.
56
47
  */
57
48
  readonly json: Exclude<JsonValue, null>;
58
49
  };
59
50
  /**
60
51
  * The encoded forms the client-scope input branch of `normalizeScalarAtom`
61
52
  * accepts: base-10 bigint strings, decimal strings, canonical ISO-8601 UTC
62
- * datetimes and RFC 4648 base64 bytes. It is the second map Q3 = 3a names, for
63
- * a transport or a generated client to pass as `Forms`.
53
+ * datetimes and RFC 4648 base64 bytes.
64
54
  */
65
55
  export type WireScalarForms = {
66
56
  readonly string: string;
@@ -1,4 +1,3 @@
1
- /** Scalar identities owned by the Aventara v1 protocol. */
2
1
  export const BUILT_IN_SCALARS = [
3
2
  "string",
4
3
  "boolean",
@@ -1,30 +1,30 @@
1
1
  import type { BuiltInScalar } from "./scalar.js";
2
2
  import type { ApplicationScalarForms, WireScalarForms } from "./scalar-value-type.js";
3
3
  /**
4
- * The built-in scalars whose wire form is not their runtime form — the ones a
5
- * JSON wire carries as a string with a grammar of its own (§6.2). Derived from
6
- * the two form maps rather than listed, so a built-in scalar added with a
7
- * string wire form fails to compile below until its grammar is written.
4
+ * The built-in scalars whose wire form is not their runtime form — the ones a JSON
5
+ * wire carries as a string with a grammar of its own. Derived from the two form
6
+ * maps rather than listed, so a built-in scalar added with a string wire form
7
+ * fails to compile below until its grammar is written.
8
8
  */
9
9
  type WireEncodedScalar = {
10
10
  readonly [S in BuiltInScalar]: WireScalarForms[S] extends ApplicationScalarForms[S] ? never : S;
11
11
  }[BuiltInScalar];
12
12
  /**
13
- * `AvProtocol.scalarFormats` — the wire grammars of protocol version 1 (§6.2;
14
- * C2, R7), as passive data: one anchored pattern SOURCE string per wire-encoded
15
- * scalar, in `BUILT_IN_SCALARS` order.
13
+ * `AvProtocol.scalarFormats` — the wire grammars of protocol version 1, as passive
14
+ * data: one anchored pattern SOURCE string per wire-encoded scalar, in
15
+ * `BUILT_IN_SCALARS` order.
16
16
  *
17
- * The one source (§Q1): execution decodes client-scope arguments with these
17
+ * The one source: execution decodes client-scope arguments with these
18
18
  * (`runtime/scalar-runtime.ts`, `runtime/decimal.ts`), `@aventara/core/protocol`
19
- * re-exports this object, and the client generator emits each source by value
20
- * into the generated runtime as a regular-expression literal. Strings, not
21
- * `RegExp`s, so it survives JSON and can be emitted (P5); frozen, so no
22
- * consumer can rewrite a grammar in place.
19
+ * re-exports this object, and the client generator emits each source by value into
20
+ * the generated runtime as a regular-expression literal. Strings, not `RegExp`s,
21
+ * so it survives JSON and can be emitted; frozen, so no consumer can rewrite a
22
+ * grammar in place.
23
23
  *
24
- * A grammar is the SHAPE only. Two scalars carry one more rule each, applied
25
- * where they decode: a `datetime` must also round-trip `toISOString()` exactly,
26
- * and a `bytes` string's padded group must leave its unused bits zero
27
- * ({@link decodeBase64}).
24
+ * A grammar is the SHAPE only. Two scalars carry one more rule each, applied where
25
+ * they decode: a `datetime` must also round-trip `toISOString()` exactly, and a
26
+ * `bytes` string's padded group must leave its unused bits zero ({@link
27
+ * decodeBase64}).
28
28
  */
29
29
  export declare const scalarFormats: Readonly<{
30
30
  readonly bigint: "^-?(?:0|[1-9]\\d*)$";
@@ -40,10 +40,10 @@ export declare const WIRE_SCALAR_PATTERNS: {
40
40
  export declare function encodeBase64(bytes: Uint8Array): string;
41
41
  /**
42
42
  * The bytes of a CANONICAL RFC 4648 base64 string; `undefined` for any other
43
- * string (C1, R6). Canonical means the grammar plus one rule the grammar cannot
44
- * state: the bits a padded final group does not carry must be zero, or two wire
45
- * strings would name one byte sequence (`"AB=="` and `"AA=="` both `[0]`). The
46
- * generated client's decoder applies the same rule.
43
+ * string. Canonical means the grammar plus one rule the grammar cannot state: the
44
+ * bits a padded final group does not carry must be zero, or two wire strings would
45
+ * name one byte sequence (`"AB=="` and `"AA=="` both `[0]`). The generated
46
+ * client's decoder applies the same rule.
47
47
  */
48
48
  export declare function decodeBase64(wire: string): Uint8Array | undefined;
49
49
  export {};
@@ -1,27 +1,9 @@
1
- /**
2
- * `AvProtocol.scalarFormats` — the wire grammars of protocol version 1 (§6.2;
3
- * C2, R7), as passive data: one anchored pattern SOURCE string per wire-encoded
4
- * scalar, in `BUILT_IN_SCALARS` order.
5
- *
6
- * The one source (§Q1): execution decodes client-scope arguments with these
7
- * (`runtime/scalar-runtime.ts`, `runtime/decimal.ts`), `@aventara/core/protocol`
8
- * re-exports this object, and the client generator emits each source by value
9
- * into the generated runtime as a regular-expression literal. Strings, not
10
- * `RegExp`s, so it survives JSON and can be emitted (P5); frozen, so no
11
- * consumer can rewrite a grammar in place.
12
- *
13
- * A grammar is the SHAPE only. Two scalars carry one more rule each, applied
14
- * where they decode: a `datetime` must also round-trip `toISOString()` exactly,
15
- * and a `bytes` string's padded group must leave its unused bits zero
16
- * ({@link decodeBase64}).
17
- */
18
1
  export const scalarFormats = Object.freeze({
19
2
  bigint: "^-?(?:0|[1-9]\\d*)$",
20
3
  decimal: "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$",
21
4
  datetime: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
22
5
  bytes: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
23
6
  });
24
- /** {@link scalarFormats}, compiled once for execution's own decoding. */
25
7
  export const WIRE_SCALAR_PATTERNS = Object.freeze({
26
8
  bigint: new RegExp(scalarFormats.bigint),
27
9
  decimal: new RegExp(scalarFormats.decimal),
@@ -29,7 +11,6 @@ export const WIRE_SCALAR_PATTERNS = Object.freeze({
29
11
  bytes: new RegExp(scalarFormats.bytes),
30
12
  });
31
13
  const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
32
- /** RFC 4648 base64, standard alphabet, padded: the canonical spelling of `bytes`. */
33
14
  export function encodeBase64(bytes) {
34
15
  let text = "";
35
16
  for (let index = 0; index < bytes.length; index += 3) {
@@ -44,13 +25,6 @@ export function encodeBase64(bytes) {
44
25
  }
45
26
  return text;
46
27
  }
47
- /**
48
- * The bytes of a CANONICAL RFC 4648 base64 string; `undefined` for any other
49
- * string (C1, R6). Canonical means the grammar plus one rule the grammar cannot
50
- * state: the bits a padded final group does not carry must be zero, or two wire
51
- * strings would name one byte sequence (`"AB=="` and `"AA=="` both `[0]`). The
52
- * generated client's decoder applies the same rule.
53
- */
54
28
  export function decodeBase64(wire) {
55
29
  if (!WIRE_SCALAR_PATTERNS.bytes.test(wire)) {
56
30
  return undefined;
@@ -200,17 +200,17 @@ type DerivedContractView<M extends AdapterModel, FieldsBlock, Restrictions> = {
200
200
  };
201
201
  /**
202
202
  * The Application Contract's type, derived from the adapter model and the
203
- * configuration literal by rules 1–4 above (Q1 = 1a).
203
+ * configuration literal by rules 1–4 above.
204
204
  *
205
205
  * It is fed to the same `OperationArgumentsFor` and `OperationResultFor` a
206
206
  * generated client feeds its ClientContract literal to: one derivation, two
207
207
  * sources of a Contract type. `limits` is the type every Contract carries; its
208
208
  * values are resolved at construction and no derivation reads them.
209
209
  *
210
- * The conditional is always true. It is there so that the view this resolves to
211
- * is `DerivedContractView` keyed on its blocks: a conditional's resolved branch
212
- * is the branch's own type, while a plain alias over `Cfg` would key the
213
- * instantiated view on the whole configuration (see `DerivedContractView`).
210
+ * The conditional is always true. It is there so that the view this resolves to is
211
+ * `DerivedContractView` keyed on its blocks: a conditional's resolved branch is
212
+ * the branch's own type, while a plain alias over `Cfg` would key the instantiated
213
+ * view on the whole configuration (see `DerivedContractView`).
214
214
  */
215
215
  export type ApplicationContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "application", "fields">, never> : never;
216
216
  /**
@@ -219,9 +219,8 @@ export type ApplicationContractView<M extends AdapterModel, Cfg = AnyFrameworkCo
219
219
  * for the in-process client-origin surfaces (`framework.client`,
220
220
  * `framework.clientTx`).
221
221
  *
222
- * Not exported from the package (architect, 2026-10-04: the new public names are
223
- * the members, not this view); a generated client reads the deployed ClientContract
224
- * literal itself. Resolved through a conditional for the reason
222
+ * Not exported from the package; a generated client reads the deployed
223
+ * ClientContract literal itself. Resolved through a conditional for the reason
225
224
  * {@link ApplicationContractView} gives.
226
225
  */
227
226
  export type ClientContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "client", "fields">, LayerBlock<Cfg, "client", "restrictions">> : never;
@@ -3,7 +3,6 @@ const FRAMEWORK_CONSTRUCTION_MESSAGES = {
3
3
  discovery: "Aventara adapter discovery validation failed",
4
4
  "contract-compilation": "Aventara contract compilation failed",
5
5
  };
6
- /** Startup failure with deterministic diagnostics from the earliest failed construction stage. */
7
6
  export class FrameworkConstructionError extends Error {
8
7
  stage;
9
8
  diagnostics;