@aventara/core 1.0.0-rc.0 → 1.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2068 -1
- package/ERRORS.md +142 -0
- package/README.md +485 -60
- package/dist/adapters/adapter-discovery-diagnostic.d.ts +4 -4
- package/dist/adapters/adapter-discovery-diagnostic.guidance.d.ts +6 -0
- package/dist/adapters/adapter-discovery-diagnostic.guidance.js +7 -0
- package/dist/adapters/adapter-field.d.ts +33 -11
- package/dist/adapters/adapter-identifier.d.ts +15 -6
- package/dist/adapters/adapter-identifier.js +6 -1
- package/dist/adapters/adapter-model.d.ts +18 -9
- package/dist/adapters/adapter-operation-executor.interface.d.ts +4 -4
- package/dist/adapters/adapter-operation.d.ts +21 -6
- package/dist/adapters/adapter-resource.d.ts +23 -9
- package/dist/adapters/adapter-sql-statement.d.ts +19 -0
- package/dist/adapters/adapter-transaction-executor.interface.d.ts +19 -0
- package/dist/adapters/adapter.interface.d.ts +59 -29
- package/dist/avz/avz-check.factory.d.ts +83 -0
- package/dist/avz/avz-check.factory.js +116 -0
- package/dist/avz/avz-check.registry.d.ts +35 -0
- package/dist/avz/avz-check.registry.js +9 -0
- package/dist/avz/avz.d.ts +203 -0
- package/dist/{json → avz}/avz.js +150 -8
- package/dist/{json → avz}/index.d.ts +2 -1
- package/dist/{json → avz}/json-shape.registry.d.ts +9 -8
- package/dist/{json → avz}/zod-issue.translator.d.ts +8 -2
- package/dist/{json → avz}/zod-issue.translator.js +7 -0
- package/dist/compiler/contract-compiler-diagnostic.d.ts +31 -5
- package/dist/compiler/contract-compiler-diagnostic.guidance.d.ts +6 -0
- package/dist/compiler/contract-compiler-diagnostic.guidance.js +97 -0
- package/dist/compiler/contract.compiler.d.ts +23 -17
- package/dist/compiler/contract.compiler.js +753 -443
- package/dist/compiler/create-requirements.projector.d.ts +49 -0
- package/dist/compiler/create-requirements.projector.js +423 -0
- package/dist/compiler/field-validator.compiler.d.ts +47 -0
- package/dist/compiler/field-validator.compiler.js +238 -0
- package/dist/compiler/managed-elsewhere.projector.d.ts +52 -0
- package/dist/compiler/managed-elsewhere.projector.js +179 -0
- package/dist/compiler/managed-elsewhere.validator.d.ts +9 -0
- package/dist/compiler/managed-elsewhere.validator.js +74 -0
- package/dist/config/any-framework-config.d.ts +19 -12
- package/dist/config/computed-fields.d.ts +62 -0
- package/dist/config/computed-fields.js +73 -0
- package/dist/config/config-diagnostic.d.ts +11 -4
- package/dist/config/config-diagnostic.guidance.d.ts +6 -0
- package/dist/config/config-diagnostic.guidance.js +32 -0
- package/dist/config/config-layer.d.ts +15 -6
- package/dist/config/config.resolver.d.ts +98 -31
- package/dist/config/config.resolver.js +173 -44
- package/dist/config/config.validator.d.ts +7 -7
- package/dist/config/config.validator.js +792 -69
- package/dist/config/define-resource.d.ts +53 -0
- package/dist/config/define-resource.js +14 -0
- package/dist/config/effective-fields.d.ts +19 -23
- package/dist/config/entrypoint.normalizer.d.ts +4 -3
- package/dist/config/exact-framework-config.d.ts +325 -0
- package/dist/config/field-compute.resolver.d.ts +21 -0
- package/dist/config/field-compute.resolver.js +123 -0
- package/dist/config/field-pipeline-config.d.ts +47 -0
- package/dist/config/forced-operation.validator.d.ts +10 -0
- package/dist/config/forced-operation.validator.js +66 -0
- package/dist/config/framework-config.d.ts +148 -39
- package/dist/config/framework-exemptions-config.d.ts +91 -0
- package/dist/config/framework-exemptions-config.js +1 -0
- package/dist/config/framework-field-definition.d.ts +78 -0
- package/dist/config/framework-field-definition.js +28 -0
- package/dist/config/framework-resources-config.d.ts +127 -0
- package/dist/config/framework-resources-config.js +1 -0
- package/dist/config/pipeline-config.d.ts +56 -20
- package/dist/config/pipeline-tree.resolver.d.ts +79 -0
- package/dist/config/pipeline-tree.resolver.js +220 -0
- package/dist/config/stage-type.eraser.d.ts +65 -0
- package/dist/config/stage-type.eraser.js +1 -0
- package/dist/contracts/access-route.rules.d.ts +10 -0
- package/dist/contracts/access-route.rules.js +45 -0
- package/dist/contracts/capability.d.ts +37 -12
- package/dist/contracts/capability.js +20 -0
- package/dist/contracts/client-contract-structure.validator.d.ts +621 -114
- package/dist/contracts/client-contract-structure.validator.js +189 -10
- package/dist/contracts/contract-access.d.ts +29 -0
- package/dist/contracts/contract-access.js +1 -0
- package/dist/contracts/contract-canonicalizer.d.ts +27 -3
- package/dist/contracts/contract-canonicalizer.js +168 -29
- package/dist/contracts/contract-hash.d.ts +11 -7
- package/dist/contracts/contract-hash.js +4 -3
- package/dist/contracts/contract-limits.d.ts +4 -1
- package/dist/contracts/contract-limits.js +1 -0
- package/dist/contracts/contract-lookup.d.ts +5 -5
- package/dist/contracts/contract-protocol.d.ts +4 -4
- package/dist/contracts/contract.d.ts +51 -17
- package/dist/contracts/create-requirements.d.ts +35 -0
- package/dist/contracts/create-requirements.js +1 -0
- package/dist/contracts/enum-definition.d.ts +1 -1
- package/dist/contracts/field-check.d.ts +101 -0
- package/dist/contracts/field-check.js +1 -0
- package/dist/contracts/field.d.ts +109 -42
- package/dist/contracts/identifier.d.ts +4 -4
- package/dist/contracts/json-schema.projector.d.ts +11 -0
- package/dist/contracts/json-schema.projector.js +78 -0
- package/dist/contracts/json-shape.d.ts +12 -1
- package/dist/contracts/lifecycle-trait.d.ts +2 -2
- package/dist/contracts/resource-operations.d.ts +28 -28
- package/dist/contracts/resource.d.ts +15 -9
- package/dist/contracts/scalar-value-type.d.ts +17 -15
- package/dist/contracts/scalar.d.ts +3 -3
- package/dist/contracts/transaction-capability.d.ts +1 -1
- package/dist/contracts/wire-scalar-format.d.ts +4 -4
- package/dist/framework/access-facade.d.ts +116 -0
- package/dist/framework/access-facade.js +120 -0
- package/dist/framework/contract-view.d.ts +315 -145
- package/dist/framework/framework-construction.error.d.ts +21 -11
- package/dist/framework/framework-construction.error.js +20 -4
- package/dist/framework/framework.d.ts +71 -26
- package/dist/framework/framework.factory.d.ts +8 -6
- package/dist/framework/framework.factory.js +150 -38
- package/dist/framework/operation-facade.d.ts +192 -54
- package/dist/framework/operation-facade.js +10 -1
- package/dist/index.d.ts +67 -50
- package/dist/index.js +7 -6
- package/dist/internal.d.ts +20 -10
- package/dist/internal.js +9 -1
- package/dist/operations/database-refusal.d.ts +51 -0
- package/dist/operations/database-refusal.js +45 -0
- package/dist/operations/operation-arguments.d.ts +381 -228
- package/dist/operations/operation-call.d.ts +31 -28
- package/dist/operations/operation-identity.d.ts +10 -10
- package/dist/operations/operation-result.d.ts +25 -23
- package/dist/operations/operation-validator-core.d.ts +6 -6
- package/dist/operations/operation-validator-core.js +172 -38
- package/dist/operations/operation-validator.d.ts +10 -10
- package/dist/operations/projection-scope.resolver.d.ts +6 -6
- package/dist/operations/structural-limits.walker.d.ts +7 -7
- package/dist/operations/structural-limits.walker.js +145 -0
- package/dist/operations/validation-code.d.ts +11 -6
- package/dist/operations/validation-code.guidance.d.ts +6 -0
- package/dist/operations/validation-code.guidance.js +90 -0
- package/dist/operations/validation-code.js +4 -0
- package/dist/operations/write-scope.resolver.d.ts +10 -6
- package/dist/operations/write-scope.resolver.js +2 -0
- package/dist/policy/access-provider.interface.d.ts +91 -0
- package/dist/policy/access-provider.interface.js +1 -0
- package/dist/policy/access-provider.registry.d.ts +17 -0
- package/dist/policy/access-provider.registry.js +15 -0
- package/dist/policy/access-question.d.ts +20 -0
- package/dist/policy/access-question.js +1 -0
- package/dist/policy/access-question.registry.d.ts +5 -0
- package/dist/policy/access-question.registry.js +19 -0
- package/dist/policy/access-question.runtime.d.ts +36 -0
- package/dist/policy/access-question.runtime.js +297 -0
- package/dist/policy/access-verb.table.d.ts +56 -0
- package/dist/policy/access-verb.table.js +21 -0
- package/dist/policy/access-verbs.d.ts +46 -0
- package/dist/policy/access-verbs.js +1 -0
- package/dist/policy/policy-admission.d.ts +20 -0
- package/dist/policy/policy-admission.js +409 -0
- package/dist/policy/policy-after-update.runtime.d.ts +79 -0
- package/dist/policy/policy-after-update.runtime.js +208 -0
- package/dist/policy/policy-condition.d.ts +15 -0
- package/dist/policy/policy-condition.js +36 -0
- package/dist/policy/policy-engine.d.ts +205 -0
- package/dist/policy/policy-engine.js +1 -0
- package/dist/policy/policy-named-rows.d.ts +18 -0
- package/dist/policy/policy-named-rows.js +51 -0
- package/dist/policy/policy-nested-write.runtime.d.ts +44 -0
- package/dist/policy/policy-nested-write.runtime.js +545 -0
- package/dist/policy/policy-read.runtime.d.ts +81 -0
- package/dist/policy/policy-read.runtime.js +503 -0
- package/dist/policy/policy-reference-write.runtime.d.ts +51 -0
- package/dist/policy/policy-reference-write.runtime.js +345 -0
- package/dist/policy/policy-request.d.ts +41 -0
- package/dist/policy/policy-request.js +63 -0
- package/dist/policy/policy-session.d.ts +106 -0
- package/dist/policy/policy-session.js +295 -0
- package/dist/policy/policy-startup.validator.d.ts +10 -0
- package/dist/policy/policy-startup.validator.js +112 -0
- package/dist/policy/policy-write.runtime.d.ts +39 -0
- package/dist/policy/policy-write.runtime.js +532 -0
- package/dist/prebuilt/core-version.generated.d.ts +2 -0
- package/dist/prebuilt/core-version.generated.js +1 -0
- package/dist/prebuilt/prebuilt-changes.d.ts +29 -0
- package/dist/prebuilt/prebuilt-changes.js +65 -0
- package/dist/prebuilt/prebuilt-contracts.d.ts +40 -0
- package/dist/prebuilt/prebuilt-contracts.emitter.d.ts +16 -0
- package/dist/prebuilt/prebuilt-contracts.emitter.js +50 -0
- package/dist/prebuilt/prebuilt-contracts.js +1 -0
- package/dist/prebuilt/prebuilt-contracts.loader.d.ts +19 -0
- package/dist/prebuilt/prebuilt-contracts.loader.js +77 -0
- package/dist/prebuilt/prebuilt-inputs.fingerprint.d.ts +16 -0
- package/dist/prebuilt/prebuilt-inputs.fingerprint.js +229 -0
- package/dist/protocol/absent-route.responder.d.ts +17 -34
- package/dist/protocol/absent-route.responder.js +53 -20
- package/dist/protocol/contract-document.responder.d.ts +5 -4
- package/dist/protocol/contract-document.responder.js +2 -2
- package/dist/protocol/http-request.decoder.d.ts +33 -13
- package/dist/protocol/http-request.decoder.js +34 -11
- package/dist/protocol/http-request.reader.d.ts +9 -6
- package/dist/protocol/http-request.reader.js +1 -0
- package/dist/protocol/http-response.encoder.d.ts +4 -4
- package/dist/protocol/http-response.encoder.js +94 -55
- package/dist/protocol/http-status.table.d.ts +2 -2
- package/dist/protocol/operation-response.guard.d.ts +2 -2
- package/dist/protocol/protocol-headers.d.ts +3 -3
- package/dist/protocol/protocol-surface.d.ts +10 -5
- package/dist/protocol/protocol-surface.js +7 -0
- package/dist/protocol/protocol.binder.d.ts +66 -28
- package/dist/protocol/protocol.binder.js +16 -10
- package/dist/protocol/protocol.handler.d.ts +34 -14
- package/dist/protocol/protocol.handler.js +122 -18
- package/dist/protocol/unmounted-route.error.d.ts +4 -4
- package/dist/protocol/unmounted-route.error.js +2 -2
- package/dist/runtime/caller-data.copier.d.ts +22 -7
- package/dist/runtime/caller-data.copier.js +30 -17
- package/dist/runtime/caller-data.door.d.ts +18 -11
- package/dist/runtime/caller-data.door.js +6 -4
- package/dist/runtime/computed-read-runtime.d.ts +12 -6
- package/dist/runtime/computed-read-runtime.js +271 -71
- package/dist/runtime/computed-value.error.d.ts +7 -6
- package/dist/runtime/computed-value.error.js +5 -4
- package/dist/runtime/context-executor.runtime.d.ts +60 -0
- package/dist/runtime/context-executor.runtime.js +277 -0
- package/dist/runtime/core-class.brand.d.ts +10 -0
- package/dist/runtime/core-class.brand.js +21 -0
- package/dist/runtime/create-requirement.d.ts +34 -79
- package/dist/runtime/create-requirement.js +205 -74
- package/dist/runtime/decimal.d.ts +16 -2
- package/dist/runtime/decimal.js +22 -1
- package/dist/runtime/diagnostics-reporter.d.ts +91 -30
- package/dist/runtime/diagnostics-reporter.js +37 -1
- package/dist/runtime/error-boundary.d.ts +73 -9
- package/dist/runtime/error-boundary.js +57 -19
- package/dist/runtime/error-guidance.d.ts +12 -0
- package/dist/runtime/error-guidance.js +1 -0
- package/dist/runtime/error.catalog.d.ts +49 -0
- package/dist/runtime/error.catalog.js +49 -0
- package/dist/runtime/execution-options.d.ts +18 -2
- package/dist/runtime/field-check.evaluator.d.ts +27 -0
- package/dist/runtime/field-check.evaluator.js +521 -0
- package/dist/runtime/field-compute.d.ts +65 -0
- package/dist/runtime/field-compute.js +1 -0
- package/dist/runtime/field-stage.plan.d.ts +15 -0
- package/dist/runtime/field-stage.plan.js +27 -0
- package/dist/runtime/field-stage.runtime.d.ts +37 -0
- package/dist/runtime/field-stage.runtime.js +147 -0
- package/dist/runtime/field-validator.runtime.d.ts +29 -0
- package/dist/runtime/field-validator.runtime.js +126 -0
- package/dist/runtime/framework-error-class.table.d.ts +33 -0
- package/dist/runtime/framework-error-class.table.js +25 -0
- package/dist/runtime/framework-error.d.ts +68 -8
- package/dist/runtime/framework-error.factory.d.ts +4 -0
- package/dist/runtime/framework-error.factory.js +15 -0
- package/dist/runtime/framework-error.js +32 -2
- package/dist/runtime/framework-warning.emitter.d.ts +6 -0
- package/dist/runtime/framework-warning.emitter.js +8 -0
- package/dist/runtime/interceptor-next.error.d.ts +5 -0
- package/dist/runtime/interceptor-next.error.js +6 -0
- package/dist/runtime/json-value.d.ts +11 -6
- package/dist/runtime/level-lifecycle.runtime.d.ts +26 -0
- package/dist/runtime/level-lifecycle.runtime.js +40 -0
- package/dist/runtime/misuse-reporter.d.ts +12 -12
- package/dist/runtime/mutation-planner.d.ts +20 -16
- package/dist/runtime/mutation-planner.js +48 -35
- package/dist/runtime/nested-write.walker.d.ts +32 -0
- package/dist/runtime/nested-write.walker.js +73 -0
- package/dist/runtime/operation-code.guidance.d.ts +6 -0
- package/dist/runtime/operation-code.guidance.js +167 -0
- package/dist/runtime/operation-request.d.ts +45 -11
- package/dist/runtime/operation-response.d.ts +17 -17
- package/dist/runtime/operation-runtime.d.ts +133 -27
- package/dist/runtime/operation-runtime.js +576 -84
- package/dist/runtime/outcome-mapper.d.ts +17 -5
- package/dist/runtime/outcome-mapper.js +23 -6
- package/dist/runtime/output-validator.d.ts +11 -11
- package/dist/runtime/output-validator.js +3 -3
- package/dist/runtime/owned-execution.registry.d.ts +16 -6
- package/dist/runtime/pipe-output.validator.d.ts +43 -18
- package/dist/runtime/pipe-output.validator.js +15 -13
- package/dist/runtime/pipeline.d.ts +221 -34
- package/dist/runtime/readonly-value.d.ts +47 -0
- package/dist/runtime/readonly-value.js +189 -0
- package/dist/runtime/referential-action.d.ts +1 -1
- package/dist/runtime/request-envelope.validator.d.ts +3 -3
- package/dist/runtime/request-envelope.validator.js +12 -7
- package/dist/runtime/request-id.d.ts +1 -1
- package/dist/runtime/request-state.d.ts +14 -0
- package/dist/runtime/request-state.js +1 -0
- package/dist/runtime/request-state.resolver.d.ts +12 -0
- package/dist/runtime/request-state.resolver.js +20 -0
- package/dist/runtime/scalar-runtime.d.ts +33 -25
- package/dist/runtime/scalar-runtime.js +105 -38
- package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
- package/dist/runtime/unsent-value.normalizer.js +128 -0
- package/dist/transactions/deferred-operation.d.ts +35 -20
- package/dist/transactions/operation-arguments-encoder.d.ts +3 -3
- package/dist/transactions/operation-arguments-encoder.js +8 -3
- package/dist/transactions/operation-fingerprint.js +2 -2
- package/dist/transactions/sql-statement.d.ts +85 -0
- package/dist/transactions/sql-statement.js +47 -0
- package/dist/transactions/sql-statement.validator.d.ts +44 -0
- package/dist/transactions/sql-statement.validator.js +167 -0
- package/dist/transactions/transaction-envelope.d.ts +9 -8
- package/dist/transactions/transaction-integrity-error.d.ts +6 -6
- package/dist/transactions/transaction-integrity-error.js +7 -2
- package/dist/transactions/transaction-plan-assembler.d.ts +30 -13
- package/dist/transactions/transaction-plan-assembler.js +184 -32
- package/dist/transactions/transaction-plan-validator.d.ts +50 -25
- package/dist/transactions/transaction-plan-validator.js +96 -38
- package/dist/transactions/transaction-reference-collector.d.ts +5 -5
- package/dist/transactions/transaction-reference-resolver.d.ts +21 -3
- package/dist/transactions/transaction-reference-resolver.js +26 -14
- package/dist/transactions/transaction-reference-validator.d.ts +74 -4
- package/dist/transactions/transaction-reference-validator.js +129 -71
- package/dist/transactions/transaction-reference.d.ts +14 -14
- package/dist/transactions/transaction-reference.js +5 -0
- package/dist/transactions/transaction-request.d.ts +22 -9
- package/dist/transactions/transaction-response.d.ts +6 -6
- package/dist/transactions/transaction-runtime.d.ts +12 -8
- package/dist/transactions/transaction-runtime.js +218 -50
- package/dist/transactions/transaction-settlement.runtime.d.ts +52 -0
- package/dist/transactions/transaction-settlement.runtime.js +120 -0
- package/dist/transactions/transaction-slot-path-error.d.ts +4 -4
- package/dist/transactions/transaction-slot-path-error.js +4 -2
- package/dist/transactions/transaction-slot-writer.js +2 -2
- package/dist/transactions/transaction-stage.runtime.d.ts +83 -0
- package/dist/transactions/transaction-stage.runtime.js +126 -0
- package/package.json +11 -9
- package/src/runtime/field-check.evaluator.ts +720 -0
- package/dist/config/define-fields.d.ts +0 -42
- package/dist/config/define-fields.js +0 -3
- package/dist/config/framework-behaviors-config.d.ts +0 -30
- package/dist/config/framework-fields-config.d.ts +0 -42
- package/dist/config/framework-restrictions-config.d.ts +0 -142
- package/dist/json/avz.d.ts +0 -96
- package/dist/runtime/field-behavior.d.ts +0 -48
- /package/dist/{config/framework-behaviors-config.js → adapters/adapter-sql-statement.js} +0 -0
- /package/dist/{config/framework-fields-config.js → adapters/adapter-transaction-executor.interface.js} +0 -0
- /package/dist/{json → avz}/index.js +0 -0
- /package/dist/{json → avz}/json-shape.registry.js +0 -0
- /package/dist/config/{framework-restrictions-config.js → exact-framework-config.js} +0 -0
- /package/dist/{runtime/field-behavior.js → config/field-pipeline-config.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AvDecimal, decimalDigitsOf, isAvDecimal } from "./decimal.js";
|
|
2
2
|
const FAILURE_MESSAGES = {
|
|
3
3
|
"unreadable-value": "Value could not be read.",
|
|
4
4
|
"non-plain-value": "Value must be plain data.",
|
|
5
5
|
};
|
|
6
|
-
export class
|
|
6
|
+
export class AvCallerDataError extends Error {
|
|
7
7
|
kind;
|
|
8
8
|
path;
|
|
9
9
|
within;
|
|
10
|
-
name = "
|
|
10
|
+
name = "AvCallerDataError";
|
|
11
11
|
constructor(kind, path, within) {
|
|
12
12
|
super(FAILURE_MESSAGES[kind]);
|
|
13
13
|
this.kind = kind;
|
|
@@ -19,7 +19,6 @@ const NO_POLICY = {};
|
|
|
19
19
|
const OBJECT_PROTOTYPE = Object.prototype;
|
|
20
20
|
const DATE_PROTOTYPE = Date.prototype;
|
|
21
21
|
const dateValueOf = Date.prototype.getTime;
|
|
22
|
-
const decimalValueOf = Decimal.prototype.toString;
|
|
23
22
|
const FAST_WALK_DEPTH = 256;
|
|
24
23
|
const SLOW_WALK = Symbol("slow walk");
|
|
25
24
|
class FastWalkFailure {
|
|
@@ -33,8 +32,8 @@ function copyValueType(value, prototype) {
|
|
|
33
32
|
if (prototype === DATE_PROTOTYPE || value instanceof Date) {
|
|
34
33
|
return new Date(dateValueOf.call(value));
|
|
35
34
|
}
|
|
36
|
-
if (value
|
|
37
|
-
return new
|
|
35
|
+
if (isAvDecimal(value)) {
|
|
36
|
+
return new AvDecimal(decimalDigitsOf(value));
|
|
38
37
|
}
|
|
39
38
|
if (value instanceof Uint8Array) {
|
|
40
39
|
return new Uint8Array(value);
|
|
@@ -134,7 +133,7 @@ function readAt(link, read) {
|
|
|
134
133
|
return read();
|
|
135
134
|
}
|
|
136
135
|
catch {
|
|
137
|
-
throw new
|
|
136
|
+
throw new AvCallerDataError("unreadable-value", pathOf(link));
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
function copySlow(value, policy, failedAt) {
|
|
@@ -154,7 +153,7 @@ function copySlow(value, policy, failedAt) {
|
|
|
154
153
|
const task = stack.pop();
|
|
155
154
|
if (task.kind === "leave") {
|
|
156
155
|
if (task.refuse !== false) {
|
|
157
|
-
throw new
|
|
156
|
+
throw new AvCallerDataError("unreadable-value", pathOf(task.refuse));
|
|
158
157
|
}
|
|
159
158
|
ancestors.delete(task.container);
|
|
160
159
|
continue;
|
|
@@ -172,7 +171,7 @@ function copySlow(value, policy, failedAt) {
|
|
|
172
171
|
const refuse = current === failedAt ? link : false;
|
|
173
172
|
const settle = (copy) => {
|
|
174
173
|
if (refuse !== false) {
|
|
175
|
-
throw new
|
|
174
|
+
throw new AvCallerDataError("unreadable-value", pathOf(refuse));
|
|
176
175
|
}
|
|
177
176
|
task.assign(copy);
|
|
178
177
|
};
|
|
@@ -209,7 +208,7 @@ function copySlow(value, policy, failedAt) {
|
|
|
209
208
|
if (!isPlainPrototype(prototype)) {
|
|
210
209
|
const copied = readAt(link, () => copyValueType(current, prototype));
|
|
211
210
|
if (copied === undefined) {
|
|
212
|
-
throw new
|
|
211
|
+
throw new AvCallerDataError("non-plain-value", pathOf(link));
|
|
213
212
|
}
|
|
214
213
|
settle(copied);
|
|
215
214
|
continue;
|
|
@@ -268,14 +267,14 @@ function pathSegment(array, key) {
|
|
|
268
267
|
}
|
|
269
268
|
return key;
|
|
270
269
|
}
|
|
271
|
-
function mirrorControlData(value) {
|
|
270
|
+
function mirrorControlData(value, members) {
|
|
272
271
|
const shape = reflectNode(value);
|
|
273
272
|
if (shape === undefined) {
|
|
274
|
-
throw new
|
|
273
|
+
throw new AvCallerDataError("unreadable-value", []);
|
|
275
274
|
}
|
|
276
275
|
let root;
|
|
277
276
|
const refuse = (kind, path) => {
|
|
278
|
-
throw new
|
|
277
|
+
throw new AvCallerDataError(kind, path, root);
|
|
279
278
|
};
|
|
280
279
|
const mirrors = new Map();
|
|
281
280
|
const stack = [
|
|
@@ -375,6 +374,20 @@ function mirrorControlData(value) {
|
|
|
375
374
|
continue;
|
|
376
375
|
}
|
|
377
376
|
const memberLink = childLink(link, pathSegment(shape.array, key));
|
|
377
|
+
const byValue = members?.copyAt(pathOf(memberLink));
|
|
378
|
+
if (byValue !== undefined) {
|
|
379
|
+
try {
|
|
380
|
+
store(copyCallerData(member, byValue));
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
if (!(error instanceof AvCallerDataError)) {
|
|
384
|
+
throw error;
|
|
385
|
+
}
|
|
386
|
+
members?.refused(pathOf(memberLink), error);
|
|
387
|
+
store(undefined);
|
|
388
|
+
}
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
378
391
|
const memberShape = reflectNode(member);
|
|
379
392
|
if (memberShape === undefined) {
|
|
380
393
|
store(UNREADABLE);
|
|
@@ -408,6 +421,9 @@ function mirrorControlData(value) {
|
|
|
408
421
|
}
|
|
409
422
|
return root;
|
|
410
423
|
}
|
|
424
|
+
export function mirrorCallerData(value, members) {
|
|
425
|
+
return mirrorControlData(value, members);
|
|
426
|
+
}
|
|
411
427
|
export function locateCallerDataError(error, copy) {
|
|
412
428
|
const within = error.within;
|
|
413
429
|
if (within === undefined) {
|
|
@@ -416,7 +432,7 @@ export function locateCallerDataError(error, copy) {
|
|
|
416
432
|
const at = pathTo(copy, within);
|
|
417
433
|
return at === undefined
|
|
418
434
|
? error
|
|
419
|
-
: new
|
|
435
|
+
: new AvCallerDataError(error.kind, [...at, ...error.path]);
|
|
420
436
|
}
|
|
421
437
|
function pathTo(copy, target) {
|
|
422
438
|
const seen = new Set();
|
|
@@ -465,6 +481,3 @@ export function copyCallerData(value, policy = NO_POLICY) {
|
|
|
465
481
|
}
|
|
466
482
|
return guardNative(() => copyFast(value, 0, policy), (failure) => copySlow(value, policy, failure instanceof FastWalkFailure ? failure.at : undefined));
|
|
467
483
|
}
|
|
468
|
-
export function callerDataFailureMessage(kind) {
|
|
469
|
-
return FAILURE_MESSAGES[kind];
|
|
470
|
-
}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
1
|
+
import type { AvValidationIssue } from "../operations/validation-code.js";
|
|
2
|
+
import { AvCallerDataError, type CallerDataPath, type CallerDataPolicy } from "./caller-data.copier.js";
|
|
3
|
+
import type { AvMisuseEvent, MisuseReporter } from "./misuse-reporter.js";
|
|
4
4
|
/**
|
|
5
5
|
* Where the arguments an execution entry receives came from.
|
|
6
6
|
*
|
|
7
7
|
* - `"caller"`: a server-side caller's own objects — copied at the door.
|
|
8
8
|
* - `"owned"`: data no caller holds a reference to — a body the protocol decoder
|
|
9
|
-
* parsed with `JSON.parse` for this request alone,
|
|
10
|
-
*
|
|
9
|
+
* parsed with `JSON.parse` for this request alone, a host's parsed body the
|
|
10
|
+
* protocol's shortcut copied at the call, or a plan the typed runner assembled
|
|
11
|
+
* from copies its builders took. It is never copied again.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* - `{ refused }`: a body the protocol's shortcut copied at the call, whose copy
|
|
14
|
+
* failed — answered at the door as `"caller"` would answer it, never read again.
|
|
15
|
+
*
|
|
16
|
+
* Only core's own modules choose anything but `"caller"`: the public
|
|
17
|
+
* `framework.execute` and `executeTransaction` always pass `"caller"`.
|
|
14
18
|
*/
|
|
15
|
-
export type ArgumentsSource = "caller" | "owned"
|
|
19
|
+
export type ArgumentsSource = "caller" | "owned" | {
|
|
20
|
+
readonly refused: AvCallerDataError;
|
|
21
|
+
};
|
|
16
22
|
/** The operation identity a misuse event may name, as far as it could be read. */
|
|
17
|
-
|
|
23
|
+
type MisuseIdentity = Omit<AvMisuseEvent, "kind" | "path">;
|
|
18
24
|
/**
|
|
19
25
|
* The identity of a request the framework holds a copy of, keeping only what is
|
|
20
26
|
* identity: an origin, a Resource name and a standard operation, each present only
|
|
@@ -30,7 +36,7 @@ export declare function misuseIdentityOf(request: {
|
|
|
30
36
|
* The caller's `V1001` for a refused value at `address` (the door's own spelling of
|
|
31
37
|
* where the copied value stands), reported once to the misuse hook.
|
|
32
38
|
*/
|
|
33
|
-
export declare function refuseCallerData(error:
|
|
39
|
+
export declare function refuseCallerData(error: AvCallerDataError, address: CallerDataPath, identity: MisuseIdentity, misuse: MisuseReporter): AvValidationIssue;
|
|
34
40
|
/**
|
|
35
41
|
* A door's copy of one caller value, or the failure it met. The door holds it until
|
|
36
42
|
* its answer is due — a plan answers its steps in order — so the failure is a value
|
|
@@ -41,7 +47,7 @@ export type CallerDataCopy = {
|
|
|
41
47
|
readonly value: unknown;
|
|
42
48
|
} | {
|
|
43
49
|
readonly ok: false;
|
|
44
|
-
readonly error:
|
|
50
|
+
readonly error: AvCallerDataError;
|
|
45
51
|
};
|
|
46
52
|
/** Copies `value` at a door, keeping {@link copyCallerData}'s refusal as a value. */
|
|
47
53
|
export declare function copyAtDoor(value: unknown, policy?: CallerDataPolicy): CallerDataCopy;
|
|
@@ -54,3 +60,4 @@ export declare function copyAtDoor(value: unknown, policy?: CallerDataPolicy): C
|
|
|
54
60
|
* plan validator inspects and copies step by step.
|
|
55
61
|
*/
|
|
56
62
|
export declare function copyEnvelopeAtDoor(request: unknown, members: readonly string[]): CallerDataCopy;
|
|
63
|
+
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { parseOperationIdentity } from "../operations/operation-identity.js";
|
|
2
2
|
import { validationIssue } from "../operations/validation-code.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AvCallerDataError, copyCallerData, } from "./caller-data.copier.js";
|
|
4
4
|
export function misuseIdentityOf(request) {
|
|
5
|
-
const origin = request.origin === "application" ||
|
|
5
|
+
const origin = request.origin === "application" ||
|
|
6
|
+
request.origin === "client" ||
|
|
7
|
+
request.origin === "agent"
|
|
6
8
|
? request.origin
|
|
7
9
|
: undefined;
|
|
8
10
|
const identity = typeof request.family === "string" && typeof request.variant === "string"
|
|
@@ -28,7 +30,7 @@ export function copyAtDoor(value, policy) {
|
|
|
28
30
|
return { ok: true, value: copyCallerData(value, policy) };
|
|
29
31
|
}
|
|
30
32
|
catch (error) {
|
|
31
|
-
if (error instanceof
|
|
33
|
+
if (error instanceof AvCallerDataError) {
|
|
32
34
|
return { ok: false, error };
|
|
33
35
|
}
|
|
34
36
|
throw error;
|
|
@@ -53,7 +55,7 @@ export function copyEnvelopeAtDoor(request, members) {
|
|
|
53
55
|
if (!copy.ok) {
|
|
54
56
|
return {
|
|
55
57
|
ok: false,
|
|
56
|
-
error: new
|
|
58
|
+
error: new AvCallerDataError(copy.error.kind, [
|
|
57
59
|
member,
|
|
58
60
|
...copy.error.path,
|
|
59
61
|
]),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { AvAdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
+
import type { ResolvedComputeConfig } from "../config/field-compute.resolver.js";
|
|
3
|
+
import type { AvContract, AvContractCore } from "../contracts/contract.js";
|
|
4
|
+
import type { AvComputeContext } from "./field-compute.js";
|
|
3
5
|
import type { OperationExecutionRequest } from "./operation-request.js";
|
|
4
|
-
|
|
5
|
-
type ContextFactory = () => PipelineContext;
|
|
6
|
+
type ContextFactory = () => AvComputeContext;
|
|
6
7
|
export type RelationReadPlan = {
|
|
7
8
|
readonly field: string;
|
|
8
9
|
readonly cardinality: "one" | "many";
|
|
@@ -20,6 +21,11 @@ export type PlannedReadOperation = {
|
|
|
20
21
|
readonly projection: ReadProjectionPlan | undefined;
|
|
21
22
|
readonly materialize: boolean;
|
|
22
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The fields a level returns when it states no projection: every scalar of the
|
|
26
|
+
* active Contract whose `select` is `true` and that is not governed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function defaultProjectionFields(active: AvContract, resourceName: string): readonly string[];
|
|
23
29
|
/**
|
|
24
30
|
* Clone the caller projection into the internal Adapter projection: the read
|
|
25
31
|
* set the Adapter is asked for, always explicit for a projecting variant, plus
|
|
@@ -27,10 +33,10 @@ export type PlannedReadOperation = {
|
|
|
27
33
|
* are never mutated and hidden dependencies are resolved through the Core
|
|
28
34
|
* Contract.
|
|
29
35
|
*/
|
|
30
|
-
export declare function planReadOperation(core:
|
|
36
|
+
export declare function planReadOperation(core: AvContractCore, model: AvAdapterModel, active: AvContract, compute: ResolvedComputeConfig | undefined, request: OperationExecutionRequest, args: unknown): PlannedReadOperation;
|
|
31
37
|
/**
|
|
32
38
|
* Materialize computed scalar reads and remove internal dependency fields,
|
|
33
39
|
* against `active` — the Contract `planReadOperation` was given as `active`.
|
|
34
40
|
*/
|
|
35
|
-
export declare function materializeReadOperation(active:
|
|
41
|
+
export declare function materializeReadOperation(active: AvContract, compute: ResolvedComputeConfig | undefined, _request: OperationExecutionRequest, plan: PlannedReadOperation, value: unknown, contextFactory: ContextFactory): Promise<unknown>;
|
|
36
42
|
export {};
|