@aventara/core 0.1.0-pilot.3 → 0.1.0-pilot.4

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 (97) hide show
  1. package/dist/adapters/adapter-discovery-diagnostic.d.ts +2 -0
  2. package/dist/adapters/adapter-field.d.ts +3 -26
  3. package/dist/adapters/adapter-identifier.d.ts +1 -11
  4. package/dist/adapters/adapter-model.d.ts +4 -0
  5. package/dist/adapters/adapter-operation-executor.interface.d.ts +5 -1
  6. package/dist/adapters/adapter-resource.d.ts +7 -28
  7. package/dist/adapters/adapter.interface.d.ts +21 -26
  8. package/dist/compiler/contract-compiler-diagnostic.d.ts +2 -0
  9. package/dist/compiler/contract.compiler.d.ts +11 -22
  10. package/dist/config/any-framework-config.d.ts +5 -26
  11. package/dist/config/config-diagnostic.d.ts +2 -0
  12. package/dist/config/config-layer.d.ts +6 -19
  13. package/dist/config/config.resolver.d.ts +6 -14
  14. package/dist/config/config.validator.d.ts +6 -3
  15. package/dist/config/define-fields.d.ts +6 -46
  16. package/dist/config/effective-fields.d.ts +6 -29
  17. package/dist/config/entrypoint.normalizer.d.ts +6 -18
  18. package/dist/config/framework-behaviors-config.d.ts +11 -10
  19. package/dist/config/framework-config.d.ts +15 -15
  20. package/dist/config/framework-fields-config.d.ts +14 -7
  21. package/dist/config/framework-restrictions-config.d.ts +41 -61
  22. package/dist/config/pipeline-config.d.ts +7 -17
  23. package/dist/contracts/capability.d.ts +13 -49
  24. package/dist/contracts/client-contract-structure.validator.d.ts +7 -53
  25. package/dist/contracts/contract-canonicalizer.d.ts +4 -6
  26. package/dist/contracts/contract-hash.d.ts +3 -2
  27. package/dist/contracts/contract-limits.d.ts +7 -1
  28. package/dist/contracts/contract-protocol.d.ts +7 -8
  29. package/dist/contracts/contract.d.ts +13 -4
  30. package/dist/contracts/enum-definition.d.ts +2 -0
  31. package/dist/contracts/field.d.ts +30 -167
  32. package/dist/contracts/identifier.d.ts +1 -16
  33. package/dist/contracts/lifecycle-trait.d.ts +4 -3
  34. package/dist/contracts/resource-operations.d.ts +2 -62
  35. package/dist/contracts/resource.d.ts +2 -0
  36. package/dist/contracts/scalar-value-type.d.ts +16 -47
  37. package/dist/contracts/scalar.d.ts +4 -3
  38. package/dist/contracts/transaction-capability.d.ts +2 -0
  39. package/dist/contracts/wire-scalar-format.d.ts +6 -21
  40. package/dist/framework/contract-view.d.ts +30 -113
  41. package/dist/framework/framework-construction.error.d.ts +6 -1
  42. package/dist/framework/framework.d.ts +31 -46
  43. package/dist/framework/framework.factory.d.ts +3 -17
  44. package/dist/framework/operation-facade.d.ts +3 -7
  45. package/dist/operations/operation-arguments.d.ts +52 -207
  46. package/dist/operations/operation-call.d.ts +13 -15
  47. package/dist/operations/operation-identity.d.ts +4 -2
  48. package/dist/operations/operation-result.d.ts +15 -61
  49. package/dist/operations/operation-validator-core.d.ts +5 -4
  50. package/dist/operations/operation-validator.d.ts +5 -7
  51. package/dist/operations/projection-scope.resolver.d.ts +0 -10
  52. package/dist/operations/validation-code.d.ts +5 -17
  53. package/dist/operations/write-scope.resolver.d.ts +3 -28
  54. package/dist/protocol/absent-route.responder.d.ts +23 -38
  55. package/dist/protocol/av-protocol.d.ts +2 -8
  56. package/dist/protocol/contract-document.responder.d.ts +5 -18
  57. package/dist/protocol/http-request.decoder.d.ts +12 -59
  58. package/dist/protocol/http-request.reader.d.ts +5 -5
  59. package/dist/protocol/http-response.encoder.d.ts +14 -20
  60. package/dist/protocol/http-status.table.d.ts +0 -8
  61. package/dist/protocol/index.d.ts +2 -7
  62. package/dist/protocol/operation-response.guard.d.ts +0 -15
  63. package/dist/protocol/protocol-failure.d.ts +8 -27
  64. package/dist/protocol/protocol-headers.d.ts +15 -42
  65. package/dist/protocol/protocol-surface.d.ts +0 -22
  66. package/dist/protocol/protocol.binder.d.ts +16 -26
  67. package/dist/protocol/protocol.handler.d.ts +15 -23
  68. package/dist/runtime/decimal.d.ts +5 -3
  69. package/dist/runtime/diagnostics-reporter.d.ts +14 -34
  70. package/dist/runtime/error-boundary.d.ts +6 -10
  71. package/dist/runtime/execution-options.d.ts +3 -7
  72. package/dist/runtime/field-behavior.d.ts +12 -19
  73. package/dist/runtime/framework-error.d.ts +2 -2
  74. package/dist/runtime/json-value.d.ts +7 -15
  75. package/dist/runtime/mutation-planner.d.ts +6 -12
  76. package/dist/runtime/operation-request.d.ts +7 -0
  77. package/dist/runtime/operation-response.d.ts +18 -23
  78. package/dist/runtime/operation-runtime.d.ts +12 -27
  79. package/dist/runtime/pipeline.d.ts +14 -29
  80. package/dist/runtime/referential-action.d.ts +1 -26
  81. package/dist/runtime/request-id.d.ts +3 -10
  82. package/dist/runtime/scalar-runtime.d.ts +12 -12
  83. package/dist/transactions/deferred-operation.d.ts +10 -21
  84. package/dist/transactions/operation-arguments-encoder.d.ts +1 -0
  85. package/dist/transactions/operation-fingerprint.d.ts +3 -1
  86. package/dist/transactions/transaction-envelope.d.ts +2 -4
  87. package/dist/transactions/transaction-integrity-error.d.ts +4 -15
  88. package/dist/transactions/transaction-plan-assembler.d.ts +1 -0
  89. package/dist/transactions/transaction-plan-validator.d.ts +3 -17
  90. package/dist/transactions/transaction-reference-resolver.d.ts +9 -12
  91. package/dist/transactions/transaction-reference.d.ts +23 -28
  92. package/dist/transactions/transaction-request.d.ts +3 -5
  93. package/dist/transactions/transaction-response.d.ts +5 -7
  94. package/dist/transactions/transaction-runtime.d.ts +3 -3
  95. package/dist/transactions/transaction-slot-path-error.d.ts +5 -15
  96. package/dist/transactions/transaction-slot-writer.d.ts +3 -13
  97. package/package.json +1 -1
@@ -1,21 +1,5 @@
1
1
  import type { ClientProtocolIdentity } from "../runtime/operation-request.js";
2
- /**
3
- * `AvProtocol.headers` — the header names the protocol owns, as passive data.
4
- *
5
- * - `protocolVersion`, `contractHash`: the two identity headers every
6
- * generated-client resource and transaction request sends; the `_contract`
7
- * request needs neither.
8
- * - `requestId`: the correlation header. A valid one is adopted as the request's
9
- * id, an invalid one ignored, and every framework-produced response echoes it.
10
- *
11
- * Spelled as the canonical wire text. HTTP header names are case-insensitive, so a
12
- * reader matches them without regard to case; these spellings are what the
13
- * framework and the generated client SEND.
14
- *
15
- * Passive data: strings only, frozen, so a consumer — the client generator emits
16
- * it by value into generated source — can neither mutate it nor receive anything
17
- * `JSON.stringify` would drop or reshape.
18
- */
2
+ /** `AvProtocol.headers` — the header names the protocol owns, as passive data. */
19
3
  export declare const headers: Readonly<{
20
4
  readonly protocolVersion: "Aventara-Protocol-Version";
21
5
  readonly contractHash: "Aventara-Contract-Hash";
@@ -24,46 +8,35 @@ export declare const headers: Readonly<{
24
8
  /** A request's headers as a host hands them over (`AvProtocolRequest.headers`). */
25
9
  type ReceivedHeaders = Readonly<Record<string, string | readonly string[] | undefined>>;
26
10
  /**
27
- * The request's headers as one spelling: names lower-cased, a repeated header's
28
- * values — a list, or one name received in several casings — joined with `", "` in
29
- * the order received (RFC 9110 §5.3), and an `undefined` entry or an empty list
30
- * dropped as absent. Values are otherwise as received. This is what a client
31
- * request's `transport.headers` carries to the developer's pipelines, and what
32
- * every header read below reads.
33
- *
34
- * Built with `Object.fromEntries`, so a header named `__proto__` stays data.
11
+ * The request's headers as one spelling: names lower-cased, a repeated header's values
12
+ * — a list, or one name received in several casings — joined with `", "` in the order
13
+ * received, and an `undefined` entry or an empty list dropped as absent. Values are
14
+ * otherwise as received. This is what a client request's `transport.headers` carries
15
+ * to the developer's pipelines, and what every header read below reads.
35
16
  */
36
17
  export declare function normalizeHeaders(received: ReceivedHeaders): Readonly<Record<string, string>>;
37
18
  /**
38
- * One header's value as the framework reads it, from {@link normalizeHeaders}'
39
- * output: surrounding spaces and tabs are not part of a field value (RFC 9110
40
- * §5.5), so they are removed. `undefined` when the header is absent.
19
+ * One header's value as the framework reads it, from {@link normalizeHeaders}' output:
20
+ * surrounding spaces and tabs are not part of a field value, so they are removed.
21
+ * `undefined` when the header is absent.
41
22
  */
42
23
  export declare function headerValue(normalized: Readonly<Record<string, string>>, name: string): string | undefined;
43
24
  /**
44
25
  * The identity headers as the `ClientProtocolIdentity` core checks, or `undefined`
45
- * when either is ABSENT — a request without them is malformed: it does not say
46
- * which protocol and ClientContract it speaks, so there is nothing to compare.
47
- *
48
- * Present values are read, never judged: whether they match is the Framework
49
- * Validation Layer's call (cross-phase invariant 13), made by core's one
50
- * stale-client check. A present version that is not a decimal integer (no sign, no
51
- * leading zero) reads as `NaN`, so it cannot match (`A2006`); a present hash is
52
- * passed as received (`A2005` unless it is the current one). Present includes
53
- * empty: a header sent with no value was still sent.
26
+ * when either is ABSENT — a request without them is malformed: it does not say which
27
+ * protocol and ClientContract it speaks, so there is nothing to compare.
54
28
  */
55
29
  export declare function protocolIdentityOf(normalized: Readonly<Record<string, string>>): ClientProtocolIdentity | undefined;
56
30
  /**
57
- * The identity headers a request did not send, in the order the framework sends
58
- * them — what the `A2000` answering it names (pilot.1). Empty exactly when {@link
59
- * protocolIdentityOf} reads an identity.
31
+ * The identity headers a request did not send, in the order the framework sends them —
32
+ * what the `A2000` answering it names. Empty exactly when {@link protocolIdentityOf}
33
+ * reads an identity.
60
34
  */
61
35
  export declare function missingIdentityHeaders(normalized: Readonly<Record<string, string>>): readonly IdentityHeaderName[];
62
36
  /** The two identity headers' names, as the framework spells them. */
63
37
  export type IdentityHeaderName = (typeof headers)["protocolVersion"] | (typeof headers)["contractHash"];
64
38
  /**
65
- * A repeated header joins with `", "`, which holds a space, so it is never
66
- * adopted.
39
+ * A repeated header joins with `", "`, which holds a space, so it is never adopted.
67
40
  */
68
41
  export declare function adoptedRequestId(normalized: Readonly<Record<string, string>>): string | undefined;
69
42
  export {};
@@ -3,16 +3,6 @@ import { type OperationIdentity } from "../operations/operation-identity.js";
3
3
  /**
4
4
  * One route of the protocol surface: a route a host mounts for the bound
5
5
  * ClientContract, tagged by `kind`.
6
- *
7
- * - `operation`: a `(resource, family, variant)` the ClientContract advertises.
8
- * `method` is always `POST` — every Resource operation is, reads included.
9
- * `path` is `/_resources/<resource>/<family>/<variant>`, each segment
10
- * percent-encoded exactly as the generated client sends it, so it decodes back
11
- * to the exact registry key. Family and variant are one standard operation
12
- * identity.
13
- * - `contract`: `GET /_contract` — always present.
14
- * - `transactions`: `POST /_transactions` — present exactly when the
15
- * ClientContract's `transactions` is `"interactive"`.
16
6
  */
17
7
  export type SurfaceRoute = ({
18
8
  readonly kind: "operation";
@@ -33,17 +23,5 @@ export type SurfaceRoute = ({
33
23
  * deep-frozen — exactly the advertised operation triples in the Contract's own key
34
24
  * order, then `GET /_contract`, then `POST /_transactions` when, and only when,
35
25
  * `transactions === "interactive"`.
36
- *
37
- * Derived from the ClientContract alone — never configuration, the adapter model,
38
- * or another layer's Contract — so a client-hidden resource has no route, and a
39
- * resource whose every operation was restricted away keeps its `operations: {}`
40
- * and contributes nothing. Availability is read ONLY through
41
- * `isOperationVariantAvailable`, so a scope-qualified leaf is a route exactly as
42
- * `true` is, and the next widening of `OperationAvailability` reaches this reader
43
- * with every other. A family or variant key outside the standard operation set is
44
- * not a route: segments go through `parseOperationIdentity`, the same decoder that
45
- * reads a request's. The transaction route is tested against `"interactive"`
46
- * itself, never as "not `none`", so a capability value this reader does not know
47
- * mounts nothing.
48
26
  */
49
27
  export declare function surfaceOf(client: ClientContract): readonly SurfaceRoute[];
@@ -6,9 +6,8 @@ import { type AvProtocolResponse } from "./http-response.encoder.js";
6
6
  import { transportFailure } from "./protocol-failure.js";
7
7
  import { type SurfaceRoute } from "./protocol-surface.js";
8
8
  /**
9
- * The protocol bound to ONE Framework instance — what `AvProtocol.bind` returns. A
10
- * host binds once, at startup, and calls these members per request; none takes a
11
- * Contract, an entrypoint or a limit, because the binding already read them.
9
+ * The protocol bound to one Framework instance, as `AvProtocol.bind` returns
10
+ * it. Bind once at startup and call these members per request.
12
11
  */
13
12
  export type AvProtocolBinding = {
14
13
  /**
@@ -19,10 +18,6 @@ export type AvProtocolBinding = {
19
18
  * `transactions` is `"interactive"`. Each path is relative to
20
19
  * `framework.entrypoint`. Read once at bind time: every call answers the same
21
20
  * deep-frozen list, which is passive data a host may serialize.
22
- *
23
- * A host that mounts one route per entry still needs a fallback for the paths it
24
- * did not mount: that is the absence responder's, not a catch-all into framework
25
- * handling.
26
21
  */
27
22
  readonly surface: () => readonly SurfaceRoute[];
28
23
  /**
@@ -42,9 +37,9 @@ export type AvProtocolBinding = {
42
37
  readonly decodeTransaction: (request: AvProtocolRequest) => DecodedTransaction;
43
38
  /**
44
39
  * One operation's framework response — what `framework.execute` answered — as the
45
- * HTTP response a host writes: the code's status, `data` in wire forms,
46
- * `Aventara-Request-Id` echoed. A result with no wire form answers `A3003` → 500.
47
- * A diagnostic of one operation names it (`resource`, `family`, `variant`), so the
40
+ * HTTP response a host writes: the code's status, `data` in wire forms, `Aventara-
41
+ * Request-Id` echoed. A result with no wire form answers `A3003` → 500. A
42
+ * diagnostic of one operation names it (`resource`, `family`, `variant`), so the
48
43
  * `A3003` reaches the diagnostics sink only when the host passes `decoded` —
49
44
  * `decodeOperation`'s success value — as `handleOperation` does; without it the
50
45
  * answer is the same and nothing is reported.
@@ -59,9 +54,9 @@ export type AvProtocolBinding = {
59
54
  readonly encodeTransaction: (response: TransactionResponse, requestId: string) => AvProtocolResponse;
60
55
  /**
61
56
  * A transport code — `A2000`, `A2010`, `A2011` or `A2012` — as the complete
62
- * framework response, with framework-authored text (ruled 2026-10-05). For a host
63
- * that parses the body itself and must answer its parser's failure. `A2012`
64
- * requires the methods its route allows, so every 405 carries `Allow`.
57
+ * framework response. For a host that parses the body itself and must answer
58
+ * its parser's failure. `A2012` requires the methods its route allows, so
59
+ * every 405 carries `Allow`.
65
60
  */
66
61
  readonly failure: typeof transportFailure;
67
62
  /**
@@ -89,22 +84,17 @@ export type AvProtocolBinding = {
89
84
  */
90
85
  readonly encodeContract: (request: AvProtocolRequest) => AvProtocolResponse;
91
86
  /**
92
- * The absence responder: the fallback a host mounts for every path it did not
93
- * mount from `surface()` — never a catch-all into framework handling (it reads no
94
- * body, runs no pipeline, calls no Adapter). Answers what the catch-all decoder
95
- * answers before a body — `A2000`, `A2006`, `A2005`, `A2001`, `A2002`, `A2012`
96
- * with `Allow` — byte for byte; a route that exists reached with its own method as
97
- * `500 A3000` (a host that mounted only part of the surface); and `undefined` for
98
- * a path outside the protocol's namespace, which the host answers itself.
87
+ * The fallback for every path a host did not mount from `surface()`. It reads
88
+ * no body, runs no pipeline and calls no Adapter. It answers `A2000`, `A2006`,
89
+ * `A2005`, `A2001`, `A2002` or `A2012` (with `Allow`) as the operation routes
90
+ * would, `500 A3000` for a mounted route reached with its own method, and
91
+ * `undefined` for a path outside the protocol's namespace, which the host
92
+ * answers itself.
99
93
  */
100
94
  readonly answerAbsent: (request: AvProtocolRequest) => AvProtocolResponse | undefined;
101
95
  };
102
96
  /**
103
- * `AvProtocol.bind(framework)`: reads the instance's compiled ClientContract once
104
- * and returns the bound members, frozen.
105
- *
106
- * It validates nothing construction did not: `createFramework` already refused a
107
- * bad entrypoint and compiled the ClientContract this reads, so binding cannot
108
- * fail.
97
+ * `AvProtocol.bind(framework)`: reads the instance's compiled ClientContract
98
+ * once and returns the bound members, frozen.
109
99
  */
110
100
  export declare function bind(framework: Framework): AvProtocolBinding;
@@ -5,8 +5,8 @@ import type { ClientOperationRequest } from "../runtime/operation-request.js";
5
5
  import { type AvProtocolRequest } from "./http-request.decoder.js";
6
6
  import { type AvProtocolResponse, type UnencodableReport } from "./http-response.encoder.js";
7
7
  /**
8
- * What the shortcuts read off the bound Framework: its compiled Contracts, the
9
- * execution seam, and its configured diagnostics sink.
8
+ * What the shortcuts read off the bound Framework: its compiled Contracts, its
9
+ * execution entry points and its configured diagnostics sink.
10
10
  */
11
11
  export type HandlerContext = {
12
12
  readonly contracts: FrameworkContracts;
@@ -15,34 +15,26 @@ export type HandlerContext = {
15
15
  readonly sink: FrameworkDiagnosticsSink | undefined;
16
16
  };
17
17
  /**
18
- * Where a plan's `A3003` goes: the Framework's diagnostics sink, as a
19
- * `"transaction"` diagnostic — client scope, the request id the plan ran under,
20
- * and the step the encoder blames as `operation` when it blames one. One spelling
21
- * for both `protocol.encodeTransaction` and `protocol.handleTransaction`.
18
+ * Where a plan's `A3003` goes: the Framework's diagnostics sink, as a `"transaction"`
19
+ * diagnostic — client scope, the request id the plan ran under, and the step the
20
+ * encoder blames as `operation` when it blames one. One spelling for both
21
+ * `protocol.encodeTransaction` and `protocol.handleTransaction`.
22
22
  */
23
23
  export declare function planUnencodableReport(sink: FrameworkDiagnosticsSink | undefined, requestId: string): UnencodableReport;
24
24
  /**
25
25
  * Where one operation's `A3003` goes: the Framework's diagnostics sink, as an
26
- * `"operation"` diagnostic carrying the decoded request's identity and id — the
27
- * shape the public `OperationDiagnostic` already has. One spelling for
26
+ * `"operation"` diagnostic carrying the decoded request's identity and id — the shape
27
+ * the public `OperationDiagnostic` already has. One spelling for
28
28
  * `protocol.handleOperation` and for `protocol.encodeOperation` given the decoded
29
29
  * request.
30
30
  */
31
31
  export declare function operationUnencodableReport(sink: FrameworkDiagnosticsSink | undefined, request: ClientOperationRequest): UnencodableReport;
32
32
  /**
33
- * `protocol.handleOperation(request)`: the three steps a host would otherwise
34
- * spell out — `decodeOperation` → `framework.execute` → `encodeOperation` — in one
35
- * call, resolving the `AvProtocolResponse` the host writes. A request the decoder
36
- * answers itself (a transport failure, an identity mismatch, an unadvertised
37
- * route) is answered without executing.
38
- *
39
- * Total over ANY value, never rejecting: the decoder answers every value,
40
- * `execute` resolves for every request it is handed, and the encoder answers every
41
- * response — a result with no wire form as `A3003` →
42
- * 500. That `A3003` reaches the Framework's diagnostics sink as an `"operation"`
43
- * diagnostic carrying the decoded request's identity and id, which only this
44
- * shortcut holds: the bare `encodeOperation` is given the response and the
45
- * request id alone.
33
+ * `protocol.handleOperation(request)`: the three steps a host would otherwise spell
34
+ * out — `decodeOperation` → `framework.execute` → `encodeOperation` — in one call,
35
+ * resolving the `AvProtocolResponse` the host writes. A request the decoder answers
36
+ * itself (a transport failure, an identity mismatch, an unadvertised route) is
37
+ * answered without executing.
46
38
  */
47
39
  export declare function handleOperationRequest(context: HandlerContext, request: AvProtocolRequest): Promise<AvProtocolResponse>;
48
40
  /**
@@ -51,8 +43,8 @@ export declare function handleOperationRequest(context: HandlerContext, request:
51
43
  * decoded plan is client origin and cannot say otherwise, so every step runs under
52
44
  * ClientContract rules: a client-hidden field, a client-restricted variant or a
53
45
  * client-hidden Resource is refused as through its single-operation route, plus
54
- * `cause.operation`. A committed plan is `200 A1009`; a rolled-back one answers
55
- * its failing step's code at that code's status. Total over any value, as {@link
46
+ * `cause.operation`. A committed plan is `200 A1009`; a rolled-back one answers its
47
+ * failing step's code at that code's status. Total over any value, as {@link
56
48
  * handleOperationRequest} is; an `A3003` is reported through {@link
57
49
  * planUnencodableReport}.
58
50
  */
@@ -1,12 +1,14 @@
1
- /** Provider-neutral exact decimal runtime value owned by Aventara. */
1
+ /**
2
+ * An exact decimal value, independent of any database driver's decimal class.
3
+ * Results carry `decimal` fields as `Decimal`.
4
+ */
2
5
  export declare class Decimal {
3
6
  #private;
4
7
  constructor(value: string);
5
8
  toString(): string;
6
9
  /**
7
10
  * The decimal string, exactly as given: what `JSON.stringify` writes for a
8
- * Decimal, so a result a developer serializes by hand carries its digits rather
9
- * than `{}`. The protocol's encoders do not rely on it.
11
+ * Decimal, so a result serialized by hand keeps its digits.
10
12
  */
11
13
  toJSON(): string;
12
14
  }
@@ -4,13 +4,9 @@ import type { FrameworkTransactionRequest } from "../transactions/transaction-re
4
4
  import type { FrameworkOperationRequest } from "./operation-request.js";
5
5
  import type { OperationErrorCode } from "./operation-response.js";
6
6
  /**
7
- * One unplanned failure as the framework saw it before sanitization: the raw
8
- * value, the outcome code actually emitted, and enough identity to act on it. The
9
- * code is usually an internal one, because the channel fires for unplanned
10
- * failures; it is the thrower's own code when the framework dropped something it
11
- * could not vouch for from an otherwise honoured deliberate outcome, which changes
12
- * no outcome. Server-side only — a diagnostic is never projected onto the wire,
13
- * which is precisely why it may carry the raw error.
7
+ * One unplanned failure of an operation: the raw error, the code the caller
8
+ * received, and the operation and request it happened in. Server-side only:
9
+ * diagnostics are never sent to the caller.
14
10
  */
15
11
  export type OperationDiagnostic = {
16
12
  readonly kind: "operation";
@@ -23,6 +19,10 @@ export type OperationDiagnostic = {
23
19
  readonly requestId: string;
24
20
  readonly operation?: number;
25
21
  };
22
+ /**
23
+ * One unplanned failure of a transaction: the raw error, the code the caller
24
+ * received, and the step it is blamed on (`operation`) when there is one.
25
+ */
26
26
  export type TransactionDiagnostic = {
27
27
  readonly kind: "transaction";
28
28
  readonly error: unknown;
@@ -31,11 +31,11 @@ export type TransactionDiagnostic = {
31
31
  readonly requestId: string;
32
32
  readonly operation?: number;
33
33
  };
34
+ /** One diagnostic: of an operation, or of a transaction as a whole. */
34
35
  export type FrameworkDiagnostic = OperationDiagnostic | TransactionDiagnostic;
35
36
  /**
36
- * The framework-owned observability channel. Configured once at the
37
- * configuration root: it is deliberately not a pipeline stage, so the
38
- * developer whose bug it reports cannot reorder, scope or remove it.
37
+ * Receives a diagnostic for every unplanned failure. Set once, as the root
38
+ * configuration's `diagnostics`.
39
39
  */
40
40
  export type FrameworkDiagnosticsSink = (diagnostic: FrameworkDiagnostic) => void | Promise<void>;
41
41
  /**
@@ -47,38 +47,18 @@ export type DiagnosticsReporter = (error: unknown, code: OperationErrorCode) =>
47
47
  /** The identifying half of a diagnostic, captured once per request. */
48
48
  type OperationDiagnosticIdentity = Omit<OperationDiagnostic, "error" | "code">;
49
49
  type TransactionDiagnosticIdentity = Omit<TransactionDiagnostic, "error" | "code">;
50
- /**
51
- * The channel bound to one diagnostic identity, as the reporters below bind
52
- * it. Exported for `@aventara/core/protocol`, whose binding reports a failure
53
- * only it can meet — a result with no wire form (`A3003`) — under the
54
- * identity it holds; never exported from the main entry.
55
- */
50
+ /** The diagnostics channel bound to one diagnostic identity. */
56
51
  export declare function createReporter(sink: FrameworkDiagnosticsSink | undefined, identity: OperationDiagnosticIdentity | TransactionDiagnosticIdentity): DiagnosticsReporter;
57
52
  /** Records the sink `framework` was configured with; called once, at construction. */
58
53
  export declare function recordDiagnosticsSink(framework: object, sink: FrameworkDiagnosticsSink | undefined): void;
59
54
  /** The sink `framework` was configured with, or `undefined` for none. */
60
55
  export declare function diagnosticsSinkOf(framework: object): FrameworkDiagnosticsSink | undefined;
61
56
  /**
62
- * Binds the configured sink to one operation request.
63
- *
64
- * Identity is captured on entry rather than at report time: by the moment a
65
- * failure is reported the request may be exactly what broke, and a diagnostic
66
- * naming no operation is not actionable. A request whose own identity cannot
67
- * be read is past observing, so it silently yields the no-op channel — the
68
- * outermost totality guard still answers with the generic envelope.
69
- *
70
- * The response must be unaffected by observation, so the reporter neither
71
- * awaits the sink nor lets anything the sink does escape: a throw, a rejected
72
- * promise and a booby-trapped thenable all end here.
57
+ * Binds the configured sink to one operation request. The sink is not awaited,
58
+ * and nothing it throws or rejects with reaches the response.
73
59
  */
74
60
  export declare function createDiagnosticsReporter(sink: FrameworkDiagnosticsSink | undefined, request: FrameworkOperationRequest, operation?: number): DiagnosticsReporter;
75
- /**
76
- * The diagnostics channel of one transaction request. Like the operation
77
- * executor's reporter, it is bound by the framework factory, so the
78
- * transaction executor owns no channel and never reads configuration: it only
79
- * chooses which identity a report carries. The plan's identity is captured
80
- * once, on entry, for the same reason the operation reporter captures its own.
81
- */
61
+ /** The diagnostics channel of one transaction request. */
82
62
  export type TransactionDiagnosticsChannel = {
83
63
  /** A plan-level report; `operation` attributes it to a recorded failing index. */
84
64
  readonly transaction: (operation?: number) => DiagnosticsReporter;
@@ -5,11 +5,7 @@ import type { Filter, PipelineContext } from "./pipeline.js";
5
5
  export type FailureOrigin = "adapter" | "runtime";
6
6
  /** The one generic Adapter-failure text; every unexpected A3001 carries it. */
7
7
  export declare const ADAPTER_FAILURE_MESSAGE = "Adapter execution failed.";
8
- /**
9
- * Structurally records every value thrown across the Adapter seam so the
10
- * final error boundary can classify origin by identity, never by inspecting
11
- * error text. One boundary instance belongs to one operation execution.
12
- */
8
+ /** One boundary instance belongs to one operation execution. */
13
9
  export declare class AdapterBoundary {
14
10
  #private;
15
11
  /** Runs Adapter work, remembering anything it throws before re-throwing it. */
@@ -43,10 +39,10 @@ export type CallerArgumentsView = {
43
39
  */
44
40
  export declare function sanitizeOperationFailure(error: unknown, origin: FailureOrigin, report: DiagnosticsReporter, view: CallerArgumentsView): OperationFailureResponse;
45
41
  /**
46
- * Post-validation exception flow (spec 17.3): effective filters are stored as
47
- * `[root..., scoped...]`, so reverse iteration tries scoped filters in reverse
48
- * registration order, then root filters in reverse, then final sanitization.
49
- * A filter handles an error only by returning a {@link FrameworkError};
50
- * returning `undefined` or throwing leaves the original error unhandled.
42
+ * Post-validation exception flow: effective filters are stored as `[root...,
43
+ * scoped...]`, so reverse iteration tries scoped filters in reverse registration
44
+ * order, then root filters in reverse, then final sanitization. A filter handles an
45
+ * error only by returning a {@link FrameworkError}; returning `undefined` or throwing
46
+ * leaves the original error unhandled.
51
47
  */
52
48
  export declare function resolveOperationFailure(error: unknown, filters: readonly Filter[], context: PipelineContext, boundary: AdapterBoundary, report: DiagnosticsReporter, view: CallerArgumentsView): Promise<OperationFailureResponse>;
@@ -1,11 +1,7 @@
1
1
  /**
2
- * The caller's say over an in-process request it does not write by hand: the
3
- * second argument of every `framework.application.*` / `framework.client.*` call
4
- * and of `framework.transaction`.
5
- *
6
- * Not "transport options": an in-process call has no transport. A deferred handle
7
- * (`framework.appTx.*` / `framework.clientTx.*`) takes none — a handle is not a
8
- * request, and the id belongs to the run that executes it.
2
+ * Options for one in-process call: the optional second argument of every
3
+ * `framework.application.*` / `framework.client.*` call and of
4
+ * `framework.transaction`.
9
5
  */
10
6
  export type ExecutionOptions = {
11
7
  /**
@@ -6,17 +6,6 @@ import type { FrameworkResourceKey } from "../config/framework-fields-config.js"
6
6
  import type { PipelineContext } from "./pipeline.js";
7
7
  /**
8
8
  * What a write-stage compute callback is told about the field it is computing.
9
- *
10
- * `R` is the Resource the behavior is bound to and `Cfg` the authored
11
- * configuration literal, so `resource` is the literal Resource name and `field` —
12
- * like every other field-key position in the framework — is {@link
13
- * EffectiveFieldKey}: what the adapter discovered plus what the configuration
14
- * added.
15
- *
16
- * `data` is keyed on the same set and stays `unknown`-valued.
17
- *
18
- * Under the default `Cfg` the key set degenerates to `string` and this is
19
- * byte-for-byte the shape it was before `Cfg` existed.
20
9
  */
21
10
  type ComputedWriteContext<M extends AdapterModel, Cfg, R extends FrameworkResourceKey<M>> = {
22
11
  readonly scope: RequestOrigin;
@@ -26,11 +15,19 @@ type ComputedWriteContext<M extends AdapterModel, Cfg, R extends FrameworkResour
26
15
  readonly data: Readonly<Record<EffectiveFieldKey<M, Cfg, R>, unknown>>;
27
16
  readonly operation: PipelineContext;
28
17
  };
18
+ /**
19
+ * Computes a field's value when a row is created. It receives the incoming
20
+ * `data` and returns the value to store.
21
+ */
29
22
  export type ComputeOnCreate<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: ComputedWriteContext<M, Cfg, R>) => unknown | Promise<unknown>;
23
+ /**
24
+ * Computes a field's value when a row is updated. It receives the incoming
25
+ * `data` and returns the value to store.
26
+ */
30
27
  export type ComputeOnUpdate<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: ComputedWriteContext<M, Cfg, R>) => unknown | Promise<unknown>;
31
28
  /**
32
- * The read-stage counterpart. It sees the persisted `record` rather than the
33
- * inbound `data`, keyed on the same effective field set.
29
+ * Computes a field's value when a row is read. It receives the stored `record`
30
+ * and returns the value to return.
34
31
  */
35
32
  export type ComputeOnRead<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: {
36
33
  readonly scope: RequestOrigin;
@@ -41,12 +38,8 @@ export type ComputeOnRead<M extends AdapterModel = AdapterModel, Cfg = AnyFramew
41
38
  readonly operation: PipelineContext;
42
39
  }) => unknown | Promise<unknown>;
43
40
  /**
44
- * A computed read, optionally declaring the fields it reads.
45
- *
46
- * `dependsOn` is a field-key position and therefore keys on
47
- * {@link EffectiveFieldKey} like every other one. A name outside that set is
48
- * an array-element assignability failure (`TS2322`), not an excess property:
49
- * the author wrote a `string` where a member of the key union was required.
41
+ * A computed read: a compute function, or `{ compute, dependsOn }` naming the
42
+ * fields it reads.
50
43
  */
51
44
  export type ComputedReadBehavior<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = ComputeOnRead<M, Cfg, R> | {
52
45
  readonly dependsOn?: readonly EffectiveFieldKey<M, Cfg, R>[];
@@ -1,7 +1,7 @@
1
1
  import type { Cause, OperationErrorCode } from "./operation-response.js";
2
2
  /**
3
- * Stable typed error used by server-side pipelines, behaviors and Adapters to
4
- * deliberately surface one framework error outcome.
3
+ * Throw from a pipeline, behavior or Adapter to answer the request with one
4
+ * framework error code and cause.
5
5
  */
6
6
  export declare class FrameworkError extends Error {
7
7
  readonly code: OperationErrorCode;
@@ -1,22 +1,14 @@
1
1
  /**
2
- * A JSON value: the runtime form of the `json` scalar, inside and out.
2
+ * A JSON value: the form of the `json` scalar, in arguments and results.
3
3
  *
4
- * It is exactly what `normalizeJsonValue` (`runtime/scalar-runtime.ts`) admits,
5
- * and that traversal emits only this type, so the runtime and the type are one
6
- * fact rather than two that agree. Measured in all three scopes alike: a `Date`,
7
- * a `bigint`, a `Uint8Array`, core's `Decimal`, any other class instance and an
8
- * `undefined` property are refused (`V1001`), and none of them is a member here.
4
+ * A `Date`, a `bigint`, a `Uint8Array`, a {@link Decimal}, any other class
5
+ * instance and an `undefined` property are refused (`V1001`), as are a
6
+ * non-finite `number` (`V1004`) and a cycle (`V1001`).
9
7
  *
10
- * Two runtime refusals a type cannot carry: a non-finite `number` (`V1004`) and
11
- * a cycle (`V1001`).
8
+ * Results are fresh plain copies, so mutating one is safe.
12
9
  *
13
- * The containers are `readonly`, which an input accepts in either form and a
14
- * result under-claims: the framework hands back a fresh plain copy, so mutating
15
- * one is safe, but nothing is promised about it.
16
- *
17
- * A `json` FIELD's form is this without its top-level `null`
18
- * (`ApplicationScalarForms["json"]`): a field-level `null` is the field's
19
- * absence, which only `nullable: true` admits.
10
+ * A `json` field's value is this without its top-level `null`: a field-level
11
+ * `null` is the field's absence, which only `nullable: true` admits.
20
12
  */
21
13
  export type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
22
14
  readonly [key: string]: JsonValue;
@@ -4,11 +4,10 @@ import type { Contract, CoreContract } from "../contracts/contract.js";
4
4
  import type { OperationExecutionRequest } from "./operation-request.js";
5
5
  import type { PipelineContext } from "./pipeline.js";
6
6
  /**
7
- * The two Contracts a write reads. The **Core** Contract decides what the Adapter
8
- * is asked to store; the **active** Contract adds the fields its scope declared
9
- * under `application.fields` / `client.fields`, which Core does not carry. Such a
10
- * field is VIRTUAL by construction (`contract.compiler.ts`), so its behaviours run
11
- * and its value is stripped before the Adapter call — never sent.
7
+ * The two Contracts a write reads. The Core Contract decides what the Adapter is asked
8
+ * to store; the active Contract adds the fields its scope declared under
9
+ * `application.fields` / `client.fields`, which Core does not carry. Such a field is
10
+ * virtual: its behaviours run and its value is stripped before the Adapter call.
12
11
  */
13
12
  export type WriteContracts = {
14
13
  readonly core: CoreContract;
@@ -21,13 +20,8 @@ export type RelationRecordSite = {
21
20
  readonly stage: WriteStage;
22
21
  };
23
22
  /**
24
- * The sole grammar for relation-mutation record operands. Every write pass
25
- * maps these sites with its own record leaf, leaving identifier-only
26
- * directives untouched. The identifier operands this table deliberately leaves
27
- * empty are described by `RELATION_MUTATION_SELECTOR_SITES` in
28
- * `transactions/operation-arguments-encoder.ts`, the only pass that has to
29
- * encode them; both tables are keyed by `RelationMutationDirective`, so a new
30
- * directive fails to compile in both places.
23
+ * The sole grammar for relation-mutation record operands. Every write pass maps these
24
+ * sites with its own record leaf, leaving identifier-only directives untouched.
31
25
  */
32
26
  export declare const RELATION_MUTATION_RECORD_SITES: {
33
27
  readonly $create: readonly [{
@@ -7,6 +7,7 @@ import type { PipelineTransportContext } from "./pipeline.js";
7
7
  * `ConfigLayer`; kept as an alias so existing consumers keep compiling.
8
8
  */
9
9
  export type OperationScope = RequestOrigin;
10
+ /** The protocol version and ClientContract hash a client says it was built for. */
10
11
  export type ClientProtocolIdentity = {
11
12
  readonly version: number;
12
13
  readonly hash: string;
@@ -16,16 +17,22 @@ type RuntimeOperationBase = OperationIdentity & {
16
17
  readonly arguments: unknown;
17
18
  readonly requestId: string;
18
19
  };
20
+ /** An in-process request, run under the Application Contract. */
19
21
  export type ApplicationOperationRequest = RuntimeOperationBase & {
20
22
  readonly scope: "application";
21
23
  readonly protocol?: never;
22
24
  readonly transport?: never;
23
25
  };
26
+ /**
27
+ * A remote request, run under the Client Contract; `protocol` is the identity
28
+ * the client sent.
29
+ */
24
30
  export type ClientOperationRequest = RuntimeOperationBase & {
25
31
  readonly scope: "client";
26
32
  readonly protocol: ClientProtocolIdentity;
27
33
  readonly transport?: PipelineTransportContext;
28
34
  };
35
+ /** One operation request, as `framework.execute` takes it. */
29
36
  export type FrameworkOperationRequest = ApplicationOperationRequest | ClientOperationRequest;
30
37
  type WithoutArguments<Request> = Request extends unknown ? Omit<Request, "arguments"> : never;
31
38
  /**