@xemahq/contracts 0.69.0 → 0.71.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/dist/.source-stamp.json +2 -2
- package/dist/authorization-module/lib/platform-authorization-modules.d.ts.map +1 -1
- package/dist/authorization-module/lib/platform-authorization-modules.js +1 -1
- package/dist/authorization-module/lib/platform-authorization-modules.js.map +1 -1
- package/dist/authorization-module/platform/xema_capability.fga +4 -2
- package/dist/authorization-module/platform/xema_capability.fga.yaml +10 -0
- package/dist/authorization-module/platform/xema_core.fga +26 -9
- package/dist/authorization-module/platform/xema_core.fga.yaml +46 -0
- package/dist/authzen/lib/org-authority-contextual-tuple.d.ts +17 -0
- package/dist/authzen/lib/org-authority-contextual-tuple.d.ts.map +1 -1
- package/dist/authzen/lib/org-authority-contextual-tuple.js +66 -8
- package/dist/authzen/lib/org-authority-contextual-tuple.js.map +1 -1
- package/dist/authzen/lib/xema-authzen-profile.d.ts.map +1 -1
- package/dist/authzen/lib/xema-authzen-profile.js.map +1 -1
- package/dist/biome/lib/biome-component-process-facts.d.ts.map +1 -1
- package/dist/biome/lib/biome-component-process-facts.js.map +1 -1
- package/dist/biome/lib/biome-component.d.ts +5 -0
- package/dist/biome/lib/biome-component.d.ts.map +1 -1
- package/dist/biome/lib/biome-component.js +9 -2
- package/dist/biome/lib/biome-component.js.map +1 -1
- package/dist/biome/lib/biome-manifest.d.ts +6 -0
- package/dist/biome/lib/biome-manifest.d.ts.map +1 -1
- package/dist/biome/lib/biome-manifest.js +6 -10
- package/dist/biome/lib/biome-manifest.js.map +1 -1
- package/dist/biome/xema-biome.schema.json +10 -0
- package/dist/deployment/index.d.ts +3 -0
- package/dist/deployment/index.d.ts.map +1 -1
- package/dist/deployment/index.js +3 -0
- package/dist/deployment/index.js.map +1 -1
- package/dist/deployment/lib/artifact-signer-trust.d.ts +59 -0
- package/dist/deployment/lib/artifact-signer-trust.d.ts.map +1 -0
- package/dist/deployment/lib/artifact-signer-trust.js +121 -0
- package/dist/deployment/lib/artifact-signer-trust.js.map +1 -0
- package/dist/deployment/lib/resolved-deployment.d.ts +38 -0
- package/dist/deployment/lib/resolved-deployment.d.ts.map +1 -0
- package/dist/deployment/lib/resolved-deployment.js +103 -0
- package/dist/deployment/lib/resolved-deployment.js.map +1 -0
- package/dist/deployment/lib/trust-domain.d.ts +3 -0
- package/dist/deployment/lib/trust-domain.d.ts.map +1 -1
- package/dist/deployment/lib/trust-domain.js +17 -1
- package/dist/deployment/lib/trust-domain.js.map +1 -1
- package/dist/deployment/lib/trust-partition.d.ts +28 -0
- package/dist/deployment/lib/trust-partition.d.ts.map +1 -0
- package/dist/deployment/lib/trust-partition.js +93 -0
- package/dist/deployment/lib/trust-partition.js.map +1 -0
- package/dist/distribution/index.d.ts +1 -0
- package/dist/distribution/index.d.ts.map +1 -1
- package/dist/distribution/index.js +1 -0
- package/dist/distribution/index.js.map +1 -1
- package/dist/distribution/lib/distribution-lock.d.ts +37 -2
- package/dist/distribution/lib/distribution-lock.d.ts.map +1 -1
- package/dist/distribution/lib/distribution-lock.js +181 -33
- package/dist/distribution/lib/distribution-lock.js.map +1 -1
- package/dist/distribution/lib/distribution.d.ts +2 -0
- package/dist/distribution/lib/distribution.d.ts.map +1 -1
- package/dist/distribution/lib/distribution.js +2 -0
- package/dist/distribution/lib/distribution.js.map +1 -1
- package/dist/distribution/lib/image-lock.d.ts +4 -3
- package/dist/distribution/lib/image-lock.d.ts.map +1 -1
- package/dist/distribution/lib/image-lock.js +5 -1
- package/dist/distribution/lib/image-lock.js.map +1 -1
- package/dist/distribution/lib/image-producer-evidence.d.ts +3 -3
- package/dist/distribution/lib/image-producer-evidence.d.ts.map +1 -1
- package/dist/distribution/lib/image-producer-evidence.js +1 -0
- package/dist/distribution/lib/image-producer-evidence.js.map +1 -1
- package/dist/distribution/lib/nexus-endpoint-specs.d.ts +1 -0
- package/dist/distribution/lib/nexus-endpoint-specs.d.ts.map +1 -1
- package/dist/distribution/lib/nexus-endpoint-specs.js +4 -4
- package/dist/distribution/lib/nexus-endpoint-specs.js.map +1 -1
- package/dist/distribution/lib/verify-resolved-deployment.d.ts +30 -0
- package/dist/distribution/lib/verify-resolved-deployment.d.ts.map +1 -0
- package/dist/distribution/lib/verify-resolved-deployment.js +117 -0
- package/dist/distribution/lib/verify-resolved-deployment.js.map +1 -0
- package/dist/process-topology/lib/process-topology.d.ts +18 -2
- package/dist/process-topology/lib/process-topology.d.ts.map +1 -1
- package/dist/process-topology/lib/process-topology.js +43 -2
- package/dist/process-topology/lib/process-topology.js.map +1 -1
- package/dist/process-topology/lib/resolve-process-topology.d.ts +3 -0
- package/dist/process-topology/lib/resolve-process-topology.d.ts.map +1 -1
- package/dist/process-topology/lib/resolve-process-topology.js +32 -3
- package/dist/process-topology/lib/resolve-process-topology.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum TrustPartitionViolationCode {
|
|
2
|
+
UnknownBiome = "unknown-biome",
|
|
3
|
+
ExceedsCeiling = "exceeds-ceiling",
|
|
4
|
+
IdentitySpansTrustDomains = "identity-spans-trust-domains",
|
|
5
|
+
DuplicateIdentity = "duplicate-identity",
|
|
6
|
+
UnplacedIdentityBiome = "unplaced-identity-biome"
|
|
7
|
+
}
|
|
8
|
+
export interface TrustPartitionViolation {
|
|
9
|
+
readonly code: TrustPartitionViolationCode;
|
|
10
|
+
readonly domain?: string;
|
|
11
|
+
readonly serviceAccount?: string;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PartitionedBiome {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly trustCeiling: string;
|
|
17
|
+
readonly trustDomain: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function gradeTrustRefinement(biomes: readonly PartitionedBiome[]): TrustPartitionViolation[];
|
|
20
|
+
export interface EnforcementIdentity {
|
|
21
|
+
readonly serviceAccount: string;
|
|
22
|
+
readonly actsFor: readonly {
|
|
23
|
+
readonly biome: string;
|
|
24
|
+
readonly component: string;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
export declare function gradeEnforcementIdentities(identities: readonly EnforcementIdentity[], domainOf: Readonly<Record<string, string>>): TrustPartitionViolation[];
|
|
28
|
+
//# sourceMappingURL=trust-partition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust-partition.d.ts","sourceRoot":"","sources":["../../../src/deployment/lib/trust-partition.ts"],"names":[],"mappings":"AAmBA,oBAAY,2BAA2B;IAErC,YAAY,kBAAkB;IAE9B,cAAc,oBAAoB;IAElC,yBAAyB,iCAAiC;IAE1D,iBAAiB,uBAAuB;IAExC,qBAAqB,4BAA4B;CAClD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAE3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AASD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,uBAAuB,EAAE,CA2B3B;AAGD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACrF;AAaD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,SAAS,mBAAmB,EAAE,EAC1C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,uBAAuB,EAAE,CAkD3B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrustPartitionViolationCode = void 0;
|
|
4
|
+
exports.gradeTrustRefinement = gradeTrustRefinement;
|
|
5
|
+
exports.gradeEnforcementIdentities = gradeEnforcementIdentities;
|
|
6
|
+
var TrustPartitionViolationCode;
|
|
7
|
+
(function (TrustPartitionViolationCode) {
|
|
8
|
+
TrustPartitionViolationCode["UnknownBiome"] = "unknown-biome";
|
|
9
|
+
TrustPartitionViolationCode["ExceedsCeiling"] = "exceeds-ceiling";
|
|
10
|
+
TrustPartitionViolationCode["IdentitySpansTrustDomains"] = "identity-spans-trust-domains";
|
|
11
|
+
TrustPartitionViolationCode["DuplicateIdentity"] = "duplicate-identity";
|
|
12
|
+
TrustPartitionViolationCode["UnplacedIdentityBiome"] = "unplaced-identity-biome";
|
|
13
|
+
})(TrustPartitionViolationCode || (exports.TrustPartitionViolationCode = TrustPartitionViolationCode = {}));
|
|
14
|
+
function gradeTrustRefinement(biomes) {
|
|
15
|
+
const ceilingsOf = new Map();
|
|
16
|
+
for (const biome of biomes) {
|
|
17
|
+
const ceilings = ceilingsOf.get(biome.trustDomain) ?? new Map();
|
|
18
|
+
const members = ceilings.get(biome.trustCeiling) ?? [];
|
|
19
|
+
members.push(biome.id);
|
|
20
|
+
ceilings.set(biome.trustCeiling, members);
|
|
21
|
+
ceilingsOf.set(biome.trustDomain, ceilings);
|
|
22
|
+
}
|
|
23
|
+
const violations = [];
|
|
24
|
+
for (const domain of [...ceilingsOf.keys()].sort(codeUnit)) {
|
|
25
|
+
const ceilings = ceilingsOf.get(domain);
|
|
26
|
+
if (ceilings.size <= 1)
|
|
27
|
+
continue;
|
|
28
|
+
const summary = [...ceilings.entries()]
|
|
29
|
+
.map(([ceiling, members]) => `${ceiling} (${[...members].sort(codeUnit).join(', ')})`)
|
|
30
|
+
.sort(codeUnit)
|
|
31
|
+
.join(' and ');
|
|
32
|
+
violations.push({
|
|
33
|
+
code: TrustPartitionViolationCode.ExceedsCeiling,
|
|
34
|
+
domain,
|
|
35
|
+
message: `trust domain "${domain}" holds biomes of ${ceilings.size} edition ceiling domains: ${summary}. ` +
|
|
36
|
+
`A deployment may only split an edition's trust domains, never merge them; to let these biomes ` +
|
|
37
|
+
`share a domain, the edition must group them in its trustCeiling.`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return violations;
|
|
41
|
+
}
|
|
42
|
+
function gradeEnforcementIdentities(identities, domainOf) {
|
|
43
|
+
const violations = [];
|
|
44
|
+
const seen = new Set();
|
|
45
|
+
for (const identity of identities) {
|
|
46
|
+
if (seen.has(identity.serviceAccount)) {
|
|
47
|
+
violations.push({
|
|
48
|
+
code: TrustPartitionViolationCode.DuplicateIdentity,
|
|
49
|
+
serviceAccount: identity.serviceAccount,
|
|
50
|
+
message: `ServiceAccount "${identity.serviceAccount}" is listed twice; list it once with every ` +
|
|
51
|
+
`component it acts for, since a boundary sees one identity.`,
|
|
52
|
+
});
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
seen.add(identity.serviceAccount);
|
|
56
|
+
const domains = new Map();
|
|
57
|
+
for (const { biome, component } of identity.actsFor) {
|
|
58
|
+
const domain = Object.prototype.hasOwnProperty.call(domainOf, biome)
|
|
59
|
+
? domainOf[biome]
|
|
60
|
+
: undefined;
|
|
61
|
+
if (domain === undefined) {
|
|
62
|
+
violations.push({
|
|
63
|
+
code: TrustPartitionViolationCode.UnplacedIdentityBiome,
|
|
64
|
+
serviceAccount: identity.serviceAccount,
|
|
65
|
+
message: `ServiceAccount "${identity.serviceAccount}" acts for ${biome}/${component}, ` +
|
|
66
|
+
`but the partition places no biome "${biome}".`,
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const members = domains.get(domain) ?? [];
|
|
71
|
+
members.push(`${biome}/${component}`);
|
|
72
|
+
domains.set(domain, members);
|
|
73
|
+
}
|
|
74
|
+
if (domains.size > 1) {
|
|
75
|
+
const summary = [...domains.entries()]
|
|
76
|
+
.map(([domain, members]) => `${domain} (${members.sort(codeUnit).join(', ')})`)
|
|
77
|
+
.sort(codeUnit)
|
|
78
|
+
.join(' and ');
|
|
79
|
+
violations.push({
|
|
80
|
+
code: TrustPartitionViolationCode.IdentitySpansTrustDomains,
|
|
81
|
+
serviceAccount: identity.serviceAccount,
|
|
82
|
+
message: `ServiceAccount "${identity.serviceAccount}" acts for components of ${domains.size} trust ` +
|
|
83
|
+
`domains: ${summary}. One account is one identity at every boundary, so these domains ` +
|
|
84
|
+
`are not separate; run the components under separate accounts or place them in one domain.`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return violations;
|
|
89
|
+
}
|
|
90
|
+
function codeUnit(a, b) {
|
|
91
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=trust-partition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust-partition.js","sourceRoot":"","sources":["../../../src/deployment/lib/trust-partition.ts"],"names":[],"mappings":";;;AA0DA,oDA6BC;AAmBD,gEAqDC;AA5ID,IAAY,2BAWX;AAXD,WAAY,2BAA2B;IAErC,6DAA8B,CAAA;IAE9B,iEAAkC,CAAA;IAElC,yFAA0D,CAAA;IAE1D,uEAAwC,CAAA;IAExC,gFAAiD,CAAA;AACnD,CAAC,EAXW,2BAA2B,2CAA3B,2BAA2B,QAWtC;AA4BD,SAAgB,oBAAoB,CAClC,MAAmC;IAEnC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAiC,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC,G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c,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/distribution/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC"}
|
|
@@ -33,4 +33,5 @@ __exportStar(require("./lib/nexus-binding"), exports);
|
|
|
33
33
|
__exportStar(require("./lib/resolve-nexus-bindings"), exports);
|
|
34
34
|
__exportStar(require("./lib/nexus-endpoint-specs"), exports);
|
|
35
35
|
__exportStar(require("./lib/lock-consumers"), exports);
|
|
36
|
+
__exportStar(require("./lib/verify-resolved-deployment"), exports);
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/distribution/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,8DAA4C;AAC5C,+DAA6C;AAC7C,qDAAmC;AACnC,2DAAyC;AACzC,sDAAoC;AACpC,0DAAwC;AACxC,mDAAiC;AACjC,gEAA8C;AAC9C,kEAAgD;AAChD,sEAAoD;AACpD,mEAAiD;AACjD,uEAAqD;AACrD,+DAA6C;AAC7C,qDAAmC;AACnC,sDAAoC;AACpC,+DAA6C;AAC7C,6DAA2C;AAC3C,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/distribution/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,8DAA4C;AAC5C,+DAA6C;AAC7C,qDAAmC;AACnC,2DAAyC;AACzC,sDAAoC;AACpC,0DAAwC;AACxC,mDAAiC;AACjC,gEAA8C;AAC9C,kEAAgD;AAChD,sEAAoD;AACpD,mEAAiD;AACjD,uEAAqD;AACrD,+DAA6C;AAC7C,qDAAmC;AACnC,sDAAoC;AACpC,+DAA6C;AAC7C,6DAA2C;AAC3C,uDAAqC;AACrC,mEAAiD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BiomeComponentKind, BiomeScalingMode, type BiomeComponentProcessFacts, type PostgresExtensionName, type BiomeTier, type BiomeTarget, type BiomeOrigin, type BiomeAudience, type BiomeBundleSourceSpec } from '../../biome';
|
|
3
|
+
import { type ResolvedDeployment } from '../../deployment';
|
|
3
4
|
import { type ResourceInclusion, type ResourceKindRef, type ResourceLogicalName, type ResourceScope } from '../../resource-requirement';
|
|
4
5
|
import { type PlatformServiceTier } from './distribution';
|
|
5
6
|
import { type ClosureEntry } from './biome-closure';
|
|
@@ -98,7 +99,9 @@ export interface LockedBiome {
|
|
|
98
99
|
nexusRequires?: readonly NexusServiceRequirement[];
|
|
99
100
|
workerTaskQueues?: Readonly<Record<string, readonly LockedWorkerTaskQueue[]>>;
|
|
100
101
|
workflowClients?: Readonly<Record<string, readonly LockedWorkflowClient[]>>;
|
|
101
|
-
|
|
102
|
+
workflowSubjects?: readonly LockedWorkflowSubject[];
|
|
103
|
+
trustCeiling?: string;
|
|
104
|
+
workerImages: Readonly<Record<string, LockedWorkerImage>>;
|
|
102
105
|
imageDigest?: string;
|
|
103
106
|
displayName: string;
|
|
104
107
|
packageName: string | null;
|
|
@@ -120,16 +123,48 @@ export declare const LockedWorkerImageSchema: z.ZodObject<{
|
|
|
120
123
|
entry: z.ZodString;
|
|
121
124
|
}, z.core.$strict>;
|
|
122
125
|
export interface LockedWorkflowClient {
|
|
126
|
+
biome?: string | undefined;
|
|
123
127
|
component: string;
|
|
124
128
|
taskQueue: LockedWorkerTaskQueue;
|
|
125
129
|
}
|
|
126
130
|
export declare const LockedWorkflowClientSchema: z.ZodObject<{
|
|
131
|
+
biome: z.ZodOptional<z.ZodString>;
|
|
127
132
|
component: z.ZodString;
|
|
128
133
|
taskQueue: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
129
134
|
name: z.ZodEnum<typeof import("../../workflow").TaskQueueName>;
|
|
130
135
|
placement: z.ZodEnum<typeof import("../../execution-target").TaskQueuePlacement>;
|
|
131
136
|
}, z.core.$strict>]>;
|
|
132
137
|
}, z.core.$strict>;
|
|
138
|
+
export declare enum WorkflowSubjectPermission {
|
|
139
|
+
Write = "write"
|
|
140
|
+
}
|
|
141
|
+
export declare function controllerTokenServiceAccount(worker: string): string;
|
|
142
|
+
export interface LockedWorkflowSubject {
|
|
143
|
+
component: string;
|
|
144
|
+
permissions: WorkflowSubjectPermission[];
|
|
145
|
+
}
|
|
146
|
+
export declare const LockedWorkflowSubjectSchema: z.ZodObject<{
|
|
147
|
+
component: z.ZodString;
|
|
148
|
+
permissions: z.ZodArray<z.ZodEnum<typeof WorkflowSubjectPermission>>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
export declare function deriveWorkflowSubjects(biome: {
|
|
151
|
+
readonly workerTaskQueues?: Readonly<Record<string, readonly LockedWorkerTaskQueue[]>> | undefined;
|
|
152
|
+
readonly workflowClients?: Readonly<Record<string, readonly LockedWorkflowClient[]>> | undefined;
|
|
153
|
+
}): LockedWorkflowSubject[];
|
|
154
|
+
export interface ResolvedWorkflowSubject {
|
|
155
|
+
serviceAccount: string;
|
|
156
|
+
permissions: WorkflowSubjectPermission[];
|
|
157
|
+
actsFor: {
|
|
158
|
+
biome: string;
|
|
159
|
+
component: string;
|
|
160
|
+
}[];
|
|
161
|
+
}
|
|
162
|
+
export declare function resolveWorkflowSubjects(lock: {
|
|
163
|
+
readonly biomes: readonly {
|
|
164
|
+
readonly id: string;
|
|
165
|
+
readonly workflowSubjects?: readonly LockedWorkflowSubject[] | undefined;
|
|
166
|
+
}[];
|
|
167
|
+
}, resolved: Pick<ResolvedDeployment, 'biomes' | 'serviceAccounts'>): Record<string, ResolvedWorkflowSubject[]>;
|
|
133
168
|
export declare const LockedWorkerTaskQueueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
134
169
|
name: z.ZodEnum<typeof import("../../workflow").TaskQueueName>;
|
|
135
170
|
placement: z.ZodEnum<typeof import("../../execution-target").TaskQueuePlacement>;
|
|
@@ -142,7 +177,7 @@ export interface LockedBiomeDisplay {
|
|
|
142
177
|
summary?: string;
|
|
143
178
|
accent?: string;
|
|
144
179
|
}
|
|
145
|
-
export type LockedBiomeV3 = Omit<LockedBiome, 'bundleSource' | 'serviceResources' | 'serviceProcessFacts' | 'nexusProvides' | 'nexusRequires' | 'workerTaskQueues' | 'workflowClients' | 'workerImages'>;
|
|
180
|
+
export type LockedBiomeV3 = Omit<LockedBiome, 'bundleSource' | 'serviceResources' | 'serviceProcessFacts' | 'nexusProvides' | 'nexusRequires' | 'workerTaskQueues' | 'workflowClients' | 'workflowSubjects' | 'trustCeiling' | 'workerImages'>;
|
|
146
181
|
export type LockedBiomeV2 = Omit<LockedBiomeV3, 'serviceDatabaseExtensions' | 'source'> & {
|
|
147
182
|
source?: LockedBiomeSourceV2;
|
|
148
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution-lock.d.ts","sourceRoot":"","sources":["../../../src/distribution/lib/distribution-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAML,kBAAkB,
|
|
1
|
+
{"version":3,"file":"distribution-lock.d.ts","sourceRoot":"","sources":["../../../src/distribution/lib/distribution-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAML,kBAAkB,EAIlB,gBAAgB,EAEhB,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AAQrB,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EAKh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CAAC,CAAC;AAqBvE,eAAO,MAAM,sBAAsB,EAIlB,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AA2B7C,eAAO,MAAM,4BAA4B,EAOzB,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAmB5C,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,GAAG;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,kBAAkB,EAAE,GAAG,SAAS,CAAC;CACpE,GACA,6BAA6B,CAY/B;AASD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,2BAA2B,GAChC,gBAAgB,CAGlB;AA8CD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAEpE;AASD,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,OAAO,GACX,wBAAwB,CAK1B"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DistributionLockReaderSchema = exports.DistributionLockSchema = exports.DistributionLockV4Schema = exports.DistributionLockV3Schema = exports.DistributionLockV2Schema = exports.DistributionLockResolutionSchema = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_LATEST = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_V3 = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_BASELINE = exports.DISTRIBUTION_LOCK_SCHEMA_VERSIONS = exports.CapabilityDomainOwnerSchema = exports.LockedPlatformServiceSchema = exports.LockedBiomeSchema = exports.LockedBiomeV3Schema = exports.LockedBiomeV2Schema = exports.LockedServiceProcessFactsSchema = exports.LockedWorkerTaskQueueSchema = exports.LockedWorkflowClientSchema = exports.LockedWorkerImageSchema = exports.LockedBiomeSourceSchema = exports.LockedBiomeSourceV2Schema = exports.LockedHostModuleSchema = exports.LockedServiceResourcesSchema = exports.LockedServiceResourceSchema = exports.LockedResourceProviderSchema = exports.LockedServiceDependencySchema = exports.ServiceOwnerIdentitySchema = exports.PlatformServiceOwnerIdentitySchema = exports.BiomeServiceOwnerIdentitySchema = void 0;
|
|
3
|
+
exports.DistributionLockReaderSchema = exports.DistributionLockSchema = exports.DistributionLockV4Schema = exports.DistributionLockV3Schema = exports.DistributionLockV2Schema = exports.DistributionLockResolutionSchema = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_LATEST = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_V3 = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION = exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_BASELINE = exports.DISTRIBUTION_LOCK_SCHEMA_VERSIONS = exports.CapabilityDomainOwnerSchema = exports.LockedPlatformServiceSchema = exports.LockedBiomeSchema = exports.LockedBiomeV3Schema = exports.LockedBiomeV2Schema = exports.LockedServiceProcessFactsSchema = exports.LockedWorkerTaskQueueSchema = exports.LockedWorkflowSubjectSchema = exports.WorkflowSubjectPermission = exports.LockedWorkflowClientSchema = exports.LockedWorkerImageSchema = exports.LockedBiomeSourceSchema = exports.LockedBiomeSourceV2Schema = exports.LockedHostModuleSchema = exports.LockedServiceResourcesSchema = exports.LockedServiceResourceSchema = exports.LockedResourceProviderSchema = exports.LockedServiceDependencySchema = exports.ServiceOwnerIdentitySchema = exports.PlatformServiceOwnerIdentitySchema = exports.BiomeServiceOwnerIdentitySchema = void 0;
|
|
4
4
|
exports.compareLockedServiceResources = compareLockedServiceResources;
|
|
5
5
|
exports.parseLockedServiceResources = parseLockedServiceResources;
|
|
6
|
+
exports.controllerTokenServiceAccount = controllerTokenServiceAccount;
|
|
7
|
+
exports.deriveWorkflowSubjects = deriveWorkflowSubjects;
|
|
8
|
+
exports.resolveWorkflowSubjects = resolveWorkflowSubjects;
|
|
6
9
|
exports.lockedWorkerTaskQueueName = lockedWorkerTaskQueueName;
|
|
7
10
|
exports.lockedVersionedWorkers = lockedVersionedWorkers;
|
|
8
11
|
exports.distributionLockSchemaVersionFor = distributionLockSchemaVersionFor;
|
|
@@ -13,6 +16,8 @@ const zod_1 = require("zod");
|
|
|
13
16
|
const biome_1 = require("../../biome");
|
|
14
17
|
const capability_1 = require("../../capability");
|
|
15
18
|
const execution_target_1 = require("../../execution-target");
|
|
19
|
+
const deployment_1 = require("../../deployment");
|
|
20
|
+
const process_topology_1 = require("../../process-topology");
|
|
16
21
|
const resource_requirement_1 = require("../../resource-requirement");
|
|
17
22
|
const distribution_1 = require("./distribution");
|
|
18
23
|
const biome_closure_1 = require("./biome-closure");
|
|
@@ -158,10 +163,90 @@ exports.LockedWorkerImageSchema = zod_1.z
|
|
|
158
163
|
.strict();
|
|
159
164
|
exports.LockedWorkflowClientSchema = zod_1.z
|
|
160
165
|
.object({
|
|
166
|
+
biome: biome_1.BiomeIdSchema.optional(),
|
|
161
167
|
component: zod_1.z.string().min(1),
|
|
162
168
|
taskQueue: execution_target_1.WorkerTaskQueueRefSchema,
|
|
163
169
|
})
|
|
164
170
|
.strict();
|
|
171
|
+
var WorkflowSubjectPermission;
|
|
172
|
+
(function (WorkflowSubjectPermission) {
|
|
173
|
+
WorkflowSubjectPermission["Write"] = "write";
|
|
174
|
+
})(WorkflowSubjectPermission || (exports.WorkflowSubjectPermission = WorkflowSubjectPermission = {}));
|
|
175
|
+
const CONTROLLER_TOKEN_SERVICE_ACCOUNT_SUFFIX = '-controller-token';
|
|
176
|
+
function controllerTokenServiceAccount(worker) {
|
|
177
|
+
return `${worker}${CONTROLLER_TOKEN_SERVICE_ACCOUNT_SUFFIX}`;
|
|
178
|
+
}
|
|
179
|
+
exports.LockedWorkflowSubjectSchema = zod_1.z
|
|
180
|
+
.object({
|
|
181
|
+
component: zod_1.z.string().min(1),
|
|
182
|
+
permissions: zod_1.z
|
|
183
|
+
.array(zod_1.z.nativeEnum(WorkflowSubjectPermission))
|
|
184
|
+
.min(1)
|
|
185
|
+
.refine((permissions) => new Set(permissions).size === permissions.length, {
|
|
186
|
+
message: 'must not name a permission twice',
|
|
187
|
+
}),
|
|
188
|
+
})
|
|
189
|
+
.strict();
|
|
190
|
+
function deriveWorkflowSubjects(biome) {
|
|
191
|
+
const components = new Set([
|
|
192
|
+
...Object.keys(biome.workerTaskQueues ?? {}),
|
|
193
|
+
...Object.keys(biome.workflowClients ?? {}),
|
|
194
|
+
]);
|
|
195
|
+
return [...components].sort(codeUnitOrder).map((component) => ({
|
|
196
|
+
component,
|
|
197
|
+
permissions: [WorkflowSubjectPermission.Write],
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
function resolveWorkflowSubjects(lock, resolved) {
|
|
201
|
+
const domainOf = new Map(resolved.biomes.map((biome) => [biome.id, biome.trustDomain]));
|
|
202
|
+
const accountsOf = new Map();
|
|
203
|
+
for (const account of resolved.serviceAccounts) {
|
|
204
|
+
for (const { biome, component } of account.actsFor) {
|
|
205
|
+
const key = `${biome}/${component}`;
|
|
206
|
+
accountsOf.set(key, [...(accountsOf.get(key) ?? []), account.name]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const byDomain = new Map();
|
|
210
|
+
for (const biome of lock.biomes) {
|
|
211
|
+
const subjects = biome.workflowSubjects ?? [];
|
|
212
|
+
if (subjects.length === 0)
|
|
213
|
+
continue;
|
|
214
|
+
const domain = domainOf.get(biome.id);
|
|
215
|
+
if (domain === undefined) {
|
|
216
|
+
throw new Error(`resolveWorkflowSubjects: the resolved deployment places no biome "${biome.id}"; it was not resolved from this lock`);
|
|
217
|
+
}
|
|
218
|
+
const rows = byDomain.get(domain) ?? new Map();
|
|
219
|
+
for (const subject of subjects) {
|
|
220
|
+
for (const serviceAccount of accountsOf.get(`${biome.id}/${subject.component}`) ?? []) {
|
|
221
|
+
const row = rows.get(serviceAccount) ?? { serviceAccount, permissions: [], actsFor: [] };
|
|
222
|
+
for (const permission of subject.permissions) {
|
|
223
|
+
if (!row.permissions.includes(permission))
|
|
224
|
+
row.permissions.push(permission);
|
|
225
|
+
}
|
|
226
|
+
row.actsFor.push({ biome: biome.id, component: subject.component });
|
|
227
|
+
rows.set(serviceAccount, row);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
byDomain.set(domain, rows);
|
|
231
|
+
}
|
|
232
|
+
const result = {};
|
|
233
|
+
for (const domain of [...byDomain.keys()].sort(codeUnitOrder)) {
|
|
234
|
+
const rows = [...byDomain.get(domain).values()];
|
|
235
|
+
if (rows.length === 0)
|
|
236
|
+
continue;
|
|
237
|
+
result[domain] = rows
|
|
238
|
+
.map((row) => ({
|
|
239
|
+
serviceAccount: row.serviceAccount,
|
|
240
|
+
permissions: [...row.permissions].sort(codeUnitOrder),
|
|
241
|
+
actsFor: [...row.actsFor].sort((a, b) => codeUnitOrder(a.biome, b.biome) || codeUnitOrder(a.component, b.component)),
|
|
242
|
+
}))
|
|
243
|
+
.sort((a, b) => codeUnitOrder(a.serviceAccount, b.serviceAccount));
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
function codeUnitOrder(a, b) {
|
|
248
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
249
|
+
}
|
|
165
250
|
exports.LockedWorkerTaskQueueSchema = execution_target_1.WorkerTaskQueueRefSchema;
|
|
166
251
|
function lockedWorkerTaskQueueName(queue) {
|
|
167
252
|
return (0, execution_target_1.workerTaskQueueRefDeclaration)(queue).name;
|
|
@@ -321,6 +406,8 @@ const refineLockedBiomeResources = (value, context) => {
|
|
|
321
406
|
(0, resolve_nexus_bindings_1.refineLockedNexusFacts)(value, context);
|
|
322
407
|
refineLockedWorkerTaskQueues(value, context);
|
|
323
408
|
refineLockedWorkflowClients(value, context);
|
|
409
|
+
refineLockedWorkflowSubjects(value, context);
|
|
410
|
+
refineLockedTrustCeiling(value, context);
|
|
324
411
|
refineLockedWorkerImages(value, context);
|
|
325
412
|
};
|
|
326
413
|
const refineLockedWorkerImages = (value, context) => {
|
|
@@ -414,7 +501,7 @@ const refineLockedWorkflowClients = (value, context) => {
|
|
|
414
501
|
clients.forEach((client, index) => {
|
|
415
502
|
const clientQueue = (0, execution_target_1.workerTaskQueueRefDeclaration)(client.taskQueue);
|
|
416
503
|
const clientQueueKey = (0, execution_target_1.workerTaskQueueKey)(clientQueue);
|
|
417
|
-
const pair = `${client.component}:${clientQueueKey}`;
|
|
504
|
+
const pair = `${client.biome ?? value.id}/${client.component}:${clientQueueKey}`;
|
|
418
505
|
if (seen.has(pair)) {
|
|
419
506
|
context.addIssue({
|
|
420
507
|
code: zod_1.z.ZodIssueCode.custom,
|
|
@@ -423,6 +510,8 @@ const refineLockedWorkflowClients = (value, context) => {
|
|
|
423
510
|
});
|
|
424
511
|
}
|
|
425
512
|
seen.add(pair);
|
|
513
|
+
if (client.biome !== undefined && client.biome !== value.id)
|
|
514
|
+
return;
|
|
426
515
|
const queues = Object.prototype.hasOwnProperty.call(workerQueues, client.component)
|
|
427
516
|
? workerQueues[client.component]
|
|
428
517
|
: undefined;
|
|
@@ -443,6 +532,42 @@ const refineLockedWorkflowClients = (value, context) => {
|
|
|
443
532
|
});
|
|
444
533
|
}
|
|
445
534
|
};
|
|
535
|
+
const refineLockedWorkflowSubjects = (value, context) => {
|
|
536
|
+
const stated = value.workflowSubjects;
|
|
537
|
+
if (stated === undefined)
|
|
538
|
+
return;
|
|
539
|
+
if (stated.length === 0) {
|
|
540
|
+
context.addIssue({
|
|
541
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
542
|
+
path: ['workflowSubjects'],
|
|
543
|
+
message: 'must be omitted when empty',
|
|
544
|
+
});
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const expected = deriveWorkflowSubjects(value);
|
|
548
|
+
const render = (row) => row === undefined ? '(none)' : JSON.stringify(row);
|
|
549
|
+
for (let index = 0; index < Math.max(stated.length, expected.length); index += 1) {
|
|
550
|
+
if (render(stated[index]) !== render(expected[index])) {
|
|
551
|
+
context.addIssue({
|
|
552
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
553
|
+
path: ['workflowSubjects', index],
|
|
554
|
+
message: `differs from the subjects derived from biome "${value.id}": stated ${render(stated[index])}, derived ${render(expected[index])}`,
|
|
555
|
+
});
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
const refineLockedTrustCeiling = (value, context) => {
|
|
561
|
+
if (value.trustCeiling === undefined || value.origin === undefined)
|
|
562
|
+
return;
|
|
563
|
+
if (value.trustCeiling === (0, process_topology_1.defaultTrustDomain)(value.id, value.origin)) {
|
|
564
|
+
context.addIssue({
|
|
565
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
566
|
+
path: ['trustCeiling'],
|
|
567
|
+
message: `"${value.trustCeiling}" is biome "${value.id}"'s default domain; the writer omits it`,
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
446
571
|
function lockedVersionedWorkers(biome) {
|
|
447
572
|
return Object.keys(biome.workerTaskQueues ?? {}).sort();
|
|
448
573
|
}
|
|
@@ -490,10 +615,11 @@ const lockedBiomeV4Shape = {
|
|
|
490
615
|
.record(zod_1.z.string().min(1), zod_1.z.array(exports.LockedWorkflowClientSchema).min(1).readonly())
|
|
491
616
|
.readonly()
|
|
492
617
|
.optional(),
|
|
618
|
+
workflowSubjects: zod_1.z.array(exports.LockedWorkflowSubjectSchema).readonly().optional(),
|
|
619
|
+
trustCeiling: deployment_1.TrustDomainNameSchema.optional(),
|
|
493
620
|
workerImages: zod_1.z
|
|
494
621
|
.record(zod_1.z.string().min(1), exports.LockedWorkerImageSchema)
|
|
495
|
-
.readonly()
|
|
496
|
-
.optional(),
|
|
622
|
+
.readonly(),
|
|
497
623
|
};
|
|
498
624
|
const lockedBiomeV4Object = zod_1.z
|
|
499
625
|
.object(lockedBiomeV4Shape)
|
|
@@ -517,6 +643,7 @@ const readerLockedBiomeV4Object = zod_1.z
|
|
|
517
643
|
.array(ReaderLockedServiceResourceSchema)
|
|
518
644
|
.readonly()
|
|
519
645
|
.optional(),
|
|
646
|
+
workerImages: lockedBiomeV4Shape.workerImages.optional(),
|
|
520
647
|
})
|
|
521
648
|
.superRefine(refineLockedBiome);
|
|
522
649
|
exports.LockedPlatformServiceSchema = zod_1.z
|
|
@@ -651,6 +778,46 @@ const refineResourceProviders = (lock, context) => {
|
|
|
651
778
|
});
|
|
652
779
|
});
|
|
653
780
|
};
|
|
781
|
+
const refineCrossBiomeWorkflowClients = (lock, context) => {
|
|
782
|
+
const byId = new Map(lock.biomes.map((biome) => [biome.id, biome]));
|
|
783
|
+
lock.biomes.forEach((biome, biomeIndex) => {
|
|
784
|
+
for (const [name, clients] of Object.entries(biome.workflowClients ?? {})) {
|
|
785
|
+
clients.forEach((client, index) => {
|
|
786
|
+
if (client.biome === undefined || client.biome === biome.id)
|
|
787
|
+
return;
|
|
788
|
+
const path = ['biomes', biomeIndex, 'workflowClients', name, index];
|
|
789
|
+
const target = byId.get(client.biome);
|
|
790
|
+
if (target === undefined) {
|
|
791
|
+
context.addIssue({
|
|
792
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
793
|
+
path: [...path, 'biome'],
|
|
794
|
+
message: `names biome "${client.biome}", which this lock does not ship`,
|
|
795
|
+
});
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const queues = Object.prototype.hasOwnProperty.call(target.workerTaskQueues ?? {}, client.component)
|
|
799
|
+
? target.workerTaskQueues?.[client.component]
|
|
800
|
+
: undefined;
|
|
801
|
+
if (queues === undefined) {
|
|
802
|
+
context.addIssue({
|
|
803
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
804
|
+
path: [...path, 'component'],
|
|
805
|
+
message: `"${client.component}" is not a worker/v2 of biome "${client.biome}" — it has no workerTaskQueues entry`,
|
|
806
|
+
});
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
const wanted = (0, execution_target_1.workerTaskQueueRefDeclaration)(client.taskQueue);
|
|
810
|
+
if (!queues.some((queue) => (0, execution_target_1.sameWorkerTaskQueue)((0, execution_target_1.workerTaskQueueRefDeclaration)(queue), wanted))) {
|
|
811
|
+
context.addIssue({
|
|
812
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
813
|
+
path: [...path, 'taskQueue'],
|
|
814
|
+
message: `task queue "${(0, execution_target_1.workerTaskQueueKey)(wanted)}" is not one worker "${client.component}" of biome "${client.biome}" polls`,
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
};
|
|
654
821
|
const distributionLockV4Object = zod_1.z
|
|
655
822
|
.object({
|
|
656
823
|
schemaVersion: zod_1.z.literal(exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_LATEST),
|
|
@@ -663,7 +830,8 @@ const distributionLockV4Object = zod_1.z
|
|
|
663
830
|
.superRefine(refineResourceProviders)
|
|
664
831
|
.superRefine(refineResolutionCoverage)
|
|
665
832
|
.superRefine(nexus_binding_1.refineNexusBindings)
|
|
666
|
-
.superRefine(resolve_nexus_bindings_1.refineNexusBindingsAgreeWithFacts)
|
|
833
|
+
.superRefine(resolve_nexus_bindings_1.refineNexusBindingsAgreeWithFacts)
|
|
834
|
+
.superRefine(refineCrossBiomeWorkflowClients);
|
|
667
835
|
const readerDistributionLockV2Object = zod_1.z.looseObject({
|
|
668
836
|
schemaVersion: zod_1.z.literal(exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_BASELINE),
|
|
669
837
|
biomes: zod_1.z.array(readerLockedBiomeV2Object).readonly(),
|
|
@@ -695,35 +863,15 @@ exports.DistributionLockReaderSchema = zod_1.z.discriminatedUnion('schemaVersion
|
|
|
695
863
|
readerDistributionLockV4Object,
|
|
696
864
|
]);
|
|
697
865
|
function distributionLockSchemaVersionFor(body) {
|
|
698
|
-
|
|
699
|
-
(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
(biome.serviceProcessFacts !== undefined &&
|
|
706
|
-
Object.keys(biome.serviceProcessFacts).length > 0) ||
|
|
707
|
-
(biome.nexusProvides !== undefined && biome.nexusProvides.length > 0) ||
|
|
708
|
-
(biome.nexusRequires !== undefined && biome.nexusRequires.length > 0) ||
|
|
709
|
-
(biome.workerTaskQueues !== undefined &&
|
|
710
|
-
Object.keys(biome.workerTaskQueues).length > 0) ||
|
|
711
|
-
(biome.workflowClients !== undefined &&
|
|
712
|
-
Object.keys(biome.workflowClients).length > 0) ||
|
|
713
|
-
(biome.workerImages !== undefined &&
|
|
714
|
-
Object.keys(biome.workerImages).length > 0))) {
|
|
715
|
-
return exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_LATEST;
|
|
716
|
-
}
|
|
717
|
-
for (const biome of body.biomes) {
|
|
718
|
-
const extensions = biome.serviceDatabaseExtensions;
|
|
719
|
-
if (extensions !== undefined && Object.keys(extensions).length > 0) {
|
|
720
|
-
return exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_V3;
|
|
721
|
-
}
|
|
722
|
-
if (biome.source?.imageNamePrefix !== undefined) {
|
|
723
|
-
return exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_V3;
|
|
724
|
-
}
|
|
866
|
+
const silent = body.biomes
|
|
867
|
+
.filter((biome) => biome.workerImages === undefined)
|
|
868
|
+
.map((biome) => biome.id);
|
|
869
|
+
if (silent.length > 0) {
|
|
870
|
+
throw new Error(`distribution lock biome(s) ${silent.join(', ')} state no workerImages: a ` +
|
|
871
|
+
`producer states every biome's shared-image workers, {} when it has none, ` +
|
|
872
|
+
`so that an absent field can never read as "no workers"`);
|
|
725
873
|
}
|
|
726
|
-
return exports.
|
|
874
|
+
return exports.DISTRIBUTION_LOCK_SCHEMA_VERSION_LATEST;
|
|
727
875
|
}
|
|
728
876
|
function sealDistributionLock(body) {
|
|
729
877
|
const schemaVersion = distributionLockSchemaVersionFor(body);
|