@aventara/core 0.0.0-stage → 0.1.0-pilot.0
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/LICENSE +91 -0
- package/LICENSE-ADDITIONAL-PERMISSION.md +9 -0
- package/README.md +29 -2
- package/dist/adapters/adapter-discovery-diagnostic.d.ts +6 -0
- package/dist/adapters/adapter-discovery-diagnostic.js +1 -0
- package/dist/adapters/adapter-field.d.ts +52 -0
- package/dist/adapters/adapter-field.js +1 -0
- package/dist/adapters/adapter-identifier.d.ts +25 -0
- package/dist/adapters/adapter-identifier.js +1 -0
- package/dist/adapters/adapter-model.d.ts +14 -0
- package/dist/adapters/adapter-model.js +1 -0
- package/dist/adapters/adapter-operation-executor.interface.d.ts +6 -0
- package/dist/adapters/adapter-operation-executor.interface.js +1 -0
- package/dist/adapters/adapter-operation.d.ts +12 -0
- package/dist/adapters/adapter-operation.js +1 -0
- package/dist/adapters/adapter-resource.d.ts +43 -0
- package/dist/adapters/adapter-resource.js +1 -0
- package/dist/adapters/adapter.interface.d.ts +41 -0
- package/dist/adapters/adapter.interface.js +1 -0
- package/dist/compiler/contract-compiler-diagnostic.d.ts +14 -0
- package/dist/compiler/contract-compiler-diagnostic.js +1 -0
- package/dist/compiler/contract.compiler.d.ts +42 -0
- package/dist/compiler/contract.compiler.js +995 -0
- package/dist/config/any-framework-config.d.ts +40 -0
- package/dist/config/any-framework-config.js +1 -0
- package/dist/config/config-diagnostic.d.ts +6 -0
- package/dist/config/config-diagnostic.js +1 -0
- package/dist/config/config-layer.d.ts +25 -0
- package/dist/config/config-layer.js +1 -0
- package/dist/config/config.resolver.d.ts +43 -0
- package/dist/config/config.resolver.js +115 -0
- package/dist/config/config.validator.d.ts +9 -0
- package/dist/config/config.validator.js +224 -0
- package/dist/config/define-fields.d.ts +80 -0
- package/dist/config/define-fields.js +18 -0
- package/dist/config/effective-fields.d.ts +57 -0
- package/dist/config/effective-fields.js +1 -0
- package/dist/config/entrypoint.normalizer.d.ts +44 -0
- package/dist/config/entrypoint.normalizer.js +76 -0
- package/dist/config/framework-behaviors-config.d.ts +29 -0
- package/dist/config/framework-behaviors-config.js +1 -0
- package/dist/config/framework-config.d.ts +51 -0
- package/dist/config/framework-config.js +1 -0
- package/dist/config/framework-fields-config.d.ts +29 -0
- package/dist/config/framework-fields-config.js +1 -0
- package/dist/config/framework-restrictions-config.d.ts +172 -0
- package/dist/config/framework-restrictions-config.js +1 -0
- package/dist/config/pipeline-config.d.ts +49 -0
- package/dist/config/pipeline-config.js +1 -0
- package/dist/contracts/capability.d.ts +68 -0
- package/dist/contracts/capability.js +83 -0
- package/dist/contracts/client-contract-structure.validator.d.ts +1130 -0
- package/dist/contracts/client-contract-structure.validator.js +387 -0
- package/dist/contracts/contract-canonicalizer.d.ts +13 -0
- package/dist/contracts/contract-canonicalizer.js +330 -0
- package/dist/contracts/contract-hash.d.ts +10 -0
- package/dist/contracts/contract-hash.js +23 -0
- package/dist/contracts/contract-limits.d.ts +15 -0
- package/dist/contracts/contract-limits.js +8 -0
- package/dist/contracts/contract-lookup.d.ts +16 -0
- package/dist/contracts/contract-lookup.js +21 -0
- package/dist/contracts/contract-protocol.d.ts +18 -0
- package/dist/contracts/contract-protocol.js +11 -0
- package/dist/contracts/contract.d.ts +24 -0
- package/dist/contracts/contract.js +1 -0
- package/dist/contracts/enum-definition.d.ts +3 -0
- package/dist/contracts/enum-definition.js +1 -0
- package/dist/contracts/field.d.ts +258 -0
- package/dist/contracts/field.js +152 -0
- package/dist/contracts/identifier.d.ts +27 -0
- package/dist/contracts/identifier.js +1 -0
- package/dist/contracts/lifecycle-trait.d.ts +7 -0
- package/dist/contracts/lifecycle-trait.js +14 -0
- package/dist/contracts/resource-operations.d.ts +123 -0
- package/dist/contracts/resource-operations.js +81 -0
- package/dist/contracts/resource.d.ts +10 -0
- package/dist/contracts/resource.js +1 -0
- package/dist/contracts/scalar-value-type.d.ts +112 -0
- package/dist/contracts/scalar-value-type.js +1 -0
- package/dist/contracts/scalar.d.ts +9 -0
- package/dist/contracts/scalar.js +12 -0
- package/dist/contracts/transaction-capability.d.ts +2 -0
- package/dist/contracts/transaction-capability.js +1 -0
- package/dist/contracts/wire-scalar-format.d.ts +49 -0
- package/dist/contracts/wire-scalar-format.js +78 -0
- package/dist/framework/contract-view.d.ts +228 -0
- package/dist/framework/contract-view.js +1 -0
- package/dist/framework/framework-construction.error.d.ts +11 -0
- package/dist/framework/framework-construction.error.js +16 -0
- package/dist/framework/framework.d.ts +90 -0
- package/dist/framework/framework.factory.d.ts +25 -0
- package/dist/framework/framework.factory.js +164 -0
- package/dist/framework/framework.js +1 -0
- package/dist/framework/operation-facade.d.ts +97 -0
- package/dist/framework/operation-facade.js +39 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +27 -0
- package/dist/operations/operation-arguments.d.ts +589 -0
- package/dist/operations/operation-arguments.js +1 -0
- package/dist/operations/operation-boolean-nodes.d.ts +11 -0
- package/dist/operations/operation-boolean-nodes.js +299 -0
- package/dist/operations/operation-call.d.ts +89 -0
- package/dist/operations/operation-call.js +1 -0
- package/dist/operations/operation-identity.d.ts +14 -0
- package/dist/operations/operation-identity.js +26 -0
- package/dist/operations/operation-nesting.d.ts +8 -0
- package/dist/operations/operation-nesting.js +312 -0
- package/dist/operations/operation-result.d.ts +122 -0
- package/dist/operations/operation-result.js +1 -0
- package/dist/operations/operation-validator-core.d.ts +28 -0
- package/dist/operations/operation-validator-core.js +931 -0
- package/dist/operations/operation-validator.d.ts +26 -0
- package/dist/operations/operation-validator.js +69 -0
- package/dist/operations/projection-scope.resolver.d.ts +41 -0
- package/dist/operations/projection-scope.resolver.js +42 -0
- package/dist/operations/validation-code.d.ts +33 -0
- package/dist/operations/validation-code.js +71 -0
- package/dist/operations/write-scope.resolver.d.ts +43 -0
- package/dist/operations/write-scope.resolver.js +44 -0
- package/dist/protocol/absent-route.responder.d.ts +113 -0
- package/dist/protocol/absent-route.responder.js +150 -0
- package/dist/protocol/av-protocol.d.ts +16 -0
- package/dist/protocol/av-protocol.js +16 -0
- package/dist/protocol/contract-document.responder.d.ts +35 -0
- package/dist/protocol/contract-document.responder.js +89 -0
- package/dist/protocol/http-request.decoder.d.ts +123 -0
- package/dist/protocol/http-request.decoder.js +165 -0
- package/dist/protocol/http-request.reader.d.ts +46 -0
- package/dist/protocol/http-request.reader.js +149 -0
- package/dist/protocol/http-response.encoder.d.ts +47 -0
- package/dist/protocol/http-response.encoder.js +191 -0
- package/dist/protocol/http-status.table.d.ts +19 -0
- package/dist/protocol/http-status.table.js +49 -0
- package/dist/protocol/index.d.ts +13 -0
- package/dist/protocol/index.js +10 -0
- package/dist/protocol/operation-response.guard.d.ts +27 -0
- package/dist/protocol/operation-response.guard.js +86 -0
- package/dist/protocol/protocol-failure.d.ts +37 -0
- package/dist/protocol/protocol-failure.js +32 -0
- package/dist/protocol/protocol-headers.d.ts +66 -0
- package/dist/protocol/protocol-headers.js +104 -0
- package/dist/protocol/protocol-surface.d.ts +53 -0
- package/dist/protocol/protocol-surface.js +60 -0
- package/dist/protocol/protocol.binder.d.ts +123 -0
- package/dist/protocol/protocol.binder.js +42 -0
- package/dist/protocol/protocol.handler.d.ts +63 -0
- package/dist/protocol/protocol.handler.js +73 -0
- package/dist/runtime/computed-read-runtime.d.ts +36 -0
- package/dist/runtime/computed-read-runtime.js +375 -0
- package/dist/runtime/decimal.d.ts +12 -0
- package/dist/runtime/decimal.js +27 -0
- package/dist/runtime/diagnostics-reporter.d.ts +90 -0
- package/dist/runtime/diagnostics-reporter.js +108 -0
- package/dist/runtime/error-boundary.d.ts +52 -0
- package/dist/runtime/error-boundary.js +435 -0
- package/dist/runtime/execution-options.d.ts +17 -0
- package/dist/runtime/execution-options.js +1 -0
- package/dist/runtime/field-behavior.d.ts +58 -0
- package/dist/runtime/field-behavior.js +1 -0
- package/dist/runtime/framework-error.d.ts +10 -0
- package/dist/runtime/framework-error.js +15 -0
- package/dist/runtime/json-value.d.ts +23 -0
- package/dist/runtime/json-value.js +1 -0
- package/dist/runtime/mutation-planner.d.ts +68 -0
- package/dist/runtime/mutation-planner.js +216 -0
- package/dist/runtime/operation-request.d.ts +40 -0
- package/dist/runtime/operation-request.js +1 -0
- package/dist/runtime/operation-response.d.ts +55 -0
- package/dist/runtime/operation-response.js +64 -0
- package/dist/runtime/operation-runtime.d.ts +75 -0
- package/dist/runtime/operation-runtime.js +226 -0
- package/dist/runtime/outcome-mapper.d.ts +11 -0
- package/dist/runtime/outcome-mapper.js +93 -0
- package/dist/runtime/output-validator.d.ts +16 -0
- package/dist/runtime/output-validator.js +177 -0
- package/dist/runtime/pipeline.d.ts +63 -0
- package/dist/runtime/pipeline.js +1 -0
- package/dist/runtime/referential-action.d.ts +77 -0
- package/dist/runtime/referential-action.js +56 -0
- package/dist/runtime/request-id.d.ts +13 -0
- package/dist/runtime/request-id.js +39 -0
- package/dist/runtime/scalar-runtime.d.ts +57 -0
- package/dist/runtime/scalar-runtime.js +822 -0
- package/dist/transactions/deferred-operation.d.ts +66 -0
- package/dist/transactions/deferred-operation.js +1 -0
- package/dist/transactions/operation-arguments-encoder.d.ts +7 -0
- package/dist/transactions/operation-arguments-encoder.js +330 -0
- package/dist/transactions/operation-fingerprint.d.ts +10 -0
- package/dist/transactions/operation-fingerprint.js +28 -0
- package/dist/transactions/transaction-envelope.d.ts +43 -0
- package/dist/transactions/transaction-envelope.js +131 -0
- package/dist/transactions/transaction-integrity-error.d.ts +25 -0
- package/dist/transactions/transaction-integrity-error.js +19 -0
- package/dist/transactions/transaction-plan-assembler.d.ts +39 -0
- package/dist/transactions/transaction-plan-assembler.js +236 -0
- package/dist/transactions/transaction-plan-validator.d.ts +87 -0
- package/dist/transactions/transaction-plan-validator.js +448 -0
- package/dist/transactions/transaction-reference-resolver.d.ts +27 -0
- package/dist/transactions/transaction-reference-resolver.js +45 -0
- package/dist/transactions/transaction-reference-validator.d.ts +14 -0
- package/dist/transactions/transaction-reference-validator.js +271 -0
- package/dist/transactions/transaction-reference.d.ts +134 -0
- package/dist/transactions/transaction-reference.js +86 -0
- package/dist/transactions/transaction-request.d.ts +29 -0
- package/dist/transactions/transaction-request.js +1 -0
- package/dist/transactions/transaction-response.d.ts +17 -0
- package/dist/transactions/transaction-response.js +16 -0
- package/dist/transactions/transaction-runtime.d.ts +21 -0
- package/dist/transactions/transaction-runtime.js +119 -0
- package/dist/transactions/transaction-slot-path-error.d.ts +25 -0
- package/dist/transactions/transaction-slot-path-error.js +20 -0
- package/dist/transactions/transaction-slot-writer.d.ts +30 -0
- package/dist/transactions/transaction-slot-writer.js +106 -0
- package/package.json +34 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Required Notice: Copyright 2026 Mohamed Ragheb
|
|
2
|
+
|
|
3
|
+
# PolyForm Shield License 1.0.0
|
|
4
|
+
|
|
5
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
14
|
+
|
|
15
|
+
## Distribution License
|
|
16
|
+
|
|
17
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
18
|
+
|
|
19
|
+
## Notices
|
|
20
|
+
|
|
21
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
22
|
+
|
|
23
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
24
|
+
|
|
25
|
+
## Changes and New Works License
|
|
26
|
+
|
|
27
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
28
|
+
|
|
29
|
+
## Patent License
|
|
30
|
+
|
|
31
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
32
|
+
|
|
33
|
+
## Noncompete
|
|
34
|
+
|
|
35
|
+
Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
|
|
36
|
+
|
|
37
|
+
## Competition
|
|
38
|
+
|
|
39
|
+
Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
|
|
40
|
+
|
|
41
|
+
## New Products
|
|
42
|
+
|
|
43
|
+
If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
|
|
44
|
+
|
|
45
|
+
## Discontinued Products
|
|
46
|
+
|
|
47
|
+
You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
|
|
48
|
+
|
|
49
|
+
> Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
|
|
50
|
+
|
|
51
|
+
## Sales of Business
|
|
52
|
+
|
|
53
|
+
If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
|
|
54
|
+
|
|
55
|
+
## Fair Use
|
|
56
|
+
|
|
57
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
58
|
+
|
|
59
|
+
## No Other Rights
|
|
60
|
+
|
|
61
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
62
|
+
|
|
63
|
+
## Patent Defense
|
|
64
|
+
|
|
65
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
66
|
+
|
|
67
|
+
## Violations
|
|
68
|
+
|
|
69
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
70
|
+
|
|
71
|
+
## No Liability
|
|
72
|
+
|
|
73
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
74
|
+
|
|
75
|
+
## Definitions
|
|
76
|
+
|
|
77
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
78
|
+
|
|
79
|
+
A **product** can be a good or service, or a combination of them.
|
|
80
|
+
|
|
81
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
82
|
+
|
|
83
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
|
|
84
|
+
|
|
85
|
+
**Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
|
|
86
|
+
|
|
87
|
+
**Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
88
|
+
|
|
89
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
90
|
+
|
|
91
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Additional Permission — Aventara
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Mohamed Ragheb
|
|
4
|
+
|
|
5
|
+
In addition to the permissions of the PolyForm Shield License 1.0.0 in `LICENSE`, the licensor grants the following additional permission:
|
|
6
|
+
|
|
7
|
+
The Noncompete section applies only to providing a product that competes with the software itself — the Aventara framework, its packages and its tooling. Providing a product that competes with any other product the licensor or its affiliates provide using the software is a permitted purpose.
|
|
8
|
+
|
|
9
|
+
This additional permission only adds to your permissions; it does not restrict or replace any term of `LICENSE`.
|
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@aventara/core`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Aventara framework itself: the framework factory (`createFramework`), configuration and its resolution, the
|
|
4
|
+
adapter interfaces an ORM adapter implements, Contract compilation and identity, validation, operation semantics, the
|
|
5
|
+
pipeline runtime, transactions and execution. Its HTTP protocol — passive data and pure functions; it mounts nothing —
|
|
6
|
+
is the separate entry point `@aventara/core/protocol`, which hosts such as `@aventara/nest` serve.
|
|
7
|
+
|
|
8
|
+
Core is ORM- and transport-agnostic: it imports neither Prisma nor NestJS. An application uses it through an adapter
|
|
9
|
+
(`@aventara/prisma7-adapter`) and a host (`@aventara/nest`), and the usual way to set that up is the CLI.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @aventara/cli new my-api # a new NestJS project with Prisma and Aventara
|
|
15
|
+
npx @aventara/cli init # or: add Aventara to an existing NestJS 12 project
|
|
16
|
+
npm install @aventara/core # the package on its own
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Node `^22.18.0 || >=24.2.0`. ES modules, with a CommonJS `default` condition.
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
Start from the `@aventara/cli` README (what `new` and `init` write), then `@aventara/nest` (mounting a `Framework`)
|
|
24
|
+
and `@aventara/prisma7-adapter` (the Prisma 7 adapter and its generate step); each package's README ships in its
|
|
25
|
+
tarball and shows on its npm page.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
PolyForm Shield 1.0.0 with an additional permission — free to use, including in commercial applications; you may not
|
|
30
|
+
use it to build a product that competes with Aventara itself. See `LICENSE` and `LICENSE-ADDITIONAL-PERMISSION.md`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { RelationFieldCapabilities, ScalarFieldCapabilities, ScalarFormat } from "../contracts/field.js";
|
|
2
|
+
import type { LifecycleTrait } from "../contracts/lifecycle-trait.js";
|
|
3
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
4
|
+
/** Provider-observable lifecycle facts available during adapter discovery. */
|
|
5
|
+
export type AdapterLifecycleTrait = Extract<LifecycleTrait, "DEFAULTED" | "GENERATED_ON_CREATE" | "GENERATED_ON_UPDATE">;
|
|
6
|
+
/**
|
|
7
|
+
* Scalar-shaped provider field expressed only in Aventara vocabulary.
|
|
8
|
+
*
|
|
9
|
+
* Scalar capabilities carry no scope qualifier, measured and not assumed: all six
|
|
10
|
+
* members are uniform across every operation variant on both pilot engines, so a
|
|
11
|
+
* discoverer has nothing per-position to answer here.
|
|
12
|
+
*/
|
|
13
|
+
export type AdapterScalarField<M extends AdapterModel> = {
|
|
14
|
+
readonly kind: "scalar";
|
|
15
|
+
readonly type: {
|
|
16
|
+
readonly scalar: Extract<keyof M["scalars"], string>;
|
|
17
|
+
} | {
|
|
18
|
+
readonly enum: Extract<keyof M["enums"], string>;
|
|
19
|
+
};
|
|
20
|
+
readonly format?: ScalarFormat;
|
|
21
|
+
readonly nullable: boolean;
|
|
22
|
+
readonly list: boolean;
|
|
23
|
+
readonly lifecycle: readonly AdapterLifecycleTrait[];
|
|
24
|
+
readonly capabilities: ScalarFieldCapabilities;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Provider relation edge; the target AdapterResource owns object shape.
|
|
28
|
+
*
|
|
29
|
+
* The capabilities are the Contract's own {@link RelationFieldCapabilities}, scope
|
|
30
|
+
* qualifier included, and that sharing is the point: the ADAPTER is the only party
|
|
31
|
+
* that can measure which argument positions a relation is reachable in, because
|
|
32
|
+
* the answer depends on which provider call each operation variant is routed to.
|
|
33
|
+
* Core tabulating it would be a tabulated provider fact (D-802) and would be wrong
|
|
34
|
+
* for the next adapter.
|
|
35
|
+
*
|
|
36
|
+
* The qualifier is OPTIONAL at this boundary, as it is in the Contract: an adapter
|
|
37
|
+
* that has not measured the axis states the unqualified answer and is believed,
|
|
38
|
+
* which is what keeps a surface that predates the measurement meaningful rather
|
|
39
|
+
* than silently narrowed.
|
|
40
|
+
*
|
|
41
|
+
* **A scope qualifies the TOP LEVEL of an argument only** — the measurement and the
|
|
42
|
+
* reason are recorded on `ProjectionScope`, and a discoverer that narrows
|
|
43
|
+
* recursively would advertise less than the provider accepts.
|
|
44
|
+
*/
|
|
45
|
+
export type AdapterRelationField<M extends AdapterModel> = {
|
|
46
|
+
readonly kind: "relation";
|
|
47
|
+
readonly target: Extract<keyof M["resources"], string>;
|
|
48
|
+
readonly cardinality: "one" | "many";
|
|
49
|
+
readonly nullable: boolean;
|
|
50
|
+
readonly capabilities: RelationFieldCapabilities;
|
|
51
|
+
};
|
|
52
|
+
export type AdapterField<M extends AdapterModel> = AdapterScalarField<M> | AdapterRelationField<M>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AdapterField } from "./adapter-field.js";
|
|
2
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
3
|
+
/**
|
|
4
|
+
* Keys of `TFields` whose discovered field can be scalar-shaped.
|
|
5
|
+
*
|
|
6
|
+
* `TFields[K]` is an indexed access, not a naked type parameter, so a bare
|
|
7
|
+
* conditional would not distribute over a union-valued field. With the
|
|
8
|
+
* abstract `AdapterFieldMap` default every key maps to the whole
|
|
9
|
+
* `AdapterField` union, which is not a subtype of the scalar branch, so the
|
|
10
|
+
* bare form collapses to `never` and makes `AdapterIdentifier` uninhabitable.
|
|
11
|
+
* `Extract` selects the scalar branch out of the union instead, so a key is
|
|
12
|
+
* kept unless it is provably relation-only.
|
|
13
|
+
*/
|
|
14
|
+
export type AdapterScalarFieldKey<TFields extends Readonly<Record<string, AdapterField<AdapterModel>>>> = Extract<{
|
|
15
|
+
[K in keyof TFields]: [
|
|
16
|
+
Extract<TFields[K], {
|
|
17
|
+
readonly kind: "scalar";
|
|
18
|
+
}>
|
|
19
|
+
] extends [never] ? never : K;
|
|
20
|
+
}[keyof TFields], string>;
|
|
21
|
+
/** Non-empty scalar-field tuple discovered as provider uniqueness. */
|
|
22
|
+
export type AdapterIdentifier<TFields extends Readonly<Record<string, AdapterField<AdapterModel>>>> = readonly [
|
|
23
|
+
AdapterScalarFieldKey<TFields>,
|
|
24
|
+
...AdapterScalarFieldKey<TFields>[]
|
|
25
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EnumDefinition } from "../contracts/enum-definition.js";
|
|
2
|
+
import type { ScalarRegistry } from "../contracts/scalar.js";
|
|
3
|
+
import type { TransactionCapability } from "../contracts/transaction-capability.js";
|
|
4
|
+
import type { AdapterResource } from "./adapter-resource.js";
|
|
5
|
+
/**
|
|
6
|
+
* Canonical provider-discovery facts before framework configuration or
|
|
7
|
+
* Contract compilation is applied.
|
|
8
|
+
*/
|
|
9
|
+
export interface AdapterModel {
|
|
10
|
+
readonly scalars: ScalarRegistry;
|
|
11
|
+
readonly enums: Readonly<Record<string, EnumDefinition>>;
|
|
12
|
+
readonly resources: Readonly<Record<string, AdapterResource<this>>>;
|
|
13
|
+
readonly transactions: TransactionCapability;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
2
|
+
import type { AdapterOperation } from "./adapter-operation.js";
|
|
3
|
+
/** Small execution seam usable both directly and inside provider transactions. */
|
|
4
|
+
export interface AdapterOperationExecutor<M extends AdapterModel = AdapterModel> {
|
|
5
|
+
execute(operation: AdapterOperation<M>): Promise<unknown>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OperationIdentity } from "../operations/operation-identity.js";
|
|
2
|
+
import type { SemanticOperationArguments } from "../operations/operation-validator.js";
|
|
3
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
4
|
+
/**
|
|
5
|
+
* Provider execution request after framework semantic validation.
|
|
6
|
+
* Operation identity and arguments remain provider-neutral; adapters receive
|
|
7
|
+
* only validated semantic argument objects, never raw transport input.
|
|
8
|
+
*/
|
|
9
|
+
export type AdapterOperation<M extends AdapterModel = AdapterModel> = OperationIdentity & {
|
|
10
|
+
readonly resource: Extract<keyof M["resources"], string>;
|
|
11
|
+
readonly arguments: SemanticOperationArguments;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ResourceOperations } from "../contracts/resource-operations.js";
|
|
2
|
+
import type { AdapterField } from "./adapter-field.js";
|
|
3
|
+
import type { AdapterIdentifier } from "./adapter-identifier.js";
|
|
4
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
5
|
+
export type AdapterFieldMap<M extends AdapterModel> = Readonly<Record<string, AdapterField<M>>>;
|
|
6
|
+
/**
|
|
7
|
+
* The field names the adapter discovered for `R`.
|
|
8
|
+
*
|
|
9
|
+
* This is the lower layer of `EffectiveFieldKey`, in
|
|
10
|
+
* `config/effective-fields.ts`: everything the provider already knows about,
|
|
11
|
+
* before any configuration is applied. Named in prose rather than with a
|
|
12
|
+
* `{@link}` because a resolvable link would need an import, and `adapters/`
|
|
13
|
+
* must not reach into `config/`.
|
|
14
|
+
*
|
|
15
|
+
* `R`'s constraint is written out rather than imported as
|
|
16
|
+
* `FrameworkResourceKey<M>` — the identical type — because `adapters/` owns
|
|
17
|
+
* the Base layer and must not depend on `config/`.
|
|
18
|
+
*/
|
|
19
|
+
export type AdapterFieldKey<M extends AdapterModel, R extends Extract<keyof M["resources"], string>> = Extract<keyof M["resources"][R]["fields"], string>;
|
|
20
|
+
/**
|
|
21
|
+
* Provider-discovered facts for one Aventara Resource candidate.
|
|
22
|
+
*
|
|
23
|
+
* `TFields` is never supplied by a caller — every in-repo site writes
|
|
24
|
+
* `AdapterResource<M>` — but it is **load-bearing and must not be inlined**.
|
|
25
|
+
* It is the indirection that keeps `M` out of this type's body.
|
|
26
|
+
*
|
|
27
|
+
* `AdapterField<M>` is invariant in `M` (it reads `keyof M["scalars"]` and
|
|
28
|
+
* `keyof M["resources"]`). If `M` reached the body, `AdapterResource` would
|
|
29
|
+
* acquire an invariant variance marker, and every concrete model would stop
|
|
30
|
+
* satisfying the self-typed `AdapterModel.resources: Readonly<Record<string,
|
|
31
|
+
* AdapterResource<this>>>` constraint. Measured: 43 type errors across the
|
|
32
|
+
* adapter and index type tests, and identically 43 whether the parameter is
|
|
33
|
+
* deleted or merely bypassed — so it is the body occurrence that matters,
|
|
34
|
+
* not the arity.
|
|
35
|
+
*
|
|
36
|
+
* This is why F-601 ("the second type parameter is dead") was closed as
|
|
37
|
+
* mistaken rather than actioned. Deleting it is not a cleanup.
|
|
38
|
+
*/
|
|
39
|
+
export type AdapterResource<M extends AdapterModel, TFields extends AdapterFieldMap<M> = AdapterFieldMap<M>> = {
|
|
40
|
+
readonly fields: TFields;
|
|
41
|
+
readonly identifiers: readonly AdapterIdentifier<TFields>[];
|
|
42
|
+
readonly operations: ResourceOperations;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReferentialActionTable } from "../runtime/referential-action.js";
|
|
2
|
+
import type { AdapterModel } from "./adapter-model.js";
|
|
3
|
+
import type { AdapterOperationExecutor } from "./adapter-operation-executor.interface.js";
|
|
4
|
+
/** Provider-specific implementation of Aventara discovery and execution. */
|
|
5
|
+
export interface Adapter<M extends AdapterModel = AdapterModel> extends AdapterOperationExecutor<M> {
|
|
6
|
+
/**
|
|
7
|
+
* Canonical provider-discovery facts, held by the adapter and read
|
|
8
|
+
* synchronously at framework construction. Discovery is a property, not a
|
|
9
|
+
* call: the model is a settled fact of the constructed adapter, so it
|
|
10
|
+
* cannot fail, change, or be observed twice during construction.
|
|
11
|
+
*/
|
|
12
|
+
readonly model: M;
|
|
13
|
+
/**
|
|
14
|
+
* Optional referential actions: for each Resource that holds a reference,
|
|
15
|
+
* what deleting a referenced row does to its rows, in Aventara's words
|
|
16
|
+
* (`runtime/referential-action.ts`). Read once at framework construction,
|
|
17
|
+
* like `model`, and never part of a Contract or its hash.
|
|
18
|
+
*
|
|
19
|
+
* Direction, because getting it backwards is silent: an edge listed under
|
|
20
|
+
* Resource `R` says **deleting a `target` row does `onDelete` to rows of
|
|
21
|
+
* `R`**.
|
|
22
|
+
*
|
|
23
|
+
* Optional so an Adapter that cannot state them is believed: core then plans
|
|
24
|
+
* no cascade, and a transaction plan is never refused for one (`V1019`).
|
|
25
|
+
*/
|
|
26
|
+
readonly referentialActions?: ReferentialActionTable;
|
|
27
|
+
/**
|
|
28
|
+
* Optional callback transaction capability, required exactly when the
|
|
29
|
+
* discovered model declares `transactions: "interactive"`. The callback
|
|
30
|
+
* receives only a transaction-scoped operation executor, never the provider
|
|
31
|
+
* client itself, and every operation of a plan executes through it.
|
|
32
|
+
*
|
|
33
|
+
* The implementation MUST reject with the exact value `work` threw — by
|
|
34
|
+
* identity, never a wrapper — and MUST NOT resolve after `work` rejected;
|
|
35
|
+
* rollback is implied by that rejection. Framework guards, pipes, hooks and
|
|
36
|
+
* interceptors of every plan operation run inside `work` while the provider
|
|
37
|
+
* transaction is open, so they must not perform network I/O or unrelated
|
|
38
|
+
* slow work (spec §14.5).
|
|
39
|
+
*/
|
|
40
|
+
transaction?<T>(work: (executor: AdapterOperationExecutor<M>) => Promise<T>): Promise<T>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ContractCompilerDiagnosticCode = "COMPILER_UNKNOWN_RESOURCE" | "COMPILER_UNKNOWN_FIELD" | "COMPILER_RELATION_FIELD_CONFIG_UNSUPPORTED" | "COMPILER_INCOMPLETE_FIELD" | "COMPILER_STRUCTURAL_FIELD_OVERRIDE" | "COMPILER_MISSING_SCALAR" | "COMPILER_MISSING_ENUM" | "COMPILER_DANGLING_RELATION" | "COMPILER_UNAVAILABLE_OPERATION" | "COMPILER_UNAVAILABLE_CAPABILITY" | "COMPILER_INVALID_LIFECYCLE" | "COMPILER_MISSING_READ_BEHAVIOR" | "COMPILER_INVALID_BEHAVIOR_DEPENDENCY"
|
|
2
|
+
/**
|
|
3
|
+
* The finished, hashed client projection is not a structurally valid
|
|
4
|
+
* `ClientContract` (`validateClientContractStructure`; Phase 10 R3, the
|
|
5
|
+
* architect's code, 2026-10-05). A framework-bug guard: the server never
|
|
6
|
+
* serves what its own generator would refuse. `path` is the JSONPath
|
|
7
|
+
* inside the ClientContract (`$.enums.status.values[1]`).
|
|
8
|
+
*/
|
|
9
|
+
| "COMPILER_INVALID_CLIENT_CONTRACT";
|
|
10
|
+
export type ContractCompilerDiagnostic = {
|
|
11
|
+
readonly code: ContractCompilerDiagnosticCode;
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AdapterModel } from "../adapters/adapter-model.js";
|
|
2
|
+
import type { ResolvedFrameworkConfig } from "../config/config.resolver.js";
|
|
3
|
+
import type { ApplicationContract, ClientContract, CoreContract } from "../contracts/contract.js";
|
|
4
|
+
import type { ContractCompilerDiagnostic } from "./contract-compiler-diagnostic.js";
|
|
5
|
+
export type FrameworkContracts = {
|
|
6
|
+
readonly core: CoreContract;
|
|
7
|
+
readonly application: ApplicationContract;
|
|
8
|
+
readonly client: ClientContract;
|
|
9
|
+
};
|
|
10
|
+
export type ContractCompilationResult = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly contracts: FrameworkContracts;
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly diagnostics: readonly ContractCompilerDiagnostic[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Whether writing `configured` VERBATIM as capability member `key` would advertise
|
|
19
|
+
* something `baseline` does not — the question the `fields` walk asks before it
|
|
20
|
+
* copies a value onto an adapter field (F-817).
|
|
21
|
+
*
|
|
22
|
+
* Answered on the member's AXIS, off the same `satisfies`-pinned table the
|
|
23
|
+
* restriction walk and the output gate read, and the baseline is read through the
|
|
24
|
+
* shape's own owners: {@link holdsAt} for a position list, the `…At` readers for a
|
|
25
|
+
* scope-qualified token arm. Never off the runtime shape of the value: an
|
|
26
|
+
* object-shaped arm used to match no branch and pass unexamined, and `true` was
|
|
27
|
+
* compared to the baseline with `!== true`, which reads a qualified baseline as
|
|
28
|
+
* *not advertised* even where it holds in every position.
|
|
29
|
+
*
|
|
30
|
+
* The unqualified forms keep their meaning: `true` and a bare token list claim
|
|
31
|
+
* every position on the axis, so either one over a qualified baseline is an
|
|
32
|
+
* addition — writing it verbatim would widen the member (C-855).
|
|
33
|
+
*
|
|
34
|
+
* A key no axis covers, and a value its axis does not admit, are not additions;
|
|
35
|
+
* they are unrepresentable, and the output gate ({@link validateCapabilityRepresentation})
|
|
36
|
+
* is the one place that says so. So is a position off the axis.
|
|
37
|
+
*
|
|
38
|
+
* Exported for its unit test only; it is not part of the package surface.
|
|
39
|
+
*/
|
|
40
|
+
export declare function capabilityAddsBaseline(fieldKind: "scalar" | "relation", baseline: Readonly<Record<string, unknown>>, key: string, configured: unknown): boolean;
|
|
41
|
+
/** Compile Core first, then derive Application and Client from the Core compilation lineage. */
|
|
42
|
+
export declare function compileContracts<M extends AdapterModel>(model: M, config: ResolvedFrameworkConfig<M>): Promise<ContractCompilationResult>;
|