@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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { projectJsonValue } from "../contracts/json-schema.projector.js";
|
|
2
|
+
import { ACCESS_VERB_NAMES, ACCESS_VERBS, providerVerb, } from "../policy/access-verb.table.js";
|
|
3
|
+
import { copyAtDoor } from "../runtime/caller-data.door.js";
|
|
4
|
+
import { requestIdOf } from "../runtime/request-id.js";
|
|
5
|
+
import { stateOptionOf } from "../runtime/request-state.resolver.js";
|
|
6
|
+
import { encodeOperationArgumentsForWire } from "../transactions/operation-arguments-encoder.js";
|
|
7
|
+
import { settleOperation } from "./operation-facade.js";
|
|
8
|
+
export function createServerClientAccess(dependencies) {
|
|
9
|
+
const { contract, answer, client } = dependencies;
|
|
10
|
+
const stateFor = async (options) => {
|
|
11
|
+
if (options?.state !== undefined || options?.headers === undefined) {
|
|
12
|
+
return stateOf(options);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
state: await dependencies.state({
|
|
16
|
+
headers: requestHeadersOf(options.headers),
|
|
17
|
+
...(options.request === undefined ? {} : { request: options.request }),
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const can = async (questions, options) => settleOperation(await answer({
|
|
22
|
+
origin: "client",
|
|
23
|
+
requestId: requestIdOf(options),
|
|
24
|
+
...(await stateFor(options)),
|
|
25
|
+
body: wireQuestions(contract, questions),
|
|
26
|
+
}));
|
|
27
|
+
if (client === undefined) {
|
|
28
|
+
return Object.freeze({ can });
|
|
29
|
+
}
|
|
30
|
+
const verbs = { can };
|
|
31
|
+
for (const name of ACCESS_VERB_NAMES) {
|
|
32
|
+
const verb = providerVerb(client.verbs, name);
|
|
33
|
+
if (verb !== undefined) {
|
|
34
|
+
verbs[name] = serverVerb(verb, ACCESS_VERBS[name]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze(verbs);
|
|
38
|
+
}
|
|
39
|
+
function serverVerb(verb, shape) {
|
|
40
|
+
const run = async (args, options) => {
|
|
41
|
+
const answer = await verb.call({
|
|
42
|
+
args,
|
|
43
|
+
headers: requestHeadersOf(options?.headers),
|
|
44
|
+
...(options?.request === undefined ? {} : { request: options.request }),
|
|
45
|
+
...(options?.response === undefined
|
|
46
|
+
? {}
|
|
47
|
+
: { response: options.response }),
|
|
48
|
+
});
|
|
49
|
+
switch (shape.resolves) {
|
|
50
|
+
case "nothing":
|
|
51
|
+
return undefined;
|
|
52
|
+
default:
|
|
53
|
+
return answer === null || answer === undefined
|
|
54
|
+
? null
|
|
55
|
+
: projectJsonValue(answer, verb.result);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return shape.args
|
|
59
|
+
? (args, options) => run(args, options)
|
|
60
|
+
: (options) => run(undefined, options);
|
|
61
|
+
}
|
|
62
|
+
function stateOf(options) {
|
|
63
|
+
const state = stateOptionOf(options);
|
|
64
|
+
return state === undefined ? {} : { state };
|
|
65
|
+
}
|
|
66
|
+
function isRecord(value) {
|
|
67
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
68
|
+
}
|
|
69
|
+
function wireQuestions(contract, questions) {
|
|
70
|
+
const copy = copyAtDoor({ questions });
|
|
71
|
+
if (!copy.ok) {
|
|
72
|
+
return { questions };
|
|
73
|
+
}
|
|
74
|
+
const body = copy.value;
|
|
75
|
+
if (!Array.isArray(body.questions)) {
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
questions: body.questions.map((question) => {
|
|
80
|
+
if (!isRecord(question) ||
|
|
81
|
+
!Object.hasOwn(question, "where") ||
|
|
82
|
+
typeof question.resource !== "string" ||
|
|
83
|
+
!Object.hasOwn(contract.resources, question.resource)) {
|
|
84
|
+
return question;
|
|
85
|
+
}
|
|
86
|
+
const encoded = encodeOperationArgumentsForWire(contract, { family: "find", variant: "unique", resource: question.resource }, { where: question.where });
|
|
87
|
+
return { ...question, where: encoded.where };
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function requestHeadersOf(headers) {
|
|
92
|
+
if (headers !== undefined &&
|
|
93
|
+
typeof headers.get === "function") {
|
|
94
|
+
return headers;
|
|
95
|
+
}
|
|
96
|
+
const lowered = new Map();
|
|
97
|
+
for (const [name, value] of Object.entries(headers ?? {})) {
|
|
98
|
+
const values = typeof value === "string"
|
|
99
|
+
? [value]
|
|
100
|
+
: Array.isArray(value)
|
|
101
|
+
? value
|
|
102
|
+
: [];
|
|
103
|
+
if (values.length > 0) {
|
|
104
|
+
const key = name.toLowerCase();
|
|
105
|
+
const before = lowered.get(key);
|
|
106
|
+
lowered.set(key, before === undefined
|
|
107
|
+
? values.join(", ")
|
|
108
|
+
: `${before}, ${values.join(", ")}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return Object.freeze({
|
|
112
|
+
get: (name) => lowered.get(name.toLowerCase()) ?? null,
|
|
113
|
+
has: (name) => lowered.has(name.toLowerCase()),
|
|
114
|
+
forEach: (callback) => {
|
|
115
|
+
for (const [name, value] of lowered) {
|
|
116
|
+
callback(value, name);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
@@ -17,6 +17,14 @@ type RootBlock<Cfg, Key extends PropertyKey> = LiteralRecord<(Cfg & {
|
|
|
17
17
|
})[Key]>;
|
|
18
18
|
/** The root's `resources` block, its stages erased. */
|
|
19
19
|
type ResourcesBlock<Cfg> = ErasedResources<RootBlock<Cfg, "resources">>;
|
|
20
|
+
/** A `resources` block reduced to the `fields` entries the view reads. */
|
|
21
|
+
type ViewBlock<Block> = [Block] extends [never] ? never : {
|
|
22
|
+
readonly [R in keyof Block as "fields" extends keyof NonNullable<Block[R]> ? R : never]: {
|
|
23
|
+
readonly fields: (NonNullable<Block[R]> & {
|
|
24
|
+
readonly fields?: unknown;
|
|
25
|
+
})["fields"];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
20
28
|
/** An overlay's `resources` block, its stages erased (see {@link ResourcesBlock}). */
|
|
21
29
|
type OverlayResourcesBlock<Cfg, Layer extends AvRequestOrigin> = ErasedResources<LiteralRecord<(LiteralRecord<OverlayOf<Cfg, Layer>> & {
|
|
22
30
|
readonly resources?: unknown;
|
|
@@ -90,12 +98,93 @@ type DefinitionOf<FieldEntry> = EntryOf<FieldEntry, "definition">;
|
|
|
90
98
|
type LayeredFields<ModelFields, ResourceConfig> = {
|
|
91
99
|
readonly [F in keyof ModelFields | AddedFieldKey<ModelFields, ResourceConfig>]: F extends keyof ModelFields ? LayeredModelField<ModelFields[F], DefinitionOf<EntryOf<ResourceConfig, F>>> : AddedField<DefinitionOf<EntryOf<ResourceConfig, F>>>;
|
|
92
100
|
};
|
|
101
|
+
/** The configuration's `policy.engine`, read by indexed access (see {@link RootBlock}). */
|
|
102
|
+
type PolicyEngineOf<Cfg> = (NonNullable<(Cfg & {
|
|
103
|
+
readonly policy?: unknown;
|
|
104
|
+
})["policy"]> & {
|
|
105
|
+
readonly engine?: unknown;
|
|
106
|
+
})["engine"];
|
|
107
|
+
/** The configuration's `access.policy`, read by indexed access. */
|
|
108
|
+
type AccessEngineOf<Cfg> = ((Cfg & {
|
|
109
|
+
readonly access?: {
|
|
110
|
+
readonly policy?: unknown;
|
|
111
|
+
};
|
|
112
|
+
})["access"] & {
|
|
113
|
+
readonly policy?: unknown;
|
|
114
|
+
})["policy"];
|
|
115
|
+
/** The configuration's policy engine's `governed` set, when its type states one. */
|
|
116
|
+
type GovernedBlock<Cfg> = LiteralRecord<(NonNullable<PolicyEngineOf<Cfg>> & AccessEngineOf<Cfg> & {
|
|
117
|
+
readonly governed?: unknown;
|
|
118
|
+
})["governed"]>;
|
|
119
|
+
/** The names `Governed` lists for Resource `R`, or `never`. */
|
|
120
|
+
type GovernedNames<Governed, R> = [Governed] extends [never] ? never : R extends keyof Governed ? Governed[R] extends readonly (infer Name)[] ? Name : never : never;
|
|
121
|
+
/** The `governed: true` mark, added to a field: a key the field does not have. */
|
|
122
|
+
type GovernedMark = {
|
|
123
|
+
readonly governed: true;
|
|
124
|
+
};
|
|
125
|
+
/** A Resource's fields with each governed one marked. */
|
|
126
|
+
type GovernedFields<Fields, Governed> = [Governed] extends [never] ? Fields : {
|
|
127
|
+
readonly [F in keyof Fields]: F extends Governed ? Fields[F] & GovernedMark : Fields[F];
|
|
128
|
+
};
|
|
129
|
+
/** The root's `resources` block's Resources marked `managedElsewhere: true`. */
|
|
130
|
+
type ManagedBlock<Block> = [Block] extends [never] ? never : {
|
|
131
|
+
[R in keyof Block]-?: NonNullable<Block[R]> extends {
|
|
132
|
+
readonly managedElsewhere: true;
|
|
133
|
+
} ? R : never;
|
|
134
|
+
}[keyof Block];
|
|
135
|
+
/** The write families a managed Resource never offers. */
|
|
136
|
+
type WriteFamily = "create" | "update" | "delete" | "upsert";
|
|
137
|
+
/** The two write capabilities a field may have. */
|
|
138
|
+
type WriteStage = "create" | "update";
|
|
139
|
+
/** A managed Resource's operations: its reads alone. */
|
|
140
|
+
type ReadOperations<Operations> = {
|
|
141
|
+
readonly [F in keyof Operations as F extends WriteFamily ? never : F]: Operations[F];
|
|
142
|
+
};
|
|
143
|
+
/** Capabilities with each write member narrowed to `Kept` tokens, dropped when none is left. */
|
|
144
|
+
type KeptWrites<Caps, Kept> = {
|
|
145
|
+
readonly [K in keyof Caps as K extends WriteStage ? [Extract<MemberTokens<NonNullable<Caps[K]>>, Kept>] extends [never] ? never : K : K]: K extends WriteStage ? WithTokens<NonNullable<Caps[K]>, Extract<MemberTokens<NonNullable<Caps[K]>>, Kept>> : Caps[K];
|
|
146
|
+
};
|
|
147
|
+
/** A field whose writes keep only `Kept` directives. */
|
|
148
|
+
type WritesKept<Field, Kept> = {
|
|
149
|
+
readonly [P in keyof Field]: P extends "capabilities" ? KeptWrites<Field[P], Kept> : Field[P];
|
|
150
|
+
};
|
|
151
|
+
/** The directives a relation into a managed Resource keeps: the source row's own, where it holds the key. */
|
|
152
|
+
type SourceRowDirectives<Field> = Field extends {
|
|
153
|
+
readonly referenceFields: readonly [unknown, ...unknown[]];
|
|
154
|
+
} ? "$connect" | "$disconnect" : never;
|
|
155
|
+
/** A Resource's fields, written as a managed Resource's or as relations into one. */
|
|
156
|
+
type ManagedFields<Fields, Managed, IsManaged> = [Managed] extends [never] ? Fields : IsManaged extends true ? {
|
|
157
|
+
readonly [F in keyof Fields]: WritesKept<Fields[F], never>;
|
|
158
|
+
} : {
|
|
159
|
+
readonly [F in keyof Fields]: Fields[F] extends {
|
|
160
|
+
readonly kind: "relation";
|
|
161
|
+
readonly target: Managed;
|
|
162
|
+
} ? WritesKept<Fields[F], SourceRowDirectives<Fields[F]>> : Fields[F];
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* The root's view with what is managed elsewhere applied: each managed
|
|
166
|
+
* Resource's writes withheld, and each relation's into one; under `Hidden` (the
|
|
167
|
+
* client's view) the managed Resources and every relation into them left out.
|
|
168
|
+
*/
|
|
169
|
+
type ManagedView<Resources, Managed, Hidden> = [Managed] extends [never] ? Resources : ManagedResources<Resources, Managed, Hidden>;
|
|
170
|
+
/** {@link ManagedView}'s Resources when something is managed elsewhere. */
|
|
171
|
+
type ManagedResources<in out Resources, in out Managed, in out Hidden> = {
|
|
172
|
+
readonly [R in Exclude<keyof Resources, Hidden>]: {
|
|
173
|
+
readonly [P in keyof Resources[R]]: P extends "fields" ? [Hidden] extends [never] ? ManagedFields<Resources[R][P], Managed, R extends Managed ? true : false> : {
|
|
174
|
+
readonly [F in keyof Resources[R][P] as Resources[R][P][F] extends {
|
|
175
|
+
readonly kind: "relation";
|
|
176
|
+
readonly target: Hidden;
|
|
177
|
+
} ? never : F]: Resources[R][P][F];
|
|
178
|
+
} : P extends "operations" ? R extends Managed ? ReadOperations<Resources[R][P]> : Resources[R][P] : Resources[R][P];
|
|
179
|
+
};
|
|
180
|
+
};
|
|
93
181
|
/**
|
|
94
182
|
* One Resource before exposure: the model's own, with its fields layered and
|
|
95
|
-
* its create requirements less what the layers'
|
|
183
|
+
* marked where governed, and its create requirements less what the layers'
|
|
184
|
+
* compute stages fill.
|
|
96
185
|
*/
|
|
97
|
-
type LayeredResource<in out Resource, in out ResourceConfig, in out OverlayConfig> = {
|
|
98
|
-
readonly [P in keyof Resource]: P extends "fields" ? LayeredFields<Resource[P], EntryOf<ResourceConfig, "fields"
|
|
186
|
+
type LayeredResource<in out Resource, in out ResourceConfig, in out OverlayConfig, in out Governed = never> = {
|
|
187
|
+
readonly [P in keyof Resource]: P extends "fields" ? GovernedFields<LayeredFields<Resource[P], EntryOf<ResourceConfig, "fields">>, Governed> : P extends "createRequirements" ? RequirementsLessComputed<Exclude<Resource[P], undefined>, ComputedOnCreateKey<EntryOf<ResourceConfig, "fields">> | ComputedOnCreateKey<EntryOf<OverlayConfig, "fields">>> : Resource[P];
|
|
99
188
|
};
|
|
100
189
|
/** The fields of a `fields` block with a `compute.create` stage. */
|
|
101
190
|
type ComputedOnCreateKey<FieldsBlock> = [FieldsBlock] extends [never] ? never : {
|
|
@@ -111,9 +200,9 @@ type ComputedOnCreateKey<FieldsBlock> = [FieldsBlock] extends [never] ? never :
|
|
|
111
200
|
* none is satisfied and leaves `oneOf`. A member left empty is absent, as the
|
|
112
201
|
* compiler leaves it (`projectCreateRequirements`).
|
|
113
202
|
*/
|
|
114
|
-
type RequirementsLessComputed<Requirements, Computed> = [
|
|
115
|
-
|
|
116
|
-
] ? Requirements : {
|
|
203
|
+
export type RequirementsLessComputed<Requirements, Computed> = [
|
|
204
|
+
Computed
|
|
205
|
+
] extends [never] ? Requirements : {
|
|
117
206
|
readonly [P in keyof Requirements as P extends "required" | "oneOf" ? LessComputed<P, Requirements[P], Computed> extends readonly [] ? never : P : P]: P extends "required" | "oneOf" ? LessComputed<P, Requirements[P], Computed> : Requirements[P];
|
|
118
207
|
};
|
|
119
208
|
/** One member of a statement less `Computed`: its names, or its groups. */
|
|
@@ -132,8 +221,8 @@ type GroupsLessComputed<Groups, Computed> = Groups extends readonly [
|
|
|
132
221
|
...GroupsLessComputed<Rest, Computed>
|
|
133
222
|
] : GroupsLessComputed<Rest, Computed> : readonly [];
|
|
134
223
|
/** The Resources before exposure: the model, with the root's definitions applied. */
|
|
135
|
-
type LayeredResources<Resources, Block, OverlayBlock> = {
|
|
136
|
-
readonly [R in keyof Resources]: LayeredResource<Resources[R], EntryOf<Block, R>, EntryOf<OverlayBlock, R>>;
|
|
224
|
+
type LayeredResources<Resources, Block, OverlayBlock, Governed = never> = {
|
|
225
|
+
readonly [R in keyof Resources]: LayeredResource<Resources[R], EntryOf<Block, R>, EntryOf<OverlayBlock, R>, GovernedNames<Governed, R>>;
|
|
137
226
|
};
|
|
138
227
|
/**
|
|
139
228
|
* The style a layer's `exposed` sets: `false` picks, `true` or absent omits, a
|
|
@@ -207,7 +296,7 @@ type OmittedMember<Member, Entry> = Entry extends readonly unknown[] ? WithToken
|
|
|
207
296
|
/** One capability member under a Pick object entry: a token list keeps only those tokens. */
|
|
208
297
|
type PickedMember<Member, Entry> = Entry extends readonly unknown[] ? WithTokens<Member, Extract<MemberTokens<Member>, Listed<Entry>>> : Member;
|
|
209
298
|
/** The capability members no exemption names and a Pick still keeps. */
|
|
210
|
-
type AdapterLimit = "nestedWriteFilter";
|
|
299
|
+
type AdapterLimit = "nestedWriteFilter" | "filterModes" | "pathFilterModes";
|
|
211
300
|
/** A field's capabilities under its exemption, a list of names or an object. */
|
|
212
301
|
type ExemptedCapabilities<Caps, Entry, Style> = Style extends "omit" ? Entry extends readonly unknown[] ? {
|
|
213
302
|
readonly [P in keyof Caps as P extends Listed<Entry> ? never : P]: Caps[P];
|
|
@@ -285,17 +374,32 @@ type ExposedResources<Resources, Style, Block> = Style extends "omit" ? [Block]
|
|
|
285
374
|
readonly [R in Extract<keyof Resources, GrantedResourceKey<Block>>]: ExemptedResource<Resources[R], RawEntry<Block, R>, "pick">;
|
|
286
375
|
} : Resources;
|
|
287
376
|
/** The Resources of the root's final view: what every overlay starts from. */
|
|
288
|
-
export type RootViewResources<M extends AvAdapterModel, Cfg> = ExposedResources<LayeredResources<M["resources"], ResourcesBlock<Cfg>, never>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg
|
|
377
|
+
export type RootViewResources<M extends AvAdapterModel, Cfg> = ManagedView<ExposedResources<LayeredResources<M["resources"], ResourcesBlock<Cfg>, never>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>>, ManagedBlock<RootBlock<Cfg, "resources">>, never>;
|
|
289
378
|
/** The Resources of an overlay's final view: the root's view, narrowed by it. */
|
|
290
|
-
export type OverlayViewResources<M extends AvAdapterModel, Cfg, Layer extends "application" | "client"> = ExposedResources<ExposedResources<LayeredResources<M["resources"], ResourcesBlock<Cfg>, OverlayResourcesBlock<Cfg, Layer>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, Layer>>>, ExemptionsOf<OverlayOf<Cfg, Layer>>>;
|
|
379
|
+
export type OverlayViewResources<M extends AvAdapterModel, Cfg, Layer extends "application" | "client"> = ExposedResources<ManagedView<ExposedResources<LayeredResources<M["resources"], ResourcesBlock<Cfg>, OverlayResourcesBlock<Cfg, Layer>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>>, ManagedBlock<RootBlock<Cfg, "resources">>, Layer extends "client" ? ManagedBlock<RootBlock<Cfg, "resources">> : never>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, Layer>>>, ExemptionsOf<OverlayOf<Cfg, Layer>>>;
|
|
291
380
|
/**
|
|
292
|
-
* One derived Contract's type: the model, with the root's `
|
|
381
|
+
* One derived Contract's type: the model, with the root's `fields` entries
|
|
293
382
|
* applied, then the root's exposure, then the overlay's over the root's view.
|
|
383
|
+
* `framework.application`, `client`, `appTx` and `clientTx` are typed over it,
|
|
384
|
+
* and a declaration file names it when it writes one of their nodes.
|
|
385
|
+
*/
|
|
386
|
+
export type AvContractView<M extends AvAdapterModel, RootFields, RootStyle, RootExemptions, OverlayStyle, OverlayExemptions, OverlayFields, Governed = never> = {
|
|
387
|
+
readonly scalars: M["scalars"];
|
|
388
|
+
readonly enums: M["enums"];
|
|
389
|
+
readonly resources: ExposedResources<ExposedResources<LayeredResources<M["resources"], RootFields, OverlayFields, Governed>, RootStyle, RootExemptions>, OverlayStyle, OverlayExemptions>;
|
|
390
|
+
readonly limits: AvContractLimits;
|
|
391
|
+
readonly transactions: M["transactions"];
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* {@link AvContractView} for a configuration that marks Resources managed
|
|
395
|
+
* elsewhere (`Managed`): their writes, and the writes of relations into them,
|
|
396
|
+
* withheld after the root's exposure; under `Hidden` (the client's view) they
|
|
397
|
+
* and every relation into them left out.
|
|
294
398
|
*/
|
|
295
|
-
type
|
|
399
|
+
export type AvManagedContractView<M extends AvAdapterModel, RootFields, RootStyle, RootExemptions, OverlayStyle, OverlayExemptions, OverlayFields, Governed, in out Managed, in out Hidden> = {
|
|
296
400
|
readonly scalars: M["scalars"];
|
|
297
401
|
readonly enums: M["enums"];
|
|
298
|
-
readonly resources: ExposedResources<ExposedResources<LayeredResources<M["resources"],
|
|
402
|
+
readonly resources: ExposedResources<ManagedView<ExposedResources<LayeredResources<M["resources"], RootFields, OverlayFields, Governed>, RootStyle, RootExemptions>, Managed, Hidden>, OverlayStyle, OverlayExemptions>;
|
|
299
403
|
readonly limits: AvContractLimits;
|
|
300
404
|
readonly transactions: M["transactions"];
|
|
301
405
|
};
|
|
@@ -303,7 +407,7 @@ type DerivedContractView<M extends AvAdapterModel, FieldsBlock, RootStyle, RootE
|
|
|
303
407
|
* The Application Contract's type, derived from the adapter model and the
|
|
304
408
|
* configuration.
|
|
305
409
|
*/
|
|
306
|
-
export type AvContractApplicationView<M extends AvAdapterModel, Cfg = AvConfigAny> = [Cfg] extends [unknown] ?
|
|
410
|
+
export type AvContractApplicationView<M extends AvAdapterModel, Cfg = AvConfigAny> = [Cfg] extends [unknown] ? [ManagedBlock<RootBlock<Cfg, "resources">>] extends [never] ? AvContractView<M, ViewBlock<ResourcesBlock<Cfg>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, "application">>>, ExemptionsOf<OverlayOf<Cfg, "application">>, ViewBlock<OverlayResourcesBlock<Cfg, "application">>, GovernedBlock<Cfg>> : AvManagedContractView<M, ViewBlock<ResourcesBlock<Cfg>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, "application">>>, ExemptionsOf<OverlayOf<Cfg, "application">>, ViewBlock<OverlayResourcesBlock<Cfg, "application">>, GovernedBlock<Cfg>, ManagedBlock<RootBlock<Cfg, "resources">>, never> : never;
|
|
307
411
|
/**
|
|
308
412
|
* The Client Contract's type, derived from the adapter model and the
|
|
309
413
|
* configuration: what the client layer hides is absent. It types
|
|
@@ -311,5 +415,5 @@ export type AvContractApplicationView<M extends AvAdapterModel, Cfg = AvConfigAn
|
|
|
311
415
|
*/
|
|
312
416
|
export type ClientContractView<M extends AvAdapterModel, Cfg = AvConfigAny> = [
|
|
313
417
|
Cfg
|
|
314
|
-
] extends [unknown] ?
|
|
418
|
+
] extends [unknown] ? [ManagedBlock<RootBlock<Cfg, "resources">>] extends [never] ? AvContractView<M, ViewBlock<ResourcesBlock<Cfg>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, "client">>>, ExemptionsOf<OverlayOf<Cfg, "client">>, ViewBlock<OverlayResourcesBlock<Cfg, "client">>, GovernedBlock<Cfg>> : AvManagedContractView<M, ViewBlock<ResourcesBlock<Cfg>>, ExposureStyleOf<ExposedOf<Cfg>>, ExemptionsOf<Cfg>, ExposureStyleOf<ExposedOf<OverlayOf<Cfg, "client">>>, ExemptionsOf<OverlayOf<Cfg, "client">>, ViewBlock<OverlayResourcesBlock<Cfg, "client">>, GovernedBlock<Cfg>, ManagedBlock<RootBlock<Cfg, "resources">>, ManagedBlock<RootBlock<Cfg, "resources">>> : never;
|
|
315
419
|
export {};
|
|
@@ -3,14 +3,24 @@ import type { AvContractCompilerDiagnostic } from "../compiler/contract-compiler
|
|
|
3
3
|
import type { AvConfigDiagnostic } from "../config/config-diagnostic.js";
|
|
4
4
|
/** The construction step that failed. */
|
|
5
5
|
export type AvConstructionStage = "configuration" | "discovery" | "contract-compilation";
|
|
6
|
-
/** One problem
|
|
7
|
-
|
|
6
|
+
/** One problem found while constructing, before its documentation link is added. */
|
|
7
|
+
type ConstructionProblem = AvConfigDiagnostic | AvAdapterDiscoveryDiagnostic | AvContractCompilerDiagnostic;
|
|
8
|
+
/**
|
|
9
|
+
* One problem reported by {@link AvConstructionError}: its `code`, `path` and
|
|
10
|
+
* `message`, and `docs`, the URL of the code's entry on the error-codes page
|
|
11
|
+
* (the same as `AvErrorCatalog[code].docs`).
|
|
12
|
+
*/
|
|
13
|
+
export type AvConstructionDiagnostic = ConstructionProblem & {
|
|
14
|
+
readonly docs: string;
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* Thrown by {@link createFramework} when construction fails: `stage` says
|
|
10
|
-
* where, and `diagnostics` lists every problem found there.
|
|
18
|
+
* where, and `diagnostics` lists every problem found there. The message names
|
|
19
|
+
* the first of them and how many more there are.
|
|
11
20
|
*/
|
|
12
21
|
export declare class AvConstructionError extends Error {
|
|
13
22
|
readonly stage: AvConstructionStage;
|
|
14
23
|
readonly diagnostics: readonly AvConstructionDiagnostic[];
|
|
15
|
-
constructor(stage: AvConstructionStage, diagnostics: readonly
|
|
24
|
+
constructor(stage: AvConstructionStage, diagnostics: readonly ConstructionProblem[]);
|
|
16
25
|
}
|
|
26
|
+
export {};
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
+
import { brandCoreClass } from "../runtime/core-class.brand.js";
|
|
2
|
+
import { errorDocsUrl } from "../runtime/error.catalog.js";
|
|
1
3
|
const FRAMEWORK_CONSTRUCTION_MESSAGES = {
|
|
2
4
|
configuration: "Aventara framework configuration validation failed",
|
|
3
5
|
discovery: "Aventara adapter discovery validation failed",
|
|
4
6
|
"contract-compilation": "Aventara contract compilation failed",
|
|
5
7
|
};
|
|
8
|
+
function constructionMessage(stage, diagnostics) {
|
|
9
|
+
const base = FRAMEWORK_CONSTRUCTION_MESSAGES[stage];
|
|
10
|
+
const [first] = diagnostics;
|
|
11
|
+
if (first === undefined) {
|
|
12
|
+
return base;
|
|
13
|
+
}
|
|
14
|
+
const where = first.path === "" ? "" : ` at ${first.path}`;
|
|
15
|
+
const more = diagnostics.length > 1 ? ` (+${diagnostics.length - 1} more)` : "";
|
|
16
|
+
return `${base}: ${first.code}${where}: ${first.message}${more}`;
|
|
17
|
+
}
|
|
6
18
|
export class AvConstructionError extends Error {
|
|
7
19
|
stage;
|
|
8
20
|
diagnostics;
|
|
9
21
|
constructor(stage, diagnostics) {
|
|
10
|
-
super(
|
|
22
|
+
super(constructionMessage(stage, diagnostics));
|
|
11
23
|
this.name = "AvConstructionError";
|
|
12
24
|
this.stage = stage;
|
|
13
|
-
this.diagnostics =
|
|
25
|
+
this.diagnostics = diagnostics.map((diagnostic) => ({
|
|
26
|
+
...diagnostic,
|
|
27
|
+
docs: errorDocsUrl(diagnostic.code),
|
|
28
|
+
}));
|
|
14
29
|
}
|
|
15
30
|
}
|
|
31
|
+
brandCoreClass(AvConstructionError, "AvConstructionError");
|
|
@@ -2,12 +2,12 @@ import type { AvAdapterModel } from "../adapters/adapter-model.js";
|
|
|
2
2
|
import type { AvContracts } from "../compiler/contract.compiler.js";
|
|
3
3
|
import type { AvConfigAny } from "../config/any-framework-config.js";
|
|
4
4
|
import type { AvMcpEndpoint } from "../config/config.resolver.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { AvOperationRequest } from "../runtime/operation-request.js";
|
|
6
6
|
import type { AvOperationResponse } from "../runtime/operation-response.js";
|
|
7
7
|
import type { AvTransactionRunner } from "../transactions/deferred-operation.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { AvTransactionRequest } from "../transactions/transaction-request.js";
|
|
9
9
|
import type { AvTransactionResponse } from "../transactions/transaction-response.js";
|
|
10
|
-
import type { ApplicationOperations, ApplicationTransactionBuilders, ClientOperations, ClientTransactionBuilders } from "./operation-facade.js";
|
|
10
|
+
import type { ApplicationOperations, ApplicationTransactionBuilders, ClientOperations, ClientTransactionBuilders, ServerClientOperations, ServerClientTransactionBuilders } from "./operation-facade.js";
|
|
11
11
|
/**
|
|
12
12
|
* One Aventara instance, as returned by {@link createFramework}: its compiled
|
|
13
13
|
* Contracts, typed in-process operations, transaction builders and the
|
|
@@ -50,6 +50,19 @@ export type AvFramework<M extends AvAdapterModel = AvAdapterModel, Cfg = AvConfi
|
|
|
50
50
|
* failure thrown.
|
|
51
51
|
*/
|
|
52
52
|
readonly client: ClientOperations<M, Cfg>;
|
|
53
|
+
/**
|
|
54
|
+
* The client layer for server code, taking application values:
|
|
55
|
+
* `framework.serverClient.<resource>.<family>.<variant>(args, options?)`.
|
|
56
|
+
*
|
|
57
|
+
* Typed and run exactly as {@link client} (the Client Contract's view, the
|
|
58
|
+
* client pipelines, validation, exposure and policy), but its arguments are
|
|
59
|
+
* the application forms: a `datetime` is a `Date`, a `bigint` a `bigint`, a
|
|
60
|
+
* `decimal` an `AvDecimal`, `bytes` a `Uint8Array`. Each call copies its
|
|
61
|
+
* arguments, encodes them into the wire forms `client` reads, and hands the
|
|
62
|
+
* same client-origin request to {@link execute}. Results are the same as
|
|
63
|
+
* `client`'s; the optional second argument is {@link AvExecutionOptions}.
|
|
64
|
+
*/
|
|
65
|
+
readonly serverClient: ServerClientOperations<M, Cfg>;
|
|
53
66
|
/**
|
|
54
67
|
* Transaction builders under application rules:
|
|
55
68
|
* `framework.appTx.<resource>.<family>.<variant>(args)` defers one operation
|
|
@@ -72,7 +85,15 @@ export type AvFramework<M extends AvAdapterModel = AvAdapterModel, Cfg = AvConfi
|
|
|
72
85
|
* share one (`A2004`/`V1020` at the first step of the other origin).
|
|
73
86
|
*/
|
|
74
87
|
readonly clientTx: ClientTransactionBuilders<M, Cfg>;
|
|
75
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The {@link clientTx} builders taking application values, as
|
|
90
|
+
* {@link serverClient} takes them: each handle's arguments are copied and
|
|
91
|
+
* encoded into the wire forms when it is built. Its handles are client-origin,
|
|
92
|
+
* so one {@link transaction} may hold them beside `clientTx` handles, never
|
|
93
|
+
* beside `appTx` ones.
|
|
94
|
+
*/
|
|
95
|
+
readonly serverClientTx: ServerClientTransactionBuilders<M, Cfg>;
|
|
96
|
+
execute(request: AvOperationRequest): Promise<AvOperationResponse>;
|
|
76
97
|
/**
|
|
77
98
|
* Validates a whole transaction plan, then runs its operations one after
|
|
78
99
|
* another inside one Adapter transaction. Answers `A1009` with each
|
|
@@ -83,7 +104,7 @@ export type AvFramework<M extends AvAdapterModel = AvAdapterModel, Cfg = AvConfi
|
|
|
83
104
|
* Guards, pipes, hooks and interceptors run while the transaction is open, so
|
|
84
105
|
* they should not perform network I/O or other slow work.
|
|
85
106
|
*/
|
|
86
|
-
executeTransaction(request:
|
|
107
|
+
executeTransaction(request: AvTransactionRequest): Promise<AvTransactionResponse>;
|
|
87
108
|
/**
|
|
88
109
|
* Runs handles from `appTx`/`clientTx` as one transaction:
|
|
89
110
|
* `framework.transaction([h1, h2, …], options?)`. Resolves each handle's
|
|
@@ -10,4 +10,4 @@ import type { AvFramework } from "./framework.js";
|
|
|
10
10
|
*
|
|
11
11
|
* @throws {@link AvConstructionError} when any of those steps fails.
|
|
12
12
|
*/
|
|
13
|
-
export declare function createFramework<M extends AvAdapterModel, const Cfg = AvConfigAny>(config: Cfg &
|
|
13
|
+
export declare function createFramework<M extends AvAdapterModel, const Cfg = AvConfigAny>(config: Cfg & AvConfigExact<M, Cfg> & AvConfig<M, Cfg>): Promise<AvFramework<M, ErasedConfig<Cfg>>>;
|