@aventara/core 1.0.0-rc.0 → 1.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2068 -1
- package/ERRORS.md +142 -0
- package/README.md +485 -60
- package/dist/adapters/adapter-discovery-diagnostic.d.ts +4 -4
- package/dist/adapters/adapter-discovery-diagnostic.guidance.d.ts +6 -0
- package/dist/adapters/adapter-discovery-diagnostic.guidance.js +7 -0
- package/dist/adapters/adapter-field.d.ts +33 -11
- package/dist/adapters/adapter-identifier.d.ts +15 -6
- package/dist/adapters/adapter-identifier.js +6 -1
- package/dist/adapters/adapter-model.d.ts +18 -9
- package/dist/adapters/adapter-operation-executor.interface.d.ts +4 -4
- package/dist/adapters/adapter-operation.d.ts +21 -6
- package/dist/adapters/adapter-resource.d.ts +23 -9
- package/dist/adapters/adapter-sql-statement.d.ts +19 -0
- package/dist/adapters/adapter-transaction-executor.interface.d.ts +19 -0
- package/dist/adapters/adapter.interface.d.ts +59 -29
- package/dist/avz/avz-check.factory.d.ts +83 -0
- package/dist/avz/avz-check.factory.js +116 -0
- package/dist/avz/avz-check.registry.d.ts +35 -0
- package/dist/avz/avz-check.registry.js +9 -0
- package/dist/avz/avz.d.ts +203 -0
- package/dist/{json → avz}/avz.js +150 -8
- package/dist/{json → avz}/index.d.ts +2 -1
- package/dist/{json → avz}/json-shape.registry.d.ts +9 -8
- package/dist/{json → avz}/zod-issue.translator.d.ts +8 -2
- package/dist/{json → avz}/zod-issue.translator.js +7 -0
- package/dist/compiler/contract-compiler-diagnostic.d.ts +31 -5
- package/dist/compiler/contract-compiler-diagnostic.guidance.d.ts +6 -0
- package/dist/compiler/contract-compiler-diagnostic.guidance.js +97 -0
- package/dist/compiler/contract.compiler.d.ts +23 -17
- package/dist/compiler/contract.compiler.js +753 -443
- package/dist/compiler/create-requirements.projector.d.ts +49 -0
- package/dist/compiler/create-requirements.projector.js +423 -0
- package/dist/compiler/field-validator.compiler.d.ts +47 -0
- package/dist/compiler/field-validator.compiler.js +238 -0
- package/dist/compiler/managed-elsewhere.projector.d.ts +52 -0
- package/dist/compiler/managed-elsewhere.projector.js +179 -0
- package/dist/compiler/managed-elsewhere.validator.d.ts +9 -0
- package/dist/compiler/managed-elsewhere.validator.js +74 -0
- package/dist/config/any-framework-config.d.ts +19 -12
- package/dist/config/computed-fields.d.ts +62 -0
- package/dist/config/computed-fields.js +73 -0
- package/dist/config/config-diagnostic.d.ts +11 -4
- package/dist/config/config-diagnostic.guidance.d.ts +6 -0
- package/dist/config/config-diagnostic.guidance.js +32 -0
- package/dist/config/config-layer.d.ts +15 -6
- package/dist/config/config.resolver.d.ts +98 -31
- package/dist/config/config.resolver.js +173 -44
- package/dist/config/config.validator.d.ts +7 -7
- package/dist/config/config.validator.js +792 -69
- package/dist/config/define-resource.d.ts +53 -0
- package/dist/config/define-resource.js +14 -0
- package/dist/config/effective-fields.d.ts +19 -23
- package/dist/config/entrypoint.normalizer.d.ts +4 -3
- package/dist/config/exact-framework-config.d.ts +325 -0
- package/dist/config/field-compute.resolver.d.ts +21 -0
- package/dist/config/field-compute.resolver.js +123 -0
- package/dist/config/field-pipeline-config.d.ts +47 -0
- package/dist/config/forced-operation.validator.d.ts +10 -0
- package/dist/config/forced-operation.validator.js +66 -0
- package/dist/config/framework-config.d.ts +148 -39
- package/dist/config/framework-exemptions-config.d.ts +91 -0
- package/dist/config/framework-exemptions-config.js +1 -0
- package/dist/config/framework-field-definition.d.ts +78 -0
- package/dist/config/framework-field-definition.js +28 -0
- package/dist/config/framework-resources-config.d.ts +127 -0
- package/dist/config/framework-resources-config.js +1 -0
- package/dist/config/pipeline-config.d.ts +56 -20
- package/dist/config/pipeline-tree.resolver.d.ts +79 -0
- package/dist/config/pipeline-tree.resolver.js +220 -0
- package/dist/config/stage-type.eraser.d.ts +65 -0
- package/dist/config/stage-type.eraser.js +1 -0
- package/dist/contracts/access-route.rules.d.ts +10 -0
- package/dist/contracts/access-route.rules.js +45 -0
- package/dist/contracts/capability.d.ts +37 -12
- package/dist/contracts/capability.js +20 -0
- package/dist/contracts/client-contract-structure.validator.d.ts +621 -114
- package/dist/contracts/client-contract-structure.validator.js +189 -10
- package/dist/contracts/contract-access.d.ts +29 -0
- package/dist/contracts/contract-access.js +1 -0
- package/dist/contracts/contract-canonicalizer.d.ts +27 -3
- package/dist/contracts/contract-canonicalizer.js +168 -29
- package/dist/contracts/contract-hash.d.ts +11 -7
- package/dist/contracts/contract-hash.js +4 -3
- package/dist/contracts/contract-limits.d.ts +4 -1
- package/dist/contracts/contract-limits.js +1 -0
- package/dist/contracts/contract-lookup.d.ts +5 -5
- package/dist/contracts/contract-protocol.d.ts +4 -4
- package/dist/contracts/contract.d.ts +51 -17
- package/dist/contracts/create-requirements.d.ts +35 -0
- package/dist/contracts/create-requirements.js +1 -0
- package/dist/contracts/enum-definition.d.ts +1 -1
- package/dist/contracts/field-check.d.ts +101 -0
- package/dist/contracts/field-check.js +1 -0
- package/dist/contracts/field.d.ts +109 -42
- package/dist/contracts/identifier.d.ts +4 -4
- package/dist/contracts/json-schema.projector.d.ts +11 -0
- package/dist/contracts/json-schema.projector.js +78 -0
- package/dist/contracts/json-shape.d.ts +12 -1
- package/dist/contracts/lifecycle-trait.d.ts +2 -2
- package/dist/contracts/resource-operations.d.ts +28 -28
- package/dist/contracts/resource.d.ts +15 -9
- package/dist/contracts/scalar-value-type.d.ts +17 -15
- package/dist/contracts/scalar.d.ts +3 -3
- package/dist/contracts/transaction-capability.d.ts +1 -1
- package/dist/contracts/wire-scalar-format.d.ts +4 -4
- package/dist/framework/access-facade.d.ts +116 -0
- package/dist/framework/access-facade.js +120 -0
- package/dist/framework/contract-view.d.ts +315 -145
- package/dist/framework/framework-construction.error.d.ts +21 -11
- package/dist/framework/framework-construction.error.js +20 -4
- package/dist/framework/framework.d.ts +71 -26
- package/dist/framework/framework.factory.d.ts +8 -6
- package/dist/framework/framework.factory.js +150 -38
- package/dist/framework/operation-facade.d.ts +192 -54
- package/dist/framework/operation-facade.js +10 -1
- package/dist/index.d.ts +67 -50
- package/dist/index.js +7 -6
- package/dist/internal.d.ts +20 -10
- package/dist/internal.js +9 -1
- package/dist/operations/database-refusal.d.ts +51 -0
- package/dist/operations/database-refusal.js +45 -0
- package/dist/operations/operation-arguments.d.ts +381 -228
- package/dist/operations/operation-call.d.ts +31 -28
- package/dist/operations/operation-identity.d.ts +10 -10
- package/dist/operations/operation-result.d.ts +25 -23
- package/dist/operations/operation-validator-core.d.ts +6 -6
- package/dist/operations/operation-validator-core.js +172 -38
- package/dist/operations/operation-validator.d.ts +10 -10
- package/dist/operations/projection-scope.resolver.d.ts +6 -6
- package/dist/operations/structural-limits.walker.d.ts +7 -7
- package/dist/operations/structural-limits.walker.js +145 -0
- package/dist/operations/validation-code.d.ts +11 -6
- package/dist/operations/validation-code.guidance.d.ts +6 -0
- package/dist/operations/validation-code.guidance.js +90 -0
- package/dist/operations/validation-code.js +4 -0
- package/dist/operations/write-scope.resolver.d.ts +10 -6
- package/dist/operations/write-scope.resolver.js +2 -0
- package/dist/policy/access-provider.interface.d.ts +91 -0
- package/dist/policy/access-provider.interface.js +1 -0
- package/dist/policy/access-provider.registry.d.ts +17 -0
- package/dist/policy/access-provider.registry.js +15 -0
- package/dist/policy/access-question.d.ts +20 -0
- package/dist/policy/access-question.js +1 -0
- package/dist/policy/access-question.registry.d.ts +5 -0
- package/dist/policy/access-question.registry.js +19 -0
- package/dist/policy/access-question.runtime.d.ts +36 -0
- package/dist/policy/access-question.runtime.js +297 -0
- package/dist/policy/access-verb.table.d.ts +56 -0
- package/dist/policy/access-verb.table.js +21 -0
- package/dist/policy/access-verbs.d.ts +46 -0
- package/dist/policy/access-verbs.js +1 -0
- package/dist/policy/policy-admission.d.ts +20 -0
- package/dist/policy/policy-admission.js +409 -0
- package/dist/policy/policy-after-update.runtime.d.ts +79 -0
- package/dist/policy/policy-after-update.runtime.js +208 -0
- package/dist/policy/policy-condition.d.ts +15 -0
- package/dist/policy/policy-condition.js +36 -0
- package/dist/policy/policy-engine.d.ts +205 -0
- package/dist/policy/policy-engine.js +1 -0
- package/dist/policy/policy-named-rows.d.ts +18 -0
- package/dist/policy/policy-named-rows.js +51 -0
- package/dist/policy/policy-nested-write.runtime.d.ts +44 -0
- package/dist/policy/policy-nested-write.runtime.js +545 -0
- package/dist/policy/policy-read.runtime.d.ts +81 -0
- package/dist/policy/policy-read.runtime.js +503 -0
- package/dist/policy/policy-reference-write.runtime.d.ts +51 -0
- package/dist/policy/policy-reference-write.runtime.js +345 -0
- package/dist/policy/policy-request.d.ts +41 -0
- package/dist/policy/policy-request.js +63 -0
- package/dist/policy/policy-session.d.ts +106 -0
- package/dist/policy/policy-session.js +295 -0
- package/dist/policy/policy-startup.validator.d.ts +10 -0
- package/dist/policy/policy-startup.validator.js +112 -0
- package/dist/policy/policy-write.runtime.d.ts +39 -0
- package/dist/policy/policy-write.runtime.js +532 -0
- package/dist/prebuilt/core-version.generated.d.ts +2 -0
- package/dist/prebuilt/core-version.generated.js +1 -0
- package/dist/prebuilt/prebuilt-changes.d.ts +29 -0
- package/dist/prebuilt/prebuilt-changes.js +65 -0
- package/dist/prebuilt/prebuilt-contracts.d.ts +40 -0
- package/dist/prebuilt/prebuilt-contracts.emitter.d.ts +16 -0
- package/dist/prebuilt/prebuilt-contracts.emitter.js +50 -0
- package/dist/prebuilt/prebuilt-contracts.js +1 -0
- package/dist/prebuilt/prebuilt-contracts.loader.d.ts +19 -0
- package/dist/prebuilt/prebuilt-contracts.loader.js +77 -0
- package/dist/prebuilt/prebuilt-inputs.fingerprint.d.ts +16 -0
- package/dist/prebuilt/prebuilt-inputs.fingerprint.js +229 -0
- package/dist/protocol/absent-route.responder.d.ts +17 -34
- package/dist/protocol/absent-route.responder.js +53 -20
- package/dist/protocol/contract-document.responder.d.ts +5 -4
- package/dist/protocol/contract-document.responder.js +2 -2
- package/dist/protocol/http-request.decoder.d.ts +33 -13
- package/dist/protocol/http-request.decoder.js +34 -11
- package/dist/protocol/http-request.reader.d.ts +9 -6
- package/dist/protocol/http-request.reader.js +1 -0
- package/dist/protocol/http-response.encoder.d.ts +4 -4
- package/dist/protocol/http-response.encoder.js +94 -55
- package/dist/protocol/http-status.table.d.ts +2 -2
- package/dist/protocol/operation-response.guard.d.ts +2 -2
- package/dist/protocol/protocol-headers.d.ts +3 -3
- package/dist/protocol/protocol-surface.d.ts +10 -5
- package/dist/protocol/protocol-surface.js +7 -0
- package/dist/protocol/protocol.binder.d.ts +66 -28
- package/dist/protocol/protocol.binder.js +16 -10
- package/dist/protocol/protocol.handler.d.ts +34 -14
- package/dist/protocol/protocol.handler.js +122 -18
- package/dist/protocol/unmounted-route.error.d.ts +4 -4
- package/dist/protocol/unmounted-route.error.js +2 -2
- package/dist/runtime/caller-data.copier.d.ts +22 -7
- package/dist/runtime/caller-data.copier.js +30 -17
- package/dist/runtime/caller-data.door.d.ts +18 -11
- package/dist/runtime/caller-data.door.js +6 -4
- package/dist/runtime/computed-read-runtime.d.ts +12 -6
- package/dist/runtime/computed-read-runtime.js +271 -71
- package/dist/runtime/computed-value.error.d.ts +7 -6
- package/dist/runtime/computed-value.error.js +5 -4
- package/dist/runtime/context-executor.runtime.d.ts +60 -0
- package/dist/runtime/context-executor.runtime.js +277 -0
- package/dist/runtime/core-class.brand.d.ts +10 -0
- package/dist/runtime/core-class.brand.js +21 -0
- package/dist/runtime/create-requirement.d.ts +34 -79
- package/dist/runtime/create-requirement.js +205 -74
- package/dist/runtime/decimal.d.ts +16 -2
- package/dist/runtime/decimal.js +22 -1
- package/dist/runtime/diagnostics-reporter.d.ts +91 -30
- package/dist/runtime/diagnostics-reporter.js +37 -1
- package/dist/runtime/error-boundary.d.ts +73 -9
- package/dist/runtime/error-boundary.js +57 -19
- package/dist/runtime/error-guidance.d.ts +12 -0
- package/dist/runtime/error-guidance.js +1 -0
- package/dist/runtime/error.catalog.d.ts +49 -0
- package/dist/runtime/error.catalog.js +49 -0
- package/dist/runtime/execution-options.d.ts +18 -2
- package/dist/runtime/field-check.evaluator.d.ts +27 -0
- package/dist/runtime/field-check.evaluator.js +521 -0
- package/dist/runtime/field-compute.d.ts +65 -0
- package/dist/runtime/field-compute.js +1 -0
- package/dist/runtime/field-stage.plan.d.ts +15 -0
- package/dist/runtime/field-stage.plan.js +27 -0
- package/dist/runtime/field-stage.runtime.d.ts +37 -0
- package/dist/runtime/field-stage.runtime.js +147 -0
- package/dist/runtime/field-validator.runtime.d.ts +29 -0
- package/dist/runtime/field-validator.runtime.js +126 -0
- package/dist/runtime/framework-error-class.table.d.ts +33 -0
- package/dist/runtime/framework-error-class.table.js +25 -0
- package/dist/runtime/framework-error.d.ts +68 -8
- package/dist/runtime/framework-error.factory.d.ts +4 -0
- package/dist/runtime/framework-error.factory.js +15 -0
- package/dist/runtime/framework-error.js +32 -2
- package/dist/runtime/framework-warning.emitter.d.ts +6 -0
- package/dist/runtime/framework-warning.emitter.js +8 -0
- package/dist/runtime/interceptor-next.error.d.ts +5 -0
- package/dist/runtime/interceptor-next.error.js +6 -0
- package/dist/runtime/json-value.d.ts +11 -6
- package/dist/runtime/level-lifecycle.runtime.d.ts +26 -0
- package/dist/runtime/level-lifecycle.runtime.js +40 -0
- package/dist/runtime/misuse-reporter.d.ts +12 -12
- package/dist/runtime/mutation-planner.d.ts +20 -16
- package/dist/runtime/mutation-planner.js +48 -35
- package/dist/runtime/nested-write.walker.d.ts +32 -0
- package/dist/runtime/nested-write.walker.js +73 -0
- package/dist/runtime/operation-code.guidance.d.ts +6 -0
- package/dist/runtime/operation-code.guidance.js +167 -0
- package/dist/runtime/operation-request.d.ts +45 -11
- package/dist/runtime/operation-response.d.ts +17 -17
- package/dist/runtime/operation-runtime.d.ts +133 -27
- package/dist/runtime/operation-runtime.js +576 -84
- package/dist/runtime/outcome-mapper.d.ts +17 -5
- package/dist/runtime/outcome-mapper.js +23 -6
- package/dist/runtime/output-validator.d.ts +11 -11
- package/dist/runtime/output-validator.js +3 -3
- package/dist/runtime/owned-execution.registry.d.ts +16 -6
- package/dist/runtime/pipe-output.validator.d.ts +43 -18
- package/dist/runtime/pipe-output.validator.js +15 -13
- package/dist/runtime/pipeline.d.ts +221 -34
- package/dist/runtime/readonly-value.d.ts +47 -0
- package/dist/runtime/readonly-value.js +189 -0
- package/dist/runtime/referential-action.d.ts +1 -1
- package/dist/runtime/request-envelope.validator.d.ts +3 -3
- package/dist/runtime/request-envelope.validator.js +12 -7
- package/dist/runtime/request-id.d.ts +1 -1
- package/dist/runtime/request-state.d.ts +14 -0
- package/dist/runtime/request-state.js +1 -0
- package/dist/runtime/request-state.resolver.d.ts +12 -0
- package/dist/runtime/request-state.resolver.js +20 -0
- package/dist/runtime/scalar-runtime.d.ts +33 -25
- package/dist/runtime/scalar-runtime.js +105 -38
- package/dist/runtime/unsent-value.normalizer.d.ts +15 -0
- package/dist/runtime/unsent-value.normalizer.js +128 -0
- package/dist/transactions/deferred-operation.d.ts +35 -20
- package/dist/transactions/operation-arguments-encoder.d.ts +3 -3
- package/dist/transactions/operation-arguments-encoder.js +8 -3
- package/dist/transactions/operation-fingerprint.js +2 -2
- package/dist/transactions/sql-statement.d.ts +85 -0
- package/dist/transactions/sql-statement.js +47 -0
- package/dist/transactions/sql-statement.validator.d.ts +44 -0
- package/dist/transactions/sql-statement.validator.js +167 -0
- package/dist/transactions/transaction-envelope.d.ts +9 -8
- package/dist/transactions/transaction-integrity-error.d.ts +6 -6
- package/dist/transactions/transaction-integrity-error.js +7 -2
- package/dist/transactions/transaction-plan-assembler.d.ts +30 -13
- package/dist/transactions/transaction-plan-assembler.js +184 -32
- package/dist/transactions/transaction-plan-validator.d.ts +50 -25
- package/dist/transactions/transaction-plan-validator.js +96 -38
- package/dist/transactions/transaction-reference-collector.d.ts +5 -5
- package/dist/transactions/transaction-reference-resolver.d.ts +21 -3
- package/dist/transactions/transaction-reference-resolver.js +26 -14
- package/dist/transactions/transaction-reference-validator.d.ts +74 -4
- package/dist/transactions/transaction-reference-validator.js +129 -71
- package/dist/transactions/transaction-reference.d.ts +14 -14
- package/dist/transactions/transaction-reference.js +5 -0
- package/dist/transactions/transaction-request.d.ts +22 -9
- package/dist/transactions/transaction-response.d.ts +6 -6
- package/dist/transactions/transaction-runtime.d.ts +12 -8
- package/dist/transactions/transaction-runtime.js +218 -50
- package/dist/transactions/transaction-settlement.runtime.d.ts +52 -0
- package/dist/transactions/transaction-settlement.runtime.js +120 -0
- package/dist/transactions/transaction-slot-path-error.d.ts +4 -4
- package/dist/transactions/transaction-slot-path-error.js +4 -2
- package/dist/transactions/transaction-slot-writer.js +2 -2
- package/dist/transactions/transaction-stage.runtime.d.ts +83 -0
- package/dist/transactions/transaction-stage.runtime.js +126 -0
- package/package.json +11 -9
- package/src/runtime/field-check.evaluator.ts +720 -0
- package/dist/config/define-fields.d.ts +0 -42
- package/dist/config/define-fields.js +0 -3
- package/dist/config/framework-behaviors-config.d.ts +0 -30
- package/dist/config/framework-fields-config.d.ts +0 -42
- package/dist/config/framework-restrictions-config.d.ts +0 -142
- package/dist/json/avz.d.ts +0 -96
- package/dist/runtime/field-behavior.d.ts +0 -48
- /package/dist/{config/framework-behaviors-config.js → adapters/adapter-sql-statement.js} +0 -0
- /package/dist/{config/framework-fields-config.js → adapters/adapter-transaction-executor.interface.js} +0 -0
- /package/dist/{json → avz}/index.js +0 -0
- /package/dist/{json → avz}/json-shape.registry.js +0 -0
- /package/dist/config/{framework-restrictions-config.js → exact-framework-config.js} +0 -0
- /package/dist/{runtime/field-behavior.js → config/field-pipeline-config.js} +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
-
import type { AdapterFieldKey } from "../adapters/adapter-resource.js";
|
|
3
|
-
import type { FrameworkResourceKey, FrameworkScalarFieldConfig, FrameworkScalarTypeRef } from "./framework-fields-config.js";
|
|
4
|
-
/**
|
|
5
|
-
* What a configuration may say about a field the adapter already discovered:
|
|
6
|
-
* everything in {@link FrameworkScalarFieldConfig} except `type`.
|
|
7
|
-
*/
|
|
8
|
-
export type KnownScalarFieldConfig<M extends AdapterModel = AdapterModel> = Omit<FrameworkScalarFieldConfig<M>, "type"> & {
|
|
9
|
-
readonly type?: never;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* A scalar field the configuration adds, which the adapter did not discover.
|
|
13
|
-
* `type`, `nullable` and `list` are required; it takes no `json` shape.
|
|
14
|
-
*/
|
|
15
|
-
export type AddedScalarFieldConfig<M extends AdapterModel = AdapterModel> = Omit<FrameworkScalarFieldConfig<M>, "type" | "nullable" | "list" | "json"> & {
|
|
16
|
-
readonly type: FrameworkScalarTypeRef<M>;
|
|
17
|
-
readonly nullable: boolean;
|
|
18
|
-
readonly list: boolean;
|
|
19
|
-
readonly json?: never;
|
|
20
|
-
};
|
|
21
|
-
/** The shape one authored field name admits, by what the adapter knows of it. */
|
|
22
|
-
type ScalarFieldConfigFor<M extends AdapterModel, R extends FrameworkResourceKey<M>, F> = string extends AdapterFieldKey<M, R> ? FrameworkScalarFieldConfig<M> : F extends AdapterFieldKey<M, R> ? M["resources"][R]["fields"][F] extends {
|
|
23
|
-
readonly kind: "relation";
|
|
24
|
-
} ? never : M["resources"][R]["fields"][F] extends {
|
|
25
|
-
readonly type: {
|
|
26
|
-
readonly scalar: "json";
|
|
27
|
-
};
|
|
28
|
-
} ? KnownScalarFieldConfig<M> : Omit<KnownScalarFieldConfig<M>, "json"> & {
|
|
29
|
-
readonly json?: never;
|
|
30
|
-
} : AddedScalarFieldConfig<M>;
|
|
31
|
-
/** The shape an authored `fields` block is checked against, keyed on its own names. */
|
|
32
|
-
export type FrameworkFieldsShape<M extends AdapterModel, Self> = {
|
|
33
|
-
readonly [R in keyof Self]: R extends FrameworkResourceKey<M> ? {
|
|
34
|
-
readonly [F in keyof Self[R]]: ScalarFieldConfigFor<M, R, F>;
|
|
35
|
-
} : never;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Authors stage 1 of a configuration: the `fields` block, checked against
|
|
39
|
-
* what the adapter discovered and returned unwidened.
|
|
40
|
-
*/
|
|
41
|
-
export declare function defineFields<M extends AdapterModel, const Self extends FrameworkFieldsShape<M, Self>>(_model: M, fields: Self): Self;
|
|
42
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
-
import type { ComputedReadBehavior, ComputeOnCreate, ComputeOnUpdate } from "../runtime/field-behavior.js";
|
|
3
|
-
import type { AnyFrameworkConfig } from "./any-framework-config.js";
|
|
4
|
-
import type { EffectiveFieldKey } from "./effective-fields.js";
|
|
5
|
-
import type { FrameworkResourceKey } from "./framework-fields-config.js";
|
|
6
|
-
/** A read behavior: a compute function, or one declaring the fields it reads. */
|
|
7
|
-
export type FrameworkReadBehavior<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = ComputedReadBehavior<M, Cfg, R>;
|
|
8
|
-
/**
|
|
9
|
-
* A field's behaviors: a value computed on create, on update, or on read.
|
|
10
|
-
* `false` turns off a behavior set at an outer layer.
|
|
11
|
-
*/
|
|
12
|
-
export type FrameworkFieldBehaviorConfig<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = {
|
|
13
|
-
/** Computes the field's value when a row is created. */
|
|
14
|
-
readonly create?: false | ComputeOnCreate<M, Cfg, R>;
|
|
15
|
-
/** Computes the field's value when a row is updated. */
|
|
16
|
-
readonly update?: false | ComputeOnUpdate<M, Cfg, R>;
|
|
17
|
-
/** Computes the field's value when a row is read. */
|
|
18
|
-
readonly read?: false | FrameworkReadBehavior<M, Cfg, R>;
|
|
19
|
-
};
|
|
20
|
-
/** Behaviors for one Resource's fields. */
|
|
21
|
-
export type FrameworkResourceBehaviorsConfig<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = {
|
|
22
|
-
/** Behaviors per field name. */
|
|
23
|
-
readonly fields: Readonly<Partial<{
|
|
24
|
-
[F in EffectiveFieldKey<M, Cfg, R>]: FrameworkFieldBehaviorConfig<M, Cfg, R>;
|
|
25
|
-
}>>;
|
|
26
|
-
};
|
|
27
|
-
/** Server-side behaviors, per Resource. */
|
|
28
|
-
export type FrameworkBehaviorsConfig<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig> = Readonly<Partial<{
|
|
29
|
-
[R in FrameworkResourceKey<M>]: FrameworkResourceBehaviorsConfig<M, Cfg, R>;
|
|
30
|
-
}>>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
-
import type { ScalarFieldCapabilities, ScalarFormat } from "../contracts/field.js";
|
|
3
|
-
import type { JsonShape } from "../contracts/json-shape.js";
|
|
4
|
-
import type { LifecycleTrait } from "../contracts/lifecycle-trait.js";
|
|
5
|
-
/** The lifecycle traits a configuration may set on a field. */
|
|
6
|
-
export type FrameworkFieldLifecycleTrait = Extract<LifecycleTrait, "VIRTUAL">;
|
|
7
|
-
/** The names of the Resources in adapter model `M`. */
|
|
8
|
-
export type FrameworkResourceKey<M extends AdapterModel> = Extract<keyof M["resources"], string>;
|
|
9
|
-
/** A scalar type or an enum of adapter model `M`, by name. */
|
|
10
|
-
export type FrameworkScalarTypeRef<M extends AdapterModel> = {
|
|
11
|
-
readonly scalar: Extract<keyof M["scalars"], string>;
|
|
12
|
-
} | {
|
|
13
|
-
readonly enum: Extract<keyof M["enums"], string>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* A scalar field's settings. For a discovered field, the discovered values are
|
|
17
|
-
* the baseline; a field the adapter did not discover must state `type`,
|
|
18
|
-
* `nullable` and `list`.
|
|
19
|
-
*/
|
|
20
|
-
export type FrameworkScalarFieldConfig<M extends AdapterModel = AdapterModel> = {
|
|
21
|
-
/** The field's scalar or enum type. */
|
|
22
|
-
readonly type?: FrameworkScalarTypeRef<M>;
|
|
23
|
-
/** The scalar's format name, carried in the Contract. */
|
|
24
|
-
readonly format?: ScalarFormat;
|
|
25
|
-
/** Whether the field may be `null`. */
|
|
26
|
-
readonly nullable?: boolean;
|
|
27
|
-
/** Whether the field holds a list of values. */
|
|
28
|
-
readonly list?: boolean;
|
|
29
|
-
/** Persistence traits: `"VIRTUAL"` marks a field the store does not hold. */
|
|
30
|
-
readonly lifecycle?: readonly FrameworkFieldLifecycleTrait[];
|
|
31
|
-
/** The field's capabilities; see {@link ScalarFieldCapabilities}. */
|
|
32
|
-
readonly capabilities?: Partial<ScalarFieldCapabilities>;
|
|
33
|
-
/**
|
|
34
|
-
* A Json field's shape, built with `AvZ` from `@aventara/core/json`: writes
|
|
35
|
-
* to the field are checked against it, and its value is typed by it.
|
|
36
|
-
*/
|
|
37
|
-
readonly json?: JsonShape;
|
|
38
|
-
};
|
|
39
|
-
/** Field settings for one Resource, by field name. */
|
|
40
|
-
export type FrameworkResourceFieldsConfig<M extends AdapterModel = AdapterModel> = Readonly<Record<string, FrameworkScalarFieldConfig<M>>>;
|
|
41
|
-
/** Fields to add or describe, per Resource. */
|
|
42
|
-
export type FrameworkFieldsConfig<M extends AdapterModel = AdapterModel> = Readonly<Partial<Record<FrameworkResourceKey<M>, FrameworkResourceFieldsConfig<M>>>>;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
-
import type { AdapterFieldKey } from "../adapters/adapter-resource.js";
|
|
3
|
-
import type { PaginationCapability, ProjectionScope, RelationFilterCapability, RelationMutationDirective, RelationReducer, ScalarFilterOperator, ScalarMutationDirective, WriteScope } from "../contracts/capability.js";
|
|
4
|
-
import type { AnyFrameworkConfig } from "./any-framework-config.js";
|
|
5
|
-
import type { EffectiveFieldKey } from "./effective-fields.js";
|
|
6
|
-
import type { FrameworkResourceKey } from "./framework-fields-config.js";
|
|
7
|
-
/**
|
|
8
|
-
* `true` keeps a capability, `false` removes it, and a list keeps only the
|
|
9
|
-
* listed entries. Restrictions only narrow what the adapter offers.
|
|
10
|
-
*/
|
|
11
|
-
export type FrameworkCapabilitySetRestriction<T extends string> = boolean | readonly T[];
|
|
12
|
-
/**
|
|
13
|
-
* A restriction on a relation's `select` or `include` capability: `true`,
|
|
14
|
-
* `false`, or the projection positions to keep.
|
|
15
|
-
*/
|
|
16
|
-
export type FrameworkProjectionScopeRestriction = boolean | readonly ProjectionScope[];
|
|
17
|
-
/**
|
|
18
|
-
* A restriction on a relation's `create` or `update` capability. A directive
|
|
19
|
-
* list narrows the directives only; the object form can also narrow the write
|
|
20
|
-
* positions (`scopes`).
|
|
21
|
-
*
|
|
22
|
-
* `directives: []` leaves the relation writable with no directive;
|
|
23
|
-
* `scopes: []` or `false` makes it not writable.
|
|
24
|
-
*/
|
|
25
|
-
export type FrameworkRelationMutationRestriction = boolean | readonly RelationMutationDirective[] | {
|
|
26
|
-
readonly directives?: readonly RelationMutationDirective[];
|
|
27
|
-
readonly scopes?: readonly WriteScope[];
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* A restriction on a relation's `reducers` capability: `true`, `false`, a
|
|
31
|
-
* reducer list, or an object narrowing reducers and projection positions.
|
|
32
|
-
*/
|
|
33
|
-
export type FrameworkRelationReducerRestriction = boolean | readonly RelationReducer[] | {
|
|
34
|
-
readonly reducers?: readonly RelationReducer[];
|
|
35
|
-
readonly scopes?: readonly ProjectionScope[];
|
|
36
|
-
};
|
|
37
|
-
/** Restrictions on a scalar field's capabilities. */
|
|
38
|
-
export type FrameworkScalarCapabilityRestrictions = {
|
|
39
|
-
/** Whether the field can be selected. */
|
|
40
|
-
readonly select?: boolean;
|
|
41
|
-
/** The filter operators to keep. */
|
|
42
|
-
readonly filter?: FrameworkCapabilitySetRestriction<ScalarFilterOperator>;
|
|
43
|
-
/** Whether results can be ordered by the field. */
|
|
44
|
-
readonly order?: boolean;
|
|
45
|
-
/** Whether ordering can place `null`s first or last. */
|
|
46
|
-
readonly orderNulls?: boolean;
|
|
47
|
-
/** The directives to keep when creating. */
|
|
48
|
-
readonly create?: FrameworkCapabilitySetRestriction<ScalarMutationDirective>;
|
|
49
|
-
/** The directives to keep when updating. */
|
|
50
|
-
readonly update?: FrameworkCapabilitySetRestriction<ScalarMutationDirective>;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Restrictions on a relation field's capabilities. `select`, `include`,
|
|
54
|
-
* `reducers`, `create` and `update` can also be narrowed by argument position.
|
|
55
|
-
*/
|
|
56
|
-
export type FrameworkRelationCapabilityRestrictions = {
|
|
57
|
-
readonly select?: FrameworkProjectionScopeRestriction;
|
|
58
|
-
readonly include?: FrameworkProjectionScopeRestriction;
|
|
59
|
-
readonly filter?: FrameworkCapabilitySetRestriction<RelationFilterCapability>;
|
|
60
|
-
readonly order?: boolean;
|
|
61
|
-
readonly pagination?: FrameworkCapabilitySetRestriction<PaginationCapability>;
|
|
62
|
-
readonly reducers?: FrameworkRelationReducerRestriction;
|
|
63
|
-
readonly create?: FrameworkRelationMutationRestriction;
|
|
64
|
-
readonly update?: FrameworkRelationMutationRestriction;
|
|
65
|
-
};
|
|
66
|
-
/** Restrictions for one scalar field. */
|
|
67
|
-
export type FrameworkScalarFieldRestrictions = {
|
|
68
|
-
/** `true` hides the field. */
|
|
69
|
-
readonly hidden?: boolean;
|
|
70
|
-
/** Capabilities to narrow. */
|
|
71
|
-
readonly capabilities?: FrameworkScalarCapabilityRestrictions;
|
|
72
|
-
};
|
|
73
|
-
/** Restrictions for one relation field. */
|
|
74
|
-
export type FrameworkRelationFieldRestrictions = {
|
|
75
|
-
/** `true` hides the field. */
|
|
76
|
-
readonly hidden?: boolean;
|
|
77
|
-
/** Capabilities to narrow. */
|
|
78
|
-
readonly capabilities?: FrameworkRelationCapabilityRestrictions;
|
|
79
|
-
};
|
|
80
|
-
/** Restrictions for one field: scalar or relation. */
|
|
81
|
-
export type FrameworkFieldRestrictions = FrameworkScalarFieldRestrictions | FrameworkRelationFieldRestrictions;
|
|
82
|
-
/**
|
|
83
|
-
* Standard operations to turn off, by family and variant: `false` removes
|
|
84
|
-
* one the adapter offers.
|
|
85
|
-
*/
|
|
86
|
-
export type FrameworkResourceOperationRestrictions = {
|
|
87
|
-
readonly find?: {
|
|
88
|
-
readonly first?: boolean;
|
|
89
|
-
readonly unique?: boolean;
|
|
90
|
-
readonly many?: boolean;
|
|
91
|
-
readonly count?: boolean;
|
|
92
|
-
};
|
|
93
|
-
readonly create?: {
|
|
94
|
-
readonly one?: boolean;
|
|
95
|
-
readonly many?: boolean;
|
|
96
|
-
readonly count?: boolean;
|
|
97
|
-
};
|
|
98
|
-
readonly update?: {
|
|
99
|
-
readonly first?: boolean;
|
|
100
|
-
readonly unique?: boolean;
|
|
101
|
-
readonly many?: boolean;
|
|
102
|
-
readonly count?: boolean;
|
|
103
|
-
};
|
|
104
|
-
readonly delete?: {
|
|
105
|
-
readonly first?: boolean;
|
|
106
|
-
readonly unique?: boolean;
|
|
107
|
-
readonly many?: boolean;
|
|
108
|
-
readonly count?: boolean;
|
|
109
|
-
};
|
|
110
|
-
readonly upsert?: {
|
|
111
|
-
readonly unique?: boolean;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
/** The restriction shape an adapter-discovered field admits, by its kind. */
|
|
115
|
-
type AdapterFieldRestrictionsFor<TField> = TField extends {
|
|
116
|
-
readonly kind: "scalar";
|
|
117
|
-
} ? FrameworkScalarFieldRestrictions : TField extends {
|
|
118
|
-
readonly kind: "relation";
|
|
119
|
-
} ? FrameworkRelationFieldRestrictions : FrameworkFieldRestrictions;
|
|
120
|
-
/**
|
|
121
|
-
* The restriction shape one effective field name admits. Three cases, in
|
|
122
|
-
* order.
|
|
123
|
-
*/
|
|
124
|
-
type FieldRestrictionsFor<M extends AdapterModel, R extends FrameworkResourceKey<M>, F extends string> = string extends F ? FrameworkFieldRestrictions : F extends AdapterFieldKey<M, R> ? AdapterFieldRestrictionsFor<M["resources"][R]["fields"][F]> : FrameworkScalarFieldRestrictions;
|
|
125
|
-
/** Restrictions for one Resource's fields, by field name. */
|
|
126
|
-
export type FrameworkResourceFieldRestrictions<M extends AdapterModel, Cfg, R extends FrameworkResourceKey<M>> = Readonly<Partial<{
|
|
127
|
-
[F in EffectiveFieldKey<M, Cfg, R>]: FieldRestrictionsFor<M, R, F>;
|
|
128
|
-
}>>;
|
|
129
|
-
/** Restrictions for one Resource. */
|
|
130
|
-
export type FrameworkResourceRestrictions<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = {
|
|
131
|
-
/** `true` hides the whole Resource. */
|
|
132
|
-
readonly hidden?: boolean;
|
|
133
|
-
/** Restrictions per field. */
|
|
134
|
-
readonly fields?: FrameworkResourceFieldRestrictions<M, Cfg, R>;
|
|
135
|
-
/** Standard operations to turn off. */
|
|
136
|
-
readonly operations?: FrameworkResourceOperationRestrictions;
|
|
137
|
-
};
|
|
138
|
-
/** What to hide or narrow, per Resource. */
|
|
139
|
-
export type FrameworkRestrictionsConfig<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig> = Readonly<Partial<{
|
|
140
|
-
[R in FrameworkResourceKey<M>]: FrameworkResourceRestrictions<M, Cfg, R>;
|
|
141
|
-
}>>;
|
|
142
|
-
export {};
|
package/dist/json/avz.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { JsonSchemaPrimitive, JsonShape, JsonShapeValue } from "../contracts/json-shape.js";
|
|
2
|
-
/** The forms a Json Shape takes. */
|
|
3
|
-
export type AvZKind = "string" | "number" | "int" | "boolean" | "null" | "literal" | "enum" | "object" | "array" | "tuple" | "record" | "union" | "discriminatedUnion" | "optional" | "nullable";
|
|
4
|
-
/**
|
|
5
|
-
* A Json Shape built with {@link AvZ}: opaque, its `kind` the only member. Its
|
|
6
|
-
* TypeScript type is `AvZ.infer<typeof shape>`.
|
|
7
|
-
*/
|
|
8
|
-
export interface AvZShape<Value = unknown, Kind extends AvZKind = AvZKind> extends JsonShape<Value> {
|
|
9
|
-
readonly kind: Kind;
|
|
10
|
-
}
|
|
11
|
-
/** The fields of an object shape, by key. */
|
|
12
|
-
export type AvZFields = {
|
|
13
|
-
readonly [key: string]: AvZShape;
|
|
14
|
-
};
|
|
15
|
-
declare const avzOptionalKey: unique symbol;
|
|
16
|
-
/** Marks a shape whose object key may be left out. Type-level only. */
|
|
17
|
-
interface AvZOptionalKey {
|
|
18
|
-
readonly [avzOptionalKey]: true;
|
|
19
|
-
}
|
|
20
|
-
type FieldKeysOptional<Fields extends AvZFields> = {
|
|
21
|
-
[Key in keyof Fields]: Fields[Key] extends AvZOptionalKey ? Key : never;
|
|
22
|
-
}[keyof Fields];
|
|
23
|
-
type Flatten<T> = {
|
|
24
|
-
[Key in keyof T]: T[Key];
|
|
25
|
-
} & {};
|
|
26
|
-
/** The value an object shape describes. */
|
|
27
|
-
type AvZObjectValue<Fields extends AvZFields> = ObjectValueOf<Fields, FieldKeysOptional<Fields>>;
|
|
28
|
-
type ObjectValueOf<Fields extends AvZFields, Optional extends keyof Fields> = Flatten<{
|
|
29
|
-
-readonly [Key in Exclude<keyof Fields, Optional>]: JsonShapeValue<Fields[Key]>;
|
|
30
|
-
} & {
|
|
31
|
-
-readonly [Key in Optional]?: JsonShapeValue<Fields[Key]>;
|
|
32
|
-
}>;
|
|
33
|
-
/** An object shape: closed, so a key it does not declare is refused. */
|
|
34
|
-
export interface AvZObject<Fields extends AvZFields = AvZFields> extends AvZShape<AvZObjectValue<Fields>, "object"> {
|
|
35
|
-
readonly fields: Fields;
|
|
36
|
-
}
|
|
37
|
-
/** A shape whose object key may be left out. */
|
|
38
|
-
export interface AvZOptional<Inner extends AvZShape = AvZShape> extends AvZShape<JsonShapeValue<Inner> | undefined, "optional">, AvZOptionalKey {
|
|
39
|
-
}
|
|
40
|
-
/** A shape that also admits `null`. */
|
|
41
|
-
export type AvZNullable<Inner extends AvZShape = AvZShape> = AvZShape<JsonShapeValue<Inner> | null, "nullable"> & (Inner extends AvZOptionalKey ? AvZOptionalKey : unknown);
|
|
42
|
-
/** A value a literal shape may hold. */
|
|
43
|
-
export type AvZLiteralValue = JsonSchemaPrimitive;
|
|
44
|
-
/** What keys a record shape: any string, an enum's values or one literal. */
|
|
45
|
-
type AvZRecordKey = AvZShape<string, "string"> | AvZShape<string, "enum"> | AvZShape<string, "literal">;
|
|
46
|
-
/** An option of a discriminated union: an object whose discriminator is a literal or an enum. */
|
|
47
|
-
type AvZDiscriminable<Discriminator extends string> = AvZObject<{
|
|
48
|
-
readonly [Key in Discriminator]: AvZShape<AvZLiteralValue, "literal"> | AvZShape<string, "enum">;
|
|
49
|
-
} & AvZFields>;
|
|
50
|
-
type TupleValue<Items extends readonly AvZShape[]> = {
|
|
51
|
-
-readonly [Index in keyof Items]: JsonShapeValue<Items[Index]>;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Builds Json Shapes: the type of a Json field, declared in the configuration as
|
|
55
|
-
* `fields: { Post: { meta: { json: AvZ.object({ … }) } } }`. Types only — no
|
|
56
|
-
* rules, refinements, transforms or defaults. Objects are closed: a key the shape
|
|
57
|
-
* does not declare is refused.
|
|
58
|
-
*/
|
|
59
|
-
export declare class AvZ {
|
|
60
|
-
private constructor();
|
|
61
|
-
/** Any string. */
|
|
62
|
-
static readonly string: () => AvZShape<string, "string">;
|
|
63
|
-
/** Any finite number. */
|
|
64
|
-
static readonly number: () => AvZShape<number, "number">;
|
|
65
|
-
/** An integer (a safe one). */
|
|
66
|
-
static readonly int: () => AvZShape<number, "int">;
|
|
67
|
-
/** `true` or `false`. */
|
|
68
|
-
static readonly boolean: () => AvZShape<boolean, "boolean">;
|
|
69
|
-
/** `null`. */
|
|
70
|
-
static readonly null: () => AvZShape<null, "null">;
|
|
71
|
-
/** Exactly `value`: a string, a finite number, a boolean or `null`. */
|
|
72
|
-
static readonly literal: <const Value extends AvZLiteralValue>(value: Value) => AvZShape<Value, "literal">;
|
|
73
|
-
/** One of `values`. */
|
|
74
|
-
static readonly enum: <const Values extends readonly [string, ...string[]]>(values: Values) => AvZShape<Values[number], "enum">;
|
|
75
|
-
/** An object with exactly these keys; `AvZ.optional` marks one that may be left out. */
|
|
76
|
-
static readonly object: <const Fields extends AvZFields>(fields: Fields) => AvZObject<Fields>;
|
|
77
|
-
/** A list of `item`s. */
|
|
78
|
-
static readonly array: <Item extends AvZShape>(item: Item) => AvZShape<JsonShapeValue<Item>[], "array">;
|
|
79
|
-
/** A list of exactly these items, in order. */
|
|
80
|
-
static readonly tuple: <const Items extends readonly [AvZShape, ...AvZShape[]]>(items: Items) => AvZShape<TupleValue<Items>, "tuple">;
|
|
81
|
-
/** An object of `value`s, keyed by any string, an enum's values or a literal. */
|
|
82
|
-
static readonly record: <Key extends AvZRecordKey, Value extends AvZShape>(key: Key, value: Value) => AvZShape<Record<JsonShapeValue<Key>, JsonShapeValue<Value>>, "record">;
|
|
83
|
-
/** Any one of `options`. */
|
|
84
|
-
static readonly union: <const Options extends readonly [AvZShape, AvZShape, ...AvZShape[]]>(options: Options) => AvZShape<JsonShapeValue<Options[number]>, "union">;
|
|
85
|
-
/** One of `options`, told apart by the literal or enum at `discriminator`. */
|
|
86
|
-
static readonly discriminatedUnion: <Discriminator extends string, const Options extends readonly [AvZDiscriminable<Discriminator>, ...AvZDiscriminable<Discriminator>[]]>(discriminator: Discriminator, options: Options) => AvZShape<JsonShapeValue<Options[number]>, "discriminatedUnion">;
|
|
87
|
-
/** An object key that may be left out. */
|
|
88
|
-
static readonly optional: <Inner extends AvZShape>(inner: Inner) => AvZOptional<Inner>;
|
|
89
|
-
/** `inner`, or `null`. */
|
|
90
|
-
static readonly nullable: <Inner extends AvZShape>(inner: Inner) => AvZNullable<Inner>;
|
|
91
|
-
}
|
|
92
|
-
export declare namespace AvZ {
|
|
93
|
-
/** The TypeScript type a shape describes. */
|
|
94
|
-
type infer<Shape extends JsonShape> = JsonShapeValue<Shape>;
|
|
95
|
-
}
|
|
96
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
-
import type { AnyFrameworkConfig } from "../config/any-framework-config.js";
|
|
3
|
-
import type { RequestOrigin } from "../config/config-layer.js";
|
|
4
|
-
import type { EffectiveFieldKey } from "../config/effective-fields.js";
|
|
5
|
-
import type { FrameworkResourceKey } from "../config/framework-fields-config.js";
|
|
6
|
-
import type { PipelineContext } from "./pipeline.js";
|
|
7
|
-
/**
|
|
8
|
-
* What a write-stage compute callback is told about the field it is computing.
|
|
9
|
-
*/
|
|
10
|
-
type ComputedWriteContext<M extends AdapterModel, Cfg, R extends FrameworkResourceKey<M>> = {
|
|
11
|
-
readonly origin: RequestOrigin;
|
|
12
|
-
readonly resource: R;
|
|
13
|
-
readonly field: EffectiveFieldKey<M, Cfg, R>;
|
|
14
|
-
readonly value: unknown;
|
|
15
|
-
readonly data: Readonly<Record<EffectiveFieldKey<M, Cfg, R>, unknown>>;
|
|
16
|
-
readonly operation: PipelineContext;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Computes a field's value when a row is created. It receives the incoming
|
|
20
|
-
* `data` and returns the value to store.
|
|
21
|
-
*/
|
|
22
|
-
export type ComputeOnCreate<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: ComputedWriteContext<M, Cfg, R>) => unknown | Promise<unknown>;
|
|
23
|
-
/**
|
|
24
|
-
* Computes a field's value when a row is updated. It receives the incoming
|
|
25
|
-
* `data` and returns the value to store.
|
|
26
|
-
*/
|
|
27
|
-
export type ComputeOnUpdate<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: ComputedWriteContext<M, Cfg, R>) => unknown | Promise<unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* Computes a field's value when a row is read. It receives the stored `record`
|
|
30
|
-
* and returns the value to return.
|
|
31
|
-
*/
|
|
32
|
-
export type ComputeOnRead<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = (context: {
|
|
33
|
-
readonly origin: RequestOrigin;
|
|
34
|
-
readonly resource: R;
|
|
35
|
-
readonly field: EffectiveFieldKey<M, Cfg, R>;
|
|
36
|
-
readonly value: unknown;
|
|
37
|
-
readonly record: Readonly<Record<EffectiveFieldKey<M, Cfg, R>, unknown>>;
|
|
38
|
-
readonly operation: PipelineContext;
|
|
39
|
-
}) => unknown | Promise<unknown>;
|
|
40
|
-
/**
|
|
41
|
-
* A computed read: a compute function, or `{ compute, dependsOn }` naming the
|
|
42
|
-
* fields it reads.
|
|
43
|
-
*/
|
|
44
|
-
export type ComputedReadBehavior<M extends AdapterModel = AdapterModel, Cfg = AnyFrameworkConfig, R extends FrameworkResourceKey<M> = FrameworkResourceKey<M>> = ComputeOnRead<M, Cfg, R> | {
|
|
45
|
-
readonly dependsOn?: readonly EffectiveFieldKey<M, Cfg, R>[];
|
|
46
|
-
readonly compute: ComputeOnRead<M, Cfg, R>;
|
|
47
|
-
};
|
|
48
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|