@agent-teams/engineering-foundation 1.6.1 → 1.7.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/dist/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.d.ts +26 -0
- package/dist/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.d.ts.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.js +316 -0
- package/dist/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.js.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.d.ts +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.js +12 -9
- package/dist/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/policies/validate-growth-authority.d.ts +2 -0
- package/dist/capabilities/public-api-compatibility/application/policies/validate-growth-authority.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/policies/validate-growth-authority.js +2 -1
- package/dist/capabilities/public-api-compatibility/application/policies/validate-growth-authority.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/authority-module.d.ts +2 -0
- package/dist/capabilities/public-api-compatibility/authority-module.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/authority-module.js +1 -0
- package/dist/capabilities/public-api-compatibility/authority-module.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/node-test-execution/runner.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/node-test-execution/runner.js +4 -3
- package/dist/capabilities/quality-gate-runner/adapters/inbound/node-test-execution/runner.js.map +1 -1
- package/dist/capabilities/source-dependencies/adapters/outbound/node/source-census-reader.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/adapters/outbound/node/source-census-reader.js +14 -1
- package/dist/capabilities/source-dependencies/adapters/outbound/node/source-census-reader.js.map +1 -1
- package/dist/composition/sdk-growth-authority.d.ts +2 -0
- package/dist/composition/sdk-growth-authority.d.ts.map +1 -1
- package/dist/composition/sdk-growth-authority.js +1 -0
- package/dist/composition/sdk-growth-authority.js.map +1 -1
- package/dist/features/quality-coverage/adapters/consumer-observations.d.ts.map +1 -1
- package/dist/features/quality-coverage/adapters/consumer-observations.js +8 -3
- package/dist/features/quality-coverage/adapters/consumer-observations.js.map +1 -1
- package/dist/process-execution/windows-managed-process.d.ts.map +1 -1
- package/dist/process-execution/windows-managed-process.js +22 -6
- package/dist/process-execution/windows-managed-process.js.map +1 -1
- package/dist/sdk-growth-authority.d.ts +2 -0
- package/dist/sdk-growth-authority.d.ts.map +1 -1
- package/dist/sdk-growth-authority.js +1 -0
- package/dist/sdk-growth-authority.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GrowthAuthorityCompletion, GrowthAuthorityGrant, GrowthAuthorityReceipt, GrowthAuthorityRequest } from "../../../application/model/growth-authority.js";
|
|
2
|
+
import type { GrowthDigest } from "../../../application/model/growth-observation.js";
|
|
3
|
+
export interface GrowthToolingValidated<T> {
|
|
4
|
+
readonly value: T;
|
|
5
|
+
readonly wire: string;
|
|
6
|
+
readonly wireDigest: GrowthDigest;
|
|
7
|
+
readonly protocolDigest: GrowthDigest;
|
|
8
|
+
}
|
|
9
|
+
export type GrowthToolingValidatedReceipt = Omit<GrowthToolingValidated<GrowthAuthorityReceipt>, "protocolDigest">;
|
|
10
|
+
export declare function decodeRequest(value: unknown): GrowthToolingValidated<GrowthAuthorityRequest>;
|
|
11
|
+
export declare function encodeGrant(value: unknown, options: {
|
|
12
|
+
readonly request: unknown;
|
|
13
|
+
readonly now: Date;
|
|
14
|
+
}): GrowthToolingValidated<GrowthAuthorityGrant>;
|
|
15
|
+
export declare function decodeCompletion(value: unknown, options: {
|
|
16
|
+
readonly request: unknown;
|
|
17
|
+
readonly grant: unknown;
|
|
18
|
+
readonly finalizedReportBytes: unknown;
|
|
19
|
+
}): GrowthToolingValidated<GrowthAuthorityCompletion>;
|
|
20
|
+
export declare function encodeReceipt(value: unknown, options: {
|
|
21
|
+
readonly request: unknown;
|
|
22
|
+
readonly grant: unknown;
|
|
23
|
+
readonly completion: unknown;
|
|
24
|
+
readonly finalizedReportBytes: unknown;
|
|
25
|
+
}): GrowthToolingValidatedReceipt;
|
|
26
|
+
//# sourceMappingURL=growth-authority-tooling-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"growth-authority-tooling-codec.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAGtK,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAgBrF,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;CACvC;AACD,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAqEnH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAAC,sBAAsB,CAAC,CAG5F;AA4BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;CAAE,GAAG,sBAAsB,CAAC,oBAAoB,CAAC,CAKpJ;AAkID,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAA;CAAE,GAAG,sBAAsB,CAAC,yBAAyB,CAAC,CAG3M;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAA;CAAE,GAAG,6BAA6B,CAUlN"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import { growthAuthoritySchemaVersion } from "../../../application/model/growth-authority.js";
|
|
4
|
+
import { GrowthObservationInvariantError } from "../../../application/model/growth-observation.js";
|
|
5
|
+
import { NodeChangeFingerprint } from "../../outbound/crypto/node-change-fingerprint.js";
|
|
6
|
+
import { parseStrictJsonResponse } from "../../outbound/reviewrouter/strict-json-response.js";
|
|
7
|
+
import { growthCanonicalJson, growthObservationReference } from "../../../application/policies/normalize-growth-observation.js";
|
|
8
|
+
import { validateGrowthReport } from "../../../application/policies/validate-growth-report.js";
|
|
9
|
+
import { growthAuthorityCompletionDigest, growthAuthorityGrantDigest, growthAuthorityRequestDigest, growthReportAuthorityDigests, validateGrowthAuthorityBinding, validateGrowthAuthorityGrant, digest, exact, invalid, object, text, validateGrowthAuthorityReceipt, validateGrowthAuthorityRequest } from "../../../application/policies/validate-growth-authority.js";
|
|
10
|
+
const fingerprint = new NodeChangeFingerprint();
|
|
11
|
+
const inspection = Object.freeze({ isProxy: types.isProxy });
|
|
12
|
+
const maximumBytes = 32 * 1024 * 1024;
|
|
13
|
+
const encoder = new TextEncoder();
|
|
14
|
+
/** A descriptor-only snapshot. No producer getter, proxy trap or custom method is invoked. */
|
|
15
|
+
function snapshot(value, budget, depth = 0) {
|
|
16
|
+
if (++budget.nodes > 1_000_000 || depth > 64 || types.isProxy(value)) {
|
|
17
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === "string") {
|
|
20
|
+
budget.units += value.length;
|
|
21
|
+
if (budget.units > maximumBytes) {
|
|
22
|
+
invalid("growth-authority-tooling-input-budget-exhausted");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (value === null || typeof value === "boolean" || typeof value === "string" || (typeof value === "number" && Number.isSafeInteger(value))) {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
if (typeof value !== "object") {
|
|
29
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
30
|
+
}
|
|
31
|
+
const isArray = Array.isArray(value);
|
|
32
|
+
const prototype = Object.getPrototypeOf(value);
|
|
33
|
+
if (isArray ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) {
|
|
34
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
35
|
+
}
|
|
36
|
+
return isArray ? snapshotArray(value, budget, depth) : snapshotObject(value, budget, depth);
|
|
37
|
+
}
|
|
38
|
+
function snapshotArray(value, budget, depth) {
|
|
39
|
+
const keys = Reflect.ownKeys(value);
|
|
40
|
+
const length = Object.getOwnPropertyDescriptor(value, "length")?.value;
|
|
41
|
+
if (!Number.isSafeInteger(length) || length < 0 || keys.length !== length + 1) {
|
|
42
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
43
|
+
}
|
|
44
|
+
const result = [];
|
|
45
|
+
for (let index = 0; index < length; index += 1) {
|
|
46
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
47
|
+
if (descriptor === undefined || !("value" in descriptor) || descriptor.enumerable !== true) {
|
|
48
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
49
|
+
}
|
|
50
|
+
result.push(snapshot(descriptor.value, budget, depth + 1));
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function snapshotObject(value, budget, depth) {
|
|
55
|
+
const result = Object.create(null);
|
|
56
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
57
|
+
if (typeof key !== "string" || key.normalize("NFC") !== key) {
|
|
58
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
59
|
+
}
|
|
60
|
+
budget.units += key.length;
|
|
61
|
+
if (budget.units > maximumBytes) {
|
|
62
|
+
invalid("growth-authority-tooling-input-budget-exhausted");
|
|
63
|
+
}
|
|
64
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
65
|
+
if (descriptor === undefined || !("value" in descriptor) || descriptor.enumerable !== true) {
|
|
66
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
67
|
+
}
|
|
68
|
+
Object.defineProperty(result, key, { value: snapshot(descriptor.value, budget, depth + 1), enumerable: true, configurable: true, writable: true });
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
function input(value) {
|
|
73
|
+
let parsed = value;
|
|
74
|
+
if (typeof value === "string") {
|
|
75
|
+
if (value.length > maximumBytes || encoder.encode(value).byteLength > maximumBytes) {
|
|
76
|
+
invalid("growth-authority-tooling-input-budget-exhausted");
|
|
77
|
+
}
|
|
78
|
+
parsed = parseStrictJsonResponse(value, 64);
|
|
79
|
+
}
|
|
80
|
+
else if (intrinsicByteLength(value) !== null) {
|
|
81
|
+
const bytes = copyBytes(value);
|
|
82
|
+
parsed = parseStrictJsonResponse(new TextDecoder("utf-8", { fatal: true }).decode(bytes), 64);
|
|
83
|
+
}
|
|
84
|
+
const safe = snapshot(parsed, { nodes: 0, units: 0 });
|
|
85
|
+
if (encoder.encode(growthCanonicalJson(safe)).byteLength > maximumBytes) {
|
|
86
|
+
invalid("growth-authority-tooling-input-budget-exhausted");
|
|
87
|
+
}
|
|
88
|
+
return safe;
|
|
89
|
+
}
|
|
90
|
+
function optionsRecord(value, keys) {
|
|
91
|
+
if (types.isProxy(value) || value === null || typeof value !== "object" || Array.isArray(value)
|
|
92
|
+
|| Object.getPrototypeOf(value) !== Object.prototype) {
|
|
93
|
+
invalid("growth-authority-tooling-options-unsafe");
|
|
94
|
+
}
|
|
95
|
+
return object(value, keys, "growth-authority-tooling-options-unsafe");
|
|
96
|
+
}
|
|
97
|
+
function wire(value) {
|
|
98
|
+
const serialized = growthCanonicalJson(value);
|
|
99
|
+
return { value, wire: serialized, wireDigest: `sha256:${createHash("sha256").update(serialized).digest("hex")}` };
|
|
100
|
+
}
|
|
101
|
+
function request(value) {
|
|
102
|
+
return validateGrowthAuthorityRequest(input(value));
|
|
103
|
+
}
|
|
104
|
+
export function decodeRequest(value) {
|
|
105
|
+
const validated = request(value);
|
|
106
|
+
return { ...wire(validated), protocolDigest: growthAuthorityRequestDigest(validated, fingerprint) };
|
|
107
|
+
}
|
|
108
|
+
function grant(value, validatedRequest, now) {
|
|
109
|
+
return validateGrowthAuthorityGrant(input(value), validatedRequest, fingerprint, inspection, now);
|
|
110
|
+
}
|
|
111
|
+
function historicalGrant(value, validatedRequest) {
|
|
112
|
+
const safe = input(value);
|
|
113
|
+
return validateGrowthAuthorityGrant(safe, validatedRequest, fingerprint, inspection, historicalTime(safe));
|
|
114
|
+
}
|
|
115
|
+
function issuanceTime(value) {
|
|
116
|
+
if (types.isProxy(value) || value === null || typeof value !== "object") {
|
|
117
|
+
invalid("growth-authority-trusted-time-invalid");
|
|
118
|
+
}
|
|
119
|
+
let milliseconds;
|
|
120
|
+
try {
|
|
121
|
+
milliseconds = Date.prototype.getTime.call(value);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
invalid("growth-authority-trusted-time-invalid");
|
|
125
|
+
}
|
|
126
|
+
if (Object.getPrototypeOf(value) !== Date.prototype) {
|
|
127
|
+
invalid("growth-authority-trusted-time-invalid");
|
|
128
|
+
}
|
|
129
|
+
if (!Number.isFinite(milliseconds)) {
|
|
130
|
+
invalid("growth-authority-trusted-time-invalid");
|
|
131
|
+
}
|
|
132
|
+
return new Date(milliseconds);
|
|
133
|
+
}
|
|
134
|
+
function historicalTime(value) {
|
|
135
|
+
const row = object(value, ["schemaVersion", "kind", "grantId", "requestDigest", "admissionReceipt", "binding", "workflowRef", "runRef", "issuedAt", "expiresAt",
|
|
136
|
+
"trustedBase", "trustedBaseReference", "retainedHistory", "released", "ownerEvidence", "archives", "candidates", "metadataRoots", "requiredCoverageDigest", "requiredPhases"]);
|
|
137
|
+
// Historical decoding tests the closed grant during its own validity window.
|
|
138
|
+
// A promotion admission receipt can be issued after the promotion grant's
|
|
139
|
+
// issuedAt, so the lower bound is not a valid historical observation time.
|
|
140
|
+
const expires = new Date(text(row["expiresAt"]));
|
|
141
|
+
if (!Number.isFinite(expires.getTime())) {
|
|
142
|
+
invalid("growth-authority-time-invalid");
|
|
143
|
+
}
|
|
144
|
+
return new Date(expires.getTime() - 1);
|
|
145
|
+
}
|
|
146
|
+
export function encodeGrant(value, options) {
|
|
147
|
+
const args = optionsRecord(options, ["request", "now"]);
|
|
148
|
+
const validatedRequest = request(args["request"]);
|
|
149
|
+
const validated = grant(value, validatedRequest, issuanceTime(args["now"]));
|
|
150
|
+
return { ...wire(validated), protocolDigest: growthAuthorityGrantDigest(validated, fingerprint) };
|
|
151
|
+
}
|
|
152
|
+
function intrinsicByteLength(value) {
|
|
153
|
+
if (types.isProxy(value) || value === null || typeof value !== "object") {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const length = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), "byteLength")?.get?.call(value);
|
|
158
|
+
return typeof length === "number" ? length : null;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function copyBytes(value) {
|
|
165
|
+
const length = intrinsicByteLength(value);
|
|
166
|
+
if (length === null) {
|
|
167
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
168
|
+
}
|
|
169
|
+
const source = value; // Intrinsic typed-array brand was checked above.
|
|
170
|
+
const prototype = Object.getPrototypeOf(source);
|
|
171
|
+
if (prototype !== Uint8Array.prototype && prototype !== Buffer.prototype) {
|
|
172
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
173
|
+
}
|
|
174
|
+
if (["byteLength", "byteOffset", "buffer", "length"].some((key) => Object.hasOwn(source, key))
|
|
175
|
+
|| Object.hasOwn(source, Symbol.iterator)) {
|
|
176
|
+
invalid("growth-authority-tooling-input-unsafe");
|
|
177
|
+
}
|
|
178
|
+
if (typeof length !== "number" || length === 0 || length > maximumBytes) {
|
|
179
|
+
invalid("growth-authority-tooling-input-budget-exhausted");
|
|
180
|
+
}
|
|
181
|
+
return Uint8Array.from(Uint8Array.prototype.values.call(source));
|
|
182
|
+
}
|
|
183
|
+
function reportBytes(value) {
|
|
184
|
+
return copyBytes(value);
|
|
185
|
+
}
|
|
186
|
+
/** Pure parser for the exact retained report artifact, including its final LF. */
|
|
187
|
+
function parseFinalizedGrowthReportBytes(bytes, reportFingerprint) {
|
|
188
|
+
const safe = reportBytes(bytes);
|
|
189
|
+
let source;
|
|
190
|
+
try {
|
|
191
|
+
source = new TextDecoder("utf-8", { fatal: true }).decode(safe);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
throw new GrowthObservationInvariantError("growth-authority-report-json-invalid");
|
|
195
|
+
}
|
|
196
|
+
const report = validateGrowthReport(parseStrictJsonResponse(source, 64), reportFingerprint);
|
|
197
|
+
if (!Buffer.from(safe).equals(Buffer.from(`${growthCanonicalJson(report)}\n`, "utf8"))) {
|
|
198
|
+
throw new GrowthObservationInvariantError("growth-authority-report-bytes-invalid");
|
|
199
|
+
}
|
|
200
|
+
return report;
|
|
201
|
+
}
|
|
202
|
+
function assertReportBinding(report, requestValue, current, bytes) {
|
|
203
|
+
const authorityGrant = requestValue.operation === "check" ? current
|
|
204
|
+
: current.admissionReceipt.kind === "receipt" ? current.admissionReceipt.receipt.provenance?.grant : undefined;
|
|
205
|
+
if (requestValue.operation === "promote-release" && current.admissionReceipt.kind === "receipt" && authorityGrant !== undefined) {
|
|
206
|
+
const priorCompletion = current.admissionReceipt.receipt.provenance?.completion;
|
|
207
|
+
if (priorCompletion === undefined) {
|
|
208
|
+
invalid("growth-authority-admission-provenance-invalid");
|
|
209
|
+
}
|
|
210
|
+
const priorRow = object(priorCompletion, ["schemaVersion", "kind", "grantId", "grantDigest", "requestDigest", "binding", "reportDigest", "reportByteLength",
|
|
211
|
+
"coverageDigest", "phasesDigest", "verdict", "releaseEligible", "publication", "promotion"]);
|
|
212
|
+
assertCompletionFields(priorRow, authorityGrant, report, bytes, authorityGrant.requestDigest);
|
|
213
|
+
}
|
|
214
|
+
if (authorityGrant === undefined || report.authority.status !== "verified"
|
|
215
|
+
|| report.authority.receiptDigest !== growthAuthorityGrantDigest(authorityGrant, fingerprint)
|
|
216
|
+
|| report.authority.workflowRef !== authorityGrant.workflowRef || report.authority.runRef !== authorityGrant.runRef) {
|
|
217
|
+
invalid("growth-authority-completion-report-authority-mismatch");
|
|
218
|
+
}
|
|
219
|
+
assertReportSources(report, authorityGrant);
|
|
220
|
+
const coverageDigest = growthReportAuthorityDigests(report, fingerprint).coverageDigest;
|
|
221
|
+
if (coverageDigest !== authorityGrant.requiredCoverageDigest || coverageDigest !== current.requiredCoverageDigest) {
|
|
222
|
+
invalid("growth-authority-coverage-mismatch");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function assertReportSources(report, authorityGrant) {
|
|
226
|
+
const invocation = authorityGrant.binding.invocation;
|
|
227
|
+
exact(report.repository, invocation.repository, "growth-authority-report-source-mismatch");
|
|
228
|
+
exact(report.tool, invocation.tool, "growth-authority-report-source-mismatch");
|
|
229
|
+
if (report.trustedBase.status === "available") {
|
|
230
|
+
exact(report.trustedBase.value, authorityGrant.trustedBaseReference, "growth-authority-report-source-mismatch");
|
|
231
|
+
}
|
|
232
|
+
if (report.candidate.status === "available") {
|
|
233
|
+
const candidate = report.candidate.value;
|
|
234
|
+
exact({ sourceCommit: candidate.sourceCommit, sourceTree: candidate.sourceTree, topologyDigest: candidate.topologyDigest,
|
|
235
|
+
lockDigest: candidate.lockDigest, toolchainDigest: candidate.toolchainDigest, artifactDigests: candidate.artifactDigests }, { sourceCommit: invocation.sourceCommit, sourceTree: invocation.sourceTree, topologyDigest: invocation.topologyDigest,
|
|
236
|
+
lockDigest: invocation.lockDigest, toolchainDigest: invocation.toolchainDigest, artifactDigests: invocation.artifactDigests }, "growth-authority-report-source-mismatch");
|
|
237
|
+
}
|
|
238
|
+
if (report.trustedBaseComparison.status === "complete") {
|
|
239
|
+
if (report.trustedBase.status !== "available" || report.candidate.status !== "available") {
|
|
240
|
+
invalid("growth-authority-report-source-mismatch");
|
|
241
|
+
}
|
|
242
|
+
exact({ before: report.trustedBaseComparison.before, after: report.trustedBaseComparison.after }, { before: report.trustedBase.value.surfaceDigest, after: report.candidate.value.surfaceDigest }, "growth-authority-report-source-mismatch");
|
|
243
|
+
}
|
|
244
|
+
if (report.verdict === "admitted") {
|
|
245
|
+
exact(report.transitionReceipts[0]?.decisions, authorityGrant.ownerEvidence.map((entry) => entry.decisionDigest).toSorted(), "growth-authority-report-source-mismatch");
|
|
246
|
+
}
|
|
247
|
+
exact(report.released.map((row) => ({ packageName: row.packageName, kind: row.evidence.kind })), authorityGrant.released.map((row) => ({ packageName: row.packageName, kind: row.evidence.kind })), "growth-authority-report-source-mismatch");
|
|
248
|
+
for (const row of report.released) {
|
|
249
|
+
const retained = authorityGrant.released.find((entry) => entry.packageName === row.packageName);
|
|
250
|
+
if (retained?.evidence.kind === "released" && row.evidence.kind === "released" && row.evidence.observation.status === "available") {
|
|
251
|
+
const archive = authorityGrant.archives.find((entry) => entry.packageName === row.packageName);
|
|
252
|
+
if (archive === undefined) {
|
|
253
|
+
invalid("growth-authority-report-source-mismatch");
|
|
254
|
+
}
|
|
255
|
+
exact(row.evidence.observation.value, growthObservationReference(archive.observation, fingerprint), "growth-authority-report-source-mismatch");
|
|
256
|
+
}
|
|
257
|
+
if (retained?.evidence.kind === "initial-unreleased" && row.evidence.kind === "initial-unreleased" && row.evidence.history.status === "available") {
|
|
258
|
+
exact(row.evidence.history.value, retained.evidence.historyDigest, "growth-authority-report-source-mismatch");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function assertCompletionFields(row, grantValue, report, bytes, requestDigest) {
|
|
263
|
+
const reportDigests = growthReportAuthorityDigests(report, fingerprint);
|
|
264
|
+
const reportDigest = `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
265
|
+
if (row["grantId"] !== grantValue.grantId || row["grantDigest"] !== growthAuthorityGrantDigest(grantValue, fingerprint)
|
|
266
|
+
|| row["requestDigest"] !== requestDigest
|
|
267
|
+
|| row["reportDigest"] !== reportDigest || row["reportByteLength"] !== bytes.byteLength
|
|
268
|
+
|| row["coverageDigest"] !== reportDigests.coverageDigest || row["phasesDigest"] !== reportDigests.phasesDigest
|
|
269
|
+
|| row["verdict"] !== report.verdict || row["releaseEligible"] !== report.releaseEligible) {
|
|
270
|
+
invalid("growth-authority-completion-mismatch");
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function validateCompletion(value, options, validatedContext) {
|
|
274
|
+
const args = optionsRecord(options, ["request", "grant", "finalizedReportBytes"]);
|
|
275
|
+
const validatedRequest = validatedContext?.request ?? request(args["request"]);
|
|
276
|
+
const validatedGrant = validatedContext?.grant ?? historicalGrant(args["grant"], validatedRequest);
|
|
277
|
+
const row = object(input(value), ["schemaVersion", "kind", "grantId", "grantDigest", "requestDigest", "binding", "reportDigest", "reportByteLength",
|
|
278
|
+
"coverageDigest", "phasesDigest", "verdict", "releaseEligible", "publication", "promotion"]);
|
|
279
|
+
if (row["schemaVersion"] !== growthAuthoritySchemaVersion || row["kind"] !== "completion" || row["publication"] !== "finalized") {
|
|
280
|
+
invalid("growth-authority-completion-invalid");
|
|
281
|
+
}
|
|
282
|
+
const binding = validateGrowthAuthorityBinding(row["binding"]);
|
|
283
|
+
exact(binding, validatedRequest.binding, "growth-authority-completion-binding-mismatch");
|
|
284
|
+
const bytes = reportBytes(args["finalizedReportBytes"]);
|
|
285
|
+
const report = parseFinalizedGrowthReportBytes(bytes, fingerprint);
|
|
286
|
+
assertReportBinding(report, validatedRequest, validatedGrant, bytes);
|
|
287
|
+
const reportDigests = growthReportAuthorityDigests(report, fingerprint);
|
|
288
|
+
const promotion = object(row["promotion"], validatedRequest.operation === "check" ? ["kind"] : ["kind", "planDigest"]);
|
|
289
|
+
if ((validatedRequest.operation === "check" && promotion["kind"] !== "none")
|
|
290
|
+
|| (validatedRequest.operation === "promote-release" && promotion["kind"] !== "plan")) {
|
|
291
|
+
invalid("growth-authority-promotion-invalid");
|
|
292
|
+
}
|
|
293
|
+
const normalizedPromotion = promotion["kind"] === "none" ? { kind: "none" } : { kind: "plan", planDigest: digest(promotion["planDigest"]) };
|
|
294
|
+
assertCompletionFields(row, validatedGrant, report, bytes, growthAuthorityRequestDigest(validatedRequest, fingerprint));
|
|
295
|
+
return { schemaVersion: growthAuthoritySchemaVersion, kind: "completion", grantId: validatedGrant.grantId,
|
|
296
|
+
grantDigest: digest(row["grantDigest"]), requestDigest: digest(row["requestDigest"]), binding,
|
|
297
|
+
reportDigest: digest(row["reportDigest"]), reportByteLength: bytes.byteLength, coverageDigest: reportDigests.coverageDigest, phasesDigest: reportDigests.phasesDigest,
|
|
298
|
+
verdict: report.verdict, releaseEligible: report.releaseEligible, publication: "finalized", promotion: normalizedPromotion };
|
|
299
|
+
}
|
|
300
|
+
export function decodeCompletion(value, options) {
|
|
301
|
+
const validated = validateCompletion(value, options);
|
|
302
|
+
return { ...wire(validated), protocolDigest: growthAuthorityCompletionDigest(validated, fingerprint) };
|
|
303
|
+
}
|
|
304
|
+
export function encodeReceipt(value, options) {
|
|
305
|
+
const args = optionsRecord(options, ["request", "grant", "completion", "finalizedReportBytes"]);
|
|
306
|
+
const validatedRequest = request(args["request"]);
|
|
307
|
+
const validatedGrant = historicalGrant(args["grant"], validatedRequest);
|
|
308
|
+
const validatedCompletion = validateCompletion(args["completion"], { request: validatedRequest, grant: validatedGrant, finalizedReportBytes: args["finalizedReportBytes"] }, { request: validatedRequest, grant: validatedGrant });
|
|
309
|
+
const validated = validateGrowthAuthorityReceipt(input(value), validatedCompletion, validatedRequest.operation, fingerprint);
|
|
310
|
+
if (validated.grantId !== validatedGrant.grantId || validated.grantDigest !== growthAuthorityGrantDigest(validatedGrant, fingerprint)
|
|
311
|
+
|| validated.requestDigest !== growthAuthorityRequestDigest(validatedRequest, fingerprint)) {
|
|
312
|
+
invalid("growth-authority-receipt-grant-mismatch");
|
|
313
|
+
}
|
|
314
|
+
return wire(validated);
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=growth-authority-tooling-codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"growth-authority-tooling-codec.js","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/inbound/authority/growth-authority-tooling-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AAInG,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,0BAA0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AAI,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,IAAI,CAAC,sBAAsB,CAAC,EAAE,EACzK,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7H,IAAI,SAAS,CAAC,OAAO,KAAK,cAAc,CAAC,OAAO,IAAI,SAAS,CAAC,WAAW,KAAK,0BAA0B,CAAC,cAAc,EAAE,WAAW,CAAC;WAChI,SAAS,CAAC,aAAa,KAAK,4BAA4B,CAAC,gBAAgB,EAAE,WAAW,CAAC,EAAE,CAAC;QAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;IAAC,CAAC;IACrJ,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Validate duplicate-key and grammar invariants before JSON.parse erases the
|
|
2
2
|
* original token stream. JSON.parse then creates ordinary data objects without
|
|
3
3
|
* carrying accessors or Proxy behavior across the transport boundary. */
|
|
4
|
-
export declare function parseStrictJsonResponse(source: string): unknown;
|
|
4
|
+
export declare function parseStrictJsonResponse(source: string, maximumDepth?: number): unknown;
|
|
5
5
|
//# sourceMappingURL=strict-json-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-json-response.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.ts"],"names":[],"mappings":"AAIA;;yEAEyE;AACzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"strict-json-response.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.ts"],"names":[],"mappings":"AAIA;;yEAEyE;AACzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CA0DtF"}
|
|
@@ -4,7 +4,7 @@ function malformed(reason) {
|
|
|
4
4
|
/** Validate duplicate-key and grammar invariants before JSON.parse erases the
|
|
5
5
|
* original token stream. JSON.parse then creates ordinary data objects without
|
|
6
6
|
* carrying accessors or Proxy behavior across the transport boundary. */
|
|
7
|
-
export function parseStrictJsonResponse(source) {
|
|
7
|
+
export function parseStrictJsonResponse(source, maximumDepth) {
|
|
8
8
|
let offset = 0;
|
|
9
9
|
const space = () => { while (/\s/u.test(source[offset] ?? "")) {
|
|
10
10
|
offset += 1;
|
|
@@ -41,15 +41,18 @@ export function parseStrictJsonResponse(source) {
|
|
|
41
41
|
}
|
|
42
42
|
return malformed("syntax");
|
|
43
43
|
};
|
|
44
|
-
const value = () => {
|
|
44
|
+
const value = (depth) => {
|
|
45
|
+
if (maximumDepth !== undefined && depth > maximumDepth) {
|
|
46
|
+
malformed("depth");
|
|
47
|
+
}
|
|
45
48
|
space();
|
|
46
49
|
const character = source[offset];
|
|
47
50
|
if (character === "{") {
|
|
48
|
-
object();
|
|
51
|
+
object(depth);
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
if (character === "[") {
|
|
52
|
-
array();
|
|
55
|
+
array(depth);
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
55
58
|
if (character === '"') {
|
|
@@ -62,7 +65,7 @@ export function parseStrictJsonResponse(source) {
|
|
|
62
65
|
}
|
|
63
66
|
offset += token.length;
|
|
64
67
|
};
|
|
65
|
-
const array = () => {
|
|
68
|
+
const array = (depth) => {
|
|
66
69
|
take("[");
|
|
67
70
|
space();
|
|
68
71
|
if (source[offset] === "]") {
|
|
@@ -70,7 +73,7 @@ export function parseStrictJsonResponse(source) {
|
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
75
|
for (;;) {
|
|
73
|
-
value();
|
|
76
|
+
value(depth + 1);
|
|
74
77
|
space();
|
|
75
78
|
if (source[offset] === "]") {
|
|
76
79
|
offset += 1;
|
|
@@ -79,7 +82,7 @@ export function parseStrictJsonResponse(source) {
|
|
|
79
82
|
take(",");
|
|
80
83
|
}
|
|
81
84
|
};
|
|
82
|
-
const object = () => {
|
|
85
|
+
const object = (depth) => {
|
|
83
86
|
take("{");
|
|
84
87
|
const keys = new Set();
|
|
85
88
|
space();
|
|
@@ -94,7 +97,7 @@ export function parseStrictJsonResponse(source) {
|
|
|
94
97
|
}
|
|
95
98
|
keys.add(key);
|
|
96
99
|
take(":");
|
|
97
|
-
value();
|
|
100
|
+
value(depth + 1);
|
|
98
101
|
space();
|
|
99
102
|
if (source[offset] === "}") {
|
|
100
103
|
offset += 1;
|
|
@@ -103,7 +106,7 @@ export function parseStrictJsonResponse(source) {
|
|
|
103
106
|
take(",");
|
|
104
107
|
}
|
|
105
108
|
};
|
|
106
|
-
value();
|
|
109
|
+
value(0);
|
|
107
110
|
space();
|
|
108
111
|
if (offset !== source.length) {
|
|
109
112
|
malformed("syntax");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-json-response.js","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"strict-json-response.js","sourceRoot":"","sources":["../../../../../../src/capabilities/public-api-compatibility/adapters/outbound/reviewrouter/strict-json-response.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS,CAAC,MAA4C;IAC7D,MAAM,IAAI,SAAS,CAAC,yDAAyD,MAAM,GAAG,CAAC,CAAC;AAC1F,CAAC;AAED;;yEAEyE;AACzE,MAAM,UAAU,uBAAuB,CAAC,MAAc,EAAE,YAAqB;IAC3E,IAAI,MAAM,GAAG,CAA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vC,CAAC"}
|
|
@@ -3,9 +3,11 @@ import type { GrowthDigest } from "../model/growth-observation.js";
|
|
|
3
3
|
import type { GrowthReport } from "../model/growth-report.js";
|
|
4
4
|
import type { ChangeFingerprint } from "../ports/change-fingerprint.js";
|
|
5
5
|
export { growthDecisionDigest, prepareGrowthDecisions } from "./evaluate-growth-admission.js";
|
|
6
|
+
export { digest, exact, invalid, object, text } from "./validate-growth-authority-primitives.js";
|
|
6
7
|
export { validateGrowthInstalledInventory } from "./validate-growth-installed-inventory.js";
|
|
7
8
|
export declare function growthAuthorityRepositoryIdentity(repository: GrowthAuthorityRepository): string;
|
|
8
9
|
export declare function validateGrowthAuthorityBinding(value: unknown): GrowthAuthorityBinding;
|
|
10
|
+
export declare function validateGrowthAuthorityRequest(value: unknown): GrowthAuthorityRequest;
|
|
9
11
|
export declare function growthAuthorityRequestDigest(request: GrowthAuthorityRequest, fingerprint: ChangeFingerprint): GrowthDigest;
|
|
10
12
|
export declare function growthAuthorityGrantDigest(grant: GrowthAuthorityGrant, fingerprint: ChangeFingerprint): GrowthDigest;
|
|
11
13
|
export declare function growthAuthorityCompletionDigest(completion: GrowthAuthorityCompletion, fingerprint: ChangeFingerprint): GrowthDigest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-growth-authority.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/public-api-compatibility/application/policies/validate-growth-authority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAAE,yBAAyB,EAAE,oBAAoB,EACV,sBAAsB,EACnF,yBAAyB,EAAE,sBAAsB,EAAE,mBAAmB,EACvE,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,yBAAyB,GAAG,MAAM,CAE/F;AAQD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAgCrF;
|
|
1
|
+
{"version":3,"file":"validate-growth-authority.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/public-api-compatibility/application/policies/validate-growth-authority.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAAE,yBAAyB,EAAE,oBAAoB,EACV,sBAAsB,EACnF,yBAAyB,EAAE,sBAAsB,EAAE,mBAAmB,EACvE,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAG9F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AACjG,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,yBAAyB,GAAG,MAAM,CAE/F;AAQD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAgCrF;AAmBD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAkBrF;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,GAAG,YAAY,CAE1H;AACD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,iBAAiB,GAAG,YAAY,CAEpH;AACD,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,yBAAyB,EAAE,WAAW,EAAE,iBAAiB,GAAG,YAAY,CAEnI;AACD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,iBAAiB,GAAG,YAAY,CAEjH;AACD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,GAAG;IAAE,cAAc,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,CAG/J;AAyBD,KAAK,eAAe,GAAG,QAAQ,CAAC;IAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAA;CAAE,CAAC,CAAC;AAkPtE;kFACkF;AAClF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,EAC1H,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,GAAG,oBAAoB,CAmG9D;AAQD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,SAAS,EAAE,sBAAsB,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,iBAAiB,GAAG,sBAAsB,CA0B5M"}
|
package/dist/capabilities/public-api-compatibility/application/policies/validate-growth-authority.js
CHANGED
|
@@ -4,6 +4,7 @@ import { validateGrowthMetadataRoots } from "./validate-growth-metadata-root.js"
|
|
|
4
4
|
export { growthDecisionDigest, prepareGrowthDecisions } from "./evaluate-growth-admission.js";
|
|
5
5
|
import { growthCanonicalJson, growthObservationReference, growthUniqueSorted, normalizeGrowthInvocation, normalizeGrowthObservation } from "./normalize-growth-observation.js";
|
|
6
6
|
import { array, commit, custodyPath, date, digest, exact, exactVersion, integrity, invalid, member, object, repositoryPath, source, text, uniqueMap } from "./validate-growth-authority-primitives.js";
|
|
7
|
+
export { digest, exact, invalid, object, text } from "./validate-growth-authority-primitives.js";
|
|
7
8
|
export { validateGrowthInstalledInventory } from "./validate-growth-installed-inventory.js";
|
|
8
9
|
export function growthAuthorityRepositoryIdentity(repository) {
|
|
9
10
|
return `${repository.provider}:${repository.repositoryId}`;
|
|
@@ -82,7 +83,7 @@ function validateSelectors(value) {
|
|
|
82
83
|
return { trustedBasePath: repositoryPath(row["trustedBasePath"]), decisionsPath: repositoryPath(row["decisionsPath"]),
|
|
83
84
|
released: growthUniqueSorted(released, (entry) => entry.packageName) };
|
|
84
85
|
}
|
|
85
|
-
function validateGrowthAuthorityRequest(value) {
|
|
86
|
+
export function validateGrowthAuthorityRequest(value) {
|
|
86
87
|
const row = object(value, ["schemaVersion", "kind", "operation", "admissionReceiptId", "binding", "contextSelectors", "decisionDigests", "requiredPhases"]);
|
|
87
88
|
if (row["schemaVersion"] !== growthAuthoritySchemaVersion || row["kind"] !== "request" || !["check", "promote-release"].includes(String(row["operation"]))) {
|
|
88
89
|
invalid("growth-authority-request-invalid");
|