@vizejs/marquette 0.299.1
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/README.md +129 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +1 -0
- package/dist/model-DWcxWbC1.d.mts +197 -0
- package/dist/model-DWcxWbC1.d.mts.map +1 -0
- package/dist/test-run-admission.d.mts +48 -0
- package/dist/test-run-admission.d.mts.map +1 -0
- package/dist/test-run-admission.mjs +72 -0
- package/dist/test-run-admission.mjs.map +1 -0
- package/dist/test-run-canonical.d.mts +35 -0
- package/dist/test-run-canonical.d.mts.map +1 -0
- package/dist/test-run-canonical.mjs +124 -0
- package/dist/test-run-canonical.mjs.map +1 -0
- package/dist/test-run-model-B2INFVlw.mjs +9 -0
- package/dist/test-run-model-B2INFVlw.mjs.map +1 -0
- package/dist/test-run-model-DkllmEsY.d.mts +181 -0
- package/dist/test-run-model-DkllmEsY.d.mts.map +1 -0
- package/dist/test-run-validate-XF0vyoWI.mjs +229 -0
- package/dist/test-run-validate-XF0vyoWI.mjs.map +1 -0
- package/dist/test-run-validate.d.mts +24 -0
- package/dist/test-run-validate.d.mts.map +1 -0
- package/dist/test-run-validate.mjs +2 -0
- package/dist/test-run.d.mts +40 -0
- package/dist/test-run.d.mts.map +1 -0
- package/dist/test-run.mjs +27 -0
- package/dist/test-run.mjs.map +1 -0
- package/dist/validate.d.mts +29 -0
- package/dist/validate.d.mts.map +1 -0
- package/dist/validate.mjs +146 -0
- package/dist/validate.mjs.map +1 -0
- package/package.json +85 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# `@vizejs/marquette`
|
|
2
|
+
|
|
3
|
+
Typed application marquettes for every Vize target.
|
|
4
|
+
|
|
5
|
+
> Experimental: serialized contracts are versioned, but the TypeScript API may
|
|
6
|
+
> evolve while target adapters are being validated.
|
|
7
|
+
|
|
8
|
+
Marquette is the small, language-neutral description shared by web, native,
|
|
9
|
+
desktop, terminal, backend, transport, testing, and gallery tooling. This
|
|
10
|
+
package provides literal-preserving TypeScript authoring. Runtime validation is
|
|
11
|
+
available through a separate entry, while canonicalization and compatibility
|
|
12
|
+
analysis remain focused layers.
|
|
13
|
+
|
|
14
|
+
## Author a marquette
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { defineApplicationMarquette } from "@vizejs/marquette";
|
|
18
|
+
|
|
19
|
+
export default defineApplicationMarquette({
|
|
20
|
+
application: "shop",
|
|
21
|
+
targets: ["web", "native"],
|
|
22
|
+
environments: [
|
|
23
|
+
{
|
|
24
|
+
id: "web",
|
|
25
|
+
target: "web",
|
|
26
|
+
consumer: "client",
|
|
27
|
+
runtime: "browser",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "native",
|
|
31
|
+
target: "native",
|
|
32
|
+
consumer: "client",
|
|
33
|
+
runtime: "native",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "server",
|
|
37
|
+
target: "web",
|
|
38
|
+
consumer: "server",
|
|
39
|
+
runtime: "rust",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
backends: [
|
|
43
|
+
{
|
|
44
|
+
id: "api",
|
|
45
|
+
family: "rust",
|
|
46
|
+
environment: "server",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
protocols: [
|
|
50
|
+
{
|
|
51
|
+
id: "api.query",
|
|
52
|
+
family: "schema-query",
|
|
53
|
+
backend: "api",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
routes: [
|
|
57
|
+
{
|
|
58
|
+
id: "home",
|
|
59
|
+
path: "/",
|
|
60
|
+
environment: "web",
|
|
61
|
+
rendering: "hybrid",
|
|
62
|
+
backend: "api",
|
|
63
|
+
protocol: "api.query",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Environment dependencies, backend owners, protocol owners, and route
|
|
70
|
+
references are checked against identifiers declared in the same object. A
|
|
71
|
+
misspelled reference is therefore an authoring error rather than a runtime
|
|
72
|
+
surprise.
|
|
73
|
+
|
|
74
|
+
## Runtime validation
|
|
75
|
+
|
|
76
|
+
Use the dedicated validation entry when contracts cross file, process, or
|
|
77
|
+
language boundaries:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { validateApplicationMarquette } from "@vizejs/marquette/validate";
|
|
81
|
+
|
|
82
|
+
const diagnostics = validateApplicationMarquette(shop);
|
|
83
|
+
for (const diagnostic of diagnostics) {
|
|
84
|
+
console.error(diagnostic.code, diagnostic.path, diagnostic.message);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Validation is deterministic, does not mutate the authored object, and reports
|
|
89
|
+
stable codes shared with the native contract implementation. Keeping it in a
|
|
90
|
+
separate entry means authoring-only applications do not include validation
|
|
91
|
+
code.
|
|
92
|
+
|
|
93
|
+
## Test-run evidence
|
|
94
|
+
|
|
95
|
+
Release-bound test-run evidence records live in their own lazy entries so
|
|
96
|
+
deployment tooling can bind a `tests` check to retained, immutable facts:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { defineTestRunEvidence } from "@vizejs/marquette/test-run";
|
|
100
|
+
import { validateTestRunEvidence } from "@vizejs/marquette/test-run/validate";
|
|
101
|
+
import { testRunAdmissionId } from "@vizejs/marquette/test-run/canonical";
|
|
102
|
+
import { admitTestRun } from "@vizejs/marquette/test-run/admission";
|
|
103
|
+
|
|
104
|
+
const diagnostics = validateTestRunEvidence(evidence);
|
|
105
|
+
const admissionId = await testRunAdmissionId(evidence); // test-run:<sha256>
|
|
106
|
+
const rejections = await admitTestRun(evidence, candidate, admissionId, now);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Validation shares its `VIZE_MARQUETTE_1xx` codes, paths, and ordering with the
|
|
110
|
+
native implementation, and the canonical entry produces byte-identical
|
|
111
|
+
serialization and SHA-256 fingerprints, proven by the shared fixtures in
|
|
112
|
+
`tests/fixtures/test-run-evidence/`. The published record schema is available
|
|
113
|
+
from `@vizejs/marquette/test-run/schema`.
|
|
114
|
+
|
|
115
|
+
## Guarantees
|
|
116
|
+
|
|
117
|
+
- Exact identifiers remain available as `EnvironmentId`, `BackendId`,
|
|
118
|
+
`ProtocolId`, and `RouteId` unions.
|
|
119
|
+
- `defineApplicationMarquette` returns its input without allocation or
|
|
120
|
+
normalization.
|
|
121
|
+
- The published application-contract schema is available from
|
|
122
|
+
`@vizejs/marquette/schema`.
|
|
123
|
+
- Every optional contract field documents its default in JSDoc.
|
|
124
|
+
- Package builds enforce a 1 KiB gzip budget for authoring entries and 3 KiB
|
|
125
|
+
or 4 KiB budgets for the validation entries.
|
|
126
|
+
|
|
127
|
+
Marquette describes components and environments; it does not author UI
|
|
128
|
+
components. Public Vize UI components use real `.vue` SFC files as their
|
|
129
|
+
canonical source, never authored `h()` calls or handwritten render functions.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { _ as RouteId, a as CapabilityId, b as TargetId, c as MARQUETTE_FORMAT_VERSION, d as MarquetteProtocol, f as MarquetteRoute, g as RenderingMode, h as ProtocolId, i as CapabilityDefinition, l as MarquetteBackend, m as ProtocolFamily, n as BackendFamily, o as EnvironmentConsumer, p as MarquetteTarget, r as BackendId, s as EnvironmentId, t as ApplicationMarquette, u as MarquetteEnvironment, v as RuntimeFamily, y as ServerEnvironmentId } from "./model-DWcxWbC1.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/author.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Cross-reference constraints derived from the literals in one marquette.
|
|
6
|
+
*
|
|
7
|
+
* Keeping this type separate makes editor diagnostics point at the authored
|
|
8
|
+
* reference instead of widening every identifier to `string`.
|
|
9
|
+
*/
|
|
10
|
+
type MarquetteReferenceConstraints<Marquette extends ApplicationMarquette> = {
|
|
11
|
+
readonly capabilities?: { readonly [Id in CapabilityId<Marquette>]: CapabilityDefinition & {
|
|
12
|
+
readonly id: Id;
|
|
13
|
+
} };
|
|
14
|
+
readonly environments?: readonly (MarquetteEnvironment<string, EnvironmentId<Marquette>> & {
|
|
15
|
+
readonly capabilities?: readonly CapabilityId<Marquette>[];
|
|
16
|
+
readonly target: TargetId<Marquette>;
|
|
17
|
+
})[];
|
|
18
|
+
readonly backends?: readonly (MarquetteBackend<string, ServerEnvironmentId<Marquette>> & {
|
|
19
|
+
readonly capabilities?: readonly CapabilityId<Marquette>[];
|
|
20
|
+
})[];
|
|
21
|
+
readonly protocols?: readonly (MarquetteProtocol<string, BackendId<Marquette>> & {
|
|
22
|
+
readonly capabilities?: readonly CapabilityId<Marquette>[];
|
|
23
|
+
})[];
|
|
24
|
+
readonly routes?: readonly (MarquetteRoute<string, EnvironmentId<Marquette>, BackendId<Marquette>, ProtocolId<Marquette>> & {
|
|
25
|
+
readonly capabilities?: readonly CapabilityId<Marquette>[];
|
|
26
|
+
})[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Defines an application marquette while preserving every authored literal.
|
|
30
|
+
*
|
|
31
|
+
* Environment dependencies, backend owners, protocol owners, and route
|
|
32
|
+
* references are checked against identifiers declared in the same object.
|
|
33
|
+
* The function returns its input without allocation or runtime work.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const app = defineApplicationMarquette({
|
|
38
|
+
* application: "shop",
|
|
39
|
+
* targets: ["web"],
|
|
40
|
+
* environments: [
|
|
41
|
+
* { id: "web", target: "web", consumer: "client", runtime: "browser" },
|
|
42
|
+
* ],
|
|
43
|
+
* routes: [
|
|
44
|
+
* { id: "home", path: "/", environment: "web", rendering: "client" },
|
|
45
|
+
* ],
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function defineApplicationMarquette<const Marquette extends ApplicationMarquette>(marquette: Marquette & MarquetteReferenceConstraints<NoInfer<Marquette>>): Marquette;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { type ApplicationMarquette, type BackendFamily, type BackendId, type CapabilityDefinition, type CapabilityId, type EnvironmentConsumer, type EnvironmentId, MARQUETTE_FORMAT_VERSION, type MarquetteBackend, type MarquetteEnvironment, type MarquetteProtocol, type MarquetteReferenceConstraints, type MarquetteRoute, type MarquetteTarget, type ProtocolFamily, type ProtocolId, type RenderingMode, type RouteId, type RuntimeFamily, type ServerEnvironmentId, type TargetId, defineApplicationMarquette };
|
|
52
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/author.ts"],"mappings":";;;;;AAqBA;;;;KAAY,6BAAA,mBAAgD,oBAAA;EAAA,SACjD,YAAA,qBACS,YAAA,CAAa,SAAA,IAAa,oBAAA;IAAA,SAAkC,EAAA,EAAI,EAAA;EAAA;EAAA,SAEzE,YAAA,aAAyB,oBAAA,SAA6B,aAAA,CAAc,SAAA;IAAA,SAClE,YAAA,YAAwB,YAAA,CAAa,SAAA;IAAA,SACrC,MAAA,EAAQ,QAAA,CAAS,SAAA;EAAA;EAAA,SAEnB,QAAA,aAAqB,gBAAA,SAAyB,mBAAA,CAAoB,SAAA;IAAA,SAChE,YAAA,YAAwB,YAAA,CAAa,SAAA;EAAA;EAAA,SAEvC,SAAA,aAAsB,iBAAA,SAA0B,SAAA,CAAU,SAAA;IAAA,SACxD,YAAA,YAAwB,YAAA,CAAa,SAAA;EAAA;EAAA,SAEvC,MAAA,aAAmB,cAAA,SAE1B,aAAA,CAAc,SAAA,GACd,SAAA,CAAU,SAAA,GACV,UAAA,CAAW,SAAA;IAAA,SACE,YAAA,YAAwB,YAAA,CAAa,SAAA;EAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;iBAwBtC,0BAAA,yBAAmD,oBAAA,CAAA,CACjE,SAAA,EAAW,SAAA,GAAY,6BAAA,CAA8B,OAAA,CAAQ,SAAA,KAC5D,SAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/author.ts
|
|
2
|
+
/**
|
|
3
|
+
* Defines an application marquette while preserving every authored literal.
|
|
4
|
+
*
|
|
5
|
+
* Environment dependencies, backend owners, protocol owners, and route
|
|
6
|
+
* references are checked against identifiers declared in the same object.
|
|
7
|
+
* The function returns its input without allocation or runtime work.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const app = defineApplicationMarquette({
|
|
12
|
+
* application: "shop",
|
|
13
|
+
* targets: ["web"],
|
|
14
|
+
* environments: [
|
|
15
|
+
* { id: "web", target: "web", consumer: "client", runtime: "browser" },
|
|
16
|
+
* ],
|
|
17
|
+
* routes: [
|
|
18
|
+
* { id: "home", path: "/", environment: "web", rendering: "client" },
|
|
19
|
+
* ],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function defineApplicationMarquette(marquette) {
|
|
24
|
+
return marquette;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/model.ts
|
|
28
|
+
/** Current serialized application-marquette format. */
|
|
29
|
+
const MARQUETTE_FORMAT_VERSION = 1;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { MARQUETTE_FORMAT_VERSION, defineApplicationMarquette };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/author.ts","../src/model.ts"],"sourcesContent":["import type {\n ApplicationMarquette,\n BackendId,\n CapabilityDefinition,\n CapabilityId,\n EnvironmentId,\n MarquetteBackend,\n MarquetteEnvironment,\n MarquetteProtocol,\n MarquetteRoute,\n ProtocolId,\n ServerEnvironmentId,\n TargetId,\n} from \"./model.js\";\n\n/**\n * Cross-reference constraints derived from the literals in one marquette.\n *\n * Keeping this type separate makes editor diagnostics point at the authored\n * reference instead of widening every identifier to `string`.\n */\nexport type MarquetteReferenceConstraints<Marquette extends ApplicationMarquette> = {\n readonly capabilities?: {\n readonly [Id in CapabilityId<Marquette>]: CapabilityDefinition & { readonly id: Id };\n };\n readonly environments?: readonly (MarquetteEnvironment<string, EnvironmentId<Marquette>> & {\n readonly capabilities?: readonly CapabilityId<Marquette>[];\n readonly target: TargetId<Marquette>;\n })[];\n readonly backends?: readonly (MarquetteBackend<string, ServerEnvironmentId<Marquette>> & {\n readonly capabilities?: readonly CapabilityId<Marquette>[];\n })[];\n readonly protocols?: readonly (MarquetteProtocol<string, BackendId<Marquette>> & {\n readonly capabilities?: readonly CapabilityId<Marquette>[];\n })[];\n readonly routes?: readonly (MarquetteRoute<\n string,\n EnvironmentId<Marquette>,\n BackendId<Marquette>,\n ProtocolId<Marquette>\n > & { readonly capabilities?: readonly CapabilityId<Marquette>[] })[];\n};\n\n/**\n * Defines an application marquette while preserving every authored literal.\n *\n * Environment dependencies, backend owners, protocol owners, and route\n * references are checked against identifiers declared in the same object.\n * The function returns its input without allocation or runtime work.\n *\n * @example\n * ```ts\n * const app = defineApplicationMarquette({\n * application: \"shop\",\n * targets: [\"web\"],\n * environments: [\n * { id: \"web\", target: \"web\", consumer: \"client\", runtime: \"browser\" },\n * ],\n * routes: [\n * { id: \"home\", path: \"/\", environment: \"web\", rendering: \"client\" },\n * ],\n * });\n * ```\n */\nexport function defineApplicationMarquette<const Marquette extends ApplicationMarquette>(\n marquette: Marquette & MarquetteReferenceConstraints<NoInfer<Marquette>>,\n): Marquette {\n return marquette;\n}\n","/** Current serialized application-marquette format. */\nexport const MARQUETTE_FORMAT_VERSION = 1 as const;\n\n/** User-visible target produced by an application marquette. */\nexport type MarquetteTarget = \"web\" | \"native\" | \"desktop\" | \"terminal\";\n\n/** Runtime family that executes one environment. */\nexport type RuntimeFamily =\n | \"browser\"\n | \"javascript\"\n | \"rust\"\n | \"go\"\n | \"jvm\"\n | \"native\"\n | \"desktop\"\n | \"terminal\"\n | \"external\";\n\n/** Side of the application graph that consumes an environment. */\nexport type EnvironmentConsumer = \"client\" | \"server\";\n\n/** Backend implementation family selected by an application. */\nexport type BackendFamily = \"javascript\" | \"rust\" | \"go\" | \"jvm\" | \"external\";\n\n/** Semantic family used by one data or procedure endpoint. */\nexport type ProtocolFamily = \"schema-query\" | \"typed-rpc\" | \"binary-rpc\";\n\n/** Rendering strategy selected for one route or target view. */\nexport type RenderingMode =\n | \"client\"\n | \"static\"\n | \"server\"\n | \"stream\"\n | \"partial\"\n | \"hybrid\"\n | \"native\"\n | \"desktop\"\n | \"terminal\";\n\n/** Versioned capability understood by adapters and developer tools. */\nexport interface CapabilityDefinition {\n /** Stable lowercase capability identifier. */\n readonly id: string;\n /** Summary shown by diagnostics, documentation, and AI tooling. */\n readonly description: string;\n /**\n * Capability contract version.\n *\n * @default 1\n */\n readonly version?: number;\n}\n\n/** Independently transformed and cached application environment. */\nexport interface MarquetteEnvironment<\n Id extends string = string,\n DependencyId extends string = string,\n> {\n /** Stable identifier, unique within the application. */\n readonly id: Id;\n /** User-visible target served by this environment. */\n readonly target: MarquetteTarget;\n /** Whether output is consumed by an end user or a trusted runtime. */\n readonly consumer: EnvironmentConsumer;\n /** Runtime family that executes the output. */\n readonly runtime: RuntimeFamily;\n /**\n * Authored entry module.\n *\n * @default undefined\n */\n readonly entry?: string;\n /**\n * Environments that must build first.\n *\n * @default []\n */\n readonly dependsOn?: readonly DependencyId[];\n /**\n * Capabilities required from the environment adapter.\n *\n * @default []\n */\n readonly capabilities?: readonly string[];\n}\n\n/** Backend application or independently deployed service. */\nexport interface MarquetteBackend<\n Id extends string = string,\n EnvironmentId extends string = string,\n> {\n /** Stable backend identifier. */\n readonly id: Id;\n /** Backend implementation family. */\n readonly family: BackendFamily;\n /**\n * Server environment that owns local execution.\n *\n * @default undefined\n */\n readonly environment?: EnvironmentId;\n /**\n * Capabilities required from the backend adapter.\n *\n * @default []\n */\n readonly capabilities?: readonly string[];\n}\n\n/** Protocol endpoint exposed by a backend. */\nexport interface MarquetteProtocol<Id extends string = string, BackendId extends string = string> {\n /** Stable endpoint identifier. */\n readonly id: Id;\n /** Protocol semantic family. */\n readonly family: ProtocolFamily;\n /** Backend that owns the endpoint. */\n readonly backend: BackendId;\n /**\n * Capabilities required from the protocol adapter.\n *\n * @default []\n */\n readonly capabilities?: readonly string[];\n}\n\n/** Typed application route or target view. */\nexport interface MarquetteRoute<\n Id extends string = string,\n EnvironmentId extends string = string,\n BackendId extends string = string,\n ProtocolId extends string = string,\n> {\n /** Stable identifier used by generated navigation APIs. */\n readonly id: Id;\n /** Logical path, always beginning with `/`. */\n readonly path: `/${string}`;\n /** Environment that owns the rendered route. */\n readonly environment: EnvironmentId;\n /** Rendering strategy used by the route. */\n readonly rendering: RenderingMode;\n /**\n * Backend used by data loading, mutations, or server rendering.\n *\n * @default undefined\n */\n readonly backend?: BackendId;\n /**\n * Protocol endpoint used as the route data contract.\n *\n * @default undefined\n */\n readonly protocol?: ProtocolId;\n /**\n * Capabilities required by the route.\n *\n * @default []\n */\n readonly capabilities?: readonly string[];\n}\n\n/** Complete, versioned application marquette. */\nexport interface ApplicationMarquette<\n Environments extends readonly MarquetteEnvironment[] = readonly MarquetteEnvironment[],\n Backends extends readonly MarquetteBackend[] = readonly MarquetteBackend[],\n Protocols extends readonly MarquetteProtocol[] = readonly MarquetteProtocol[],\n Routes extends readonly MarquetteRoute[] = readonly MarquetteRoute[],\n> {\n /**\n * Serialized contract format.\n *\n * @default 1\n */\n readonly formatVersion?: typeof MARQUETTE_FORMAT_VERSION;\n /** Stable lowercase application identifier. */\n readonly application: string;\n /**\n * User-visible application targets.\n *\n * @default []\n */\n readonly targets?: readonly MarquetteTarget[];\n /**\n * Versioned capability definitions keyed by identifier.\n *\n * @default {}\n */\n readonly capabilities?: Readonly<Record<string, CapabilityDefinition>>;\n /**\n * Independently transformed application environments.\n *\n * @default []\n */\n readonly environments?: Environments;\n /**\n * Backend applications and services.\n *\n * @default []\n */\n readonly backends?: Backends;\n /**\n * Protocol endpoints.\n *\n * @default []\n */\n readonly protocols?: Protocols;\n /**\n * Typed routes and target views.\n *\n * @default []\n */\n readonly routes?: Routes;\n}\n\n/** Extracts identifiers only when a collection is present in the authored object. */\ntype DeclaredId<Marquette, Collection extends PropertyKey> = Marquette extends {\n readonly [Key in Collection]: readonly { readonly id: infer Id extends string }[];\n}\n ? Id\n : never;\n\n/** Exact environment identifier union inferred from a marquette. */\nexport type EnvironmentId<Marquette extends ApplicationMarquette> = DeclaredId<\n Marquette,\n \"environments\"\n>;\n\n/** Exact server-owned environment identifier union inferred from a marquette. */\nexport type ServerEnvironmentId<Marquette extends ApplicationMarquette> = Marquette extends {\n readonly environments: readonly (infer Environment)[];\n}\n ? Environment extends {\n readonly consumer: \"server\";\n readonly id: infer Id extends string;\n }\n ? Id\n : never\n : never;\n\n/** Exact backend identifier union inferred from a marquette. */\nexport type BackendId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, \"backends\">;\n\n/** Exact protocol identifier union inferred from a marquette. */\nexport type ProtocolId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, \"protocols\">;\n\n/** Exact route identifier union inferred from a marquette. */\nexport type RouteId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, \"routes\">;\n\n/** Exact target union inferred from the authored target list. */\nexport type TargetId<Marquette extends ApplicationMarquette> = Marquette extends {\n readonly targets: readonly (infer Target extends MarquetteTarget)[];\n}\n ? Target\n : never;\n\n/** Exact capability identifier union inferred from authored capability keys. */\nexport type CapabilityId<Marquette extends ApplicationMarquette> = Marquette extends {\n readonly capabilities: Readonly<Record<infer Id extends string, CapabilityDefinition>>;\n}\n ? Id\n : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgEA,SAAgB,2BACd,WACW;CACX,OAAO;;;;;AClET,MAAa,2BAA2B"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
//#region src/model.d.ts
|
|
2
|
+
/** Current serialized application-marquette format. */
|
|
3
|
+
declare const MARQUETTE_FORMAT_VERSION: 1;
|
|
4
|
+
/** User-visible target produced by an application marquette. */
|
|
5
|
+
type MarquetteTarget = "web" | "native" | "desktop" | "terminal";
|
|
6
|
+
/** Runtime family that executes one environment. */
|
|
7
|
+
type RuntimeFamily = "browser" | "javascript" | "rust" | "go" | "jvm" | "native" | "desktop" | "terminal" | "external";
|
|
8
|
+
/** Side of the application graph that consumes an environment. */
|
|
9
|
+
type EnvironmentConsumer = "client" | "server";
|
|
10
|
+
/** Backend implementation family selected by an application. */
|
|
11
|
+
type BackendFamily = "javascript" | "rust" | "go" | "jvm" | "external";
|
|
12
|
+
/** Semantic family used by one data or procedure endpoint. */
|
|
13
|
+
type ProtocolFamily = "schema-query" | "typed-rpc" | "binary-rpc";
|
|
14
|
+
/** Rendering strategy selected for one route or target view. */
|
|
15
|
+
type RenderingMode = "client" | "static" | "server" | "stream" | "partial" | "hybrid" | "native" | "desktop" | "terminal";
|
|
16
|
+
/** Versioned capability understood by adapters and developer tools. */
|
|
17
|
+
interface CapabilityDefinition {
|
|
18
|
+
/** Stable lowercase capability identifier. */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
/** Summary shown by diagnostics, documentation, and AI tooling. */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
/**
|
|
23
|
+
* Capability contract version.
|
|
24
|
+
*
|
|
25
|
+
* @default 1
|
|
26
|
+
*/
|
|
27
|
+
readonly version?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Independently transformed and cached application environment. */
|
|
30
|
+
interface MarquetteEnvironment<Id extends string = string, DependencyId extends string = string> {
|
|
31
|
+
/** Stable identifier, unique within the application. */
|
|
32
|
+
readonly id: Id;
|
|
33
|
+
/** User-visible target served by this environment. */
|
|
34
|
+
readonly target: MarquetteTarget;
|
|
35
|
+
/** Whether output is consumed by an end user or a trusted runtime. */
|
|
36
|
+
readonly consumer: EnvironmentConsumer;
|
|
37
|
+
/** Runtime family that executes the output. */
|
|
38
|
+
readonly runtime: RuntimeFamily;
|
|
39
|
+
/**
|
|
40
|
+
* Authored entry module.
|
|
41
|
+
*
|
|
42
|
+
* @default undefined
|
|
43
|
+
*/
|
|
44
|
+
readonly entry?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Environments that must build first.
|
|
47
|
+
*
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
readonly dependsOn?: readonly DependencyId[];
|
|
51
|
+
/**
|
|
52
|
+
* Capabilities required from the environment adapter.
|
|
53
|
+
*
|
|
54
|
+
* @default []
|
|
55
|
+
*/
|
|
56
|
+
readonly capabilities?: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
/** Backend application or independently deployed service. */
|
|
59
|
+
interface MarquetteBackend<Id extends string = string, EnvironmentId extends string = string> {
|
|
60
|
+
/** Stable backend identifier. */
|
|
61
|
+
readonly id: Id;
|
|
62
|
+
/** Backend implementation family. */
|
|
63
|
+
readonly family: BackendFamily;
|
|
64
|
+
/**
|
|
65
|
+
* Server environment that owns local execution.
|
|
66
|
+
*
|
|
67
|
+
* @default undefined
|
|
68
|
+
*/
|
|
69
|
+
readonly environment?: EnvironmentId;
|
|
70
|
+
/**
|
|
71
|
+
* Capabilities required from the backend adapter.
|
|
72
|
+
*
|
|
73
|
+
* @default []
|
|
74
|
+
*/
|
|
75
|
+
readonly capabilities?: readonly string[];
|
|
76
|
+
}
|
|
77
|
+
/** Protocol endpoint exposed by a backend. */
|
|
78
|
+
interface MarquetteProtocol<Id extends string = string, BackendId extends string = string> {
|
|
79
|
+
/** Stable endpoint identifier. */
|
|
80
|
+
readonly id: Id;
|
|
81
|
+
/** Protocol semantic family. */
|
|
82
|
+
readonly family: ProtocolFamily;
|
|
83
|
+
/** Backend that owns the endpoint. */
|
|
84
|
+
readonly backend: BackendId;
|
|
85
|
+
/**
|
|
86
|
+
* Capabilities required from the protocol adapter.
|
|
87
|
+
*
|
|
88
|
+
* @default []
|
|
89
|
+
*/
|
|
90
|
+
readonly capabilities?: readonly string[];
|
|
91
|
+
}
|
|
92
|
+
/** Typed application route or target view. */
|
|
93
|
+
interface MarquetteRoute<Id extends string = string, EnvironmentId extends string = string, BackendId extends string = string, ProtocolId extends string = string> {
|
|
94
|
+
/** Stable identifier used by generated navigation APIs. */
|
|
95
|
+
readonly id: Id;
|
|
96
|
+
/** Logical path, always beginning with `/`. */
|
|
97
|
+
readonly path: `/${string}`;
|
|
98
|
+
/** Environment that owns the rendered route. */
|
|
99
|
+
readonly environment: EnvironmentId;
|
|
100
|
+
/** Rendering strategy used by the route. */
|
|
101
|
+
readonly rendering: RenderingMode;
|
|
102
|
+
/**
|
|
103
|
+
* Backend used by data loading, mutations, or server rendering.
|
|
104
|
+
*
|
|
105
|
+
* @default undefined
|
|
106
|
+
*/
|
|
107
|
+
readonly backend?: BackendId;
|
|
108
|
+
/**
|
|
109
|
+
* Protocol endpoint used as the route data contract.
|
|
110
|
+
*
|
|
111
|
+
* @default undefined
|
|
112
|
+
*/
|
|
113
|
+
readonly protocol?: ProtocolId;
|
|
114
|
+
/**
|
|
115
|
+
* Capabilities required by the route.
|
|
116
|
+
*
|
|
117
|
+
* @default []
|
|
118
|
+
*/
|
|
119
|
+
readonly capabilities?: readonly string[];
|
|
120
|
+
}
|
|
121
|
+
/** Complete, versioned application marquette. */
|
|
122
|
+
interface ApplicationMarquette<Environments extends readonly MarquetteEnvironment[] = readonly MarquetteEnvironment[], Backends extends readonly MarquetteBackend[] = readonly MarquetteBackend[], Protocols extends readonly MarquetteProtocol[] = readonly MarquetteProtocol[], Routes extends readonly MarquetteRoute[] = readonly MarquetteRoute[]> {
|
|
123
|
+
/**
|
|
124
|
+
* Serialized contract format.
|
|
125
|
+
*
|
|
126
|
+
* @default 1
|
|
127
|
+
*/
|
|
128
|
+
readonly formatVersion?: typeof MARQUETTE_FORMAT_VERSION;
|
|
129
|
+
/** Stable lowercase application identifier. */
|
|
130
|
+
readonly application: string;
|
|
131
|
+
/**
|
|
132
|
+
* User-visible application targets.
|
|
133
|
+
*
|
|
134
|
+
* @default []
|
|
135
|
+
*/
|
|
136
|
+
readonly targets?: readonly MarquetteTarget[];
|
|
137
|
+
/**
|
|
138
|
+
* Versioned capability definitions keyed by identifier.
|
|
139
|
+
*
|
|
140
|
+
* @default {}
|
|
141
|
+
*/
|
|
142
|
+
readonly capabilities?: Readonly<Record<string, CapabilityDefinition>>;
|
|
143
|
+
/**
|
|
144
|
+
* Independently transformed application environments.
|
|
145
|
+
*
|
|
146
|
+
* @default []
|
|
147
|
+
*/
|
|
148
|
+
readonly environments?: Environments;
|
|
149
|
+
/**
|
|
150
|
+
* Backend applications and services.
|
|
151
|
+
*
|
|
152
|
+
* @default []
|
|
153
|
+
*/
|
|
154
|
+
readonly backends?: Backends;
|
|
155
|
+
/**
|
|
156
|
+
* Protocol endpoints.
|
|
157
|
+
*
|
|
158
|
+
* @default []
|
|
159
|
+
*/
|
|
160
|
+
readonly protocols?: Protocols;
|
|
161
|
+
/**
|
|
162
|
+
* Typed routes and target views.
|
|
163
|
+
*
|
|
164
|
+
* @default []
|
|
165
|
+
*/
|
|
166
|
+
readonly routes?: Routes;
|
|
167
|
+
}
|
|
168
|
+
/** Extracts identifiers only when a collection is present in the authored object. */
|
|
169
|
+
type DeclaredId<Marquette, Collection extends PropertyKey> = Marquette extends { readonly [Key in Collection]: readonly {
|
|
170
|
+
readonly id: infer Id extends string;
|
|
171
|
+
}[] } ? Id : never;
|
|
172
|
+
/** Exact environment identifier union inferred from a marquette. */
|
|
173
|
+
type EnvironmentId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, "environments">;
|
|
174
|
+
/** Exact server-owned environment identifier union inferred from a marquette. */
|
|
175
|
+
type ServerEnvironmentId<Marquette extends ApplicationMarquette> = Marquette extends {
|
|
176
|
+
readonly environments: readonly (infer Environment)[];
|
|
177
|
+
} ? Environment extends {
|
|
178
|
+
readonly consumer: "server";
|
|
179
|
+
readonly id: infer Id extends string;
|
|
180
|
+
} ? Id : never : never;
|
|
181
|
+
/** Exact backend identifier union inferred from a marquette. */
|
|
182
|
+
type BackendId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, "backends">;
|
|
183
|
+
/** Exact protocol identifier union inferred from a marquette. */
|
|
184
|
+
type ProtocolId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, "protocols">;
|
|
185
|
+
/** Exact route identifier union inferred from a marquette. */
|
|
186
|
+
type RouteId<Marquette extends ApplicationMarquette> = DeclaredId<Marquette, "routes">;
|
|
187
|
+
/** Exact target union inferred from the authored target list. */
|
|
188
|
+
type TargetId<Marquette extends ApplicationMarquette> = Marquette extends {
|
|
189
|
+
readonly targets: readonly (infer Target extends MarquetteTarget)[];
|
|
190
|
+
} ? Target : never;
|
|
191
|
+
/** Exact capability identifier union inferred from authored capability keys. */
|
|
192
|
+
type CapabilityId<Marquette extends ApplicationMarquette> = Marquette extends {
|
|
193
|
+
readonly capabilities: Readonly<Record<infer Id extends string, CapabilityDefinition>>;
|
|
194
|
+
} ? Id : never;
|
|
195
|
+
//#endregion
|
|
196
|
+
export { RouteId as _, CapabilityId as a, TargetId as b, MARQUETTE_FORMAT_VERSION as c, MarquetteProtocol as d, MarquetteRoute as f, RenderingMode as g, ProtocolId as h, CapabilityDefinition as i, MarquetteBackend as l, ProtocolFamily as m, BackendFamily as n, EnvironmentConsumer as o, MarquetteTarget as p, BackendId as r, EnvironmentId as s, ApplicationMarquette as t, MarquetteEnvironment as u, RuntimeFamily as v, ServerEnvironmentId as y };
|
|
197
|
+
//# sourceMappingURL=model-DWcxWbC1.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-DWcxWbC1.d.mts","names":[],"sources":["../src/model.ts"],"mappings":";;cACa,wBAAA;;KAGD,eAAA;;KAGA,aAAA;AAHZ;AAAA,KAeY,mBAAA;;KAGA,aAAA;;KAGA,cAAA;;KAGA,aAAA;;UAYK,oBAAA;EArBL;EAAA,SAuBD,EAAA;;WAEA,WAAA;EAzBoB;AAG/B;;;;EAH+B,SA+BpB,OAAA;AAAA;;UAIM,oBAAA;EA7BS;EAAA,SAkCf,EAAA,EAAI,EAAA;EA/BH;EAAA,SAiCD,MAAA,EAAQ,eAAA;;WAER,QAAA,EAAU,mBAAA;EAnCI;EAAA,SAqCd,OAAA,EAAS,aAAA;EAzBiB;;;;;EAAA,SA+B1B,KAAA;EArBO;;AAIlB;;;EAJkB,SA2BP,SAAA,YAAqB,YAAA;EAhBb;;;;;EAAA,SAsBR,YAAA;AAAA;;UAIM,gBAAA;EA5BF;EAAA,SAiCJ,EAAA,EAAI,EAAA;EA/BI;EAAA,SAiCR,MAAA,EAAQ,aAAA;EA/BE;;;;;EAAA,SAqCV,WAAA,GAAc,aAAA;EAjBd;;;AAIX;;EAJW,SAuBA,YAAA;AAAA;;UAIM,iBAAA;EAVqB;EAAA,SAY3B,EAAA,EAAI,EAAA;EAxBb;EAAA,SA0BS,MAAA,EAAQ,cAAA;EAtBR;EAAA,SAwBA,OAAA,EAAS,SAAA;EAtBT;;;;;EAAA,SA4BA,YAAA;AAAA;AAZX;AAAA,UAgBiB,cAAA;EAhBiB;EAAA,SAuBvB,EAAA,EAAI,EAAA;EAnBI;EAAA,SAqBR,IAAA;EAnBkB;EAAA,SAqBlB,WAAA,EAAa,aAAA;EA3BW;EAAA,SA6BxB,SAAA,EAAW,aAAA;EA3BX;;;;;EAAA,SAiCA,OAAA,GAAU,SAAA;EAvBV;;;AAIX;;EAJW,SA6BA,QAAA,GAAW,UAAA;EAlBP;;;;;EAAA,SAwBJ,YAAA;AAAA;;UAIM,oBAAA,+BACe,oBAAA,cAAkC,oBAAA,8BACtC,gBAAA,cAA8B,gBAAA,+BAC7B,iBAAA,cAA+B,iBAAA,4BAClC,cAAA,cAA4B,cAAA;EApCpD;;;;;EAAA,SA2CS,aAAA,UAAuB,wBAAA;EAnCV;EAAA,SAqCb,WAAA;EAnCW;;;;;EAAA,SAyCX,OAAA,YAAmB,eAAA;EAvBP;;AAIvB;;;EAJuB,SA6BZ,YAAA,GAAe,QAAA,CAAS,MAAA,SAAe,oBAAA;EAxBgB;;;;;EAAA,SA8BvD,YAAA,GAAe,YAAA;EA3B4B;;;;;EAAA,SAiC3C,QAAA,GAAW,QAAA;EANI;;;;;EAAA,SAYf,SAAA,GAAY,SAAA;EA1CrB;;;;;EAAA,SAgDS,MAAA,GAAS,MAAA;AAAA;;KAIf,UAAA,+BAAyC,WAAA,IAAe,SAAA,4BAC1C,UAAA;EAAA,SAAiC,EAAA;AAAA,QAEhD,EAAA;;KAIQ,aAAA,mBAAgC,oBAAA,IAAwB,UAAA,CAClE,SAAA;;KAKU,mBAAA,mBAAsC,oBAAA,IAAwB,SAAA;EAAA,SAC/D,YAAA;AAAA,IAEP,WAAA;EAAA,SACW,QAAA;EAAA,SACA,EAAA;AAAA,IAET,EAAA;;KAKM,SAAA,mBAA4B,oBAAA,IAAwB,UAAA,CAAW,SAAA;;KAG/D,UAAA,mBAA6B,oBAAA,IAAwB,UAAA,CAAW,SAAA;;KAGhE,OAAA,mBAA0B,oBAAA,IAAwB,UAAA,CAAW,SAAA;;KAG7D,QAAA,mBAA2B,oBAAA,IAAwB,SAAA;EAAA,SACpD,OAAA,iCAAwC,eAAA;AAAA,IAE/C,MAAA;;KAIQ,YAAA,mBAA+B,oBAAA,IAAwB,SAAA;EAAA,SACxD,YAAA,EAAc,QAAA,CAAS,MAAA,0BAAgC,oBAAA;AAAA,IAE9D,EAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { i as TestRunEvidence } from "./test-run-model-DkllmEsY.mjs";
|
|
2
|
+
import { MarquetteDiagnostic } from "./validate.mjs";
|
|
3
|
+
import { TEST_RUN_ADMISSION_PREFIX, parseTestRunAdmissionId } from "./test-run-canonical.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/test-run-admission.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Exact release candidate a deployment gate wants evidence for.
|
|
8
|
+
*
|
|
9
|
+
* Every field must match the record exactly; admission never falls back to a
|
|
10
|
+
* newer, older, or partially matching record.
|
|
11
|
+
*/
|
|
12
|
+
interface TestRunCandidate {
|
|
13
|
+
/** Application the gate is deploying. */
|
|
14
|
+
readonly application: string;
|
|
15
|
+
/** Deployment environment the gate is promoting into. */
|
|
16
|
+
readonly environment: string;
|
|
17
|
+
/** Lowercase SHA-256 fingerprint of the application contract. */
|
|
18
|
+
readonly contractFingerprint: string;
|
|
19
|
+
/** Exact source revision of the candidate. */
|
|
20
|
+
readonly sourceRevision: string;
|
|
21
|
+
/** Release the candidate belongs to. */
|
|
22
|
+
readonly release: string;
|
|
23
|
+
/** Lowercase SHA-256 fingerprint of the exact artifact being promoted. */
|
|
24
|
+
readonly artifactFingerprint: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Decides whether one record admits one exact candidate at one instant.
|
|
28
|
+
*
|
|
29
|
+
* An empty result admits the deployment. Any diagnostic rejects it: the
|
|
30
|
+
* record must validate cleanly, its canonical fingerprint must be the one
|
|
31
|
+
* named by `admissionId`, every candidate binding must match exactly, the
|
|
32
|
+
* record must not be expired at `now`, the independent verification must
|
|
33
|
+
* have accepted the run, and no skipped test may remain unaccounted for.
|
|
34
|
+
*
|
|
35
|
+
* Codes, paths, messages, and ordering are identical to the native
|
|
36
|
+
* implementation, so both host families reach the same decision for the
|
|
37
|
+
* same record.
|
|
38
|
+
*
|
|
39
|
+
* `now` must be a millisecond-precision UTC timestamp such as
|
|
40
|
+
* `2026-01-01T00:00:00.000Z`; the fixed-width format keeps the expiry
|
|
41
|
+
* comparison exact. Callers own retrieval: fetch the canonical bytes from an
|
|
42
|
+
* immutable store within their own deadline, refuse oversized content, and
|
|
43
|
+
* hand the parsed record here.
|
|
44
|
+
*/
|
|
45
|
+
declare function admitTestRun(evidence: TestRunEvidence, candidate: TestRunCandidate, admissionId: string, now: string): Promise<MarquetteDiagnostic[]>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { TEST_RUN_ADMISSION_PREFIX, TestRunCandidate, admitTestRun, parseTestRunAdmissionId };
|
|
48
|
+
//# sourceMappingURL=test-run-admission.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-run-admission.d.mts","names":[],"sources":["../src/test-run-admission.ts"],"mappings":";;;;;;;AAcA;;;;UAAiB,gBAAA;EAIN;EAAA,SAFA,WAAA;EAMA;EAAA,SAJA,WAAA;EAQA;EAAA,SANA,mBAAA;EAMmB;EAAA,SAJnB,cAAA;EA0BuB;EAAA,SAxBvB,OAAA;EAyBC;EAAA,SAvBD,mBAAA;AAAA;;;;;;;;;;;;;;;;;;;;iBAsBW,YAAA,CACpB,QAAA,EAAU,eAAA,EACV,SAAA,EAAW,gBAAA,EACX,WAAA,UACA,GAAA,WACC,OAAA,CAAQ,mBAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { a as error, o as isStrictTimestamp, t as validateTestRunEvidence } from "./test-run-validate-XF0vyoWI.mjs";
|
|
2
|
+
import { TEST_RUN_ADMISSION_PREFIX, parseTestRunAdmissionId, testRunFingerprint } from "./test-run-canonical.mjs";
|
|
3
|
+
//#region src/test-run-admission.ts
|
|
4
|
+
/**
|
|
5
|
+
* Decides whether one record admits one exact candidate at one instant.
|
|
6
|
+
*
|
|
7
|
+
* An empty result admits the deployment. Any diagnostic rejects it: the
|
|
8
|
+
* record must validate cleanly, its canonical fingerprint must be the one
|
|
9
|
+
* named by `admissionId`, every candidate binding must match exactly, the
|
|
10
|
+
* record must not be expired at `now`, the independent verification must
|
|
11
|
+
* have accepted the run, and no skipped test may remain unaccounted for.
|
|
12
|
+
*
|
|
13
|
+
* Codes, paths, messages, and ordering are identical to the native
|
|
14
|
+
* implementation, so both host families reach the same decision for the
|
|
15
|
+
* same record.
|
|
16
|
+
*
|
|
17
|
+
* `now` must be a millisecond-precision UTC timestamp such as
|
|
18
|
+
* `2026-01-01T00:00:00.000Z`; the fixed-width format keeps the expiry
|
|
19
|
+
* comparison exact. Callers own retrieval: fetch the canonical bytes from an
|
|
20
|
+
* immutable store within their own deadline, refuse oversized content, and
|
|
21
|
+
* hand the parsed record here.
|
|
22
|
+
*/
|
|
23
|
+
async function admitTestRun(evidence, candidate, admissionId, now) {
|
|
24
|
+
const diagnostics = validateTestRunEvidence(evidence);
|
|
25
|
+
const nowIsExact = isStrictTimestamp(now);
|
|
26
|
+
if (!nowIsExact) diagnostics.push(error("VIZE_MARQUETTE_148", "admission.now", "admission time must be a millisecond-precision UTC instant"));
|
|
27
|
+
const expected = parseTestRunAdmissionId(admissionId);
|
|
28
|
+
if (expected === void 0) diagnostics.push(error("VIZE_MARQUETTE_141", "admission.id", "admission id must be test-run: followed by 64 lowercase hexadecimal characters"));
|
|
29
|
+
else if (await testRunFingerprint(evidence) !== expected) diagnostics.push(error("VIZE_MARQUETTE_142", "admission.id", "admission id does not name this record's canonical fingerprint"));
|
|
30
|
+
const bindings = [
|
|
31
|
+
[
|
|
32
|
+
evidence.application,
|
|
33
|
+
candidate.application,
|
|
34
|
+
"application"
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
evidence.environment,
|
|
38
|
+
candidate.environment,
|
|
39
|
+
"environment"
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
evidence.contractFingerprint,
|
|
43
|
+
candidate.contractFingerprint,
|
|
44
|
+
"contractFingerprint"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
evidence.sourceRevision,
|
|
48
|
+
candidate.sourceRevision,
|
|
49
|
+
"sourceRevision"
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
evidence.release,
|
|
53
|
+
candidate.release,
|
|
54
|
+
"release"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
evidence.artifact.fingerprint,
|
|
58
|
+
candidate.artifactFingerprint,
|
|
59
|
+
"artifact.fingerprint"
|
|
60
|
+
]
|
|
61
|
+
];
|
|
62
|
+
for (const [recorded, wanted, field] of bindings) if (recorded !== wanted) diagnostics.push(error("VIZE_MARQUETTE_144", field, `record does not bind the candidate ${field}`));
|
|
63
|
+
if (nowIsExact && evidence.validUntil <= now) diagnostics.push(error("VIZE_MARQUETTE_145", "validUntil", "record is expired at the admission time"));
|
|
64
|
+
if (evidence.verification.outcome !== "accepted") diagnostics.push(error("VIZE_MARQUETTE_146", "verification.outcome", "only an accepted verification can admit a deployment"));
|
|
65
|
+
if (evidence.verification.skipped > 0) diagnostics.push(error("VIZE_MARQUETTE_147", "verification.skipped", "skipped tests are not approved for deployment admission"));
|
|
66
|
+
diagnostics.sort((left, right) => left.path !== right.path ? left.path < right.path ? -1 : 1 : left.code !== right.code ? left.code < right.code ? -1 : 1 : left.message < right.message ? -1 : left.message > right.message ? 1 : 0);
|
|
67
|
+
return diagnostics;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { TEST_RUN_ADMISSION_PREFIX, admitTestRun, parseTestRunAdmissionId };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=test-run-admission.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-run-admission.mjs","names":[],"sources":["../src/test-run-admission.ts"],"sourcesContent":["import type { TestRunEvidence } from \"./test-run-model.js\";\nimport type { MarquetteDiagnostic } from \"./validate.js\";\nimport { parseTestRunAdmissionId, testRunFingerprint } from \"./test-run-canonical.js\";\nimport { validateTestRunEvidence } from \"./test-run-validate.js\";\nimport { error, isStrictTimestamp } from \"./test-run-validate-rules.js\";\n\nexport { TEST_RUN_ADMISSION_PREFIX, parseTestRunAdmissionId } from \"./test-run-canonical.js\";\n\n/**\n * Exact release candidate a deployment gate wants evidence for.\n *\n * Every field must match the record exactly; admission never falls back to a\n * newer, older, or partially matching record.\n */\nexport interface TestRunCandidate {\n /** Application the gate is deploying. */\n readonly application: string;\n /** Deployment environment the gate is promoting into. */\n readonly environment: string;\n /** Lowercase SHA-256 fingerprint of the application contract. */\n readonly contractFingerprint: string;\n /** Exact source revision of the candidate. */\n readonly sourceRevision: string;\n /** Release the candidate belongs to. */\n readonly release: string;\n /** Lowercase SHA-256 fingerprint of the exact artifact being promoted. */\n readonly artifactFingerprint: string;\n}\n\n/**\n * Decides whether one record admits one exact candidate at one instant.\n *\n * An empty result admits the deployment. Any diagnostic rejects it: the\n * record must validate cleanly, its canonical fingerprint must be the one\n * named by `admissionId`, every candidate binding must match exactly, the\n * record must not be expired at `now`, the independent verification must\n * have accepted the run, and no skipped test may remain unaccounted for.\n *\n * Codes, paths, messages, and ordering are identical to the native\n * implementation, so both host families reach the same decision for the\n * same record.\n *\n * `now` must be a millisecond-precision UTC timestamp such as\n * `2026-01-01T00:00:00.000Z`; the fixed-width format keeps the expiry\n * comparison exact. Callers own retrieval: fetch the canonical bytes from an\n * immutable store within their own deadline, refuse oversized content, and\n * hand the parsed record here.\n */\nexport async function admitTestRun(\n evidence: TestRunEvidence,\n candidate: TestRunCandidate,\n admissionId: string,\n now: string,\n): Promise<MarquetteDiagnostic[]> {\n const diagnostics = validateTestRunEvidence(evidence);\n\n const nowIsExact = isStrictTimestamp(now);\n if (!nowIsExact) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_148\",\n \"admission.now\",\n \"admission time must be a millisecond-precision UTC instant\",\n ),\n );\n }\n\n const expected = parseTestRunAdmissionId(admissionId);\n if (expected === undefined) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_141\",\n \"admission.id\",\n \"admission id must be test-run: followed by 64 lowercase hexadecimal characters\",\n ),\n );\n } else if ((await testRunFingerprint(evidence)) !== expected) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_142\",\n \"admission.id\",\n \"admission id does not name this record's canonical fingerprint\",\n ),\n );\n }\n\n const bindings = [\n [evidence.application, candidate.application, \"application\"],\n [evidence.environment, candidate.environment, \"environment\"],\n [evidence.contractFingerprint, candidate.contractFingerprint, \"contractFingerprint\"],\n [evidence.sourceRevision, candidate.sourceRevision, \"sourceRevision\"],\n [evidence.release, candidate.release, \"release\"],\n [evidence.artifact.fingerprint, candidate.artifactFingerprint, \"artifact.fingerprint\"],\n ] as const;\n for (const [recorded, wanted, field] of bindings) {\n if (recorded !== wanted) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_144\", field, `record does not bind the candidate ${field}`),\n );\n }\n }\n\n if (nowIsExact && evidence.validUntil <= now) {\n diagnostics.push(\n error(\"VIZE_MARQUETTE_145\", \"validUntil\", \"record is expired at the admission time\"),\n );\n }\n if (evidence.verification.outcome !== \"accepted\") {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_146\",\n \"verification.outcome\",\n \"only an accepted verification can admit a deployment\",\n ),\n );\n }\n if (evidence.verification.skipped > 0) {\n diagnostics.push(\n error(\n \"VIZE_MARQUETTE_147\",\n \"verification.skipped\",\n \"skipped tests are not approved for deployment admission\",\n ),\n );\n }\n\n diagnostics.sort((left, right) =>\n left.path !== right.path\n ? left.path < right.path\n ? -1\n : 1\n : left.code !== right.code\n ? left.code < right.code\n ? -1\n : 1\n : left.message < right.message\n ? -1\n : left.message > right.message\n ? 1\n : 0,\n );\n return diagnostics;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAsB,aACpB,UACA,WACA,aACA,KACgC;CAChC,MAAM,cAAc,wBAAwB,SAAS;CAErD,MAAM,aAAa,kBAAkB,IAAI;CACzC,IAAI,CAAC,YACH,YAAY,KACV,MACE,sBACA,iBACA,6DACD,CACF;CAGH,MAAM,WAAW,wBAAwB,YAAY;CACrD,IAAI,aAAa,KAAA,GACf,YAAY,KACV,MACE,sBACA,gBACA,iFACD,CACF;MACI,IAAK,MAAM,mBAAmB,SAAS,KAAM,UAClD,YAAY,KACV,MACE,sBACA,gBACA,iEACD,CACF;CAGH,MAAM,WAAW;EACf;GAAC,SAAS;GAAa,UAAU;GAAa;GAAc;EAC5D;GAAC,SAAS;GAAa,UAAU;GAAa;GAAc;EAC5D;GAAC,SAAS;GAAqB,UAAU;GAAqB;GAAsB;EACpF;GAAC,SAAS;GAAgB,UAAU;GAAgB;GAAiB;EACrE;GAAC,SAAS;GAAS,UAAU;GAAS;GAAU;EAChD;GAAC,SAAS,SAAS;GAAa,UAAU;GAAqB;GAAuB;EACvF;CACD,KAAK,MAAM,CAAC,UAAU,QAAQ,UAAU,UACtC,IAAI,aAAa,QACf,YAAY,KACV,MAAM,sBAAsB,OAAO,sCAAsC,QAAQ,CAClF;CAIL,IAAI,cAAc,SAAS,cAAc,KACvC,YAAY,KACV,MAAM,sBAAsB,cAAc,0CAA0C,CACrF;CAEH,IAAI,SAAS,aAAa,YAAY,YACpC,YAAY,KACV,MACE,sBACA,wBACA,uDACD,CACF;CAEH,IAAI,SAAS,aAAa,UAAU,GAClC,YAAY,KACV,MACE,sBACA,wBACA,0DACD,CACF;CAGH,YAAY,MAAM,MAAM,UACtB,KAAK,SAAS,MAAM,OAChB,KAAK,OAAO,MAAM,OAChB,KACA,IACF,KAAK,SAAS,MAAM,OAClB,KAAK,OAAO,MAAM,OAChB,KACA,IACF,KAAK,UAAU,MAAM,UACnB,KACA,KAAK,UAAU,MAAM,UACnB,IACA,EACX;CACD,OAAO"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { i as TestRunEvidence } from "./test-run-model-DkllmEsY.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/test-run-canonical.d.ts
|
|
4
|
+
/** Prefix of every test-run deployment admission id. */
|
|
5
|
+
declare const TEST_RUN_ADMISSION_PREFIX = "test-run:";
|
|
6
|
+
/**
|
|
7
|
+
* Serializes a test-run evidence record canonically.
|
|
8
|
+
*
|
|
9
|
+
* Property order matches the record schema, targets sort by id, suites sort
|
|
10
|
+
* by id then shard index, and selection identifiers sort lexicographically,
|
|
11
|
+
* so equivalent records produce byte-identical JSON in every language. Call
|
|
12
|
+
* validation before trusting the record; canonicalization does not make an
|
|
13
|
+
* invalid record valid.
|
|
14
|
+
*/
|
|
15
|
+
declare function canonicalTestRunJson(evidence: TestRunEvidence): string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the lowercase SHA-256 fingerprint of the canonical record.
|
|
18
|
+
*
|
|
19
|
+
* The fingerprint is the exact value admitted as `test-run:<sha256>` by
|
|
20
|
+
* deployment gates. Uses the Web Crypto API available in every supported
|
|
21
|
+
* runtime.
|
|
22
|
+
*/
|
|
23
|
+
declare function testRunFingerprint(evidence: TestRunEvidence): Promise<string>;
|
|
24
|
+
/** Returns the `test-run:<sha256>` admission id for one record. */
|
|
25
|
+
declare function testRunAdmissionId(evidence: TestRunEvidence): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the fingerprint named by a `test-run:<sha256>` admission id.
|
|
28
|
+
*
|
|
29
|
+
* Returns `undefined` unless the prefix, length, and lowercase hexadecimal
|
|
30
|
+
* grammar are all exact.
|
|
31
|
+
*/
|
|
32
|
+
declare function parseTestRunAdmissionId(id: string): string | undefined;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { TEST_RUN_ADMISSION_PREFIX, canonicalTestRunJson, parseTestRunAdmissionId, testRunAdmissionId, testRunFingerprint };
|
|
35
|
+
//# sourceMappingURL=test-run-canonical.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-run-canonical.d.mts","names":[],"sources":["../src/test-run-canonical.ts"],"mappings":";;;;cAQa,yBAAA;AAAb;;;;;AAwCA;;;;AAxCA,iBAwCgB,oBAAA,CAAqB,QAAA,EAAU,eAAA;AA6D/C;;;;;;;AAAA,iBAAsB,kBAAA,CAAmB,QAAA,EAAU,eAAA,GAAkB,OAAA;;iBAW/C,kBAAA,CAAmB,QAAA,EAAU,eAAA,GAAkB,OAAA;;;;;;;iBAUrD,uBAAA,CAAwB,EAAA"}
|