@aventara/core 1.0.0-rc.1 → 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 +943 -16
- package/ERRORS.md +142 -0
- package/README.md +274 -16
- 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 +22 -0
- package/dist/adapters/adapter-identifier.d.ts +9 -0
- package/dist/adapters/adapter-identifier.js +6 -1
- package/dist/adapters/adapter-model.d.ts +9 -0
- package/dist/adapters/adapter-operation.d.ts +18 -3
- package/dist/adapters/adapter-resource.d.ts +5 -0
- package/dist/adapters/adapter.interface.d.ts +10 -0
- package/dist/avz/avz.d.ts +1 -1
- package/dist/avz/json-shape.registry.d.ts +2 -1
- 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 +6 -0
- package/dist/compiler/contract.compiler.js +227 -24
- 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/computed-fields.d.ts +62 -0
- package/dist/config/computed-fields.js +73 -0
- package/dist/config/config-diagnostic.guidance.d.ts +6 -0
- package/dist/config/config-diagnostic.guidance.js +32 -0
- package/dist/config/config.resolver.d.ts +24 -0
- package/dist/config/config.resolver.js +65 -0
- package/dist/config/config.validator.js +222 -8
- package/dist/config/define-resource.d.ts +1 -5
- package/dist/config/entrypoint.normalizer.d.ts +3 -2
- package/dist/config/exact-framework-config.d.ts +67 -22
- package/dist/config/field-compute.resolver.d.ts +2 -0
- package/dist/config/field-compute.resolver.js +8 -0
- package/dist/config/framework-config.d.ts +53 -15
- package/dist/config/framework-resources-config.d.ts +25 -14
- package/dist/config/pipeline-config.d.ts +4 -4
- package/dist/config/pipeline-tree.resolver.d.ts +2 -2
- 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 +26 -1
- package/dist/contracts/capability.js +20 -0
- package/dist/contracts/client-contract-structure.validator.d.ts +301 -89
- package/dist/contracts/client-contract-structure.validator.js +37 -2
- package/dist/contracts/contract-access.d.ts +29 -0
- package/dist/contracts/contract-access.js +1 -0
- package/dist/contracts/contract-canonicalizer.d.ts +9 -1
- package/dist/contracts/contract-canonicalizer.js +30 -4
- package/dist/contracts/contract-hash.d.ts +0 -1
- package/dist/contracts/contract-hash.js +1 -1
- package/dist/contracts/contract.d.ts +27 -1
- package/dist/contracts/field.d.ts +58 -1
- package/dist/contracts/json-schema.projector.d.ts +11 -0
- package/dist/contracts/json-schema.projector.js +78 -0
- package/dist/contracts/scalar-value-type.d.ts +3 -1
- package/dist/framework/access-facade.d.ts +116 -0
- package/dist/framework/access-facade.js +120 -0
- package/dist/framework/contract-view.d.ts +120 -16
- package/dist/framework/framework-construction.error.d.ts +14 -4
- package/dist/framework/framework-construction.error.js +18 -2
- package/dist/framework/framework.d.ts +26 -5
- package/dist/framework/framework.factory.d.ts +1 -1
- package/dist/framework/framework.factory.js +115 -23
- package/dist/framework/operation-facade.d.ts +80 -13
- package/dist/framework/operation-facade.js +2 -1
- package/dist/index.d.ts +17 -5
- package/dist/index.js +1 -0
- package/dist/internal.d.ts +7 -2
- package/dist/internal.js +6 -0
- package/dist/operations/database-refusal.d.ts +51 -0
- package/dist/operations/database-refusal.js +45 -0
- package/dist/operations/operation-arguments.d.ts +148 -60
- package/dist/operations/operation-call.d.ts +9 -5
- package/dist/operations/operation-result.d.ts +6 -4
- package/dist/operations/operation-validator-core.js +159 -36
- package/dist/operations/operation-validator.d.ts +1 -1
- package/dist/operations/structural-limits.walker.d.ts +1 -1
- package/dist/operations/validation-code.guidance.d.ts +6 -0
- package/dist/operations/validation-code.guidance.js +90 -0
- package/dist/operations/write-scope.resolver.d.ts +4 -0
- 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 +9 -27
- package/dist/protocol/absent-route.responder.js +36 -3
- package/dist/protocol/contract-document.responder.d.ts +2 -1
- package/dist/protocol/http-request.decoder.d.ts +19 -3
- package/dist/protocol/http-request.decoder.js +24 -1
- package/dist/protocol/http-request.reader.d.ts +6 -3
- package/dist/protocol/http-request.reader.js +1 -0
- package/dist/protocol/http-response.encoder.js +2 -2
- package/dist/protocol/protocol-headers.d.ts +3 -3
- package/dist/protocol/protocol-surface.d.ts +6 -1
- package/dist/protocol/protocol-surface.js +7 -0
- package/dist/protocol/protocol.binder.d.ts +16 -1
- package/dist/protocol/protocol.binder.js +4 -1
- package/dist/protocol/protocol.handler.d.ts +12 -1
- package/dist/protocol/protocol.handler.js +86 -17
- package/dist/runtime/caller-data.copier.d.ts +18 -3
- package/dist/runtime/caller-data.copier.js +21 -8
- package/dist/runtime/caller-data.door.d.ts +13 -6
- package/dist/runtime/computed-read-runtime.d.ts +6 -1
- package/dist/runtime/computed-read-runtime.js +232 -45
- package/dist/runtime/computed-value.error.d.ts +3 -2
- package/dist/runtime/computed-value.error.js +3 -2
- package/dist/runtime/context-executor.runtime.d.ts +4 -3
- package/dist/runtime/context-executor.runtime.js +4 -2
- 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 +31 -5
- package/dist/runtime/create-requirement.js +129 -21
- package/dist/runtime/decimal.d.ts +14 -0
- package/dist/runtime/decimal.js +21 -0
- package/dist/runtime/diagnostics-reporter.d.ts +44 -9
- package/dist/runtime/diagnostics-reporter.js +13 -1
- package/dist/runtime/error-boundary.d.ts +9 -2
- package/dist/runtime/error-boundary.js +12 -0
- 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 +8 -0
- package/dist/runtime/field-check.evaluator.d.ts +0 -2
- package/dist/runtime/field-check.evaluator.js +1 -1
- package/dist/runtime/field-compute.d.ts +11 -10
- package/dist/runtime/field-stage.runtime.d.ts +3 -1
- package/dist/runtime/field-stage.runtime.js +8 -4
- package/dist/runtime/field-validator.runtime.d.ts +19 -1
- package/dist/runtime/field-validator.runtime.js +47 -8
- package/dist/runtime/framework-error.js +9 -0
- package/dist/runtime/framework-warning.emitter.d.ts +6 -0
- package/dist/runtime/framework-warning.emitter.js +8 -0
- package/dist/runtime/json-value.d.ts +10 -5
- package/dist/runtime/level-lifecycle.runtime.d.ts +4 -3
- package/dist/runtime/level-lifecycle.runtime.js +3 -5
- package/dist/runtime/mutation-planner.d.ts +1 -6
- package/dist/runtime/mutation-planner.js +3 -14
- 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 +16 -9
- package/dist/runtime/operation-runtime.d.ts +35 -17
- package/dist/runtime/operation-runtime.js +220 -49
- package/dist/runtime/outcome-mapper.d.ts +2 -1
- package/dist/runtime/output-validator.d.ts +1 -1
- package/dist/runtime/owned-execution.registry.d.ts +13 -3
- package/dist/runtime/pipe-output.validator.d.ts +10 -0
- package/dist/runtime/pipe-output.validator.js +4 -2
- package/dist/runtime/pipeline.d.ts +47 -22
- package/dist/runtime/readonly-value.d.ts +20 -5
- package/dist/runtime/readonly-value.js +74 -26
- package/dist/runtime/referential-action.d.ts +1 -1
- package/dist/runtime/scalar-runtime.d.ts +4 -11
- package/dist/runtime/scalar-runtime.js +91 -22
- package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
- package/dist/runtime/unsent-value.normalizer.js +128 -0
- package/dist/transactions/operation-arguments-encoder.js +8 -3
- package/dist/transactions/operation-fingerprint.js +2 -2
- package/dist/transactions/sql-statement.d.ts +10 -2
- package/dist/transactions/sql-statement.validator.d.ts +2 -2
- package/dist/transactions/sql-statement.validator.js +38 -5
- package/dist/transactions/transaction-envelope.d.ts +5 -4
- package/dist/transactions/transaction-integrity-error.js +2 -0
- package/dist/transactions/transaction-plan-assembler.d.ts +12 -5
- package/dist/transactions/transaction-plan-assembler.js +48 -10
- package/dist/transactions/transaction-plan-validator.d.ts +23 -7
- package/dist/transactions/transaction-plan-validator.js +27 -1
- package/dist/transactions/transaction-reference-resolver.d.ts +3 -2
- package/dist/transactions/transaction-reference-validator.d.ts +43 -3
- package/dist/transactions/transaction-reference-validator.js +83 -57
- package/dist/transactions/transaction-reference.d.ts +1 -1
- package/dist/transactions/transaction-reference.js +5 -0
- package/dist/transactions/transaction-request.d.ts +8 -8
- package/dist/transactions/transaction-runtime.d.ts +5 -2
- package/dist/transactions/transaction-runtime.js +79 -27
- package/dist/transactions/transaction-settlement.runtime.d.ts +4 -3
- package/dist/transactions/transaction-slot-path-error.js +2 -0
- package/dist/transactions/transaction-stage.runtime.d.ts +5 -3
- package/dist/transactions/transaction-stage.runtime.js +7 -4
- package/package.json +6 -5
- package/src/runtime/field-check.evaluator.ts +1 -1
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { compileContracts } from "../compiler/contract.compiler.js";
|
|
2
|
-
import {
|
|
1
|
+
import { compileContracts, } from "../compiler/contract.compiler.js";
|
|
2
|
+
import { validateManagedDeletes } from "../compiler/managed-elsewhere.validator.js";
|
|
3
|
+
import { computedFieldsOf, warnOnStaleComputedFields, } from "../config/computed-fields.js";
|
|
4
|
+
import { resolveFrameworkConfig, } from "../config/config.resolver.js";
|
|
3
5
|
import { validateFrameworkConfig } from "../config/config.validator.js";
|
|
4
6
|
import { validateForcedOperations } from "../config/forced-operation.validator.js";
|
|
5
7
|
import { AVENTARA_PROTOCOL_VERSION } from "../contracts/contract-protocol.js";
|
|
6
|
-
import {
|
|
8
|
+
import { recordAccessProvider } from "../policy/access-provider.registry.js";
|
|
9
|
+
import { recordAccessQuestions } from "../policy/access-question.registry.js";
|
|
10
|
+
import { createAccessQuestionAnswerer } from "../policy/access-question.runtime.js";
|
|
11
|
+
import { heldTargetsOf } from "../policy/policy-reference-write.runtime.js";
|
|
12
|
+
import { callerOf } from "../policy/policy-request.js";
|
|
13
|
+
import { policyStartupDiagnostics } from "../policy/policy-startup.validator.js";
|
|
14
|
+
import { loadPrebuiltContracts, warnStalePrebuilt, } from "../prebuilt/prebuilt-contracts.loader.js";
|
|
15
|
+
import { copyAtDoor, copyEnvelopeAtDoor, refuseCallerData, } from "../runtime/caller-data.door.js";
|
|
7
16
|
import { createDiagnosticsReporter, createTransactionDiagnosticsChannel, recordDiagnosticsSink, } from "../runtime/diagnostics-reporter.js";
|
|
8
17
|
import { createMisuseReporter, } from "../runtime/misuse-reporter.js";
|
|
9
18
|
import { internalFailure, operationFailure, } from "../runtime/operation-response.js";
|
|
@@ -12,8 +21,10 @@ import { recordOwnedExecution } from "../runtime/owned-execution.registry.js";
|
|
|
12
21
|
import { validateOperationEnvelope, validateTransactionEnvelope, } from "../runtime/request-envelope.validator.js";
|
|
13
22
|
import { requestIdOf } from "../runtime/request-id.js";
|
|
14
23
|
import { stateOptionOf } from "../runtime/request-state.resolver.js";
|
|
24
|
+
import { encodeOperationArgumentsForWire } from "../transactions/operation-arguments-encoder.js";
|
|
15
25
|
import { createTransactionPlanAssembler } from "../transactions/transaction-plan-assembler.js";
|
|
16
26
|
import { createTransactionRuntime } from "../transactions/transaction-runtime.js";
|
|
27
|
+
import { createServerClientAccess } from "./access-facade.js";
|
|
17
28
|
import { AvConstructionError } from "./framework-construction.error.js";
|
|
18
29
|
import { createOperationFacade, createOperationTree, settleOperation, } from "./operation-facade.js";
|
|
19
30
|
const APPLICATION_SQL_BUILDER = "$sql";
|
|
@@ -34,7 +45,13 @@ export async function createFramework(config) {
|
|
|
34
45
|
]);
|
|
35
46
|
}
|
|
36
47
|
const resolvedConfig = resolveFrameworkConfig(config);
|
|
37
|
-
|
|
48
|
+
warnOnStaleComputedFields(config.adapter.computedFields, computedFieldsOf({
|
|
49
|
+
trees: resolvedConfig.trees,
|
|
50
|
+
agentExtends: resolvedConfig.agent.parent,
|
|
51
|
+
}));
|
|
52
|
+
const compilation = (config.prebuilt === undefined
|
|
53
|
+
? undefined
|
|
54
|
+
: await prebuiltCompilation(config.prebuilt, model, config, resolvedConfig)) ?? (await compileContracts(model, resolvedConfig));
|
|
38
55
|
if (!compilation.ok) {
|
|
39
56
|
throw new AvConstructionError("contract-compilation", compilation.diagnostics);
|
|
40
57
|
}
|
|
@@ -42,6 +59,16 @@ export async function createFramework(config) {
|
|
|
42
59
|
if (forcing.length > 0) {
|
|
43
60
|
throw new AvConstructionError("configuration", forcing);
|
|
44
61
|
}
|
|
62
|
+
const managedDeletes = validateManagedDeletes(compilation.contracts, config.adapter.referentialActions);
|
|
63
|
+
if (managedDeletes.length > 0) {
|
|
64
|
+
throw new AvConstructionError("configuration", managedDeletes);
|
|
65
|
+
}
|
|
66
|
+
if (resolvedConfig.policy !== undefined) {
|
|
67
|
+
const policy = policyStartupDiagnostics(compilation.contracts.core, resolvedConfig.policy, model);
|
|
68
|
+
if (policy.length > 0) {
|
|
69
|
+
throw new AvConstructionError("configuration", policy);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
45
72
|
const runtimeDependencies = {
|
|
46
73
|
adapter: config.adapter,
|
|
47
74
|
contracts: compilation.contracts,
|
|
@@ -51,12 +78,31 @@ export async function createFramework(config) {
|
|
|
51
78
|
const execute = createOperationRuntime(runtimeDependencies, pipelineDependencies);
|
|
52
79
|
const executeTransaction = createTransactionRuntime(runtimeDependencies, pipelineDependencies);
|
|
53
80
|
const misuse = createMisuseReporter(resolvedConfig.misuse);
|
|
54
|
-
const executeOperation = (request) => executeTotally(execute, request, resolvedConfig.diagnostics, "caller");
|
|
81
|
+
const executeOperation = (request, caller) => executeTotally(execute, request, resolvedConfig.diagnostics, "caller", caller);
|
|
82
|
+
const executeApplicationValues = (request, caller) => executeTotally(encodingApplicationValues(execute, compilation.contracts.client), request, resolvedConfig.diagnostics, "caller", caller);
|
|
55
83
|
const protocol = {
|
|
56
84
|
version: AVENTARA_PROTOCOL_VERSION,
|
|
57
85
|
hash: compilation.contracts.client.protocol.hash,
|
|
58
86
|
};
|
|
59
87
|
const assembler = createTransactionPlanAssembler(compilation.contracts, protocol, misuse);
|
|
88
|
+
const clientRequest = (resource, identity, args, requestId, state) => ({
|
|
89
|
+
...identity,
|
|
90
|
+
origin: "client",
|
|
91
|
+
protocol,
|
|
92
|
+
requestId,
|
|
93
|
+
...(state === undefined ? {} : { state }),
|
|
94
|
+
resource,
|
|
95
|
+
arguments: args,
|
|
96
|
+
});
|
|
97
|
+
const accessAnswerer = compilation.contracts.client.access === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: createAccessQuestionAnswerer({
|
|
100
|
+
contracts: compilation.contracts,
|
|
101
|
+
policy: resolvedConfig.policy,
|
|
102
|
+
adapter: config.adapter,
|
|
103
|
+
diagnostics: resolvedConfig.diagnostics,
|
|
104
|
+
misuse,
|
|
105
|
+
});
|
|
60
106
|
const framework = {
|
|
61
107
|
api: resolvedConfig.api,
|
|
62
108
|
mcp: resolvedConfig.mcp,
|
|
@@ -69,35 +115,76 @@ export async function createFramework(config) {
|
|
|
69
115
|
resource,
|
|
70
116
|
arguments: args,
|
|
71
117
|
}), executeOperation),
|
|
72
|
-
client: createOperationFacade(model,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
118
|
+
client: createOperationFacade(model, clientRequest, executeOperation),
|
|
119
|
+
serverClient: withServerClientAccess(createOperationFacade(model, clientRequest, executeApplicationValues), accessAnswerer === undefined
|
|
120
|
+
? undefined
|
|
121
|
+
: createServerClientAccess({
|
|
122
|
+
contract: compilation.contracts.client,
|
|
123
|
+
answer: accessAnswerer,
|
|
124
|
+
client: config.access?.client,
|
|
125
|
+
state: (input) => config.access.state(input),
|
|
126
|
+
})),
|
|
81
127
|
appTx: Object.freeze({
|
|
82
128
|
...createOperationTree(model, (resource, identity) => (args) => assembler.defer("application", resource, identity, args === undefined ? {} : args)),
|
|
83
129
|
[APPLICATION_SQL_BUILDER]: (strings, ...values) => assembler.deferSql(strings, values),
|
|
84
130
|
}),
|
|
85
131
|
clientTx: createOperationTree(model, (resource, identity) => (args) => assembler.defer("client", resource, identity, args === undefined ? {} : args)),
|
|
132
|
+
serverClientTx: createOperationTree(model, (resource, identity) => (args) => assembler.defer("client", resource, identity, args === undefined ? {} : args, "application")),
|
|
86
133
|
execute: (request) => executeRequestTotally(execute, request, resolvedConfig.diagnostics, misuse),
|
|
87
134
|
executeTransaction: (request) => executeTransactionRequestTotally(executeTransaction, request, resolvedConfig.diagnostics, misuse),
|
|
88
|
-
transaction: (async (operations, options) => settleOperation(await runTransactionTotally(executeTransaction, assembler, operations, requestIdOf(options), stateOptionOf(options), resolvedConfig.diagnostics))),
|
|
135
|
+
transaction: (async (operations, options) => settleOperation(await runTransactionTotally(executeTransaction, assembler, operations, requestIdOf(options), stateOptionOf(options), resolvedConfig.diagnostics, callerOf(options)))),
|
|
89
136
|
};
|
|
90
137
|
recordDiagnosticsSink(framework, resolvedConfig.diagnostics);
|
|
138
|
+
recordAccessProvider(framework, config.access);
|
|
139
|
+
if (accessAnswerer !== undefined) {
|
|
140
|
+
recordAccessQuestions(framework, accessAnswerer);
|
|
141
|
+
}
|
|
91
142
|
recordOwnedExecution(framework, {
|
|
92
|
-
execute: (request) => executeTotally(execute, request, resolvedConfig.diagnostics, "owned"),
|
|
93
|
-
executeTransaction: (request) => executeTransactionTotally(executeTransaction, request, resolvedConfig.diagnostics, undefined,
|
|
143
|
+
execute: (request, refused) => executeTotally(execute, request, resolvedConfig.diagnostics, refused === undefined ? "owned" : { refused }),
|
|
144
|
+
executeTransaction: (request, refused) => executeTransactionTotally(executeTransaction, request, resolvedConfig.diagnostics, undefined, refused === undefined
|
|
145
|
+
? { source: "owned" }
|
|
146
|
+
: { source: "owned", refused }),
|
|
94
147
|
});
|
|
148
|
+
if (resolvedConfig.policy !== undefined) {
|
|
149
|
+
await resolvedConfig.policy.engine.hosted?.({
|
|
150
|
+
held: heldTargetsOf(compilation.contracts.core, resolvedConfig.policy.unheld),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
95
153
|
return framework;
|
|
96
154
|
}
|
|
97
|
-
async function
|
|
155
|
+
async function prebuiltCompilation(prebuilt, model, config, resolved) {
|
|
156
|
+
let loaded;
|
|
157
|
+
try {
|
|
158
|
+
loaded = await loadPrebuiltContracts(prebuilt, model, config, resolved);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
loaded = {
|
|
162
|
+
ok: false,
|
|
163
|
+
reason: `it could not be read (${error instanceof Error ? error.message : String(error)})`,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (!loaded.ok) {
|
|
167
|
+
warnStalePrebuilt(loaded.reason);
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
return { ok: true, contracts: loaded.contracts };
|
|
171
|
+
}
|
|
172
|
+
function encodingApplicationValues(execute, contract) {
|
|
173
|
+
return (request, report, _source, caller) => {
|
|
174
|
+
const copy = copyAtDoor(request.arguments);
|
|
175
|
+
if (!copy.ok) {
|
|
176
|
+
return execute(request, report, { refused: copy.error }, caller);
|
|
177
|
+
}
|
|
178
|
+
return execute({
|
|
179
|
+
...request,
|
|
180
|
+
arguments: encodeOperationArgumentsForWire(contract, request, copy.value),
|
|
181
|
+
}, report, "owned", caller);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
async function executeTotally(execute, request, diagnostics, source, caller) {
|
|
98
185
|
const report = createDiagnosticsReporter(diagnostics, request);
|
|
99
186
|
try {
|
|
100
|
-
return await execute(request, report, source);
|
|
187
|
+
return await execute(request, report, source, caller);
|
|
101
188
|
}
|
|
102
189
|
catch (error) {
|
|
103
190
|
report(error, "A3000");
|
|
@@ -138,18 +225,18 @@ function executeTransactionRequestTotally(execute, request, diagnostics, misuse)
|
|
|
138
225
|
}
|
|
139
226
|
return executeTransactionTotally(execute, envelope.value, diagnostics, undefined, { source: "caller" });
|
|
140
227
|
}
|
|
141
|
-
async function executeTransactionTotally(execute, request, diagnostics, origins, planArguments) {
|
|
228
|
+
async function executeTransactionTotally(execute, request, diagnostics, origins, planArguments, caller) {
|
|
142
229
|
const channel = createTransactionDiagnosticsChannel(diagnostics, request);
|
|
143
230
|
const report = channel.transaction();
|
|
144
231
|
try {
|
|
145
|
-
return await execute(request, channel, origins, planArguments);
|
|
232
|
+
return await execute(request, channel, origins, planArguments, caller);
|
|
146
233
|
}
|
|
147
234
|
catch (error) {
|
|
148
235
|
report(error, "A3000");
|
|
149
236
|
return internalFailure();
|
|
150
237
|
}
|
|
151
238
|
}
|
|
152
|
-
async function runTransactionTotally(execute, assembler, operations, requestId, state, diagnostics) {
|
|
239
|
+
async function runTransactionTotally(execute, assembler, operations, requestId, state, diagnostics, caller) {
|
|
153
240
|
let assembled;
|
|
154
241
|
try {
|
|
155
242
|
assembled = await assembler.assemble(operations);
|
|
@@ -174,5 +261,10 @@ async function runTransactionTotally(execute, assembler, operations, requestId,
|
|
|
174
261
|
source: "owned",
|
|
175
262
|
refused: assembled.refused,
|
|
176
263
|
statements: assembled.statements,
|
|
177
|
-
});
|
|
264
|
+
}, caller);
|
|
265
|
+
}
|
|
266
|
+
function withServerClientAccess(facade, access) {
|
|
267
|
+
return access === undefined
|
|
268
|
+
? facade
|
|
269
|
+
: Object.freeze({ ...facade, $access: access });
|
|
178
270
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { AvAdapterModel } from "../adapters/adapter-model.js";
|
|
2
2
|
import type { AvContract } from "../contracts/contract.js";
|
|
3
3
|
import type { AvApplicationScalarForms, AvWireScalarForms } from "../contracts/scalar-value-type.js";
|
|
4
|
-
import type { AvResourceKey } from "../operations/operation-arguments.js";
|
|
5
|
-
import type {
|
|
4
|
+
import type { AvOperationArgumentsFor, AvResourceKey } from "../operations/operation-arguments.js";
|
|
5
|
+
import type { AvOperationCall, AvOperationGrammar, DeferredArguments, DeferredPlainCall, DeferredProjectingCall, PlainCall, ProjectingCall } from "../operations/operation-call.js";
|
|
6
6
|
import type { AvOperationIdentity } from "../operations/operation-identity.js";
|
|
7
|
+
import { type PolicyCaller } from "../policy/policy-request.js";
|
|
7
8
|
import type { AvExecutionOptions } from "../runtime/execution-options.js";
|
|
8
|
-
import type {
|
|
9
|
+
import type { AvOperationRequest } from "../runtime/operation-request.js";
|
|
9
10
|
import type { AvOperationResponse } from "../runtime/operation-response.js";
|
|
10
11
|
import type { AvState } from "../runtime/request-state.js";
|
|
11
|
-
import type {
|
|
12
|
+
import type { AvSqlStatementBuilder } from "../transactions/sql-statement.js";
|
|
12
13
|
import type { AvTransactionResponse } from "../transactions/transaction-response.js";
|
|
14
|
+
import type { AccessProviderOf, ServerClientAccess } from "./access-facade.js";
|
|
13
15
|
import type { AvContractApplicationView, ClientContractView } from "./contract-view.js";
|
|
14
16
|
/**
|
|
15
17
|
* A model whose Resource names are not literal — the abstract `AvAdapterModel` behind
|
|
@@ -19,13 +21,46 @@ import type { AvContractApplicationView, ClientContractView } from "./contract-v
|
|
|
19
21
|
type OpaqueSurface = {
|
|
20
22
|
readonly [resource: string]: unknown;
|
|
21
23
|
};
|
|
22
|
-
/** The
|
|
23
|
-
type FacadeSurface = "application" | "client" | "appTx" | "clientTx";
|
|
24
|
+
/** The typed surfaces of an `AvFramework`, named by the member that holds each. */
|
|
25
|
+
type FacadeSurface = "application" | "client" | "serverClient" | "appTx" | "clientTx" | "serverClientTx";
|
|
26
|
+
/** `framework.application.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`. */
|
|
27
|
+
export type AvApplicationProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = ProjectingCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
28
|
+
/** `framework.application.<Resource>.<family>.<variant>` when it does not (the `count` variants). */
|
|
29
|
+
export type AvApplicationPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = PlainCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
30
|
+
/** `framework.client.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`: wire forms in. */
|
|
31
|
+
export type AvClientProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = ProjectingCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvWireScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
32
|
+
/** `framework.client.<Resource>.<family>.<variant>` when it does not. */
|
|
33
|
+
export type AvClientPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = PlainCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvWireScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
34
|
+
/** `framework.appTx.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`. */
|
|
35
|
+
export type AvAppTxProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredProjectingCall<C, R, I, DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "application">;
|
|
36
|
+
/** `framework.appTx.<Resource>.<family>.<variant>` when it does not. */
|
|
37
|
+
export type AvAppTxPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredPlainCall<C, R, I, DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "application">;
|
|
38
|
+
/** `framework.clientTx.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`: wire forms in. */
|
|
39
|
+
export type AvClientTxProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredProjectingCall<C, R, I, DeferredArguments<C, R, I, AvWireScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "client">;
|
|
40
|
+
/** `framework.clientTx.<Resource>.<family>.<variant>` when it does not. */
|
|
41
|
+
export type AvClientTxPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredPlainCall<C, R, I, DeferredArguments<C, R, I, AvWireScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "client">;
|
|
42
|
+
/**
|
|
43
|
+
* `framework.serverClient.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`:
|
|
44
|
+
* the Client Contract's view, application forms in.
|
|
45
|
+
*/
|
|
46
|
+
export type AvServerClientProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = ProjectingCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
47
|
+
/** `framework.serverClient.<Resource>.<family>.<variant>` when it does not. */
|
|
48
|
+
export type AvServerClientPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = PlainCall<C, R, I, AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms>, AvApplicationScalarForms, AvExecutionOptions>;
|
|
49
|
+
/**
|
|
50
|
+
* `framework.serverClientTx.<Resource>.<family>.<variant>` when the variant takes a `select` or `include`:
|
|
51
|
+
* the Client Contract's view, application forms in, a client-origin handle out.
|
|
52
|
+
*/
|
|
53
|
+
export type AvServerClientTxProjectingCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredProjectingCall<C, R, I, DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "client">;
|
|
54
|
+
/** `framework.serverClientTx.<Resource>.<family>.<variant>` when it does not. */
|
|
55
|
+
export type AvServerClientTxPlainCall<in out C extends AvContract, in out R extends AvResourceKey<C>, in out I extends AvOperationIdentity> = DeferredPlainCall<C, R, I, DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms>, AvApplicationScalarForms, "client">;
|
|
24
56
|
/**
|
|
25
57
|
* One variant on a surface: a direct call (application or wire forms), or a
|
|
26
|
-
* deferred one for a transaction (`appTx`, `clientTx`)
|
|
58
|
+
* deferred one for a transaction (`appTx`, `clientTx`, `serverClientTx`),
|
|
59
|
+
* projecting when its arguments carry a `select` (as `AvOperationCall` and
|
|
60
|
+
* `AvDeferredOperationCall` decide it). `serverClient` and `serverClientTx` take
|
|
61
|
+
* the application forms over the Client Contract's view.
|
|
27
62
|
*/
|
|
28
|
-
type SurfaceCall<C extends AvContract, R extends AvResourceKey<C>, I extends AvOperationIdentity, S extends FacadeSurface> = S extends "application" ?
|
|
63
|
+
type SurfaceCall<C extends AvContract, R extends AvResourceKey<C>, I extends AvOperationIdentity, S extends FacadeSurface> = S extends "application" ? "select" extends keyof AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms> ? AvApplicationProjectingCall<C, R, I> : AvApplicationPlainCall<C, R, I> : S extends "client" ? "select" extends keyof AvOperationArgumentsFor<C, R, I, AvWireScalarForms> ? AvClientProjectingCall<C, R, I> : AvClientPlainCall<C, R, I> : S extends "serverClient" ? "select" extends keyof AvOperationArgumentsFor<C, R, I, AvApplicationScalarForms> ? AvServerClientProjectingCall<C, R, I> : AvServerClientPlainCall<C, R, I> : S extends "appTx" ? "select" extends keyof DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms> ? AvAppTxProjectingCall<C, R, I> : AvAppTxPlainCall<C, R, I> : S extends "clientTx" ? "select" extends keyof DeferredArguments<C, R, I, AvWireScalarForms, AvApplicationScalarForms> ? AvClientTxProjectingCall<C, R, I> : AvClientTxPlainCall<C, R, I> : "select" extends keyof DeferredArguments<C, R, I, AvApplicationScalarForms, AvApplicationScalarForms> ? AvServerClientTxProjectingCall<C, R, I> : AvServerClientTxPlainCall<C, R, I>;
|
|
29
64
|
/** The families view `C` advertises on Resource `R`. */
|
|
30
65
|
type FamilyKey<C extends AvContract, R extends AvResourceKey<C>> = keyof AvOperationGrammar<C>[R];
|
|
31
66
|
/** One family node of surface `S`; the public names below are its four instances. */
|
|
@@ -36,10 +71,14 @@ type FamilyNode<C extends AvContract, S extends FacadeSurface, R extends AvResou
|
|
|
36
71
|
export type AvApplicationFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "application", R, F>;
|
|
37
72
|
/** `framework.client.<Resource>.<family>`: one direct call per variant, wire forms. */
|
|
38
73
|
export type AvClientFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "client", R, F>;
|
|
74
|
+
/** `framework.serverClient.<Resource>.<family>`: one direct call per variant, application forms. */
|
|
75
|
+
export type AvServerClientFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "serverClient", R, F>;
|
|
39
76
|
/** `framework.appTx.<Resource>.<family>`: one deferred operation per variant. */
|
|
40
77
|
export type AvAppTxFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "appTx", R, F>;
|
|
41
78
|
/** `framework.clientTx.<Resource>.<family>`: one deferred operation per variant. */
|
|
42
79
|
export type AvClientTxFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "clientTx", R, F>;
|
|
80
|
+
/** `framework.serverClientTx.<Resource>.<family>`: one deferred operation per variant, application forms. */
|
|
81
|
+
export type AvServerClientTxFamilyFacade<in out C extends AvContract, in out R extends AvResourceKey<C>, in out F extends FamilyKey<C, R>> = FamilyNode<C, "serverClientTx", R, F>;
|
|
43
82
|
/** `framework.application.<Resource>`: one {@link AvApplicationFamilyFacade} per family. */
|
|
44
83
|
export type AvApplicationResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
45
84
|
readonly [F in FamilyKey<C, R>]: AvApplicationFamilyFacade<C, R, F>;
|
|
@@ -48,6 +87,10 @@ export type AvApplicationResourceFacade<in out C extends AvContract, in out R ex
|
|
|
48
87
|
export type AvClientResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
49
88
|
readonly [F in FamilyKey<C, R>]: AvClientFamilyFacade<C, R, F>;
|
|
50
89
|
};
|
|
90
|
+
/** `framework.serverClient.<Resource>`: one {@link AvServerClientFamilyFacade} per family. */
|
|
91
|
+
export type AvServerClientResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
92
|
+
readonly [F in FamilyKey<C, R>]: AvServerClientFamilyFacade<C, R, F>;
|
|
93
|
+
};
|
|
51
94
|
/** `framework.appTx.<Resource>`: one {@link AvAppTxFamilyFacade} per family. */
|
|
52
95
|
export type AvAppTxResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
53
96
|
readonly [F in FamilyKey<C, R>]: AvAppTxFamilyFacade<C, R, F>;
|
|
@@ -56,6 +99,10 @@ export type AvAppTxResourceFacade<in out C extends AvContract, in out R extends
|
|
|
56
99
|
export type AvClientTxResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
57
100
|
readonly [F in FamilyKey<C, R>]: AvClientTxFamilyFacade<C, R, F>;
|
|
58
101
|
};
|
|
102
|
+
/** `framework.serverClientTx.<Resource>`: one {@link AvServerClientTxFamilyFacade} per family. */
|
|
103
|
+
export type AvServerClientTxResourceFacade<in out C extends AvContract, in out R extends AvResourceKey<C>> = {
|
|
104
|
+
readonly [F in FamilyKey<C, R>]: AvServerClientTxFamilyFacade<C, R, F>;
|
|
105
|
+
};
|
|
59
106
|
/**
|
|
60
107
|
* `framework.application`: one {@link AvApplicationResourceFacade} per Resource
|
|
61
108
|
* of `C`, the Application Contract's view.
|
|
@@ -70,14 +117,21 @@ export type AvApplicationFacade<C extends AvContract> = {
|
|
|
70
117
|
export type AvClientFacade<C extends AvContract> = {
|
|
71
118
|
readonly [R in AvResourceKey<C>]: AvClientResourceFacade<C, R>;
|
|
72
119
|
};
|
|
120
|
+
/**
|
|
121
|
+
* `framework.serverClient`: one {@link AvServerClientResourceFacade} per Resource
|
|
122
|
+
* of `C`, the Client Contract's view, taking application forms.
|
|
123
|
+
*/
|
|
124
|
+
export type AvServerClientFacade<C extends AvContract> = {
|
|
125
|
+
readonly [R in AvResourceKey<C>]: AvServerClientResourceFacade<C, R>;
|
|
126
|
+
};
|
|
73
127
|
/** `framework.appTx.$sql`: the developer SQL step only an application transaction has. */
|
|
74
128
|
type ApplicationSqlStep = {
|
|
75
129
|
/**
|
|
76
130
|
* A developer SQL step, written only as a tagged template:
|
|
77
131
|
* ``framework.appTx.$sql<Row>`select … ${value}` ``. Every interpolated value
|
|
78
|
-
* is bound as a parameter. See {@link
|
|
132
|
+
* is bound as a parameter. See {@link AvSqlStatementBuilder}.
|
|
79
133
|
*/
|
|
80
|
-
readonly $sql:
|
|
134
|
+
readonly $sql: AvSqlStatementBuilder;
|
|
81
135
|
};
|
|
82
136
|
/**
|
|
83
137
|
* `framework.appTx`: one {@link AvAppTxResourceFacade} per Resource of `C`, the
|
|
@@ -93,18 +147,31 @@ export type AvAppTxFacade<C extends AvContract> = {
|
|
|
93
147
|
export type AvClientTxFacade<C extends AvContract> = {
|
|
94
148
|
readonly [R in AvResourceKey<C>]: AvClientTxResourceFacade<C, R>;
|
|
95
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* `framework.serverClientTx`: one {@link AvServerClientTxResourceFacade} per
|
|
152
|
+
* Resource of `C`, the Client Contract's view, taking application forms.
|
|
153
|
+
*/
|
|
154
|
+
export type AvServerClientTxFacade<C extends AvContract> = {
|
|
155
|
+
readonly [R in AvResourceKey<C>]: AvServerClientTxResourceFacade<C, R>;
|
|
156
|
+
};
|
|
96
157
|
type ApplicationSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface : AvApplicationFacade<C> : never;
|
|
97
158
|
type ClientSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface : AvClientFacade<C> : never;
|
|
159
|
+
type ServerClientSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface : AvServerClientFacade<C> : never;
|
|
98
160
|
type ApplicationDeferredSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface & ApplicationSqlStep : AvAppTxFacade<C> : never;
|
|
99
161
|
type ClientDeferredSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface : AvClientTxFacade<C> : never;
|
|
162
|
+
type ServerClientDeferredSurface<C> = C extends AvContract ? string extends AvResourceKey<C> ? OpaqueSurface : AvServerClientTxFacade<C> : never;
|
|
100
163
|
/** `framework.application`'s type: {@link AvApplicationFacade}, or opaque. */
|
|
101
164
|
export type ApplicationOperations<M extends AvAdapterModel, Cfg> = ApplicationSurface<AvContractApplicationView<M, Cfg>>;
|
|
102
165
|
/** `framework.client`'s type: {@link AvClientFacade}, or opaque. */
|
|
103
166
|
export type ClientOperations<M extends AvAdapterModel, Cfg> = ClientSurface<ClientContractView<M, Cfg>>;
|
|
167
|
+
/** `framework.serverClient`'s type: {@link AvServerClientFacade}, or opaque, and `$access`. */
|
|
168
|
+
export type ServerClientOperations<M extends AvAdapterModel, Cfg> = ServerClientSurface<ClientContractView<M, Cfg>> & ServerClientAccess<ClientContractView<M, Cfg>, AccessProviderOf<Cfg>>;
|
|
104
169
|
/** `framework.appTx`'s type: {@link AvAppTxFacade}, or opaque with `$sql`. */
|
|
105
170
|
export type ApplicationTransactionBuilders<M extends AvAdapterModel, Cfg> = ApplicationDeferredSurface<AvContractApplicationView<M, Cfg>>;
|
|
106
171
|
/** `framework.clientTx`'s type: {@link AvClientTxFacade}, or opaque. */
|
|
107
172
|
export type ClientTransactionBuilders<M extends AvAdapterModel, Cfg> = ClientDeferredSurface<ClientContractView<M, Cfg>>;
|
|
173
|
+
/** `framework.serverClientTx`'s type: {@link AvServerClientTxFacade}, or opaque. */
|
|
174
|
+
export type ServerClientTransactionBuilders<M extends AvAdapterModel, Cfg> = ServerClientDeferredSurface<ClientContractView<M, Cfg>>;
|
|
108
175
|
/**
|
|
109
176
|
* The Resources of a pipeline ctx: `ctx.<Resource>.<family>.<variant>(args)`,
|
|
110
177
|
* application-origin, resolving the operation's data.
|
|
@@ -130,8 +197,8 @@ type ComputeReadFacade<C> = C extends AvContract ? string extends AvResourceKey<
|
|
|
130
197
|
};
|
|
131
198
|
} : never;
|
|
132
199
|
/** Builds the request one façade call hands to `execute`, under its request id and state. */
|
|
133
|
-
export type FacadeRequest = (resource: string, identity: AvOperationIdentity, args: unknown, requestId: string, state: AvState | undefined) =>
|
|
134
|
-
type FacadeExecutor = (request:
|
|
200
|
+
export type FacadeRequest = (resource: string, identity: AvOperationIdentity, args: unknown, requestId: string, state: AvState | undefined) => AvOperationRequest;
|
|
201
|
+
type FacadeExecutor = (request: AvOperationRequest, caller: PolicyCaller | undefined) => Promise<AvOperationResponse>;
|
|
135
202
|
/**
|
|
136
203
|
* Builds a façade over `model`, the same object its types are read from, so a
|
|
137
204
|
* call that type-checks always reaches `execute`: a Resource, variant or field
|
|
@@ -154,7 +221,7 @@ export declare function settleOperation(response: AvOperationResponse | AvTransa
|
|
|
154
221
|
* One leaf of an operation tree: the callable for one advertised variant. The
|
|
155
222
|
* second parameter is a façade call's options; a builder leaf ignores it.
|
|
156
223
|
*/
|
|
157
|
-
|
|
224
|
+
type OperationLeaf = (resource: string, identity: AvOperationIdentity) => (args?: unknown, options?: unknown) => unknown;
|
|
158
225
|
/**
|
|
159
226
|
* The runtime shape every façade and builder shares: one frozen property per
|
|
160
227
|
* Resource of `model`, one per family under it, one leaf per variant the model
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isOperationVariantAvailable } from "../contracts/resource-operations.js";
|
|
2
2
|
import { parseOperationIdentity } from "../operations/operation-identity.js";
|
|
3
|
+
import { callerOf } from "../policy/policy-request.js";
|
|
3
4
|
import { thrownFailure } from "../runtime/framework-error.factory.js";
|
|
4
5
|
import { requestIdOf } from "../runtime/request-id.js";
|
|
5
6
|
import { stateOptionOf } from "../runtime/request-state.resolver.js";
|
|
6
7
|
export function createOperationFacade(model, request, execute) {
|
|
7
|
-
return createOperationTree(model, (resource, identity) => async (args, options) => settleOperation(await execute(request(resource, identity, args === undefined ? {} : args, requestIdOf(options), stateOptionOf(options)))));
|
|
8
|
+
return createOperationTree(model, (resource, identity) => async (args, options) => settleOperation(await execute(request(resource, identity, args === undefined ? {} : args, requestIdOf(options), stateOptionOf(options)), callerOf(options))));
|
|
8
9
|
}
|
|
9
10
|
export function settleOperation(response) {
|
|
10
11
|
if (response.cause !== null) {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { AvAdapterDiscoveryDiagnostic, AvAdapterDiscoveryDiagnosticCode, }
|
|
|
3
3
|
export type { AvAdapterModel } from "./adapters/adapter-model.js";
|
|
4
4
|
export type { AvContracts } from "./compiler/contract.compiler.js";
|
|
5
5
|
export type { AvContractCompilerDiagnostic, AvContractCompilerDiagnosticCode, } from "./compiler/contract-compiler-diagnostic.js";
|
|
6
|
+
export type { AvConfigComputedFields } from "./config/computed-fields.js";
|
|
6
7
|
export type { AvMcpEndpoint } from "./config/config.resolver.js";
|
|
7
8
|
export type { AvConfigDiagnostic, AvConfigDiagnosticCode, } from "./config/config-diagnostic.js";
|
|
8
9
|
export type { AvConfigLayerName, AvRequestOrigin, } from "./config/config-layer.js";
|
|
@@ -12,12 +13,13 @@ export type { AvConfigExact } from "./config/exact-framework-config.js";
|
|
|
12
13
|
export type { AvConfig, AvConfigAddedFieldDefinition, AvConfigAgentLayer, AvConfigAny, AvConfigExemptions, AvConfigFamily, AvConfigFieldDefinition, AvConfigFieldLifecycleTrait, AvConfigKnownFieldDefinition, AvConfigLayer, AvConfigLayerAny, AvConfigLayerKind, AvConfigLimits, AvConfigMcp, AvConfigOperations, AvConfigOperationsExemption, AvConfigOverlayField, AvConfigRelationFieldExemption, AvConfigResource, AvConfigResourceExemption, AvConfigResourceFields, AvConfigResourceKey, AvConfigResources, AvConfigResourcesAny, AvConfigResourceTransactions, AvConfigRootField, AvConfigScalarFieldExemption, AvConfigScalarTypeRef, AvConfigVariant, AvFieldCompute, AvRelationFieldCapabilityName, AvRelationFieldPipeline, AvScalarFieldCapabilityName, AvScalarFieldPipeline, AvZCheck, AvZFormat, } from "./config/framework-config.js";
|
|
13
14
|
export type { AvPipeline, AvTransactionPipeline, } from "./config/pipeline-config.js";
|
|
14
15
|
export type { AvPaginationCapability, AvProjectionScope, AvRelationFilterCapability, AvRelationMutationDirective, AvRelationReducer, AvScalarFilterOperator, AvScalarMutationDirective, AvWriteScope, } from "./contracts/capability.js";
|
|
15
|
-
export type { AvContract, AvContractAgent, AvContractApplication, AvContractClient, AvContractCore, } from "./contracts/contract.js";
|
|
16
|
+
export type { AvContract, AvContractAgent, AvContractApplication, AvContractClient, AvContractCore, AvCoreResource, } from "./contracts/contract.js";
|
|
17
|
+
export type { AvContractClientAccess } from "./contracts/contract-access.js";
|
|
16
18
|
export type { AvContractLimits } from "./contracts/contract-limits.js";
|
|
17
19
|
export type { AvContractClientProtocol, AvContractHash, AvContractProtocol, } from "./contracts/contract-protocol.js";
|
|
18
20
|
export type { AvCreateRequirementGroup, AvCreateRequirements, } from "./contracts/create-requirements.js";
|
|
19
21
|
export type { AvEnumDefinition } from "./contracts/enum-definition.js";
|
|
20
|
-
export type { AvField, AvProjectionScopes, AvRelationField, AvRelationFieldCapabilities, AvRelationMutationCapability, AvRelationProjectionCapability, AvRelationReducerCapability, AvScalarField, AvScalarFieldCapabilities, AvScalarFormat, AvScopedRelationMutations, AvScopedRelationReducers, AvWriteScopes, } from "./contracts/field.js";
|
|
22
|
+
export type { AvCoreField, AvCoreRelationField, AvField, AvProjectionScopes, AvRelationField, AvRelationFieldCapabilities, AvRelationMutationCapability, AvRelationProjectionCapability, AvRelationReducerCapability, AvScalarField, AvScalarFieldCapabilities, AvScalarFormat, AvScopedRelationMutations, AvScopedRelationReducers, AvWriteScopes, } from "./contracts/field.js";
|
|
21
23
|
export type { AvFieldCheck } from "./contracts/field-check.js";
|
|
22
24
|
export type { AvIdentifier, AvScalarFieldKey } from "./contracts/identifier.js";
|
|
23
25
|
export type { AvLifecycleTrait } from "./contracts/lifecycle-trait.js";
|
|
@@ -26,31 +28,41 @@ export type { AvOperationAvailability, AvOperationVariantScopes, AvResourceOpera
|
|
|
26
28
|
export type { AvBuiltInScalar, AvScalarDefinition, AvScalarRegistry, } from "./contracts/scalar.js";
|
|
27
29
|
export type { AvApplicationScalarForms, AvScalarValueType, AvWireScalarForms, } from "./contracts/scalar-value-type.js";
|
|
28
30
|
export type { AvTransactionCapability } from "./contracts/transaction-capability.js";
|
|
31
|
+
export type { AvContractView, AvManagedContractView, } from "./framework/contract-view.js";
|
|
29
32
|
export { createFramework } from "./framework/framework.factory.js";
|
|
30
33
|
export type { AvFramework } from "./framework/framework.js";
|
|
31
34
|
export type { AvConstructionDiagnostic, AvConstructionStage, } from "./framework/framework-construction.error.js";
|
|
32
35
|
export { AvConstructionError } from "./framework/framework-construction.error.js";
|
|
33
|
-
export type { AvApplicationFacade, AvApplicationFamilyFacade, AvApplicationResourceFacade, AvAppTxFacade, AvAppTxFamilyFacade, AvAppTxResourceFacade, AvClientFacade, AvClientFamilyFacade, AvClientResourceFacade, AvClientTxFacade, AvClientTxFamilyFacade, AvClientTxResourceFacade, } from "./framework/operation-facade.js";
|
|
34
|
-
export type { AvCreateDataInput, AvCursorInput, AvFieldKey, AvIncludeInput, AvNullsOrder, AvOperationArgumentMap, AvOperationArgumentsFor, AvOrderByEntry, AvOrderByInput, AvProjectionEntry, AvRelationProjectionInput, AvResourceKey, AvScalarOrderInput, AvSelectInput, AvSortDirection, AvUniqueWhereInput, AvUpdateDataInput, AvWhereInput, } from "./operations/operation-arguments.js";
|
|
36
|
+
export type { AvApplicationFacade, AvApplicationFamilyFacade, AvApplicationPlainCall, AvApplicationProjectingCall, AvApplicationResourceFacade, AvAppTxFacade, AvAppTxFamilyFacade, AvAppTxPlainCall, AvAppTxProjectingCall, AvAppTxResourceFacade, AvClientFacade, AvClientFamilyFacade, AvClientPlainCall, AvClientProjectingCall, AvClientResourceFacade, AvClientTxFacade, AvClientTxFamilyFacade, AvClientTxPlainCall, AvClientTxProjectingCall, AvClientTxResourceFacade, AvServerClientFacade, AvServerClientFamilyFacade, AvServerClientPlainCall, AvServerClientProjectingCall, AvServerClientResourceFacade, AvServerClientTxFacade, AvServerClientTxFamilyFacade, AvServerClientTxPlainCall, AvServerClientTxProjectingCall, AvServerClientTxResourceFacade, } from "./framework/operation-facade.js";
|
|
37
|
+
export type { AvCreateDataInput, AvCursorInput, AvFieldKey, AvIncludeInput, AvNoAdvertisedMember, AvNullsOrder, AvOperationArgumentMap, AvOperationArgumentsFor, AvOrderByEntry, AvOrderByInput, AvProjectionEntry, AvRelationProjectionInput, AvResourceKey, AvScalarFilterOperands, AvScalarOrderInput, AvScalarWhereInput, AvSelectInput, AvSortDirection, AvUniqueWhereInput, AvUpdateDataInput, AvWhereInput, } from "./operations/operation-arguments.js";
|
|
35
38
|
export type { AvDeferredOperationCall, AvOperationCall, AvOperationGrammar, AvOperationSlot, } from "./operations/operation-call.js";
|
|
36
39
|
export type { AvOperationFamily, AvOperationIdentity, AvOperationVariant, } from "./operations/operation-identity.js";
|
|
37
40
|
export type { AvOperationResultFor } from "./operations/operation-result.js";
|
|
38
41
|
export type { AvValidationCode, AvValidationIssue, } from "./operations/validation-code.js";
|
|
42
|
+
export type { AvAccessProvider } from "./policy/access-provider.interface.js";
|
|
43
|
+
export type { AvAccessQuestion } from "./policy/access-question.js";
|
|
44
|
+
export type { AvAccessVerbs } from "./policy/access-verbs.js";
|
|
45
|
+
export type { AvPolicyEngine, AvPolicyWhere, } from "./policy/policy-engine.js";
|
|
46
|
+
export type { AvPrebuiltContracts } from "./prebuilt/prebuilt-contracts.js";
|
|
39
47
|
export { AvDecimal } from "./runtime/decimal.js";
|
|
40
|
-
export type { AvDiagnostic, AvDiagnosticsSink, AvMcpDiagnostic, AvOperationDiagnostic, AvTransactionDiagnostic, } from "./runtime/diagnostics-reporter.js";
|
|
48
|
+
export type { AvCanDiagnostic, AvDiagnostic, AvDiagnosticsSink, AvMcpDiagnostic, AvOperationDiagnostic, AvTransactionDiagnostic, } from "./runtime/diagnostics-reporter.js";
|
|
49
|
+
export { AvErrorCatalog, type AvErrorCatalogCode, type AvErrorCatalogEntry, type AvErrorKind, } from "./runtime/error.catalog.js";
|
|
41
50
|
export type { AvExecutionOptions } from "./runtime/execution-options.js";
|
|
42
51
|
export type { AvComputeContext, AvComputeCreate, AvComputeRead, AvComputeUpdate, } from "./runtime/field-compute.js";
|
|
43
52
|
export { AvAuthError, AvConflictError, AvContractMismatchError, AvError, AvInternalError, AvNotFoundError, AvProtocolError, AvValidationError, } from "./runtime/framework-error.js";
|
|
44
53
|
export type { AvJsonValue } from "./runtime/json-value.js";
|
|
45
54
|
export type { AvMisuseEvent, AvMisuseSink, } from "./runtime/misuse-reporter.js";
|
|
55
|
+
export type { AvAgentOperationRequest, AvApplicationOperationRequest, AvClientOperationRequest, AvOperationRequest, AvRequestProtocol, } from "./runtime/operation-request.js";
|
|
46
56
|
export type { AvCause, AvOperationCode, AvOperationErrorCode, AvOperationFailureResponse, AvOperationNoMatchResponse, AvOperationResponse, AvOperationSuccessCode, AvOperationSuccessDataCode, AvOperationSuccessResponse, } from "./runtime/operation-response.js";
|
|
47
57
|
export type { AvAfterHook, AvBeforeHook, AvContext, AvFieldGuard, AvFieldPipe, AvFilter, AvGuard, AvInterceptor, AvPipe, AvTransactionAfterHook, AvTransactionBeforeHook, AvTransactionContext, AvTransactionFilter, AvTransactionGuard, AvTransactionInterceptor, AvTransactionPipe, AvTransactionStep, AvTransportContext, } from "./runtime/pipeline.js";
|
|
48
58
|
export type { AvDeepReadonly } from "./runtime/readonly-value.js";
|
|
49
59
|
export type { AvState } from "./runtime/request-state.js";
|
|
50
60
|
export type { AvOperation, AvOperationHandle, AvOperationReferenceSurface, AvReferenceableField, AvReferenceBuilder, AvSingleRowResult, AvTransactionResults, AvTransactionRunner, } from "./transactions/deferred-operation.js";
|
|
61
|
+
export type { AvSqlStatementBuilder, AvSqlStatementValue, } from "./transactions/sql-statement.js";
|
|
51
62
|
export type { AvTransactionIntegrityViolation } from "./transactions/transaction-integrity-error.js";
|
|
52
63
|
export { AvTransactionIntegrityError } from "./transactions/transaction-integrity-error.js";
|
|
53
64
|
export type { AvTransactionReference } from "./transactions/transaction-reference.js";
|
|
65
|
+
export type { AvAgentTransactionRequest, AvApplicationTransactionRequest, AvClientTransactionRequest, AvTransactionRequest, } from "./transactions/transaction-request.js";
|
|
54
66
|
export type { AvTransactionCommittedResponse, AvTransactionResponse, } from "./transactions/transaction-response.js";
|
|
55
67
|
export type { AvTransactionSlotPathViolation } from "./transactions/transaction-slot-path-error.js";
|
|
56
68
|
export { AvTransactionSlotPathError } from "./transactions/transaction-slot-path-error.js";
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { defineResource, } from "./config/define-resource.js";
|
|
|
2
2
|
export { createFramework } from "./framework/framework.factory.js";
|
|
3
3
|
export { AvConstructionError } from "./framework/framework-construction.error.js";
|
|
4
4
|
export { AvDecimal } from "./runtime/decimal.js";
|
|
5
|
+
export { AvErrorCatalog, } from "./runtime/error.catalog.js";
|
|
5
6
|
export { AvAuthError, AvConflictError, AvContractMismatchError, AvError, AvInternalError, AvNotFoundError, AvProtocolError, AvValidationError, } from "./runtime/framework-error.js";
|
|
6
7
|
export { AvTransactionIntegrityError } from "./transactions/transaction-integrity-error.js";
|
|
7
8
|
export { AvTransactionSlotPathError } from "./transactions/transaction-slot-path-error.js";
|
package/dist/internal.d.ts
CHANGED
|
@@ -23,18 +23,23 @@ export { computeClientContractHash, verifyClientContractHash, } from "./contract
|
|
|
23
23
|
export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
|
|
24
24
|
export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
|
|
25
25
|
export { advertisedDirectives, advertisedReducers } from "./contracts/field.js";
|
|
26
|
+
export { projectJsonValue } from "./contracts/json-schema.projector.js";
|
|
26
27
|
export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
|
|
27
28
|
export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
|
|
28
29
|
export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
|
|
29
30
|
export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
|
|
30
31
|
export type { AvContractApplicationView } from "./framework/contract-view.js";
|
|
32
|
+
export type { AvDatabaseRefusal } from "./operations/database-refusal.js";
|
|
33
|
+
export { DATABASE_REFUSALS } from "./operations/database-refusal.js";
|
|
31
34
|
export type { SemanticOperationArguments } from "./operations/operation-validator.js";
|
|
32
35
|
export { VALIDATION_CODES } from "./operations/validation-code.js";
|
|
36
|
+
export { accessProviderOf } from "./policy/access-provider.registry.js";
|
|
37
|
+
export { ACCESS_VERB_NAMES, ACCESS_VERBS, providerVerb, } from "./policy/access-verb.table.js";
|
|
38
|
+
export { prebuiltFileChanges } from "./prebuilt/prebuilt-changes.js";
|
|
39
|
+
export { emitPrebuiltContracts, prebuiltContractsOf, } from "./prebuilt/prebuilt-contracts.emitter.js";
|
|
33
40
|
export { mcpFailureReporterOf } from "./runtime/diagnostics-reporter.js";
|
|
34
41
|
export type { AvErrorClassName } from "./runtime/framework-error-class.table.js";
|
|
35
42
|
export { FRAMEWORK_ERROR_CLASS_OF } from "./runtime/framework-error-class.table.js";
|
|
36
|
-
export type { AgentOperationRequest, ApplicationOperationRequest, ClientOperationRequest, ClientProtocolIdentity, FrameworkOperationRequest, } from "./runtime/operation-request.js";
|
|
37
43
|
export { OPERATION_CODES } from "./runtime/operation-response.js";
|
|
38
44
|
export type { BuiltinNonRow, OperationFingerprint, } from "./transactions/deferred-operation.js";
|
|
39
45
|
export { computeOperationFingerprint } from "./transactions/operation-fingerprint.js";
|
|
40
|
-
export type { AgentTransactionRequest, ApplicationTransactionRequest, ClientTransactionRequest, FrameworkTransactionRequest, } from "./transactions/transaction-request.js";
|
package/dist/internal.js
CHANGED
|
@@ -7,11 +7,17 @@ export { computeClientContractHash, verifyClientContractHash, } from "./contract
|
|
|
7
7
|
export { DEFAULT_CONTRACT_LIMITS } from "./contracts/contract-limits.js";
|
|
8
8
|
export { AVENTARA_PROTOCOL_VERSION } from "./contracts/contract-protocol.js";
|
|
9
9
|
export { advertisedDirectives, advertisedReducers } from "./contracts/field.js";
|
|
10
|
+
export { projectJsonValue } from "./contracts/json-schema.projector.js";
|
|
10
11
|
export { LIFECYCLE_TRAITS } from "./contracts/lifecycle-trait.js";
|
|
11
12
|
export { isOperationVariantAvailable, projectionScopeOf, writeScopeOf, } from "./contracts/resource-operations.js";
|
|
12
13
|
export { BUILT_IN_SCALARS } from "./contracts/scalar.js";
|
|
13
14
|
export { TRANSACTION_CAPABILITIES } from "./contracts/transaction-capability.js";
|
|
15
|
+
export { DATABASE_REFUSALS } from "./operations/database-refusal.js";
|
|
14
16
|
export { VALIDATION_CODES } from "./operations/validation-code.js";
|
|
17
|
+
export { accessProviderOf } from "./policy/access-provider.registry.js";
|
|
18
|
+
export { ACCESS_VERB_NAMES, ACCESS_VERBS, providerVerb, } from "./policy/access-verb.table.js";
|
|
19
|
+
export { prebuiltFileChanges } from "./prebuilt/prebuilt-changes.js";
|
|
20
|
+
export { emitPrebuiltContracts, prebuiltContractsOf, } from "./prebuilt/prebuilt-contracts.emitter.js";
|
|
15
21
|
export { mcpFailureReporterOf } from "./runtime/diagnostics-reporter.js";
|
|
16
22
|
export { FRAMEWORK_ERROR_CLASS_OF } from "./runtime/framework-error-class.table.js";
|
|
17
23
|
export { OPERATION_CODES } from "./runtime/operation-response.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AvValidationCode } from "./validation-code.js";
|
|
2
|
+
/**
|
|
3
|
+
* Why the database refused a caller's value, each with the validation code and the
|
|
4
|
+
* issue message an adapter answers it with.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DATABASE_REFUSALS: {
|
|
7
|
+
readonly tooLong: {
|
|
8
|
+
readonly code: "V1004";
|
|
9
|
+
readonly message: "The database refused this value: it is longer than the database can hold for its column.";
|
|
10
|
+
};
|
|
11
|
+
readonly outOfRange: {
|
|
12
|
+
readonly code: "V1004";
|
|
13
|
+
readonly message: "The database refused this value: it is outside the range its column can hold.";
|
|
14
|
+
};
|
|
15
|
+
readonly datetimeOutOfRange: {
|
|
16
|
+
readonly code: "V1004";
|
|
17
|
+
readonly message: "The database refused this value: the date and time is outside the range the database can hold.";
|
|
18
|
+
};
|
|
19
|
+
readonly divisionByZero: {
|
|
20
|
+
readonly code: "V1004";
|
|
21
|
+
readonly message: "The database refused this value: it divides by zero.";
|
|
22
|
+
};
|
|
23
|
+
readonly computedNull: {
|
|
24
|
+
readonly code: "V1004";
|
|
25
|
+
readonly message: "The database refused this value: the write computes no value for a column that requires one, as a division by zero does.";
|
|
26
|
+
};
|
|
27
|
+
readonly invalidInput: {
|
|
28
|
+
readonly code: "V1001";
|
|
29
|
+
readonly message: "The database refused this value: it is not valid input for its column's type.";
|
|
30
|
+
};
|
|
31
|
+
readonly nulInText: {
|
|
32
|
+
readonly code: "V1001";
|
|
33
|
+
readonly message: "The database refused this value: its text cannot contain the NUL character (U+0000).";
|
|
34
|
+
};
|
|
35
|
+
readonly nulInJson: {
|
|
36
|
+
readonly code: "V1001";
|
|
37
|
+
readonly message: "The database refused this value: its JSON cannot contain the NUL character (U+0000).";
|
|
38
|
+
};
|
|
39
|
+
readonly trailingEscape: {
|
|
40
|
+
readonly code: "V1001";
|
|
41
|
+
readonly message: "The database refused this value: a text match cannot end with the escape character \\.";
|
|
42
|
+
};
|
|
43
|
+
readonly backReference: {
|
|
44
|
+
readonly code: "V1012";
|
|
45
|
+
readonly message: "The data source refused this nested write: a record written through a relation cannot write that relation or its reference fields back.";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/** A reason the database refused a caller's value: a key of {@link DATABASE_REFUSALS}. */
|
|
49
|
+
export type AvDatabaseRefusal = keyof typeof DATABASE_REFUSALS;
|
|
50
|
+
/** Whether `message` is the message of a database refusal answered under `code`. */
|
|
51
|
+
export declare function isDatabaseRefusalMessage(code: AvValidationCode, message: string): boolean;
|