@aventara/core 0.1.0-pilot.4 → 1.0.0-rc.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +338 -0
  2. package/README.md +100 -3
  3. package/dist/adapters/adapter-model.d.ts +8 -0
  4. package/dist/adapters/adapter.interface.d.ts +6 -2
  5. package/dist/compiler/contract-compiler-diagnostic.d.ts +6 -0
  6. package/dist/compiler/contract.compiler.js +67 -0
  7. package/dist/config/config.resolver.d.ts +3 -0
  8. package/dist/config/config.resolver.js +1 -0
  9. package/dist/config/config.validator.js +6 -0
  10. package/dist/config/define-fields.d.ts +10 -3
  11. package/dist/config/framework-config.d.ts +4 -1
  12. package/dist/config/framework-fields-config.d.ts +6 -0
  13. package/dist/contracts/client-contract-structure.validator.d.ts +21 -1
  14. package/dist/contracts/client-contract-structure.validator.js +99 -2
  15. package/dist/contracts/contract-canonicalizer.js +32 -0
  16. package/dist/contracts/contract.d.ts +7 -0
  17. package/dist/contracts/field.d.ts +10 -0
  18. package/dist/contracts/json-shape.d.ts +65 -0
  19. package/dist/contracts/json-shape.js +1 -0
  20. package/dist/contracts/reference-write-limit.d.ts +7 -0
  21. package/dist/contracts/reference-write-limit.js +1 -0
  22. package/dist/contracts/scalar-value-type.d.ts +12 -1
  23. package/dist/framework/contract-view.d.ts +126 -21
  24. package/dist/framework/framework.d.ts +5 -3
  25. package/dist/framework/framework.factory.js +56 -13
  26. package/dist/index.d.ts +8 -40
  27. package/dist/index.js +0 -20
  28. package/dist/internal.d.ts +35 -0
  29. package/dist/internal.js +16 -0
  30. package/dist/json/avz.d.ts +96 -0
  31. package/dist/json/avz.js +212 -0
  32. package/dist/json/index.d.ts +6 -0
  33. package/dist/json/index.js +1 -0
  34. package/dist/json/json-shape.registry.d.ts +22 -0
  35. package/dist/json/json-shape.registry.js +16 -0
  36. package/dist/json/zod-issue.translator.d.ts +51 -0
  37. package/dist/json/zod-issue.translator.js +142 -0
  38. package/dist/operations/operation-arguments.d.ts +151 -101
  39. package/dist/operations/operation-identity.d.ts +2 -0
  40. package/dist/operations/operation-identity.js +3 -0
  41. package/dist/operations/operation-validator-core.d.ts +1 -1
  42. package/dist/operations/operation-validator-core.js +28 -10
  43. package/dist/operations/operation-validator.d.ts +20 -5
  44. package/dist/operations/operation-validator.js +26 -10
  45. package/dist/operations/projection-scope.resolver.d.ts +1 -1
  46. package/dist/operations/structural-limits.walker.d.ts +19 -0
  47. package/dist/operations/structural-limits.walker.js +344 -0
  48. package/dist/protocol/absent-route.responder.d.ts +2 -1
  49. package/dist/protocol/absent-route.responder.js +32 -6
  50. package/dist/protocol/http-request.decoder.d.ts +6 -0
  51. package/dist/protocol/http-request.decoder.js +11 -3
  52. package/dist/protocol/protocol.binder.d.ts +4 -2
  53. package/dist/protocol/protocol.binder.js +3 -1
  54. package/dist/protocol/protocol.handler.d.ts +6 -2
  55. package/dist/protocol/protocol.handler.js +14 -4
  56. package/dist/protocol/unmounted-route.error.d.ts +19 -0
  57. package/dist/protocol/unmounted-route.error.js +10 -0
  58. package/dist/runtime/caller-data.copier.d.ts +59 -0
  59. package/dist/runtime/caller-data.copier.js +470 -0
  60. package/dist/runtime/caller-data.door.d.ts +56 -0
  61. package/dist/runtime/caller-data.door.js +65 -0
  62. package/dist/runtime/computed-read-runtime.js +3 -10
  63. package/dist/runtime/computed-value.error.d.ts +13 -0
  64. package/dist/runtime/computed-value.error.js +9 -0
  65. package/dist/runtime/create-requirement.d.ts +43 -7
  66. package/dist/runtime/create-requirement.js +89 -9
  67. package/dist/runtime/diagnostics-reporter.d.ts +20 -4
  68. package/dist/runtime/diagnostics-reporter.js +11 -4
  69. package/dist/runtime/error-boundary.d.ts +8 -0
  70. package/dist/runtime/error-boundary.js +65 -35
  71. package/dist/runtime/field-behavior.d.ts +2 -2
  72. package/dist/runtime/framework-error.d.ts +12 -0
  73. package/dist/runtime/misuse-reporter.d.ts +32 -0
  74. package/dist/runtime/misuse-reporter.js +19 -0
  75. package/dist/runtime/mutation-planner.js +13 -11
  76. package/dist/runtime/operation-request.d.ts +4 -11
  77. package/dist/runtime/operation-runtime.d.ts +14 -7
  78. package/dist/runtime/operation-runtime.js +37 -18
  79. package/dist/runtime/outcome-mapper.js +12 -2
  80. package/dist/runtime/output-validator.d.ts +10 -0
  81. package/dist/runtime/output-validator.js +11 -0
  82. package/dist/runtime/owned-execution.registry.d.ts +13 -0
  83. package/dist/runtime/owned-execution.registry.js +7 -0
  84. package/dist/runtime/pipeline.d.ts +19 -7
  85. package/dist/runtime/referential-action.d.ts +7 -0
  86. package/dist/runtime/request-envelope.validator.d.ts +5 -0
  87. package/dist/runtime/request-envelope.validator.js +118 -0
  88. package/dist/runtime/scalar-runtime.d.ts +30 -2
  89. package/dist/runtime/scalar-runtime.js +162 -79
  90. package/dist/transactions/transaction-plan-assembler.d.ts +5 -1
  91. package/dist/transactions/transaction-plan-assembler.js +74 -75
  92. package/dist/transactions/transaction-plan-validator.d.ts +30 -7
  93. package/dist/transactions/transaction-plan-validator.js +204 -153
  94. package/dist/transactions/transaction-reference-collector.d.ts +30 -0
  95. package/dist/transactions/transaction-reference-collector.js +204 -0
  96. package/dist/transactions/transaction-reference-resolver.js +10 -5
  97. package/dist/transactions/transaction-reference-validator.js +24 -17
  98. package/dist/transactions/transaction-reference.d.ts +23 -51
  99. package/dist/transactions/transaction-request.d.ts +3 -3
  100. package/dist/transactions/transaction-response.d.ts +6 -1
  101. package/dist/transactions/transaction-response.js +24 -1
  102. package/dist/transactions/transaction-runtime.d.ts +4 -2
  103. package/dist/transactions/transaction-runtime.js +4 -3
  104. package/package.json +17 -3
  105. package/dist/operations/operation-boolean-nodes.d.ts +0 -11
  106. package/dist/operations/operation-boolean-nodes.js +0 -283
  107. package/dist/operations/operation-nesting.d.ts +0 -8
  108. package/dist/operations/operation-nesting.js +0 -307
@@ -2,6 +2,7 @@ import type { Decimal } from "../runtime/decimal.js";
2
2
  import type { JsonValue } from "../runtime/json-value.js";
3
3
  import type { Contract } from "./contract.js";
4
4
  import type { ScalarField } from "./field.js";
5
+ import type { JsonFieldType } from "./json-shape.js";
5
6
  import type { BuiltInScalar } from "./scalar.js";
6
7
  /**
7
8
  * A scalar-form map: the TypeScript type each built-in scalar takes on one side
@@ -53,6 +54,16 @@ export type ScalarAtom<C extends Contract, Type, Forms extends ScalarForms> = Ty
53
54
  } ? C["enums"][Enum]["values"][number] : Type extends {
54
55
  readonly scalar: infer Scalar;
55
56
  } ? Scalar extends keyof Forms ? Forms[Scalar] : unknown : never;
57
+ /**
58
+ * One value of a scalar field, before `list` and `nullable` apply: its Json
59
+ * Shape's type where the field is shaped, otherwise {@link ScalarAtom}.
60
+ */
61
+ export type FieldAtom<C extends Contract, Field extends {
62
+ readonly type: unknown;
63
+ readonly json?: unknown;
64
+ }, Forms extends ScalarForms> = Field extends {
65
+ readonly json: JsonFieldType<infer Value>;
66
+ } ? Value : ScalarAtom<C, Field["type"], Forms>;
56
67
  /**
57
68
  * `list: true` makes the value a read-only array of atoms. A `list` the Contract
58
69
  * left as a plain `boolean` admits either, so neither form is promised.
@@ -67,5 +78,5 @@ type ListValue<List, Atom> = [List] extends [false] ? Atom : [List] extends [tru
67
78
  * - `list: true` → `readonly T[]`, whose entries are never `null`;
68
79
  * - `nullable: true` → `| null`, on the whole value, list or not.
69
80
  */
70
- export type ScalarValueType<C extends Contract, Field extends ScalarField<C>, Forms extends ScalarForms = ApplicationScalarForms> = ListValue<Field["list"], ScalarAtom<C, Field["type"], Forms>> | (true extends Field["nullable"] ? null : never);
81
+ export type ScalarValueType<C extends Contract, Field extends ScalarField<C>, Forms extends ScalarForms = ApplicationScalarForms> = ListValue<Field["list"], FieldAtom<C, Field, Forms>> | (true extends Field["nullable"] ? null : never);
71
82
  export {};
@@ -2,8 +2,12 @@ import type { AdapterModel } from "../adapters/adapter-model.js";
2
2
  import type { AnyFrameworkConfig } from "../config/any-framework-config.js";
3
3
  import type { RequestOrigin } from "../config/config-layer.js";
4
4
  import type { ContractLimits } from "../contracts/contract-limits.js";
5
- /** Whether `resolveRecord` descends into a value: an object that is no array. */
6
- type IsLayeredRecord<T> = [T] extends [readonly unknown[]] ? false : [T] extends [object] ? true : false;
5
+ import type { JsonShape, ShapedJsonSchema } from "../contracts/json-shape.js";
6
+ /**
7
+ * Whether `resolveRecord` descends into a value: an object that is no array and
8
+ * no Json Shape.
9
+ */
10
+ type IsLayeredRecord<T> = [T] extends [readonly unknown[]] ? false : [T] extends [JsonShape] ? false : [T] extends [object] ? true : false;
7
11
  /**
8
12
  * A root record with a scoped record layered over it: a key the scoped side
9
13
  * states wins; when both sides are records they merge, recursively; otherwise
@@ -34,6 +38,10 @@ type LayerBlock<Cfg, Layer extends RequestOrigin, Key extends "fields" | "restri
34
38
  })[Layer] & {
35
39
  readonly [K in Key]?: unknown;
36
40
  })[Key]>>;
41
+ /** Root's own `Key` block, before any layer is layered over it. */
42
+ type RootBlock<Cfg, Key extends "fields" | "restrictions"> = LiteralRecord<(Cfg & {
43
+ readonly [K in Key]?: unknown;
44
+ })[Key]>;
37
45
  /** One key's entry in a layered block, or `never` when the block has none. */
38
46
  type EntryOf<Block, Key> = [Block] extends [never] ? never : Key extends keyof Block ? LiteralRecord<NonNullable<Block[Key]>> : never;
39
47
  type ConfiguredCapabilities<FieldConfig> = [FieldConfig] extends [never] ? Record<never, never> : FieldConfig extends {
@@ -61,10 +69,19 @@ type LayeredModelField<Field, FieldConfig> = Field extends {
61
69
  } ? [FieldConfig] extends [never] ? Field extends {
62
70
  readonly capabilities: infer Capabilities;
63
71
  } ? "select" extends keyof Capabilities ? Field : ConfiguredModelField<Field, FieldConfig> : ConfiguredModelField<Field, FieldConfig> : ConfiguredModelField<Field, FieldConfig> : Field;
64
- /** A discovered scalar with its configured capabilities applied, member by member. */
72
+ /**
73
+ * A discovered scalar with its configured capabilities applied, member by member,
74
+ * and its configured Json Shape, whose type its value takes.
75
+ */
65
76
  type ConfiguredModelField<Field, FieldConfig> = {
66
77
  readonly [P in keyof Field]: P extends "capabilities" ? LayeredCapabilities<Field[P], ConfiguredCapabilities<FieldConfig>> : Field[P];
67
- };
78
+ } & ConfiguredJsonShape<FieldConfig>;
79
+ /** A configured Json Shape as a view field's `json` member; nothing otherwise. */
80
+ type ConfiguredJsonShape<FieldConfig> = [FieldConfig] extends [never] ? unknown : FieldConfig extends {
81
+ readonly json: JsonShape<infer Value>;
82
+ } ? {
83
+ readonly json: ShapedJsonSchema<Value>;
84
+ } : unknown;
68
85
  /** A scalar the configuration adds, exactly as the configuration states it. */
69
86
  type AddedField<FieldConfig> = {
70
87
  readonly kind: "scalar";
@@ -99,34 +116,122 @@ type IsHidden<Restriction> = [Restriction] extends [never] ? false : Restriction
99
116
  type HiddenKey<Restrictions> = [Restrictions] extends [never] ? never : {
100
117
  [K in keyof Restrictions]-?: IsHidden<EntryOf<Restrictions, K>> extends true ? K : never;
101
118
  }[keyof Restrictions];
119
+ /** A restriction entry's `capabilities` block, or `never` when it states none. */
120
+ type CapabilityRestrictionsOf<Entry> = [Entry] extends [never] ? never : EntryOf<Entry, "capabilities">;
121
+ /** A restriction member that is a literal `false`: a denial. */
122
+ type IsDenial<Value> = [Value] extends [false] ? true : false;
123
+ /** A restriction member that is a literal `true`: a restoration. */
124
+ type IsRestoration<Value> = [Value] extends [true] ? true : false;
125
+ /** The tokens a capability member advertises, its qualifier aside. */
126
+ type MemberTokens<Member, TokenKey extends string> = Member extends {
127
+ readonly scopes: unknown;
128
+ } ? TokenKey extends keyof Member ? Member[TokenKey] : never : Member;
129
+ /** The positions a scope-qualified member holds in; `never` for an unqualified one. */
130
+ type MemberScopes<Member> = Member extends {
131
+ readonly scopes: infer Scopes;
132
+ } ? Scopes : never;
133
+ /** A relation's `create`, `update` or `reducers` member narrowed by a restriction. */
134
+ type NarrowedScopedTokens<Member, Restriction, TokenKey extends "directives" | "reducers"> = Restriction extends readonly unknown[] ? [MemberScopes<Member>] extends [never] ? Restriction : {
135
+ readonly [K in TokenKey | "scopes"]: K extends "scopes" ? MemberScopes<Member> : Restriction;
136
+ } : Restriction extends object ? (Restriction extends {
137
+ readonly scopes: infer Scopes;
138
+ } ? Scopes : MemberScopes<Member>) extends infer Scopes ? [Scopes] extends [never] ? Restriction extends {
139
+ readonly [K in TokenKey]: infer Tokens;
140
+ } ? Tokens : MemberTokens<Member, TokenKey> : Scopes extends readonly [] ? false : {
141
+ readonly [K in TokenKey | "scopes"]: K extends "scopes" ? Scopes : Restriction extends {
142
+ readonly [T in TokenKey]: infer Tokens;
143
+ } ? Tokens : MemberTokens<Member, TokenKey>;
144
+ } : never : Member;
145
+ /** One capability member narrowed by a list (or, on a relation, an object) restriction. */
146
+ type NarrowedMember<Kind, Key, Member, Restriction> = Kind extends "relation" ? Key extends "select" | "include" ? Restriction extends readonly [] ? false : Restriction : Key extends "create" | "update" ? NarrowedScopedTokens<Member, Restriction, "directives"> : Key extends "reducers" ? NarrowedScopedTokens<Member, Restriction, "reducers"> : Restriction : Restriction;
147
+ /** One capability member of a field under its layer's restrictions. */
148
+ type RestrictedMember<Kind, Key, Member, Root, Layered> = IsRestoration<Layered> extends true ? Root extends readonly unknown[] | {
149
+ readonly scopes?: unknown;
150
+ } ? NarrowedMember<Kind, Key, Member, Root> : Member : [Layered] extends [boolean] ? Member : NarrowedMember<Kind, Key, Member, Layered>;
151
+ /** The members a capabilities restriction denies, or narrows to nothing. */
152
+ type DeniedMember<Kind, Own, Root, Layered> = {
153
+ [P in keyof Own]-?: P extends keyof Layered ? IsDenial<Layered[P]> extends true ? P : [
154
+ RestrictedMember<Kind, P, Own[P], P extends keyof Root ? Root[P] : undefined, Layered[P]>
155
+ ] extends [false] ? P : never : never;
156
+ }[keyof Own];
157
+ /** A field's capabilities under its layer's restrictions. */
158
+ type RestrictedCapabilities<Kind, Own, Root, Layered> = {
159
+ readonly [P in keyof Own as P extends DeniedMember<Kind, Own, Root, Layered> ? never : P]: P extends keyof Layered ? RestrictedMember<Kind, P, Own[P], P extends keyof Root ? Root[P] : undefined, Layered[P]> : Own[P];
160
+ };
161
+ /** A view field with its layer's capability restrictions applied. */
162
+ type RestrictedField<Field, RootEntry, Entry> = [
163
+ CapabilityRestrictionsOf<Entry>
164
+ ] extends [never] ? Field : {
165
+ readonly [P in keyof Field]: P extends "capabilities" ? RestrictedCapabilities<Field extends {
166
+ readonly kind: infer Kind;
167
+ } ? Kind : never, Field[P], CapabilityRestrictionsOf<RootEntry>, CapabilityRestrictionsOf<Entry>> : Field[P];
168
+ };
102
169
  /**
103
170
  * A Resource's fields in the view: the model's and the ones the configuration
104
- * adds, less the ones this view's restrictions hide.
171
+ * adds, less the ones this view's restrictions hide, each with its capability
172
+ * restrictions applied.
173
+ */
174
+ type LayeredFields<ModelFields, ResourceConfig, FieldRestrictions, RootFieldRestrictions> = {
175
+ readonly [F in Exclude<keyof ModelFields | AddedFieldKey<ModelFields, ResourceConfig>, HiddenKey<FieldRestrictions>>]: RestrictedField<F extends keyof ModelFields ? LayeredModelField<ModelFields[F], EntryOf<ResourceConfig, F>> : AddedField<EntryOf<ResourceConfig, F>>, EntryOf<RootFieldRestrictions, F>, EntryOf<FieldRestrictions, F>>;
176
+ };
177
+ /** The variants of one family an operations restriction turns off: literal `false` only. */
178
+ type DisabledVariant<FamilyRestriction> = [FamilyRestriction] extends [never] ? never : {
179
+ [V in keyof FamilyRestriction]-?: IsDenial<FamilyRestriction[V]> extends true ? V : never;
180
+ }[keyof FamilyRestriction];
181
+ /** The variants of the unique style, which need an identifier the layer keeps. */
182
+ type UniqueVariant = "unique";
183
+ /**
184
+ * The variants of one family the layer advertises: the model's, less those turned
185
+ * off, less the unique one when no identifier survives.
105
186
  */
106
- type LayeredFields<ModelFields, ResourceConfig, FieldRestrictions> = {
107
- readonly [F in Exclude<keyof ModelFields | AddedFieldKey<ModelFields, ResourceConfig>, HiddenKey<FieldRestrictions>>]: F extends keyof ModelFields ? LayeredModelField<ModelFields[F], EntryOf<ResourceConfig, F>> : AddedField<EntryOf<ResourceConfig, F>>;
187
+ type AvailableVariant<Family, FamilyRestriction, UniqueLost> = Exclude<keyof Family, DisabledVariant<FamilyRestriction> | (UniqueLost extends true ? UniqueVariant : never)>;
188
+ /** The families with at least one variant the layer advertises. */
189
+ type AvailableFamily<Operations, OperationRestrictions, UniqueLost> = {
190
+ [F in keyof Operations]-?: [
191
+ AvailableVariant<NonNullable<Operations[F]>, EntryOf<OperationRestrictions, F>, UniqueLost>
192
+ ] extends [never] ? never : F;
193
+ }[keyof Operations];
194
+ /** A Resource's operations under its layer's restrictions. */
195
+ type RestrictedOperations<Operations, OperationRestrictions, UniqueLost> = [
196
+ OperationRestrictions
197
+ ] extends [never] ? UniqueLost extends true ? LayerOperations<Operations, never, UniqueLost> : Operations : LayerOperations<Operations, OperationRestrictions, UniqueLost>;
198
+ type LayerOperations<Operations, OperationRestrictions, UniqueLost> = {
199
+ readonly [F in AvailableFamily<Operations, OperationRestrictions, UniqueLost>]: {
200
+ readonly [V in AvailableVariant<NonNullable<Operations[F]>, EntryOf<OperationRestrictions, F>, UniqueLost>]: NonNullable<Operations[F]>[V];
201
+ };
108
202
  };
109
- /** One Resource in the view: the model's own, with its fields layered. */
110
- type LayeredResource<in out Resource, in out ResourceConfig, in out ResourceRestrictions> = {
111
- readonly [P in keyof Resource]: P extends "fields" ? LayeredFields<Resource[P], ResourceConfig, EntryOf<ResourceRestrictions, "fields">> : Resource[P];
203
+ /** A Resource's identifiers less those naming a hidden field. */
204
+ type KeptIdentifiers<Identifiers, Hidden> = [Hidden] extends [never] ? Identifiers : Identifiers extends readonly (infer Identifier)[] ? readonly (Identifier extends readonly (infer Field)[] ? [Extract<Field, Hidden>] extends [never] ? Identifier : never : never)[] : Identifiers;
205
+ /** Whether hiding fields left a Resource with no identifier at all. */
206
+ type IdentifiersLost<Identifiers, Hidden> = [Hidden] extends [never] ? false : [
207
+ KeptIdentifiers<Identifiers, Hidden> extends readonly (infer Kept)[] ? Kept : never
208
+ ] extends [never] ? true : false;
209
+ /**
210
+ * One Resource in the view: the model's own, with its fields layered and its
211
+ * layer's restrictions applied to its fields, operations and identifiers.
212
+ */
213
+ type LayeredResource<in out Resource, in out ResourceConfig, in out ResourceRestrictions, in out RootResourceRestrictions> = {
214
+ readonly [P in keyof Resource]: P extends "fields" ? LayeredFields<Resource[P], ResourceConfig, EntryOf<ResourceRestrictions, "fields">, EntryOf<RootResourceRestrictions, "fields">> : P extends "operations" ? RestrictedOperations<Resource[P], EntryOf<ResourceRestrictions, "operations">, IdentifiersLost<Resource extends {
215
+ readonly identifiers: infer Ids;
216
+ } ? Ids : never, HiddenKey<EntryOf<ResourceRestrictions, "fields">>>> : P extends "identifiers" ? KeptIdentifiers<Resource[P], HiddenKey<EntryOf<ResourceRestrictions, "fields">>> : Resource[P];
112
217
  };
113
218
  /**
114
- * The Resources in the view. `Restrictions` is the layered `restrictions` block
115
- * whose `hidden` entries this view applies, or `never` for a view that applies
116
- * none.
219
+ * The Resources in the view. `Restrictions` is the layer's layered
220
+ * `restrictions` block and `RootRestrictions` root's own, whose narrowings a
221
+ * restoration inherits; both `never` for a configuration that restricts nothing.
117
222
  */
118
- type LayeredResources<Resources, Block, Restrictions> = {
119
- readonly [R in Exclude<keyof Resources, HiddenKey<Restrictions>>]: LayeredResource<Resources[R], EntryOf<Block, R>, EntryOf<Restrictions, R>>;
223
+ type LayeredResources<Resources, Block, Restrictions, RootRestrictions> = {
224
+ readonly [R in Exclude<keyof Resources, HiddenKey<Restrictions>>]: LayeredResource<Resources[R], EntryOf<Block, R>, EntryOf<Restrictions, R>, EntryOf<RootRestrictions, R>>;
120
225
  };
121
226
  /**
122
227
  * One derived Contract's type: the model, with a layer's `fields` block applied
123
- * and, when `Restrictions` is a block rather than `never`, its hidden entries
124
- * removed.
228
+ * and its layered `restrictions` block (`Restrictions`, over root's own,
229
+ * `RootRestrictions`) applied.
125
230
  */
126
- type DerivedContractView<M extends AdapterModel, FieldsBlock, Restrictions> = {
231
+ type DerivedContractView<M extends AdapterModel, FieldsBlock, Restrictions, RootRestrictions> = {
127
232
  readonly scalars: M["scalars"];
128
233
  readonly enums: M["enums"];
129
- readonly resources: LayeredResources<M["resources"], FieldsBlock, Restrictions>;
234
+ readonly resources: LayeredResources<M["resources"], FieldsBlock, Restrictions, RootRestrictions>;
130
235
  readonly limits: ContractLimits;
131
236
  readonly transactions: M["transactions"];
132
237
  };
@@ -134,11 +239,11 @@ type DerivedContractView<M extends AdapterModel, FieldsBlock, Restrictions> = {
134
239
  * The Application Contract's type, derived from the adapter model and the
135
240
  * configuration.
136
241
  */
137
- export type ApplicationContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "application", "fields">, never> : never;
242
+ export type ApplicationContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "application", "fields">, LayerBlock<Cfg, "application", "restrictions">, RootBlock<Cfg, "restrictions">> : never;
138
243
  /**
139
244
  * The Client Contract's type, derived from the adapter model and the
140
245
  * configuration: what the client layer hides is absent. It types
141
246
  * `framework.client` and `framework.clientTx`.
142
247
  */
143
- export type ClientContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "client", "fields">, LayerBlock<Cfg, "client", "restrictions">> : never;
248
+ export type ClientContractView<M extends AdapterModel, Cfg = AnyFrameworkConfig> = [Cfg] extends [unknown] ? DerivedContractView<M, LayerBlock<Cfg, "client", "fields">, LayerBlock<Cfg, "client", "restrictions">, RootBlock<Cfg, "restrictions">> : never;
144
249
  export {};
@@ -19,8 +19,9 @@ export type Framework<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkC
19
19
  * Typed in-process operations under the Application Contract:
20
20
  * `framework.application.<resource>.<family>.<variant>(args, options?)`.
21
21
  *
22
- * A call is validated like any other request, so it still refuses what a
23
- * restriction removed. The optional second argument is
22
+ * Typed from the Application Contract as configured: what the application's
23
+ * restrictions hide, deny or turn off is absent from the types, and a call is
24
+ * validated like any other request. The optional second argument is
24
25
  * {@link ExecutionOptions}.
25
26
  */
26
27
  readonly application: ApplicationOperations<M, Cfg>;
@@ -28,7 +29,8 @@ export type Framework<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkC
28
29
  * The same operations under ClientContract rules:
29
30
  * `framework.client.<resource>.<family>.<variant>(args, options?)`.
30
31
  *
31
- * What the client layer hides is absent, and arguments are read in the wire
32
+ * What the client layer hides, denies or turns off is absent from the types,
33
+ * as from a generated client, and arguments are read in the wire
32
34
  * forms a decoded request body carries, so a transport can pass `req.body` as
33
35
  * it is. Each call runs the client pipelines and the same validation as a
34
36
  * remote request.
@@ -2,9 +2,13 @@ import { compileContracts } from "../compiler/contract.compiler.js";
2
2
  import { resolveFrameworkConfig } from "../config/config.resolver.js";
3
3
  import { validateFrameworkConfig } from "../config/config.validator.js";
4
4
  import { AVENTARA_PROTOCOL_VERSION } from "../contracts/contract-protocol.js";
5
+ import { copyEnvelopeAtDoor, refuseCallerData, } from "../runtime/caller-data.door.js";
5
6
  import { createDiagnosticsReporter, createTransactionDiagnosticsChannel, recordDiagnosticsSink, } from "../runtime/diagnostics-reporter.js";
6
- import { internalFailure } from "../runtime/operation-response.js";
7
+ import { createMisuseReporter, } from "../runtime/misuse-reporter.js";
8
+ import { internalFailure, operationFailure, } from "../runtime/operation-response.js";
7
9
  import { createOperationRuntime } from "../runtime/operation-runtime.js";
10
+ import { recordOwnedExecution } from "../runtime/owned-execution.registry.js";
11
+ import { validateOperationEnvelope, validateTransactionEnvelope, } from "../runtime/request-envelope.validator.js";
8
12
  import { requestIdOf } from "../runtime/request-id.js";
9
13
  import { createTransactionPlanAssembler } from "../transactions/transaction-plan-assembler.js";
10
14
  import { createTransactionRuntime } from "../transactions/transaction-runtime.js";
@@ -41,25 +45,26 @@ export async function createFramework(config) {
41
45
  contracts: compilation.contracts,
42
46
  config: resolvedConfig,
43
47
  });
44
- const executeOperation = (request) => executeTotally(execute, request, resolvedConfig.diagnostics);
48
+ const misuse = createMisuseReporter(resolvedConfig.misuse);
49
+ const executeOperation = (request) => executeTotally(execute, request, resolvedConfig.diagnostics, "caller");
45
50
  const protocol = {
46
51
  version: AVENTARA_PROTOCOL_VERSION,
47
52
  hash: compilation.contracts.client.protocol.hash,
48
53
  };
49
- const assembler = createTransactionPlanAssembler(compilation.contracts, protocol);
54
+ const assembler = createTransactionPlanAssembler(compilation.contracts, protocol, misuse);
50
55
  const framework = {
51
56
  entrypoint: resolvedConfig.entrypoint,
52
57
  contracts: compilation.contracts,
53
58
  application: createOperationFacade(model, (resource, identity, args, requestId) => ({
54
59
  ...identity,
55
- scope: "application",
60
+ origin: "application",
56
61
  requestId,
57
62
  resource,
58
63
  arguments: args,
59
64
  }), executeOperation),
60
65
  client: createOperationFacade(model, (resource, identity, args, requestId) => ({
61
66
  ...identity,
62
- scope: "client",
67
+ origin: "client",
63
68
  protocol,
64
69
  requestId,
65
70
  resource,
@@ -67,28 +72,66 @@ export async function createFramework(config) {
67
72
  }), executeOperation),
68
73
  appTx: createOperationTree(model, (resource, identity) => (args) => assembler.defer("application", resource, identity, args === undefined ? {} : args)),
69
74
  clientTx: createOperationTree(model, (resource, identity) => (args) => assembler.defer("client", resource, identity, args === undefined ? {} : args)),
70
- execute: executeOperation,
71
- executeTransaction: (request) => executeTransactionTotally(executeTransaction, request, resolvedConfig.diagnostics),
75
+ execute: (request) => executeRequestTotally(execute, request, resolvedConfig.diagnostics, misuse),
76
+ executeTransaction: (request) => executeTransactionRequestTotally(executeTransaction, request, resolvedConfig.diagnostics, misuse),
72
77
  transaction: ((operations, options) => runTransactionTotally(executeTransaction, assembler, operations, requestIdOf(options), resolvedConfig.diagnostics)),
73
78
  };
74
79
  recordDiagnosticsSink(framework, resolvedConfig.diagnostics);
80
+ recordOwnedExecution(framework, {
81
+ execute: (request) => executeTotally(execute, request, resolvedConfig.diagnostics, "owned"),
82
+ executeTransaction: (request) => executeTransactionTotally(executeTransaction, request, resolvedConfig.diagnostics, undefined, { source: "owned" }),
83
+ });
75
84
  return framework;
76
85
  }
77
- async function executeTotally(execute, request, diagnostics) {
86
+ async function executeTotally(execute, request, diagnostics, source) {
78
87
  const report = createDiagnosticsReporter(diagnostics, request);
79
88
  try {
80
- return await execute(request, report);
89
+ return await execute(request, report, source);
81
90
  }
82
91
  catch (error) {
83
92
  report(error, "A3000");
84
93
  return internalFailure();
85
94
  }
86
95
  }
87
- async function executeTransactionTotally(execute, request, diagnostics, origins) {
96
+ function executeRequestTotally(execute, request, diagnostics, misuse) {
97
+ const envelope = copyEnvelopeAtDoor(request, ["protocol", "transport"]);
98
+ if (!envelope.ok) {
99
+ return Promise.resolve(operationFailure("A2004", {
100
+ message: "Operation arguments failed framework validation.",
101
+ issues: [refuseCallerData(envelope.error, [], {}, misuse)],
102
+ }));
103
+ }
104
+ const malformed = validateOperationEnvelope(envelope.value);
105
+ if (malformed.length > 0) {
106
+ return Promise.resolve(operationFailure("A2004", {
107
+ message: "Operation arguments failed framework validation.",
108
+ issues: malformed,
109
+ }));
110
+ }
111
+ return executeTotally(execute, envelope.value, diagnostics, "caller");
112
+ }
113
+ function executeTransactionRequestTotally(execute, request, diagnostics, misuse) {
114
+ const envelope = copyEnvelopeAtDoor(request, ["protocol", "transport"]);
115
+ if (!envelope.ok) {
116
+ return Promise.resolve(operationFailure("A2004", {
117
+ message: "Transaction plan failed framework validation.",
118
+ issues: [refuseCallerData(envelope.error, [], {}, misuse)],
119
+ }));
120
+ }
121
+ const malformed = validateTransactionEnvelope(envelope.value);
122
+ if (malformed.length > 0) {
123
+ return Promise.resolve(operationFailure("A2004", {
124
+ message: "Transaction plan failed framework validation.",
125
+ issues: malformed,
126
+ }));
127
+ }
128
+ return executeTransactionTotally(execute, envelope.value, diagnostics, undefined, { source: "caller" });
129
+ }
130
+ async function executeTransactionTotally(execute, request, diagnostics, origins, planArguments) {
88
131
  const channel = createTransactionDiagnosticsChannel(diagnostics, request);
89
132
  const report = channel.transaction();
90
133
  try {
91
- return await execute(request, channel, origins);
134
+ return await execute(request, channel, origins, planArguments);
92
135
  }
93
136
  catch (error) {
94
137
  report(error, "A3000");
@@ -102,7 +145,7 @@ async function runTransactionTotally(execute, assembler, operations, requestId,
102
145
  }
103
146
  catch (error) {
104
147
  createTransactionDiagnosticsChannel(diagnostics, {
105
- scope: "application",
148
+ origin: "application",
106
149
  requestId,
107
150
  plan: operations,
108
151
  }).transaction()(error, "A3000");
@@ -111,5 +154,5 @@ async function runTransactionTotally(execute, assembler, operations, requestId,
111
154
  if (!assembled.ok) {
112
155
  return assembled.response;
113
156
  }
114
- return executeTransactionTotally(execute, { scope: "application", requestId, plan: assembled.plan }, diagnostics, assembled.origins);
157
+ return executeTransactionTotally(execute, { origin: "application", requestId, plan: assembled.plan }, diagnostics, assembled.origins, { source: "owned", refused: assembled.refused });
115
158
  }
package/dist/index.d.ts CHANGED
@@ -1,83 +1,51 @@
1
1
  export type { Adapter } from "./adapters/adapter.interface.js";
2
2
  export type { AdapterDiscoveryDiagnostic, AdapterDiscoveryDiagnosticCode, } from "./adapters/adapter-discovery-diagnostic.js";
3
- export type { AdapterField, AdapterLifecycleTrait, AdapterRelationField, AdapterScalarField, } from "./adapters/adapter-field.js";
4
- export type { AdapterIdentifier, AdapterScalarFieldKey, } from "./adapters/adapter-identifier.js";
5
3
  export type { AdapterModel } from "./adapters/adapter-model.js";
6
- export type { AdapterOperation } from "./adapters/adapter-operation.js";
7
- export type { AdapterOperationExecutor } from "./adapters/adapter-operation-executor.interface.js";
8
- export type { AdapterFieldKey, AdapterFieldMap, AdapterResource, } from "./adapters/adapter-resource.js";
9
- export type { ContractCompilationResult, FrameworkContracts, } from "./compiler/contract.compiler.js";
10
- export { compileContracts } from "./compiler/contract.compiler.js";
4
+ export type { FrameworkContracts } from "./compiler/contract.compiler.js";
11
5
  export type { ContractCompilerDiagnostic, ContractCompilerDiagnosticCode, } from "./compiler/contract-compiler-diagnostic.js";
12
- export type { ResolvedFrameworkConfig, ResolvedFrameworkScopeConfig, } from "./config/config.resolver.js";
13
- export { resolveFrameworkConfig } from "./config/config.resolver.js";
14
- export { validateFrameworkConfig } from "./config/config.validator.js";
15
6
  export type { ConfigDiagnostic, ConfigDiagnosticCode, } from "./config/config-diagnostic.js";
16
7
  export type { ConfigLayer, RequestOrigin } from "./config/config-layer.js";
17
8
  export type { AddedScalarFieldConfig, FrameworkFieldsShape, KnownScalarFieldConfig, } from "./config/define-fields.js";
18
9
  export { defineFields } from "./config/define-fields.js";
19
- export type { ConfigFieldKey, EffectiveFieldKey, EffectiveFieldKeyAt, } from "./config/effective-fields.js";
10
+ export type { ConfigFieldKey, EffectiveFieldKey, } from "./config/effective-fields.js";
20
11
  export type { FrameworkFieldBehaviorConfig, FrameworkReadBehavior, FrameworkResourceBehaviorsConfig, } from "./config/framework-behaviors-config.js";
21
12
  export type { AnyFieldsBlock, AnyFrameworkConfig, AnyScopeConfig, FrameworkBehaviorsConfig, FrameworkCapabilitySetRestriction, FrameworkConfig, FrameworkFieldLifecycleTrait, FrameworkFieldRestrictions, FrameworkFieldsConfig, FrameworkLimitsConfig, FrameworkProjectionScopeRestriction, FrameworkRelationCapabilityRestrictions, FrameworkRelationFieldRestrictions, FrameworkRelationMutationRestriction, FrameworkRelationReducerRestriction, FrameworkResourceFieldRestrictions, FrameworkResourceFieldsConfig, FrameworkResourceKey, FrameworkResourceOperationRestrictions, FrameworkResourceRestrictions, FrameworkRestrictionsConfig, FrameworkScalarCapabilityRestrictions, FrameworkScalarFieldConfig, FrameworkScalarFieldRestrictions, FrameworkScalarTypeRef, FrameworkScopeConfig, } from "./config/framework-config.js";
22
- export type { PipelineConfig, ResolvedPipelineConfig, } from "./config/pipeline-config.js";
13
+ export type { PipelineConfig } from "./config/pipeline-config.js";
23
14
  export type { PaginationCapability, ProjectionScope, RelationFilterCapability, RelationMutationDirective, RelationReducer, ScalarFilterOperator, ScalarMutationDirective, WriteScope, } from "./contracts/capability.js";
24
- export { PROJECTION_SCOPES, WRITE_SCOPES, } from "./contracts/capability.js";
25
- export type { ClientContractStructureVerdict } from "./contracts/client-contract-structure.validator.js";
26
- export { validateClientContractStructure } from "./contracts/client-contract-structure.validator.js";
27
15
  export type { ApplicationContract, ClientContract, Contract, CoreContract, } from "./contracts/contract.js";
28
- export { CanonicalJsonError, canonicalizeContract, canonicalizeJson, } from "./contracts/contract-canonicalizer.js";
29
- export type { ClientContractHashInput } from "./contracts/contract-hash.js";
30
- export { computeClientContractHash, verifyClientContractHash, } from "./contracts/contract-hash.js";
31
16
  export type { ContractLimits } from "./contracts/contract-limits.js";
32
- export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
33
17
  export type { ClientContractProtocol, ContractHash, ContractProtocol, } from "./contracts/contract-protocol.js";
34
- export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
35
18
  export type { EnumDefinition } from "./contracts/enum-definition.js";
36
19
  export type { Field, ProjectionScopes, RelationField, RelationFieldCapabilities, RelationMutationCapability, RelationProjectionCapability, RelationReducerCapability, ScalarField, ScalarFieldCapabilities, ScalarFormat, ScopedRelationMutations, ScopedRelationReducers, WriteScopes, } from "./contracts/field.js";
37
- export { advertisedDirectives, advertisedDirectivesAt, advertisedReducers, advertisedReducersAt, holdsAt, holdsInAnyScope, } from "./contracts/field.js";
38
20
  export type { Identifier, ScalarFieldKey } from "./contracts/identifier.js";
39
21
  export type { LifecycleTrait } from "./contracts/lifecycle-trait.js";
40
- export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
41
22
  export type { Resource, ResourceFieldMap } from "./contracts/resource.js";
42
23
  export type { OperationAvailability, OperationVariantScopes, ResourceOperations, } from "./contracts/resource-operations.js";
43
- export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
44
24
  export type { BuiltInScalar, ScalarDefinition, ScalarRegistry, } from "./contracts/scalar.js";
45
- export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
46
25
  export type { ApplicationScalarForms, ScalarValueType, WireScalarForms, } from "./contracts/scalar-value-type.js";
47
26
  export type { TransactionCapability } from "./contracts/transaction-capability.js";
48
- export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
49
- export type { ApplicationContractView } from "./framework/contract-view.js";
50
27
  export { createFramework } from "./framework/framework.factory.js";
51
28
  export type { Framework } from "./framework/framework.js";
52
29
  export type { FrameworkConstructionDiagnostic, FrameworkConstructionStage, } from "./framework/framework-construction.error.js";
53
30
  export { FrameworkConstructionError } from "./framework/framework-construction.error.js";
54
- export type { CreateDataInput, CursorInput, FieldKey, IncludeInput, NullsOrder, OperationArgumentMap, OperationArgumentsFor, OrderByEntry, OrderByInput, ProjectionEntry, RelationMutationAction, RelationProjectionInput, ResourceKey, ScalarFilterInput, ScalarMutationAction, ScalarOrderInput, SelectInput, SortDirection, UniqueWhereInput, UpdateDataInput, WhereInput, } from "./operations/operation-arguments.js";
31
+ export type { CreateDataInput, CursorInput, FieldKey, IncludeInput, NullsOrder, OperationArgumentMap, OperationArgumentsFor, OrderByEntry, OrderByInput, ProjectionEntry, RelationProjectionInput, ResourceKey, ScalarOrderInput, SelectInput, SortDirection, UniqueWhereInput, UpdateDataInput, WhereInput, } from "./operations/operation-arguments.js";
55
32
  export type { DeferredOperationCall, OperationCall, OperationGrammar, OperationSlot, } from "./operations/operation-call.js";
56
33
  export type { OperationFamily, OperationIdentity, OperationVariant, } from "./operations/operation-identity.js";
57
34
  export type { OperationResultFor } from "./operations/operation-result.js";
58
- export type { OperationValidationResult, SemanticOperationArguments, } from "./operations/operation-validator.js";
59
- export { validateOperationArguments } from "./operations/operation-validator.js";
60
35
  export type { ValidationCode, ValidationIssue, } from "./operations/validation-code.js";
61
- export { VALIDATION_CODE_MESSAGES, VALIDATION_CODES, } from "./operations/validation-code.js";
62
36
  export { Decimal } from "./runtime/decimal.js";
63
37
  export type { FrameworkDiagnostic, FrameworkDiagnosticsSink, OperationDiagnostic, TransactionDiagnostic, } from "./runtime/diagnostics-reporter.js";
64
38
  export type { ExecutionOptions } from "./runtime/execution-options.js";
65
39
  export type { ComputedReadBehavior, ComputeOnCreate, ComputeOnRead, ComputeOnUpdate, } from "./runtime/field-behavior.js";
66
40
  export { FrameworkError } from "./runtime/framework-error.js";
67
41
  export type { JsonValue } from "./runtime/json-value.js";
68
- export type { ApplicationOperationRequest, ClientOperationRequest, ClientProtocolIdentity, FrameworkOperationRequest, OperationScope, } from "./runtime/operation-request.js";
69
- export type { Cause, OperationCode, OperationErrorCode, OperationFailureResponse, OperationInternalErrorCode, OperationNoMatchResponse, OperationResponse, OperationSuccessCode, OperationSuccessDataCode, OperationSuccessResponse, } from "./runtime/operation-response.js";
70
- export { OPERATION_CODES, operationFailure, operationNoMatch, operationSuccess, } from "./runtime/operation-response.js";
42
+ export type { FrameworkMisuseEvent, FrameworkMisuseSink, } from "./runtime/misuse-reporter.js";
43
+ export type { Cause, OperationCode, OperationErrorCode, OperationFailureResponse, OperationNoMatchResponse, OperationResponse, OperationSuccessCode, OperationSuccessDataCode, OperationSuccessResponse, } from "./runtime/operation-response.js";
71
44
  export type { AfterHook, BeforeHook, Filter, Guard, Interceptor, Pipe, PipelineContext, PipelineTransportContext, } from "./runtime/pipeline.js";
72
- export type { BuiltinNonRow, DeferredOperation, Operation, OperationFingerprint, OperationReferenceSurface, ReferenceableField, ReferenceBuilder, SingleRowResult, TransactionPlan, TransactionResults, TransactionRunner, } from "./transactions/deferred-operation.js";
73
- export type { OperationFingerprintNode } from "./transactions/operation-fingerprint.js";
74
- export { computeOperationFingerprint, isOperationFingerprint, } from "./transactions/operation-fingerprint.js";
45
+ export type { Operation, OperationReferenceSurface, ReferenceableField, ReferenceBuilder, SingleRowResult, TransactionResults, TransactionRunner, } from "./transactions/deferred-operation.js";
75
46
  export type { TransactionIntegrityViolation } from "./transactions/transaction-integrity-error.js";
76
47
  export { TransactionIntegrityError } from "./transactions/transaction-integrity-error.js";
77
- export type { TransactionCreateDataInput, TransactionOperationArgumentsFor, TransactionReference, TransactionReferenceCandidate, TransactionScalarValue, TransactionUpdateDataInput, } from "./transactions/transaction-reference.js";
78
- export { isTransactionReferenceCandidate, isTransactionReferenceObject, } from "./transactions/transaction-reference.js";
79
- export type { ApplicationTransactionRequest, ClientTransactionRequest, FrameworkTransactionRequest, } from "./transactions/transaction-request.js";
48
+ export type { TransactionReference } from "./transactions/transaction-reference.js";
80
49
  export type { TransactionCommittedResponse, TransactionResponse, } from "./transactions/transaction-response.js";
81
- export { transactionCommitted, transactionInfrastructureFailure, transactionOperationFailure, } from "./transactions/transaction-response.js";
82
50
  export type { TransactionSlotPathViolation } from "./transactions/transaction-slot-path-error.js";
83
51
  export { TransactionSlotPathError } from "./transactions/transaction-slot-path-error.js";
package/dist/index.js CHANGED
@@ -1,27 +1,7 @@
1
- export { compileContracts } from "./compiler/contract.compiler.js";
2
- export { resolveFrameworkConfig } from "./config/config.resolver.js";
3
- export { validateFrameworkConfig } from "./config/config.validator.js";
4
1
  export { defineFields } from "./config/define-fields.js";
5
- export { PROJECTION_SCOPES, WRITE_SCOPES, } from "./contracts/capability.js";
6
- export { validateClientContractStructure } from "./contracts/client-contract-structure.validator.js";
7
- export { CanonicalJsonError, canonicalizeContract, canonicalizeJson, } from "./contracts/contract-canonicalizer.js";
8
- export { computeClientContractHash, verifyClientContractHash, } from "./contracts/contract-hash.js";
9
- export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
10
- export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
11
- export { advertisedDirectives, advertisedDirectivesAt, advertisedReducers, advertisedReducersAt, holdsAt, holdsInAnyScope, } from "./contracts/field.js";
12
- export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
13
- export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
14
- export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
15
- export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
16
2
  export { createFramework } from "./framework/framework.factory.js";
17
3
  export { FrameworkConstructionError } from "./framework/framework-construction.error.js";
18
- export { validateOperationArguments } from "./operations/operation-validator.js";
19
- export { VALIDATION_CODE_MESSAGES, VALIDATION_CODES, } from "./operations/validation-code.js";
20
4
  export { Decimal } from "./runtime/decimal.js";
21
5
  export { FrameworkError } from "./runtime/framework-error.js";
22
- export { OPERATION_CODES, operationFailure, operationNoMatch, operationSuccess, } from "./runtime/operation-response.js";
23
- export { computeOperationFingerprint, isOperationFingerprint, } from "./transactions/operation-fingerprint.js";
24
6
  export { TransactionIntegrityError } from "./transactions/transaction-integrity-error.js";
25
- export { isTransactionReferenceCandidate, isTransactionReferenceObject, } from "./transactions/transaction-reference.js";
26
- export { transactionCommitted, transactionInfrastructureFailure, transactionOperationFailure, } from "./transactions/transaction-response.js";
27
7
  export { TransactionSlotPathError } from "./transactions/transaction-slot-path-error.js";
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `@aventara/core/internal` is not public API.
3
+ *
4
+ * It holds what Aventara's own packages (the adapters, the client generator,
5
+ * the testing kit) need from core and an application does not. It carries no
6
+ * stability promise: any export here may change or disappear in any release,
7
+ * including a patch release. Applications import from `@aventara/core`.
8
+ */
9
+ export type { AdapterField, AdapterLifecycleTrait, AdapterRelationField, AdapterScalarField, } from "./adapters/adapter-field.js";
10
+ export type { AdapterIdentifier, AdapterScalarFieldKey, } from "./adapters/adapter-identifier.js";
11
+ export type { AdapterOperation } from "./adapters/adapter-operation.js";
12
+ export type { AdapterOperationExecutor } from "./adapters/adapter-operation-executor.interface.js";
13
+ export type { AdapterFieldKey, AdapterFieldMap, AdapterResource, } from "./adapters/adapter-resource.js";
14
+ export { compileContracts } from "./compiler/contract.compiler.js";
15
+ export { resolveFrameworkConfig } from "./config/config.resolver.js";
16
+ export { PROJECTION_SCOPES, WRITE_SCOPES } from "./contracts/capability.js";
17
+ export { validateClientContractStructure } from "./contracts/client-contract-structure.validator.js";
18
+ export { CanonicalJsonError, canonicalizeContract, canonicalizeJson, } from "./contracts/contract-canonicalizer.js";
19
+ export type { ClientContractHashInput } from "./contracts/contract-hash.js";
20
+ export { computeClientContractHash, verifyClientContractHash, } from "./contracts/contract-hash.js";
21
+ export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
22
+ export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
23
+ export { advertisedDirectives, advertisedReducers } from "./contracts/field.js";
24
+ export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
25
+ export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
26
+ export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
27
+ export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
28
+ export type { ApplicationContractView } from "./framework/contract-view.js";
29
+ export type { SemanticOperationArguments } from "./operations/operation-validator.js";
30
+ export { VALIDATION_CODES } from "./operations/validation-code.js";
31
+ export type { ApplicationOperationRequest, ClientOperationRequest, ClientProtocolIdentity, FrameworkOperationRequest, } from "./runtime/operation-request.js";
32
+ export { OPERATION_CODES } from "./runtime/operation-response.js";
33
+ export type { BuiltinNonRow, OperationFingerprint, } from "./transactions/deferred-operation.js";
34
+ export { computeOperationFingerprint } from "./transactions/operation-fingerprint.js";
35
+ export type { ApplicationTransactionRequest, ClientTransactionRequest, FrameworkTransactionRequest, } from "./transactions/transaction-request.js";
@@ -0,0 +1,16 @@
1
+ export { compileContracts } from "./compiler/contract.compiler.js";
2
+ export { resolveFrameworkConfig } from "./config/config.resolver.js";
3
+ export { PROJECTION_SCOPES, WRITE_SCOPES } from "./contracts/capability.js";
4
+ export { validateClientContractStructure } from "./contracts/client-contract-structure.validator.js";
5
+ export { CanonicalJsonError, canonicalizeContract, canonicalizeJson, } from "./contracts/contract-canonicalizer.js";
6
+ export { computeClientContractHash, verifyClientContractHash, } from "./contracts/contract-hash.js";
7
+ export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
8
+ export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
9
+ export { advertisedDirectives, advertisedReducers } from "./contracts/field.js";
10
+ export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
11
+ export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
12
+ export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
13
+ export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
14
+ export { VALIDATION_CODES } from "./operations/validation-code.js";
15
+ export { OPERATION_CODES } from "./runtime/operation-response.js";
16
+ export { computeOperationFingerprint } from "./transactions/operation-fingerprint.js";