@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,28 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { FieldAtom, ScalarForms
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
1
|
+
import type { AvProjectionScope, AvRelationMutationDirective, AvScalarFilterOperator, AvScalarMutationDirective, AvWriteScope, ScalarFilterMode, ToOneRelinkDirective, ToOneRewriteDirective } from "../contracts/capability.js";
|
|
2
|
+
import type { AvContract } from "../contracts/contract.js";
|
|
3
|
+
import type { AvProjectionScopes, AvScalarField } from "../contracts/field.js";
|
|
4
|
+
import type { AvScalarValueType, FieldAtom, ScalarForms } from "../contracts/scalar-value-type.js";
|
|
5
|
+
import type { AvJsonValue } from "../runtime/json-value.js";
|
|
6
|
+
import type { AvTransactionReference, TransactionSlotShape } from "../transactions/transaction-reference.js";
|
|
7
|
+
import type { AvOperationIdentity } from "./operation-identity.js";
|
|
8
8
|
/** The Resource names of Contract `C`. */
|
|
9
|
-
export type
|
|
9
|
+
export type AvResourceKey<C extends AvContract> = Extract<keyof C["resources"], string>;
|
|
10
10
|
/** The field names of Resource `K` in Contract `C`. */
|
|
11
|
-
export type
|
|
12
|
-
type FieldAt<C extends
|
|
13
|
-
type ScalarFieldAt<C extends
|
|
11
|
+
export type AvFieldKey<C extends AvContract, K extends AvResourceKey<C>> = Extract<keyof C["resources"][K]["fields"], string>;
|
|
12
|
+
type FieldAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = C["resources"][K]["fields"][F];
|
|
13
|
+
type ScalarFieldAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = Extract<FieldAt<C, K, F>, {
|
|
14
14
|
readonly kind: "scalar";
|
|
15
15
|
}>;
|
|
16
|
-
type RelationFieldAt<C extends
|
|
16
|
+
type RelationFieldAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = Extract<FieldAt<C, K, F>, {
|
|
17
17
|
readonly kind: "relation";
|
|
18
18
|
}>;
|
|
19
|
-
type ScalarFieldKeyOf<C extends
|
|
20
|
-
[F in
|
|
21
|
-
}[
|
|
22
|
-
type RelationFieldKeyOf<C extends
|
|
23
|
-
[F in
|
|
24
|
-
}[
|
|
25
|
-
type CapabilitiesOf<C extends
|
|
19
|
+
type ScalarFieldKeyOf<C extends AvContract, K extends AvResourceKey<C>> = {
|
|
20
|
+
[F in AvFieldKey<C, K>]: ScalarFieldAt<C, K, F> extends never ? never : F;
|
|
21
|
+
}[AvFieldKey<C, K>];
|
|
22
|
+
type RelationFieldKeyOf<C extends AvContract, K extends AvResourceKey<C>> = {
|
|
23
|
+
[F in AvFieldKey<C, K>]: RelationFieldAt<C, K, F> extends never ? never : F;
|
|
24
|
+
}[AvFieldKey<C, K>];
|
|
25
|
+
type CapabilitiesOf<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = FieldAt<C, K, F> extends {
|
|
26
26
|
readonly capabilities: infer Capabilities;
|
|
27
27
|
} ? Capabilities : never;
|
|
28
28
|
/** The projection position read when no position applies: `"record"`. */
|
|
@@ -30,15 +30,15 @@ type UnrestrictedProjection = "record";
|
|
|
30
30
|
/** The write position read when no position applies, and the one nested writes use: `"nested"`. */
|
|
31
31
|
type UnrestrictedWrite = "nested";
|
|
32
32
|
/** Whether a capability member's answer holds at one argument scope. */
|
|
33
|
-
type HoldsAtScope<Value, Scope extends
|
|
33
|
+
type HoldsAtScope<Value, Scope extends AvProjectionScope | AvWriteScope> = Value extends {
|
|
34
34
|
readonly scopes: readonly (infer Stated)[];
|
|
35
|
-
} ? Scope extends Stated ? true : false : Value extends
|
|
35
|
+
} ? Scope extends Stated ? true : false : Value extends AvProjectionScopes ? Scope extends Value[number] ? true : false : true;
|
|
36
36
|
/** The tokens a capability member advertises, in any argument position. */
|
|
37
37
|
type AdvertisedTokens<Value> = Value extends {
|
|
38
|
-
readonly scopes: readonly
|
|
38
|
+
readonly scopes: readonly AvWriteScope[];
|
|
39
39
|
readonly directives: readonly (infer Directive)[];
|
|
40
40
|
} ? Directive : Value extends {
|
|
41
|
-
readonly scopes: readonly
|
|
41
|
+
readonly scopes: readonly AvProjectionScope[];
|
|
42
42
|
readonly reducers: readonly (infer Reducer)[];
|
|
43
43
|
} ? Reducer : Value extends readonly (infer Token)[] ? Token : never;
|
|
44
44
|
/**
|
|
@@ -47,48 +47,43 @@ type AdvertisedTokens<Value> = Value extends {
|
|
|
47
47
|
* Presence first, scope second: an absent or `false` member is unavailable
|
|
48
48
|
* everywhere, and only a present one is asked where it holds.
|
|
49
49
|
*/
|
|
50
|
-
type HasCapability<C extends
|
|
50
|
+
type HasCapability<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Capability extends PropertyKey, Scope extends AvProjectionScope | AvWriteScope> = Capability extends keyof CapabilitiesOf<C, K, F> ? CapabilitiesOf<C, K, F>[Capability] extends false | undefined ? false : HoldsAtScope<CapabilitiesOf<C, K, F>[Capability], Scope> : false;
|
|
51
51
|
/**
|
|
52
52
|
* The tokens a field advertises for one capability **at one argument scope** —
|
|
53
53
|
* `never` where the member does not hold at that scope, so a token list that
|
|
54
54
|
* holds only in the unrestricted position offers no token in a bulk one.
|
|
55
55
|
*/
|
|
56
|
-
type CapabilityTokens<C extends
|
|
57
|
-
type HasCapabilityToken<C extends
|
|
58
|
-
type RelationTarget<C extends
|
|
59
|
-
type RelationCardinality<C extends
|
|
60
|
-
type RelationNullable<C extends
|
|
61
|
-
type KeysWithCapability<C extends
|
|
56
|
+
type CapabilityTokens<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Capability extends PropertyKey, Scope extends AvProjectionScope | AvWriteScope> = Capability extends keyof CapabilitiesOf<C, K, F> ? HoldsAtScope<CapabilitiesOf<C, K, F>[Capability], Scope> extends true ? AdvertisedTokens<CapabilitiesOf<C, K, F>[Capability]> : never : never;
|
|
57
|
+
type HasCapabilityToken<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Capability extends PropertyKey, Scope extends AvProjectionScope | AvWriteScope, Token> = Token extends CapabilityTokens<C, K, F, Capability, Scope> ? true : false;
|
|
58
|
+
type RelationTarget<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>> = Extract<RelationFieldAt<C, K, F>["target"], AvResourceKey<C>>;
|
|
59
|
+
type RelationCardinality<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>> = RelationFieldAt<C, K, F>["cardinality"];
|
|
60
|
+
type RelationNullable<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>> = RelationFieldAt<C, K, F>["nullable"];
|
|
61
|
+
type KeysWithCapability<C extends AvContract, K extends AvResourceKey<C>, Keys extends AvFieldKey<C, K>, Capability extends PropertyKey, Scope extends AvProjectionScope | AvWriteScope> = {
|
|
62
62
|
[F in Keys]: HasCapability<C, K, F, Capability, Scope> extends true ? F : never;
|
|
63
63
|
}[Keys];
|
|
64
64
|
/**
|
|
65
65
|
* The scalar-form map used when no side of a boundary is named: every built-in
|
|
66
|
-
* value is `unknown`. Pass `
|
|
66
|
+
* value is `unknown`. Pass `AvApplicationScalarForms` or `AvWireScalarForms` to type
|
|
67
67
|
* values. Enum values are their member union under every map.
|
|
68
68
|
*/
|
|
69
69
|
type UnstatedForms = ScalarForms;
|
|
70
70
|
/** Field `F`'s value under `Forms`, the same as in results. */
|
|
71
|
-
type ScalarValueAt<C extends
|
|
71
|
+
type ScalarValueAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Forms extends ScalarForms> = ScalarFieldAt<C, K, F> extends infer Field extends AvScalarField<C> ? AvScalarValueType<C, Field, Forms> : never;
|
|
72
72
|
/** One entry of field `F`'s value — the whole value when `F` is not a list. */
|
|
73
|
-
type ScalarAtomAt<C extends
|
|
73
|
+
type ScalarAtomAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Forms extends ScalarForms> = FieldAtom<C, ScalarFieldAt<C, K, F>, Forms>;
|
|
74
74
|
/**
|
|
75
75
|
* A `$ref` to a source whose value fits slot shape `Shape` of field `F`, typed in
|
|
76
76
|
* `ReferenceForms` — the forms a source's final data is read in. `never` when
|
|
77
77
|
* `ReferenceForms` is `never`: no position takes one outside a transaction plan.
|
|
78
78
|
*/
|
|
79
|
-
type SlotReference<C extends
|
|
79
|
+
type SlotReference<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, ReferenceForms extends ScalarForms, Shape extends TransactionSlotShape> = [ReferenceForms] extends [never] ? never : AvTransactionReference<Shape extends "value" ? ScalarValueAt<C, K, F, ReferenceForms> : Shape extends "nonNullValue" ? Exclude<ScalarValueAt<C, K, F, ReferenceForms>, null> : Shape extends "entry" ? ScalarAtomAt<C, K, F, ReferenceForms> : readonly ScalarAtomAt<C, K, F, ReferenceForms>[]>;
|
|
80
80
|
/**
|
|
81
81
|
* A JSON object. Positions that accept both a value and an object of operators
|
|
82
82
|
* read a JSON object as the operators, so their value forms leave it out.
|
|
83
83
|
*/
|
|
84
|
-
type JsonObject = Extract<
|
|
85
|
-
readonly [key: string]:
|
|
84
|
+
type JsonObject = Extract<AvJsonValue, {
|
|
85
|
+
readonly [key: string]: AvJsonValue | undefined;
|
|
86
86
|
}>;
|
|
87
|
-
/**
|
|
88
|
-
* The field-independent shape of one scalar filter: any value, or an object of the
|
|
89
|
-
* operator vocabulary.
|
|
90
|
-
*/
|
|
91
|
-
export type ScalarFilterInput = unknown | Readonly<Partial<Record<ScalarFilterOperator, unknown>>>;
|
|
92
87
|
/**
|
|
93
88
|
* A scalar filter's shorthand equality value: the field's value, minus a JSON
|
|
94
89
|
* object.
|
|
@@ -98,64 +93,121 @@ type ScalarFilterShorthand<Value> = Exclude<Value, JsonObject>;
|
|
|
98
93
|
* The `$ref` each slot shape of field `F` takes, by shape: every member `never`
|
|
99
94
|
* outside a transaction plan.
|
|
100
95
|
*/
|
|
101
|
-
type FieldSlotReferences<C extends
|
|
96
|
+
type FieldSlotReferences<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, ReferenceForms extends ScalarForms> = {
|
|
102
97
|
readonly [Shape in TransactionSlotShape]: SlotReference<C, K, F, ReferenceForms, Shape>;
|
|
103
98
|
};
|
|
104
99
|
/**
|
|
105
|
-
*
|
|
106
|
-
* value; `in`, `notIn`, `hasEvery` and `hasSome` take a list of entries;
|
|
107
|
-
* one entry; a `json` field's `string*`/`array*` operand a
|
|
108
|
-
* `not` a
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
100
|
+
* Every scalar filter operator's operand: a comparison operand is the field's
|
|
101
|
+
* whole value; `in`, `notIn`, `hasEvery` and `hasSome` take a list of entries;
|
|
102
|
+
* `has` one entry; a `json` field's `string*`/`array*` operand a
|
|
103
|
+
* {@link AvJsonValue}; `not` a nested operator object of the same operators, or
|
|
104
|
+
* a value where `equals` is one of them. `mode` takes one of the modes the
|
|
105
|
+
* field offers at this level (`LevelMode`), `isEmpty` a boolean, `path` a list of
|
|
106
|
+
* JSON keys and a `json` field's `string*` operand a string: none of these is a
|
|
107
|
+
* value of the field. Only `equals`, `not` and the `json` `array*` operands take
|
|
108
|
+
* `null`. Inside a transaction plan every
|
|
109
|
+
* operand but `mode`, `isEmpty`, `path` and the `json` ones may be a `$ref` of
|
|
110
|
+
* the shape it holds (`References`).
|
|
111
|
+
*/
|
|
112
|
+
export type AvScalarFilterOperands<Value, Atom, Json, References extends Readonly<Record<TransactionSlotShape, unknown>>, Operator extends AvScalarFilterOperator, Mode extends ScalarFilterMode, PathMode extends ScalarFilterMode, LevelMode extends ScalarFilterMode> = {
|
|
113
|
+
equals: Value | References["value"];
|
|
114
|
+
not: NegatedValue<Value, References, Operator> | ScalarFilterOperators<Value, Atom, Json, References, Operator, Mode, PathMode>;
|
|
115
|
+
in: readonly Atom[] | References["entries"];
|
|
116
|
+
notIn: readonly Atom[] | References["entries"];
|
|
117
|
+
lt: Exclude<Value, null> | References["nonNullValue"];
|
|
118
|
+
lte: Exclude<Value, null> | References["nonNullValue"];
|
|
119
|
+
gt: Exclude<Value, null> | References["nonNullValue"];
|
|
120
|
+
gte: Exclude<Value, null> | References["nonNullValue"];
|
|
121
|
+
contains: Exclude<Value, null> | References["nonNullValue"];
|
|
122
|
+
startsWith: Exclude<Value, null> | References["nonNullValue"];
|
|
123
|
+
endsWith: Exclude<Value, null> | References["nonNullValue"];
|
|
124
|
+
mode: LevelMode;
|
|
125
|
+
has: Atom | References["entry"];
|
|
126
|
+
hasEvery: readonly Atom[] | References["entries"];
|
|
127
|
+
hasSome: readonly Atom[] | References["entries"];
|
|
128
|
+
isEmpty: boolean;
|
|
129
|
+
path: readonly string[];
|
|
130
|
+
stringContains: string;
|
|
131
|
+
stringStartsWith: string;
|
|
132
|
+
stringEndsWith: string;
|
|
133
|
+
arrayContains: Json;
|
|
134
|
+
arrayStartsWith: Json;
|
|
135
|
+
arrayEndsWith: Json;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* A scalar filter's operator object: the operators `Operator` names — the ones
|
|
139
|
+
* the field's `filter` member advertises — each with its operand. Where `path`
|
|
140
|
+
* is one of them, an object that names it takes `PathMode`, and one that does
|
|
141
|
+
* not takes `Mode`. An object that names `mode` or `path` names a comparing
|
|
142
|
+
* operator beside it.
|
|
143
|
+
*/
|
|
144
|
+
type ScalarFilterOperators<Value, Atom, Json, References extends Readonly<Record<TransactionSlotShape, unknown>>, Operator extends AvScalarFilterOperator, Mode extends ScalarFilterMode, PathMode extends ScalarFilterMode> = ScalarFilterLevel<ReadonlyOperands<Value, Atom, Json, References, Operator, Mode, PathMode, Mode>, Operator, Mode, NegatedValue<Value, References, Operator>, "path" extends Operator ? {
|
|
145
|
+
readonly path?: never;
|
|
146
|
+
} : unknown> | ("path" extends Operator ? ScalarFilterOperatorsAtPath<ReadonlyOperands<Value, Atom, Json, References, Operator, Mode, PathMode, PathMode>, Operator, PathMode, NegatedValue<Value, References, Operator>> : never);
|
|
147
|
+
/** {@link AvScalarFilterOperands}, each operand read-only. */
|
|
148
|
+
type ReadonlyOperands<Value, Atom, Json, References extends Readonly<Record<TransactionSlotShape, unknown>>, Operator extends AvScalarFilterOperator, Mode extends ScalarFilterMode, PathMode extends ScalarFilterMode, LevelMode extends ScalarFilterMode> = Readonly<AvScalarFilterOperands<Value, Atom, Json, References, Operator, Mode, PathMode, LevelMode>>;
|
|
149
|
+
/** The operators of a level that compare something: all but `mode` and `path`. */
|
|
150
|
+
type ComparingOperator<Operator extends AvScalarFilterOperator> = Exclude<Operator, "mode" | "path">;
|
|
151
|
+
/** `not`'s value arm: equality negated, offered only where `equals` is. */
|
|
152
|
+
type NegatedValue<Value, References extends Readonly<Record<TransactionSlotShape, unknown>>, Operator extends AvScalarFilterOperator> = "equals" extends Operator ? Exclude<Value, JsonObject> | References["value"] : never;
|
|
153
|
+
/** A level's comparing operators, each optional. */
|
|
154
|
+
type ComparingOperators<Operands extends Readonly<Record<AvScalarFilterOperator, unknown>>, Operator extends AvScalarFilterOperator> = Partial<Pick<Operands, ComparingOperator<Operator>>>;
|
|
155
|
+
/**
|
|
156
|
+
* A level's comparing operators with at least one of them present; `not` is
|
|
157
|
+
* one only with a value (an object under `not` compares at its own level).
|
|
158
|
+
*/
|
|
159
|
+
type SomeComparingOperator<Operands extends Readonly<Record<AvScalarFilterOperator, unknown>>, Operator extends AvScalarFilterOperator, Negated> = ({
|
|
160
|
+
[Key in Exclude<ComparingOperator<Operator>, "not">]-?: Pick<Operands, Key>;
|
|
161
|
+
}[Exclude<ComparingOperator<Operator>, "not">] & ComparingOperators<Operands, Operator>) | ("not" extends Operator ? {
|
|
162
|
+
readonly not: Negated;
|
|
163
|
+
} & Partial<Pick<Operands, Exclude<ComparingOperator<Operator>, "not">>> : never);
|
|
164
|
+
/**
|
|
165
|
+
* One operator object that names no `path`: without `mode`, any of its comparing
|
|
166
|
+
* operators; with `mode` (one of `Mode`), at least one of them.
|
|
167
|
+
*/
|
|
168
|
+
type ScalarFilterLevel<Operands extends Readonly<Record<AvScalarFilterOperator, unknown>>, Operator extends AvScalarFilterOperator, Mode extends ScalarFilterMode, Negated, PathKey> = ("mode" extends Operator ? (ComparingOperators<Operands, Operator> & {
|
|
169
|
+
readonly mode?: never;
|
|
170
|
+
}) | (SomeComparingOperator<Operands, Operator, Negated> & {
|
|
171
|
+
readonly mode?: Mode;
|
|
172
|
+
}) : ComparingOperators<Operands, Operator>) & PathKey;
|
|
173
|
+
/** An operator object that names `path`: `PathMode`, and a comparing operator. */
|
|
174
|
+
type ScalarFilterOperatorsAtPath<Operands extends Readonly<Record<AvScalarFilterOperator, unknown>>, Operator extends AvScalarFilterOperator, PathMode extends ScalarFilterMode, Negated> = SomeComparingOperator<Operands, Operator, Negated> & {
|
|
175
|
+
readonly path: readonly string[];
|
|
176
|
+
} & ("mode" extends Operator ? {
|
|
177
|
+
readonly mode?: PathMode;
|
|
178
|
+
} : unknown);
|
|
179
|
+
/** The filter operators field `F` advertises: `never` when it advertises none. */
|
|
180
|
+
type ScalarFilterOperatorAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = Extract<CapabilityTokens<C, K, F, "filter", UnrestrictedProjection>, AvScalarFilterOperator>;
|
|
181
|
+
/** The `mode` operands field `F` takes in an operator object without `path`. */
|
|
182
|
+
type ScalarFilterModeAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = "default" | Extract<CapabilityTokens<C, K, F, "filterModes", UnrestrictedProjection>, ScalarFilterMode>;
|
|
183
|
+
/** The `mode` operands field `F` takes in an operator object that names `path`. */
|
|
184
|
+
type ScalarPathFilterModeAt<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>> = "pathFilterModes" extends keyof CapabilitiesOf<C, K, F> ? "default" | Extract<CapabilityTokens<C, K, F, "pathFilterModes", UnrestrictedProjection>, ScalarFilterMode> : ScalarFilterModeAt<C, K, F>;
|
|
139
185
|
/**
|
|
140
|
-
* One scalar field's filter under `Forms`: a shorthand value
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* to a
|
|
186
|
+
* One scalar field's filter under `Forms`: a shorthand value where the field
|
|
187
|
+
* advertises `equals`, or an object of the operators it advertises. Inside a
|
|
188
|
+
* transaction plan the value and every operand that holds a field value may be a
|
|
189
|
+
* `$ref` (see {@link TransactionSlotShape}): equality to a source nullable only
|
|
190
|
+
* where the field is, a comparison to a non-null source, `in` and the list
|
|
191
|
+
* operators to a list source, `has` to one entry.
|
|
145
192
|
*/
|
|
146
|
-
type ScalarFilterFor<C extends
|
|
193
|
+
type ScalarFilterFor<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = ("equals" extends ScalarFilterOperatorAt<C, K, F> ? ScalarFilterShorthand<ScalarValueAt<C, K, F, Forms>> | SlotReference<C, K, F, ReferenceForms, "value"> : never) | ScalarFilterOperators<ScalarValueAt<C, K, F, Forms>, ScalarAtomAt<C, K, F, Forms>, ScalarFieldAt<C, K, F>["type"] extends {
|
|
147
194
|
readonly scalar: "json";
|
|
148
|
-
} ?
|
|
149
|
-
|
|
150
|
-
type
|
|
195
|
+
} ? AvJsonValue : ScalarValueAt<C, K, F, Forms>, FieldSlotReferences<C, K, F, ReferenceForms>, ScalarFilterOperatorAt<C, K, F>, ScalarFilterModeAt<C, K, F>, ScalarPathFilterModeAt<C, K, F>>;
|
|
196
|
+
/** The scalar fields of `K` a `where` can name: those advertising an operator. */
|
|
197
|
+
type ScalarFilterableKey<C extends AvContract, K extends AvResourceKey<C>> = {
|
|
198
|
+
[F in ScalarFieldKeyOf<C, K>]: [ScalarFilterOperatorAt<C, K, F>] extends [
|
|
199
|
+
never
|
|
200
|
+
] ? never : F;
|
|
201
|
+
}[ScalarFieldKeyOf<C, K>];
|
|
202
|
+
type RelationParentFilterKey<C extends AvContract, K extends AvResourceKey<C>> = {
|
|
151
203
|
[F in RelationFieldKeyOf<C, K>]: RelationCardinality<C, K, F> extends "one" ? HasCapabilityToken<C, K, F, "filter", UnrestrictedProjection, "match"> extends true ? F : HasCapabilityToken<C, K, F, "filter", UnrestrictedProjection, "null"> extends true ? F : never : Extract<CapabilityTokens<C, K, F, "filter", UnrestrictedProjection>, "some" | "every" | "none"> extends never ? never : F;
|
|
152
204
|
}[RelationFieldKeyOf<C, K>];
|
|
153
|
-
type ToManyRelationWhereInput<C extends
|
|
154
|
-
type RelationWhereInput<C extends
|
|
155
|
-
type ScalarWhereFields<C extends
|
|
205
|
+
type ToManyRelationWhereInput<C extends AvContract, K extends AvResourceKey<C>, F extends RelationParentFilterKey<C, K> & RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<Partial<Record<Extract<CapabilityTokens<C, K, F, "filter", UnrestrictedProjection>, "some" | "every" | "none">, AvWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>>>>;
|
|
206
|
+
type RelationWhereInput<C extends AvContract, K extends AvResourceKey<C>, F extends RelationParentFilterKey<C, K> & RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = RelationCardinality<C, K, F> extends "one" ? (HasCapabilityToken<C, K, F, "filter", UnrestrictedProjection, "match"> extends true ? AvWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms> : never) | (RelationNullable<C, K, F> extends true ? HasCapabilityToken<C, K, F, "filter", UnrestrictedProjection, "null"> extends true ? null : never : never) : ToManyRelationWhereInput<C, K, F, Forms, ReferenceForms>;
|
|
207
|
+
type ScalarWhereFields<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
156
208
|
[F in ScalarFilterableKey<C, K>]?: ScalarFilterFor<C, K, F, Forms, ReferenceForms>;
|
|
157
209
|
}>;
|
|
158
|
-
type RelationWhereFields<C extends
|
|
210
|
+
type RelationWhereFields<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
159
211
|
[F in RelationParentFilterKey<C, K>]?: RelationWhereInput<C, K, F & RelationFieldKeyOf<C, K>, Forms, ReferenceForms>;
|
|
160
212
|
}>;
|
|
161
213
|
/**
|
|
@@ -163,47 +215,47 @@ type RelationWhereFields<C extends Contract, K extends ResourceKey<C>, Forms ext
|
|
|
163
215
|
* through; see {@link UnstatedForms} for the default. `ReferenceForms` opens a
|
|
164
216
|
* transaction step's own `where` to `$ref`s, at every depth of it.
|
|
165
217
|
*/
|
|
166
|
-
export type
|
|
167
|
-
AND?: readonly
|
|
168
|
-
OR?: readonly
|
|
169
|
-
NOT?:
|
|
170
|
-
} & ScalarWhereFields<C, K, Forms, ReferenceForms> & RelationWhereFields<C, K, Forms, ReferenceForms
|
|
171
|
-
type ActiveIdentifier<C extends
|
|
172
|
-
type IdentifierObject<C extends
|
|
173
|
-
[F in Extract<I[number],
|
|
218
|
+
export type AvWhereInput<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = Readonly<{
|
|
219
|
+
AND?: readonly AvWhereInput<C, K, Forms, ReferenceForms>[];
|
|
220
|
+
OR?: readonly AvWhereInput<C, K, Forms, ReferenceForms>[];
|
|
221
|
+
NOT?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
222
|
+
}> & ScalarWhereFields<C, K, Forms, ReferenceForms> & RelationWhereFields<C, K, Forms, ReferenceForms>;
|
|
223
|
+
type ActiveIdentifier<C extends AvContract, K extends AvResourceKey<C>> = C["resources"][K]["identifiers"][number];
|
|
224
|
+
type IdentifierObject<C extends AvContract, K extends AvResourceKey<C>, I extends readonly string[], Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
225
|
+
[F in Extract<I[number], AvFieldKey<C, K>>]: ScalarValueAt<C, K, F, Forms> | SlotReference<C, K, F, ReferenceForms, "nonNullValue">;
|
|
174
226
|
} & {
|
|
175
|
-
[F in Exclude<
|
|
227
|
+
[F in Exclude<AvFieldKey<C, K>, I[number]>]?: never;
|
|
176
228
|
}>;
|
|
177
229
|
/**
|
|
178
230
|
* A `where` argument for a unique operation: the values of one identifier. Inside a
|
|
179
231
|
* transaction plan (`ReferenceForms` stated) each value may be a `$ref` to a non-null
|
|
180
232
|
* source of the same type.
|
|
181
233
|
*/
|
|
182
|
-
export type
|
|
234
|
+
export type AvUniqueWhereInput<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = ActiveIdentifier<C, K> extends infer I ? I extends readonly string[] ? IdentifierObject<C, K, I, Forms, ReferenceForms> : never : never;
|
|
183
235
|
/** `"asc"` or `"desc"`. */
|
|
184
|
-
export type
|
|
236
|
+
export type AvSortDirection = "asc" | "desc";
|
|
185
237
|
/** Where `null`s sort: `"first"` or `"last"`. */
|
|
186
|
-
export type
|
|
238
|
+
export type AvNullsOrder = "first" | "last";
|
|
187
239
|
/** How one scalar field sorts: a direction, or a direction and a `nulls` order. */
|
|
188
|
-
export type
|
|
189
|
-
sort:
|
|
190
|
-
nulls:
|
|
240
|
+
export type AvScalarOrderInput = AvSortDirection | Readonly<{
|
|
241
|
+
sort: AvSortDirection;
|
|
242
|
+
nulls: AvNullsOrder;
|
|
191
243
|
}>;
|
|
192
|
-
type OrderableScalarKey<C extends
|
|
193
|
-
type OrderableRelationKey<C extends
|
|
194
|
-
type OrderableFieldKey<C extends
|
|
195
|
-
type ScalarOrderForField<C extends
|
|
244
|
+
type OrderableScalarKey<C extends AvContract, K extends AvResourceKey<C>> = KeysWithCapability<C, K, ScalarFieldKeyOf<C, K>, "order", UnrestrictedProjection>;
|
|
245
|
+
type OrderableRelationKey<C extends AvContract, K extends AvResourceKey<C>> = KeysWithCapability<C, K, RelationFieldKeyOf<C, K>, "order", UnrestrictedProjection>;
|
|
246
|
+
type OrderableFieldKey<C extends AvContract, K extends AvResourceKey<C>> = OrderableScalarKey<C, K> | OrderableRelationKey<C, K>;
|
|
247
|
+
type ScalarOrderForField<C extends AvContract, K extends AvResourceKey<C>, F extends OrderableScalarKey<C, K>> = ScalarFieldAt<C, K, F>["nullable"] extends true ? HasCapability<C, K, F, "orderNulls", UnrestrictedProjection> extends true ? AvScalarOrderInput : AvSortDirection : AvSortDirection;
|
|
196
248
|
/**
|
|
197
249
|
* The `orderBy` value of a relation field: a to-many relation orders by
|
|
198
250
|
* `$count`; a to-one relation takes one entry of the related Resource's
|
|
199
251
|
* `orderBy`, not a list.
|
|
200
252
|
*/
|
|
201
|
-
type RelationOrderForField<C extends
|
|
202
|
-
$count:
|
|
203
|
-
}> : never :
|
|
204
|
-
type OrderValue<C extends
|
|
253
|
+
type RelationOrderForField<C extends AvContract, K extends AvResourceKey<C>, F extends OrderableRelationKey<C, K> & RelationFieldKeyOf<C, K>> = RelationCardinality<C, K, F> extends "many" ? HasCapabilityToken<C, K, F, "reducers", UnrestrictedProjection, "$count"> extends true ? Readonly<{
|
|
254
|
+
$count: AvSortDirection;
|
|
255
|
+
}> : never : AvOrderByEntry<C, RelationTarget<C, K, F>>;
|
|
256
|
+
type OrderValue<C extends AvContract, K extends AvResourceKey<C>, F extends OrderableFieldKey<C, K>> = F extends OrderableScalarKey<C, K> ? ScalarOrderForField<C, K, F> : F extends OrderableRelationKey<C, K> & RelationFieldKeyOf<C, K> ? RelationOrderForField<C, K, F> : never;
|
|
205
257
|
/** One `orderBy` precedence entry: exactly one orderable field and its value. */
|
|
206
|
-
export type
|
|
258
|
+
export type AvOrderByEntry<C extends AvContract, K extends AvResourceKey<C>> = {
|
|
207
259
|
[F in OrderableFieldKey<C, K>]: {
|
|
208
260
|
readonly [Only in F]: OrderValue<C, K, Only>;
|
|
209
261
|
} & {
|
|
@@ -211,18 +263,18 @@ export type OrderByEntry<C extends Contract, K extends ResourceKey<C>> = {
|
|
|
211
263
|
};
|
|
212
264
|
}[OrderableFieldKey<C, K>];
|
|
213
265
|
/** An `orderBy` argument: one entry, or a list in order of precedence. */
|
|
214
|
-
export type
|
|
266
|
+
export type AvOrderByInput<C extends AvContract, K extends AvResourceKey<C>> = AvOrderByEntry<C, K> | readonly AvOrderByEntry<C, K>[];
|
|
215
267
|
/**
|
|
216
268
|
* A `cursor` argument: scalar field values of the row the page starts from. Inside
|
|
217
269
|
* a transaction plan each may be a `$ref` to a non-null source of the same type.
|
|
218
270
|
*/
|
|
219
|
-
export type
|
|
271
|
+
export type AvCursorInput<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = Readonly<{
|
|
220
272
|
[F in ScalarFieldKeyOf<C, K>]?: ScalarValueAt<C, K, F, Forms> | SlotReference<C, K, F, ReferenceForms, "nonNullValue">;
|
|
221
273
|
}>;
|
|
222
274
|
/** The scalar fields selectable at one projection position. */
|
|
223
|
-
type SelectableScalarKey<C extends
|
|
224
|
-
type SelectableRelationKey<C extends
|
|
225
|
-
type IncludeRelationKey<C extends
|
|
275
|
+
type SelectableScalarKey<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope> = KeysWithCapability<C, K, ScalarFieldKeyOf<C, K>, "select", Scope>;
|
|
276
|
+
type SelectableRelationKey<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope> = KeysWithCapability<C, K, RelationFieldKeyOf<C, K>, "select", Scope>;
|
|
277
|
+
type IncludeRelationKey<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope> = KeysWithCapability<C, K, RelationFieldKeyOf<C, K>, "include", Scope>;
|
|
226
278
|
/**
|
|
227
279
|
* Whether `$count` may be asked for inside relation `F`'s projection argument.
|
|
228
280
|
*
|
|
@@ -230,27 +282,27 @@ type IncludeRelationKey<C extends Contract, K extends ResourceKey<C>, Scope exte
|
|
|
230
282
|
* unrestricted scope one level in: `{ posts: { select: ["$count"] } }` is the
|
|
231
283
|
* parent's reducer over `F`, so it sits in the parent's argument position. The
|
|
232
284
|
* target's own projection is a separate question and is unrestricted — see
|
|
233
|
-
* {@link
|
|
285
|
+
* {@link AvRelationProjectionInput}.
|
|
234
286
|
*/
|
|
235
|
-
type RelationAllowsCount<C extends
|
|
236
|
-
type NestedWhereArgument<C extends
|
|
237
|
-
where?:
|
|
287
|
+
type RelationAllowsCount<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Scope extends AvProjectionScope> = RelationCardinality<C, K, F> extends "many" ? HasCapabilityToken<C, K, F, "reducers", Scope, "$count"> : false;
|
|
288
|
+
type NestedWhereArgument<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms> = HasCapabilityToken<C, K, F, "filter", UnrestrictedProjection, "nested"> extends true ? Readonly<{
|
|
289
|
+
where?: AvWhereInput<C, RelationTarget<C, K, F>, Forms>;
|
|
238
290
|
}> : Readonly<Record<never, never>>;
|
|
239
|
-
type NestedOrderArgument<C extends
|
|
240
|
-
orderBy?:
|
|
291
|
+
type NestedOrderArgument<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>> = HasCapability<C, K, F, "order", UnrestrictedProjection> extends true ? Readonly<{
|
|
292
|
+
orderBy?: AvOrderByInput<C, RelationTarget<C, K, F>>;
|
|
241
293
|
}> : Readonly<Record<never, never>>;
|
|
242
|
-
type NestedPaginationArgument<C extends
|
|
243
|
-
cursor?:
|
|
294
|
+
type NestedPaginationArgument<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Capability extends "limit" | "offset" | "cursor", Forms extends ScalarForms> = RelationCardinality<C, K, F> extends "many" ? HasCapabilityToken<C, K, F, "pagination", UnrestrictedProjection, Capability> extends true ? Capability extends "cursor" ? Readonly<{
|
|
295
|
+
cursor?: AvCursorInput<C, RelationTarget<C, K, F>, Forms>;
|
|
244
296
|
}> : Capability extends "limit" ? Readonly<{
|
|
245
297
|
limit?: number;
|
|
246
298
|
}> : Readonly<{
|
|
247
299
|
offset?: number;
|
|
248
300
|
}> : Readonly<Record<never, never>> : Readonly<Record<never, never>>;
|
|
249
|
-
type ProjectionChoice<C extends
|
|
250
|
-
select?:
|
|
301
|
+
type ProjectionChoice<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope, AllowCount extends boolean, Forms extends ScalarForms> = Readonly<{
|
|
302
|
+
select?: AvSelectInput<C, K, Scope, AllowCount, Forms>;
|
|
251
303
|
include?: never;
|
|
252
304
|
}> | Readonly<{
|
|
253
|
-
include?:
|
|
305
|
+
include?: AvIncludeInput<C, K, Scope, Forms>;
|
|
254
306
|
select?: never;
|
|
255
307
|
}>;
|
|
256
308
|
/**
|
|
@@ -258,217 +310,318 @@ type ProjectionChoice<C extends Contract, K extends ResourceKey<C>, Scope extend
|
|
|
258
310
|
* applies to this entry only; the related rows' own projection is
|
|
259
311
|
* unrestricted.
|
|
260
312
|
*/
|
|
261
|
-
export type
|
|
313
|
+
export type AvRelationProjectionInput<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K> = RelationFieldKeyOf<C, K>, Scope extends AvProjectionScope = UnrestrictedProjection, Forms extends ScalarForms = UnstatedForms> = F extends RelationFieldKeyOf<C, K> ? Readonly<NestedWhereArgument<C, K, F, Forms> & NestedOrderArgument<C, K, F> & NestedPaginationArgument<C, K, F, "limit", Forms> & NestedPaginationArgument<C, K, F, "offset", Forms> & NestedPaginationArgument<C, K, F, "cursor", Forms> & ProjectionChoice<C, RelationTarget<C, K, F>, UnrestrictedProjection, RelationAllowsCount<C, K, F, Scope>, Forms>> : never;
|
|
262
314
|
/**
|
|
263
315
|
* One relation entry of a projection: exactly relation `F` of `Keys`, with its
|
|
264
316
|
* argument object, and every other key of `Keys` absent.
|
|
265
317
|
*/
|
|
266
|
-
type RelationProjectionEntry<C extends
|
|
267
|
-
readonly [Only in F]:
|
|
318
|
+
type RelationProjectionEntry<C extends AvContract, K extends AvResourceKey<C>, Keys extends RelationFieldKeyOf<C, K>, F extends Keys, Scope extends AvProjectionScope, Forms extends ScalarForms> = {
|
|
319
|
+
readonly [Only in F]: AvRelationProjectionInput<C, K, Only & RelationFieldKeyOf<C, K>, Scope, Forms>;
|
|
268
320
|
} & {
|
|
269
321
|
readonly [Other in Exclude<Keys, F>]?: never;
|
|
270
322
|
};
|
|
271
|
-
type SelectRelationProjectionEntry<C extends
|
|
323
|
+
type SelectRelationProjectionEntry<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope, Forms extends ScalarForms> = {
|
|
272
324
|
[F in SelectableRelationKey<C, K, Scope>]: RelationProjectionEntry<C, K, SelectableRelationKey<C, K, Scope>, F, Scope, Forms>;
|
|
273
325
|
}[SelectableRelationKey<C, K, Scope>];
|
|
274
|
-
type IncludeRelationProjectionEntry<C extends
|
|
326
|
+
type IncludeRelationProjectionEntry<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope, Forms extends ScalarForms> = {
|
|
275
327
|
[F in IncludeRelationKey<C, K, Scope>]: RelationProjectionEntry<C, K, IncludeRelationKey<C, K, Scope>, F, Scope, Forms>;
|
|
276
328
|
}[IncludeRelationKey<C, K, Scope>];
|
|
277
329
|
/**
|
|
278
330
|
* One entry of a `select` argument, at one projection position. The default is
|
|
279
331
|
* the unrestricted position.
|
|
280
332
|
*/
|
|
281
|
-
export type
|
|
333
|
+
export type AvProjectionEntry<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope = UnrestrictedProjection, AllowCount extends boolean = false, Forms extends ScalarForms = UnstatedForms> = SelectableScalarKey<C, K, Scope> | SelectableRelationKey<C, K, Scope> | SelectRelationProjectionEntry<C, K, Scope, Forms> | "$defaults" | (AllowCount extends true ? "$count" : never);
|
|
282
334
|
/** A `select` argument: the fields to return. */
|
|
283
|
-
export type
|
|
335
|
+
export type AvSelectInput<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope = UnrestrictedProjection, AllowCount extends boolean = false, Forms extends ScalarForms = UnstatedForms> = readonly AvProjectionEntry<C, K, Scope, AllowCount, Forms>[];
|
|
284
336
|
/** An `include` argument: the relations to return with each row. */
|
|
285
|
-
export type
|
|
286
|
-
/** A scalar update directive and its operand, such as `{ $increment: 1 }`. */
|
|
287
|
-
export type ScalarMutationAction = Readonly<Partial<Record<ScalarMutationDirective, unknown>>>;
|
|
288
|
-
/** A relation write: one or more relation directives and their payloads. */
|
|
289
|
-
export type RelationMutationAction = Readonly<Partial<Record<RelationMutationDirective, unknown>>>;
|
|
337
|
+
export type AvIncludeInput<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope = UnrestrictedProjection, Forms extends ScalarForms = UnstatedForms> = readonly (IncludeRelationKey<C, K, Scope> | IncludeRelationProjectionEntry<C, K, Scope, Forms>)[];
|
|
290
338
|
/** The scalar fields writable at one stage and write position. */
|
|
291
|
-
type WritableScalarKey<C extends
|
|
339
|
+
type WritableScalarKey<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Scope extends AvWriteScope> = KeysWithCapability<C, K, ScalarFieldKeyOf<C, K>, Stage, Scope>;
|
|
292
340
|
/**
|
|
293
341
|
* The relations writable at one stage in one write position. The default is
|
|
294
342
|
* the unrestricted position.
|
|
295
343
|
*/
|
|
296
|
-
export type WritableRelationKey<C extends
|
|
297
|
-
type ManyOrOne<C extends
|
|
344
|
+
export type WritableRelationKey<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Scope extends AvWriteScope = UnrestrictedWrite> = KeysWithCapability<C, K, RelationFieldKeyOf<C, K>, Stage, Scope>;
|
|
345
|
+
type ManyOrOne<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Value> = RelationCardinality<C, K, F> extends "many" ? Value | readonly Value[] : Value;
|
|
298
346
|
/**
|
|
299
347
|
* A `where` of plain fields: each scalar field's filter, combined with
|
|
300
348
|
* `AND`/`OR`/`NOT`, and no relation filter at any depth.
|
|
301
349
|
*/
|
|
302
|
-
type
|
|
303
|
-
AND?: readonly
|
|
304
|
-
OR?: readonly
|
|
305
|
-
NOT?:
|
|
306
|
-
} & ScalarWhereFields<C, K, Forms, ReferenceForms
|
|
350
|
+
export type AvScalarWhereInput<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = Readonly<{
|
|
351
|
+
AND?: readonly AvScalarWhereInput<C, K, Forms, ReferenceForms>[];
|
|
352
|
+
OR?: readonly AvScalarWhereInput<C, K, Forms, ReferenceForms>[];
|
|
353
|
+
NOT?: AvScalarWhereInput<C, K, Forms, ReferenceForms>;
|
|
354
|
+
}> & ScalarWhereFields<C, K, Forms, ReferenceForms>;
|
|
307
355
|
/**
|
|
308
356
|
* The `where` of a nested `$update` or `$delete` through relation `F`: plain fields
|
|
309
357
|
* only where the relation states `nestedWriteFilter: "scalar"`, any filter otherwise.
|
|
310
358
|
*/
|
|
311
|
-
type NestedWriteWhereInput<C extends
|
|
359
|
+
type NestedWriteWhereInput<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = CapabilitiesOf<C, K, F> extends {
|
|
312
360
|
readonly nestedWriteFilter: "scalar";
|
|
313
|
-
} ?
|
|
314
|
-
type ConnectOrCreateEntry<C extends
|
|
315
|
-
where:
|
|
316
|
-
create:
|
|
361
|
+
} ? AvScalarWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms> : AvWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>;
|
|
362
|
+
type ConnectOrCreateEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
363
|
+
where: AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>;
|
|
364
|
+
create: AvCreateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
317
365
|
}>;
|
|
318
|
-
type ToOneUpdateEntry<C extends
|
|
366
|
+
type ToOneUpdateEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
319
367
|
where?: NestedWriteWhereInput<C, K, F, Forms, ReferenceForms>;
|
|
320
|
-
data:
|
|
368
|
+
data: AvUpdateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
321
369
|
}>;
|
|
322
|
-
type ToManyUpdateEntry<C extends
|
|
370
|
+
type ToManyUpdateEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
323
371
|
where: NestedWriteWhereInput<C, K, F, Forms, ReferenceForms>;
|
|
324
|
-
data:
|
|
372
|
+
data: AvUpdateDataInput<C, RelationTarget<C, K, F>, "bulkWrite", Forms, ReferenceForms, readonly [K, F]>;
|
|
325
373
|
}>;
|
|
326
|
-
type ToOneDeleteEntry<C extends
|
|
374
|
+
type ToOneDeleteEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = true | Readonly<{
|
|
327
375
|
where?: NestedWriteWhereInput<C, K, F, Forms, ReferenceForms>;
|
|
328
376
|
}>;
|
|
329
|
-
type ToManyDeleteEntry<C extends
|
|
377
|
+
type ToManyDeleteEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
330
378
|
where: NestedWriteWhereInput<C, K, F, Forms, ReferenceForms>;
|
|
331
379
|
}>;
|
|
332
|
-
type ToOneUpsertEntry<C extends
|
|
333
|
-
where?:
|
|
334
|
-
create:
|
|
335
|
-
update:
|
|
380
|
+
type ToOneUpsertEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
381
|
+
where?: AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>;
|
|
382
|
+
create: AvCreateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
383
|
+
update: AvUpdateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
336
384
|
}>;
|
|
337
|
-
type ToManyUpsertEntry<C extends
|
|
338
|
-
where:
|
|
339
|
-
create:
|
|
340
|
-
update:
|
|
385
|
+
type ToManyUpsertEntry<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Readonly<{
|
|
386
|
+
where: AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>;
|
|
387
|
+
create: AvCreateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
388
|
+
update: AvUpdateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>;
|
|
341
389
|
}>;
|
|
342
|
-
type RelationDirectiveValue<C extends
|
|
343
|
-
declare const NO_ADVERTISED_MEMBER: unique symbol;
|
|
390
|
+
type RelationDirectiveValue<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Directive extends AvRelationMutationDirective, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = Directive extends "$create" ? ManyOrOne<C, K, F, AvCreateDataInput<C, RelationTarget<C, K, F>, UnrestrictedWrite, Forms, ReferenceForms, readonly [K, F]>> : Directive extends "$connect" ? ManyOrOne<C, K, F, AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>> : Directive extends "$connectOrCreate" ? ManyOrOne<C, K, F, ConnectOrCreateEntry<C, K, F, Forms, ReferenceForms>> : Directive extends "$disconnect" ? RelationCardinality<C, K, F> extends "one" ? true : AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms> | readonly AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>[] : Directive extends "$set" ? RelationCardinality<C, K, F> extends "one" ? AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms> | null : readonly AvUniqueWhereInput<C, RelationTarget<C, K, F>, Forms, ReferenceForms>[] : Directive extends "$update" ? RelationCardinality<C, K, F> extends "one" ? ToOneUpdateEntry<C, K, F, Forms, ReferenceForms> : ManyOrOne<C, K, F, ToManyUpdateEntry<C, K, F, Forms, ReferenceForms>> : Directive extends "$delete" ? RelationCardinality<C, K, F> extends "one" ? ToOneDeleteEntry<C, K, F, Forms, ReferenceForms> : ManyOrOne<C, K, F, ToManyDeleteEntry<C, K, F, Forms, ReferenceForms>> : Directive extends "$upsert" ? RelationCardinality<C, K, F> extends "one" ? ToOneUpsertEntry<C, K, F, Forms, ReferenceForms> : ManyOrOne<C, K, F, ToManyUpsertEntry<C, K, F, Forms, ReferenceForms>> : never;
|
|
344
391
|
/**
|
|
345
392
|
* A write member that advertises nothing: it accepts `{}` and refuses every key.
|
|
346
393
|
*/
|
|
347
|
-
|
|
348
|
-
readonly [
|
|
349
|
-
}
|
|
350
|
-
/** `Write`, or {@link
|
|
351
|
-
type RefuseEveryKeyWhenEmpty<Write> = [keyof Write] extends [never] ?
|
|
352
|
-
type RelationMutationActionFor<C extends
|
|
353
|
-
[Directive in Extract<CapabilityTokens<C, K, F, Stage, Scope>,
|
|
354
|
-
}
|
|
394
|
+
export interface AvNoAdvertisedMember {
|
|
395
|
+
readonly [Symbol.unscopables]?: never;
|
|
396
|
+
}
|
|
397
|
+
/** `Write`, or {@link AvNoAdvertisedMember} when `Write` has no keys at all. */
|
|
398
|
+
type RefuseEveryKeyWhenEmpty<Write> = [keyof Write] extends [never] ? AvNoAdvertisedMember : Write;
|
|
399
|
+
type RelationMutationActionFor<C extends AvContract, K extends AvResourceKey<C>, F extends RelationFieldKeyOf<C, K>, Stage extends "create" | "update", Scope extends AvWriteScope, Forms extends ScalarForms, ReferenceForms extends ScalarForms> = RefuseEveryKeyWhenEmpty<RelinkOrRewrite<RelationCardinality<C, K, F>, Readonly<Partial<{
|
|
400
|
+
[Directive in Extract<CapabilityTokens<C, K, F, Stage, Scope>, AvRelationMutationDirective>]: RelationDirectiveValue<C, K, F, Directive, Forms, ReferenceForms>;
|
|
401
|
+
}>>>>;
|
|
402
|
+
/**
|
|
403
|
+
* A to-one relation's directive object, which either relinks the relation
|
|
404
|
+
* (`$connect`, `$create`, …) or writes the linked row (`$update`, `$upsert`),
|
|
405
|
+
* never both: the ORM would write the newly linked row.
|
|
406
|
+
*/
|
|
407
|
+
type RelinkOrRewrite<Cardinality, Directives> = [Cardinality] extends ["one"] ? [Extract<keyof Directives, ToOneRewriteDirective>] extends [never] ? Directives : [Extract<keyof Directives, ToOneRelinkDirective>] extends [never] ? Directives : (Directives & {
|
|
408
|
+
readonly [D in Extract<keyof Directives, ToOneRewriteDirective>]?: never;
|
|
409
|
+
}) | (Directives & {
|
|
410
|
+
readonly [D in Extract<keyof Directives, ToOneRelinkDirective>]?: never;
|
|
411
|
+
}) : Directives;
|
|
355
412
|
/**
|
|
356
413
|
* One scalar mutation directive's operand: one entry of the field (`$push` on a
|
|
357
414
|
* list also takes a list of them). `$unset`'s operand is passed to the adapter as
|
|
358
415
|
* given.
|
|
359
416
|
*/
|
|
360
|
-
type ScalarDirectiveOperand<C extends
|
|
417
|
+
type ScalarDirectiveOperand<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Directive extends AvScalarMutationDirective, Forms extends ScalarForms> = Directive extends "$unset" ? unknown : Directive extends "$push" ? [ScalarFieldAt<C, K, F>["list"]] extends [false] ? ScalarAtomAt<C, K, F, Forms> : ScalarAtomAt<C, K, F, Forms> | readonly ScalarAtomAt<C, K, F, Forms>[] : ScalarAtomAt<C, K, F, Forms>;
|
|
361
418
|
/**
|
|
362
419
|
* The directive object a scalar field accepts at one stage, or `never` when it
|
|
363
420
|
* advertises no directive.
|
|
364
421
|
*/
|
|
365
|
-
type ScalarMutationActionFor<C extends
|
|
366
|
-
Extract<CapabilityTokens<C, K, F, Stage, Scope>,
|
|
367
|
-
] extends [never] ? never :
|
|
368
|
-
|
|
369
|
-
|
|
422
|
+
type ScalarMutationActionFor<C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Stage extends "create" | "update", Scope extends AvWriteScope, Forms extends ScalarForms> = [
|
|
423
|
+
Extract<CapabilityTokens<C, K, F, Stage, Scope>, AvScalarMutationDirective>
|
|
424
|
+
] extends [never] ? never : OneDirective<Extract<CapabilityTokens<C, K, F, Stage, Scope>, AvScalarMutationDirective>, C, K, F, Forms>;
|
|
425
|
+
type OneDirective<Tokens extends AvScalarMutationDirective, C extends AvContract, K extends AvResourceKey<C>, F extends AvFieldKey<C, K>, Forms extends ScalarForms> = {
|
|
426
|
+
[Directive in Tokens]: Readonly<{
|
|
427
|
+
[Key in Directive]: ScalarDirectiveOperand<C, K, F, Key, Forms>;
|
|
428
|
+
} & {
|
|
429
|
+
[Other in Exclude<Tokens, Directive>]?: never;
|
|
430
|
+
}>;
|
|
431
|
+
}[Tokens];
|
|
370
432
|
/**
|
|
371
433
|
* Each writable scalar takes its value under `Forms`, or a directive object of
|
|
372
434
|
* the directives it advertises at this stage — or, in a transaction plan's
|
|
373
|
-
* top-level data, a `$ref` to a source of the same type.
|
|
435
|
+
* top-level data, a `$ref` to a source of the same type. A field a create must
|
|
436
|
+
* write (`RequiredWriteKey`) is required.
|
|
374
437
|
*/
|
|
375
|
-
type ScalarMutationFields<C extends
|
|
376
|
-
[F in
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
438
|
+
type ScalarMutationFields<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Scope extends AvWriteScope, Forms extends ScalarForms, ReferenceForms extends ScalarForms, Via extends ParentEdge = never, Keys extends AvFieldKey<C, K> = Exclude<WritableScalarKey<C, K, Stage, Scope>, LoopbackRefused<C, K, Stage, Via>>, Required extends Keys = Extract<Keys, RequiredWriteKey<C, K, Stage, Scope, Via>>> = Readonly<([Required] extends [never] ? unknown : {
|
|
439
|
+
[F in Required]: ScalarValueAt<C, K, F, Forms> | ScalarMutationActionFor<C, K, F, Stage, Scope, Forms> | SlotReference<C, K, F, ReferenceForms, "value">;
|
|
440
|
+
}) & ([Exclude<Keys, Required>] extends [never] ? unknown : {
|
|
441
|
+
[F in Exclude<Keys, Required>]?: ScalarValueAt<C, K, F, Forms> | ScalarMutationActionFor<C, K, F, Stage, Scope, Forms> | SlotReference<C, K, F, ReferenceForms, "value">;
|
|
442
|
+
})>;
|
|
443
|
+
/**
|
|
444
|
+
* Each writable relation takes the directive object it advertises at this
|
|
445
|
+
* stage. A relation a create must write (`RequiredWriteKey`) is required.
|
|
446
|
+
*/
|
|
447
|
+
type RelationMutationFields<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Scope extends AvWriteScope, Forms extends ScalarForms, ReferenceForms extends ScalarForms, Via extends ParentEdge = never, Keys extends AvFieldKey<C, K> = Exclude<WritableRelationKey<C, K, Stage, Scope>, LoopbackRefused<C, K, Stage, Via>>, Required extends Keys = Extract<Keys, RequiredWriteKey<C, K, Stage, Scope, Via>>> = Readonly<([Required] extends [never] ? unknown : {
|
|
448
|
+
[F in Required]: RelationMutationActionFor<C, K, F & RelationFieldKeyOf<C, K>, Stage, Scope, Forms, ReferenceForms>;
|
|
449
|
+
}) & ([Exclude<Keys, Required>] extends [never] ? unknown : {
|
|
450
|
+
[F in Exclude<Keys, Required>]?: RelationMutationActionFor<C, K, F & RelationFieldKeyOf<C, K>, Stage, Scope, Forms, ReferenceForms>;
|
|
451
|
+
})>;
|
|
452
|
+
/** A relation edge a nested create is reached through: `[parent, relation]`. */
|
|
453
|
+
type ParentEdge = readonly [string, string];
|
|
454
|
+
/** The other end of `Via`'s relation, as the Contract pairs it; `never` when it does not. */
|
|
455
|
+
type LoopbackOf<C extends AvContract, Via> = Via extends readonly [
|
|
456
|
+
infer Parent,
|
|
457
|
+
infer Relation
|
|
458
|
+
] ? Parent extends AvResourceKey<C> ? Relation extends keyof C["resources"][Parent]["fields"] ? C["resources"][Parent]["fields"][Relation] extends {
|
|
459
|
+
readonly inverse: infer Inverse extends string;
|
|
460
|
+
} ? Inverse : never : never : never : never;
|
|
461
|
+
/** The fields `K`'s relation `Relation` states hold its reference; `never` when it states none. */
|
|
462
|
+
type ReferenceFieldsOf<C extends AvContract, K extends AvResourceKey<C>, Relation extends string> = Relation extends keyof C["resources"][K]["fields"] ? C["resources"][K]["fields"][Relation] extends {
|
|
463
|
+
readonly referenceFields: readonly (infer Field extends string)[];
|
|
464
|
+
} ? Field : never : never;
|
|
465
|
+
/**
|
|
466
|
+
* The members a record of `K` reached through `Via` cannot write at `Stage`:
|
|
467
|
+
* the other end of `Via`'s relation and the fields that hold its reference,
|
|
468
|
+
* unless the Contract admits that relation at the `"loopback"` position.
|
|
469
|
+
*/
|
|
470
|
+
type LoopbackRefused<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Via> = [Via] extends [never] ? never : LoopbackOf<C, Via> extends infer Loopback extends string ? [
|
|
471
|
+
Extract<Loopback, WritableRelationKey<C, K, Stage, "loopback">>
|
|
472
|
+
] extends [never] ? Loopback | ReferenceFieldsOf<C, K, Loopback> : never : never;
|
|
473
|
+
/** The names a requirement list holds; `never` when the member is absent. */
|
|
474
|
+
type RequirementNames<Requirements, Member extends PropertyKey> = Requirements extends {
|
|
475
|
+
readonly [P in Member]?: infer List;
|
|
476
|
+
} ? List extends readonly (infer Name)[] ? Name : never : never;
|
|
477
|
+
/** Resource `K`'s create requirements, or `never` when its Contract states none. */
|
|
478
|
+
type CreateRequirementsAt<C extends AvContract, K extends AvResourceKey<C>> = "createRequirements" extends keyof C["resources"][K] ? Exclude<C["resources"][K]["createRequirements"], undefined> : never;
|
|
479
|
+
/** The names a create nested through `Via` gets from its parent. */
|
|
480
|
+
type SuppliedThrough<Requirements, Via> = Via extends readonly [
|
|
481
|
+
infer Parent,
|
|
482
|
+
infer Relation
|
|
483
|
+
] ? Requirements extends {
|
|
484
|
+
readonly parentSupplies?: infer Supplies;
|
|
485
|
+
} ? Parent extends keyof Supplies ? Relation extends keyof NonNullable<Supplies[Parent]> ? NonNullable<Supplies[Parent]>[Relation] extends readonly (infer Name)[] ? Name : never : never : never : never : never;
|
|
486
|
+
/** A value that is written: anything but `undefined`. */
|
|
487
|
+
type WrittenValue = NonNullable<unknown> | null;
|
|
488
|
+
/** Keys that must be present: `never` names none. */
|
|
489
|
+
type Present<Keys extends PropertyKey> = [Keys] extends [never] ? unknown : {
|
|
490
|
+
readonly [P in Keys]: WrittenValue;
|
|
491
|
+
};
|
|
492
|
+
/**
|
|
493
|
+
* One required relation's group: the relation alone, or every reference field
|
|
494
|
+
* together, never both — where this position can write both; the relation
|
|
495
|
+
* alone where it can write the relation but not every reference field; every
|
|
496
|
+
* reference field where it cannot write the relation (a bulk record); nothing
|
|
497
|
+
* where the parent supplies the group.
|
|
498
|
+
*/
|
|
499
|
+
type GroupPresence<Group, Scalars, Relations, Supplied> = Group extends readonly [
|
|
500
|
+
infer Relation extends string,
|
|
501
|
+
...infer References extends readonly string[]
|
|
502
|
+
] ? string extends Relation ? unknown : [References[number]] extends [never] ? unknown : [Extract<Relation | References[number], Supplied>] extends [never] ? Relation extends Relations ? [Exclude<References[number], Scalars>] extends [never] ? (Present<Relation> & {
|
|
503
|
+
readonly [P in References[number]]?: never;
|
|
504
|
+
}) | (Present<References[number]> & {
|
|
505
|
+
readonly [P in Relation]?: never;
|
|
506
|
+
}) : Present<Relation> : Present<References[number]> : unknown : unknown;
|
|
507
|
+
/** Every group of a `oneOf` tuple, each one's presence intersected. */
|
|
508
|
+
type GroupsPresence<Groups, Scalars, Relations, Supplied> = Groups extends readonly [infer Group, ...infer Rest] ? GroupPresence<Group, Scalars, Relations, Supplied> & GroupsPresence<Rest, Scalars, Relations, Supplied> : unknown;
|
|
509
|
+
/**
|
|
510
|
+
* The names a create of `K` at `Scope` must write: every `required` name it can
|
|
511
|
+
* write there, less what the parent supplies through `Via`. `never` for an
|
|
512
|
+
* update, and where the Contract states nothing.
|
|
513
|
+
*/
|
|
514
|
+
type RequiredWriteKey<C extends AvContract, K extends AvResourceKey<C>, Stage extends "create" | "update", Scope extends AvWriteScope, Via> = Stage extends "create" ? [CreateRequirementsAt<C, K>] extends [never] ? never : CreateRequirementsAt<C, K> extends infer Requirements ? string extends RequirementNames<Requirements, "required"> ? never : Exclude<Extract<RequirementNames<Requirements, "required">, WritableScalarKey<C, K, "create", Scope> | WritableRelationKey<C, K, "create", Scope>>, SuppliedThrough<Requirements, Via>> : never : never;
|
|
515
|
+
/** The members a create's two halves hold at `Scope`, reached through `Via`. */
|
|
516
|
+
type HeldCreateKey<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvWriteScope, Via> = Exclude<WritableScalarKey<C, K, "create", Scope> | WritableRelationKey<C, K, "create", Scope>, LoopbackRefused<C, K, "create", Via>>;
|
|
517
|
+
/**
|
|
518
|
+
* What a create of Resource `K` at write position `Scope` must and must not
|
|
519
|
+
* write: every `required` name it can write, and one side of every `oneOf`
|
|
520
|
+
* group — less what the parent supplies when the create is nested through
|
|
521
|
+
* `Via`. `unknown` (no constraint) when the Contract states nothing.
|
|
522
|
+
*/
|
|
523
|
+
type CreateRequirementPresence<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvWriteScope, Via> = [CreateRequirementsAt<C, K>] extends [never] ? unknown : CreateRequirementsAt<C, K> extends infer Requirements ? string extends RequirementNames<Requirements, "required"> ? unknown : Present<Exclude<RequiredWriteKey<C, K, "create", Scope, Via>, HeldCreateKey<C, K, Scope, Via>>> & (Requirements extends {
|
|
524
|
+
readonly oneOf?: infer Groups;
|
|
525
|
+
} ? GroupsPresence<Groups, WritableScalarKey<C, K, "create", Scope>, WritableRelationKey<C, K, "create", Scope>, SuppliedThrough<Requirements, Via>> : unknown) : unknown;
|
|
381
526
|
/**
|
|
382
527
|
* A `create` data argument, at one write position. A write position applies
|
|
383
528
|
* to the top level only; nested writes use the unrestricted position (see
|
|
384
|
-
* {@link
|
|
385
|
-
* positions
|
|
386
|
-
*
|
|
529
|
+
* {@link AvWriteScope}). `ReferenceForms` opens a transaction plan's reference
|
|
530
|
+
* positions (its scalar values and the unique keys its relation directives name)
|
|
531
|
+
* and is never passed to nested data, which holds none.
|
|
532
|
+
*
|
|
533
|
+
* Every field the Contract's `createRequirements` names must be written, and
|
|
534
|
+
* one side of every required relation's group — the relation, or all of its
|
|
535
|
+
* reference fields — never both. `Via` is the `[parent, relation]` a nested
|
|
536
|
+
* create is reached through: what that parent supplies is not required.
|
|
537
|
+
*/
|
|
538
|
+
export type AvCreateDataInput<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvWriteScope = UnrestrictedWrite, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never, Via extends ParentEdge = never> = RefuseEveryKeyWhenEmpty<ScalarMutationFields<C, K, "create", Scope, Forms, ReferenceForms, Via>> & RefuseEveryKeyWhenEmpty<RelationMutationFields<C, K, "create", Scope, Forms, ReferenceForms, Via>> & CreateRequirementPresence<C, K, Scope, Via>;
|
|
539
|
+
/**
|
|
540
|
+
* An `update` data argument, at one write position. See {@link AvCreateDataInput};
|
|
541
|
+
* `Via` is the `[parent, relation]` a nested update is reached through.
|
|
387
542
|
*/
|
|
388
|
-
export type
|
|
389
|
-
|
|
390
|
-
export type UpdateDataInput<C extends Contract, K extends ResourceKey<C>, Scope extends WriteScope = UnrestrictedWrite, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = RefuseEveryKeyWhenEmpty<Readonly<ScalarMutationFields<C, K, "update", Scope, Forms, ReferenceForms> & RelationMutationFields<C, K, "update", Scope, Forms, ReferenceForms>>>;
|
|
391
|
-
type QueryProjectionArgs<C extends Contract, K extends ResourceKey<C>, Scope extends ProjectionScope, Forms extends ScalarForms> = ProjectionChoice<C, K, Scope, false, Forms>;
|
|
543
|
+
export type AvUpdateDataInput<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvWriteScope = UnrestrictedWrite, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never, Via extends ParentEdge = never> = RefuseEveryKeyWhenEmpty<ScalarMutationFields<C, K, "update", Scope, Forms, ReferenceForms, Via>> & RefuseEveryKeyWhenEmpty<RelationMutationFields<C, K, "update", Scope, Forms, ReferenceForms, Via>>;
|
|
544
|
+
type QueryProjectionArgs<C extends AvContract, K extends AvResourceKey<C>, Scope extends AvProjectionScope, Forms extends ScalarForms> = ProjectionChoice<C, K, Scope, false, Forms>;
|
|
392
545
|
/**
|
|
393
546
|
* Every standard operation's argument object, with each argument at its
|
|
394
547
|
* projection or write position.
|
|
395
548
|
*/
|
|
396
|
-
export type
|
|
549
|
+
export type AvOperationArgumentMap<C extends AvContract, K extends AvResourceKey<C>, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = {
|
|
397
550
|
find: {
|
|
398
551
|
first: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
399
|
-
where?:
|
|
400
|
-
orderBy?:
|
|
552
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
553
|
+
orderBy?: AvOrderByInput<C, K>;
|
|
401
554
|
};
|
|
402
555
|
unique: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
403
|
-
where:
|
|
556
|
+
where: AvUniqueWhereInput<C, K, Forms, ReferenceForms>;
|
|
404
557
|
};
|
|
405
558
|
many: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
406
|
-
where?:
|
|
407
|
-
orderBy?:
|
|
559
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
560
|
+
orderBy?: AvOrderByInput<C, K>;
|
|
408
561
|
limit?: number;
|
|
409
562
|
offset?: number;
|
|
410
|
-
cursor?:
|
|
563
|
+
cursor?: AvCursorInput<C, K, Forms, ReferenceForms>;
|
|
411
564
|
};
|
|
412
565
|
count: {
|
|
413
|
-
where?:
|
|
566
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
414
567
|
};
|
|
415
568
|
};
|
|
416
569
|
create: {
|
|
417
570
|
one: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
418
|
-
data:
|
|
571
|
+
data: AvCreateDataInput<C, K, "nested", Forms, ReferenceForms>;
|
|
419
572
|
};
|
|
420
573
|
many: QueryProjectionArgs<C, K, "bulkWrite", Forms> & {
|
|
421
|
-
data: readonly
|
|
574
|
+
data: readonly AvCreateDataInput<C, K, "bulkWrite", Forms, ReferenceForms>[];
|
|
422
575
|
};
|
|
423
576
|
count: {
|
|
424
|
-
data: readonly
|
|
577
|
+
data: readonly AvCreateDataInput<C, K, "bulkWrite", Forms, ReferenceForms>[];
|
|
425
578
|
};
|
|
426
579
|
};
|
|
427
580
|
update: {
|
|
428
581
|
first: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
429
|
-
where?:
|
|
430
|
-
orderBy?:
|
|
431
|
-
data:
|
|
582
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
583
|
+
orderBy?: AvOrderByInput<C, K>;
|
|
584
|
+
data: AvUpdateDataInput<C, K, "nested", Forms, ReferenceForms>;
|
|
432
585
|
};
|
|
433
586
|
unique: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
434
|
-
where:
|
|
435
|
-
data:
|
|
587
|
+
where: AvUniqueWhereInput<C, K, Forms, ReferenceForms>;
|
|
588
|
+
data: AvUpdateDataInput<C, K, "nested", Forms, ReferenceForms>;
|
|
436
589
|
};
|
|
437
590
|
many: QueryProjectionArgs<C, K, "bulkWrite", Forms> & {
|
|
438
|
-
where?:
|
|
439
|
-
data:
|
|
591
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
592
|
+
data: AvUpdateDataInput<C, K, "bulkWrite", Forms, ReferenceForms>;
|
|
440
593
|
};
|
|
441
594
|
count: {
|
|
442
|
-
where?:
|
|
443
|
-
data:
|
|
595
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
596
|
+
data: AvUpdateDataInput<C, K, "bulkWrite", Forms, ReferenceForms>;
|
|
444
597
|
};
|
|
445
598
|
};
|
|
446
599
|
delete: {
|
|
447
600
|
first: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
448
|
-
where?:
|
|
449
|
-
orderBy?:
|
|
601
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
602
|
+
orderBy?: AvOrderByInput<C, K>;
|
|
450
603
|
};
|
|
451
604
|
unique: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
452
|
-
where:
|
|
605
|
+
where: AvUniqueWhereInput<C, K, Forms, ReferenceForms>;
|
|
453
606
|
};
|
|
454
607
|
many: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
455
|
-
where?:
|
|
608
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
456
609
|
};
|
|
457
610
|
count: {
|
|
458
|
-
where?:
|
|
611
|
+
where?: AvWhereInput<C, K, Forms, ReferenceForms>;
|
|
459
612
|
};
|
|
460
613
|
};
|
|
461
614
|
upsert: {
|
|
462
615
|
unique: QueryProjectionArgs<C, K, "record", Forms> & {
|
|
463
|
-
where:
|
|
464
|
-
create:
|
|
465
|
-
update:
|
|
616
|
+
where: AvUniqueWhereInput<C, K, Forms, ReferenceForms>;
|
|
617
|
+
create: AvCreateDataInput<C, K, "nested", Forms, ReferenceForms>;
|
|
618
|
+
update: AvUpdateDataInput<C, K, "nested", Forms, ReferenceForms>;
|
|
466
619
|
};
|
|
467
620
|
};
|
|
468
621
|
};
|
|
469
622
|
/** One standard operation's argument object. */
|
|
470
|
-
export type
|
|
623
|
+
export type AvOperationArgumentsFor<C extends AvContract, K extends AvResourceKey<C>, I extends AvOperationIdentity, Forms extends ScalarForms = UnstatedForms, ReferenceForms extends ScalarForms = never> = I extends {
|
|
471
624
|
family: infer F;
|
|
472
625
|
variant: infer V;
|
|
473
|
-
} ? F extends keyof
|
|
626
|
+
} ? F extends keyof AvOperationArgumentMap<C, K, Forms, ReferenceForms> ? V extends keyof AvOperationArgumentMap<C, K, Forms, ReferenceForms>[F] ? AvOperationArgumentMap<C, K, Forms, ReferenceForms>[F][V] : never : never : never;
|
|
474
627
|
export {};
|