@xemahq/xema 0.26.0 → 0.28.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/README.md +70 -37
- package/dist/assets/distribution-assets.manifest.json +1 -2
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/dev.js +1 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +7 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/edition.d.ts +3 -0
- package/dist/commands/edition.d.ts.map +1 -0
- package/dist/commands/edition.js +46 -0
- package/dist/commands/edition.js.map +1 -0
- package/dist/commands/init.js +2 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/serve.js +1 -0
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/up.js +1 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/dev/env-defaults.d.ts.map +1 -1
- package/dist/dev/env-defaults.js +5 -2
- package/dist/dev/env-defaults.js.map +1 -1
- package/dist/dev/infra-preflight.d.ts +3 -2
- package/dist/dev/infra-preflight.d.ts.map +1 -1
- package/dist/dev/infra-preflight.js +18 -8
- package/dist/dev/infra-preflight.js.map +1 -1
- package/dist/edition/verify-image-evidence.bundle.mjs +54283 -0
- package/dist/edition/verify-image-evidence.bundle.provenance.json +2877 -0
- package/dist/runtime/config/schema.d.ts +1 -0
- package/dist/runtime/config/schema.d.ts.map +1 -1
- package/dist/runtime/custody/local-custody.d.ts +12 -0
- package/dist/runtime/custody/local-custody.d.ts.map +1 -0
- package/dist/runtime/custody/local-custody.js +22 -0
- package/dist/runtime/custody/local-custody.js.map +1 -0
- package/dist/runtime/custody/openbao-custody-bootstrap.d.ts +18 -0
- package/dist/runtime/custody/openbao-custody-bootstrap.d.ts.map +1 -0
- package/dist/runtime/custody/openbao-custody-bootstrap.js +50 -0
- package/dist/runtime/custody/openbao-custody-bootstrap.js.map +1 -0
- package/dist/runtime/custody/openbao-custody-store.d.ts +18 -0
- package/dist/runtime/custody/openbao-custody-store.d.ts.map +1 -0
- package/dist/runtime/custody/openbao-custody-store.js +55 -0
- package/dist/runtime/custody/openbao-custody-store.js.map +1 -0
- package/dist/runtime/custody/openbao-http-client.d.ts +34 -0
- package/dist/runtime/custody/openbao-http-client.d.ts.map +1 -0
- package/dist/runtime/custody/openbao-http-client.js +154 -0
- package/dist/runtime/custody/openbao-http-client.js.map +1 -0
- package/dist/runtime/custody/openbao-local-constants.d.ts +22 -0
- package/dist/runtime/custody/openbao-local-constants.d.ts.map +1 -0
- package/dist/runtime/custody/openbao-local-constants.js +48 -0
- package/dist/runtime/custody/openbao-local-constants.js.map +1 -0
- package/dist/runtime/custody/openbao-local-runner.d.ts +16 -0
- package/dist/runtime/custody/openbao-local-runner.d.ts.map +1 -0
- package/dist/runtime/custody/openbao-local-runner.js +86 -0
- package/dist/runtime/custody/openbao-local-runner.js.map +1 -0
- package/dist/runtime/edition/run-entry.d.ts +9 -0
- package/dist/runtime/edition/run-entry.d.ts.map +1 -0
- package/dist/runtime/edition/run-entry.js +36 -0
- package/dist/runtime/edition/run-entry.js.map +1 -0
- package/dist/runtime/edition/verb-map.d.ts +60 -0
- package/dist/runtime/edition/verb-map.d.ts.map +1 -0
- package/dist/runtime/edition/verb-map.js +146 -0
- package/dist/runtime/edition/verb-map.js.map +1 -0
- package/dist/runtime/env-seeder.d.ts +2 -0
- package/dist/runtime/env-seeder.d.ts.map +1 -1
- package/dist/runtime/env-seeder.js +18 -3
- package/dist/runtime/env-seeder.js.map +1 -1
- package/dist/runtime/launch.d.ts +2 -1
- package/dist/runtime/launch.d.ts.map +1 -1
- package/dist/runtime/launch.js +31 -7
- package/dist/runtime/launch.js.map +1 -1
- package/dist/runtime/paths.d.ts +1 -2
- package/dist/runtime/paths.d.ts.map +1 -1
- package/dist/runtime/paths.js +0 -10
- package/dist/runtime/paths.js.map +1 -1
- package/dist/runtime/runner/chart-local-provenance.d.ts +20 -0
- package/dist/runtime/runner/chart-local-provenance.d.ts.map +1 -0
- package/dist/runtime/runner/chart-local-provenance.js +114 -0
- package/dist/runtime/runner/chart-local-provenance.js.map +1 -0
- package/dist/runtime/runner/chart-preflight.d.ts +8 -8
- package/dist/runtime/runner/chart-preflight.d.ts.map +1 -1
- package/dist/runtime/runner/chart-preflight.js +30 -69
- package/dist/runtime/runner/chart-preflight.js.map +1 -1
- package/dist/runtime/runner/chart-pull.d.ts +14 -0
- package/dist/runtime/runner/chart-pull.d.ts.map +1 -0
- package/dist/runtime/runner/chart-pull.js +96 -0
- package/dist/runtime/runner/chart-pull.js.map +1 -0
- package/dist/runtime/runner/chart-resolver.d.ts +4 -12
- package/dist/runtime/runner/chart-resolver.d.ts.map +1 -1
- package/dist/runtime/runner/chart-resolver.js +16 -62
- package/dist/runtime/runner/chart-resolver.js.map +1 -1
- package/dist/runtime/runner/chart-set-lock.d.ts +6 -20
- package/dist/runtime/runner/chart-set-lock.d.ts.map +1 -1
- package/dist/runtime/runner/chart-set-lock.js +55 -99
- package/dist/runtime/runner/chart-set-lock.js.map +1 -1
- package/dist/runtime/runner/helm-cli.d.ts +3 -1
- package/dist/runtime/runner/helm-cli.d.ts.map +1 -1
- package/dist/runtime/runner/helm-cli.js +9 -7
- package/dist/runtime/runner/helm-cli.js.map +1 -1
- package/dist/runtime/runner/helm-runner.d.ts +4 -4
- package/dist/runtime/runner/helm-runner.d.ts.map +1 -1
- package/dist/runtime/runner/helm-runner.js +18 -16
- package/dist/runtime/runner/helm-runner.js.map +1 -1
- package/dist/runtime/sources/kinds/git.d.ts +1 -2
- package/dist/runtime/sources/kinds/git.d.ts.map +1 -1
- package/dist/runtime/sources/kinds/git.js +8 -5
- package/dist/runtime/sources/kinds/git.js.map +1 -1
- package/dist/runtime/sources/manifest-walk.d.ts +3 -1
- package/dist/runtime/sources/manifest-walk.d.ts.map +1 -1
- package/dist/runtime/sources/manifest-walk.js +8 -3
- package/dist/runtime/sources/manifest-walk.js.map +1 -1
- package/dist/runtime/sources/schema.d.ts +3 -0
- package/dist/runtime/sources/schema.d.ts.map +1 -1
- package/dist/runtime/sources/schema.js +6 -1
- package/dist/runtime/sources/schema.js.map +1 -1
- package/dist/runtime/supervisor.d.ts +2 -0
- package/dist/runtime/supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor.js +1 -0
- package/dist/runtime/supervisor.js.map +1 -1
- package/edition/README.md +313 -0
- package/edition/assemble-producer-input.mjs +1251 -0
- package/edition/authorization-base.mjs +347 -0
- package/edition/biome-content.mjs +268 -0
- package/edition/build-biome-index.mjs +175 -0
- package/edition/build-platform-service-index.mjs +288 -0
- package/edition/build-runtime-image-source-index.mjs +821 -0
- package/edition/built-verifier.mjs +55 -0
- package/edition/catalogue-edition.mjs +49 -0
- package/edition/catalogue-fetch.mjs +64 -0
- package/edition/catalogue.mjs +135 -0
- package/edition/chart-set-source-commit.mjs +92 -0
- package/edition/check-committed-image-evidence.mjs +383 -0
- package/edition/checkout-indexed-source-repositories.mjs +105 -0
- package/edition/comment-blanker.mjs +75 -0
- package/edition/connector-source-authority.mjs +60 -0
- package/edition/customer-definition.mjs +183 -0
- package/edition/customer-flags.mjs +7 -0
- package/edition/develop-customer-edition.mjs +99 -0
- package/edition/develop-edition-resolve.mjs +65 -0
- package/edition/develop-edition.mjs +274 -0
- package/edition/develop-freeze.mjs +173 -0
- package/edition/develop-image-coordinate.mjs +54 -0
- package/edition/develop-seal.mjs +77 -0
- package/edition/develop-snapshot-inputs.mjs +104 -0
- package/edition/dist-check.mjs +986 -0
- package/edition/distribution-evidence-set.mjs +987 -0
- package/edition/distribution-paths.mjs +191 -0
- package/edition/edition-artifact.mjs +284 -0
- package/edition/edition-biome-manifests.mjs +85 -0
- package/edition/edition-channel.mjs +6 -0
- package/edition/edition-chart-set.mjs +93 -0
- package/edition/edition-config.mjs +205 -0
- package/edition/edition-constants.mjs +57 -0
- package/edition/edition-contract.json +30 -0
- package/edition/edition-list.mjs +35 -0
- package/edition/edition-locks.mjs +69 -0
- package/edition/edition-protocol.mjs +228 -0
- package/edition/edition-workspace.mjs +187 -0
- package/edition/evidence-checkout.mjs +439 -0
- package/edition/evidence-grammars.mjs +16 -0
- package/edition/evidence-trust-pin.mjs +304 -0
- package/edition/evidence-trust-policy.mjs +294 -0
- package/edition/external-source-walk.mjs +463 -0
- package/edition/first-party-source-ids.mjs +59 -0
- package/edition/fleet-coordinate-finality.mjs +350 -0
- package/edition/git-source-auth.mjs +52 -0
- package/edition/image-delivery-entitlement-descriptor.mjs +106 -0
- package/edition/image-evidence-replay-state.mjs +242 -0
- package/edition/image-evidence.mjs +1233 -0
- package/edition/kernel-contract-authority.mjs +443 -0
- package/edition/lib.mjs +3021 -0
- package/edition/no-follow-file.mjs +94 -0
- package/edition/oci-evidence-verbs.mjs +392 -0
- package/edition/oci-image-source-evidence.mjs +239 -0
- package/edition/oras.mjs +648 -0
- package/edition/pin-source.mjs +227 -0
- package/edition/plan-image-evidence-refresh.mjs +408 -0
- package/edition/platform-lock-readability.mjs +892 -0
- package/edition/platform-service-class.mjs +18 -0
- package/edition/platform-service-source-authority.mjs +105 -0
- package/edition/positive-closure.mjs +162 -0
- package/edition/produce-distribution-completeness-evidence.mjs +311 -0
- package/edition/produce-image-delivery-entitlement-evidence.mjs +294 -0
- package/edition/produce-image-source-evidence.mjs +765 -0
- package/edition/producer-evidence-bundle.mjs +157 -0
- package/edition/registry-credentials.mjs +193 -0
- package/edition/release-catalogue.mjs +39 -0
- package/edition/release-channel-guard.mjs +109 -0
- package/edition/release-edition-artifact.mjs +157 -0
- package/edition/remedy-command.mjs +89 -0
- package/edition/repin-evidence-trust.mjs +101 -0
- package/edition/required-resource-provider.mjs +58 -0
- package/edition/resolve-chart-set.mjs +415 -0
- package/edition/resolve-customer-edition.mjs +288 -0
- package/edition/resolve-distribution.mjs +2318 -0
- package/edition/resolve-edition.mjs +186 -0
- package/edition/resolve-images.mjs +1606 -0
- package/edition/seal-image-digests.mjs +855 -0
- package/edition/sealed-evidence-accept.mjs +82 -0
- package/edition/source-authority.mjs +725 -0
- package/edition/source-closure.mjs +116 -0
- package/edition/strict-json.mjs +121 -0
- package/edition/string-order.mjs +5 -0
- package/edition/trust-policy-arming.mjs +120 -0
- package/edition/trusted-executable.mjs +166 -0
- package/edition/verifier-binding.mjs +45 -0
- package/edition/verifier-files.mjs +8 -0
- package/edition/verifier-kernel-schemas.mjs +22 -0
- package/edition/verifier-provenance.mjs +64 -0
- package/edition/verify-image-evidence.mjs +458 -0
- package/edition/verify-image-platforms.mjs +495 -0
- package/edition/why.mjs +56 -0
- package/edition/workspace-sections.mjs +195 -0
- package/examples/06-biome-sources.yaml +1 -0
- package/package.json +14 -6
- package/dist/commands/dist.d.ts +0 -16
- package/dist/commands/dist.d.ts.map +0 -1
- package/dist/commands/dist.js +0 -182
- package/dist/commands/dist.js.map +0 -1
- package/dist/runtime/distribution/available-biome.d.ts +0 -10
- package/dist/runtime/distribution/available-biome.d.ts.map +0 -1
- package/dist/runtime/distribution/available-biome.js +0 -156
- package/dist/runtime/distribution/available-biome.js.map +0 -1
- package/dist/runtime/distribution/compose.d.ts +0 -23
- package/dist/runtime/distribution/compose.d.ts.map +0 -1
- package/dist/runtime/distribution/compose.js +0 -48
- package/dist/runtime/distribution/compose.js.map +0 -1
- package/dist/runtime/runner/chart-trust.d.ts +0 -57
- package/dist/runtime/runner/chart-trust.d.ts.map +0 -1
- package/dist/runtime/runner/chart-trust.js +0 -270
- package/dist/runtime/runner/chart-trust.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// The strict parsers for the product-data sections of `edition-workspace.json`.
|
|
2
|
+
// The library owns these SCHEMAS; the VALUES (which repository holds which
|
|
3
|
+
// service, which sources the runtime images are built from, which repository
|
|
4
|
+
// key a pin role uses) are the data root's. Every parser refuses an unknown key,
|
|
5
|
+
// a missing key and a wrong type, naming the section and the path.
|
|
6
|
+
|
|
7
|
+
const FILE = 'edition-workspace.json';
|
|
8
|
+
|
|
9
|
+
const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
10
|
+
|
|
11
|
+
function fail(where, message) {
|
|
12
|
+
throw new Error(`${FILE}: ${where} ${message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** An object with exactly `required` plus any of `optional` keys. */
|
|
16
|
+
function exactObject(value, where, required, optional = []) {
|
|
17
|
+
if (!isObject(value)) {fail(where, 'must be an object');}
|
|
18
|
+
for (const key of Object.keys(value)) {
|
|
19
|
+
if (!required.includes(key) && !optional.includes(key)) {fail(where, `has unknown key "${key}"`);}
|
|
20
|
+
}
|
|
21
|
+
for (const key of required) {
|
|
22
|
+
if (!Object.hasOwn(value, key)) {fail(where, `is missing "${key}"`);}
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function text(value, where) {
|
|
28
|
+
if (typeof value !== 'string' || value.length === 0) {fail(where, 'must be a non-empty string');}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function textList(value, where) {
|
|
33
|
+
if (!Array.isArray(value)) {fail(where, 'must be an array of strings');}
|
|
34
|
+
return Object.freeze(value.map((item, i) => text(item, `${where}[${i}]`)));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function list(value, where, parseItem) {
|
|
38
|
+
if (!Array.isArray(value)) {fail(where, 'must be an array');}
|
|
39
|
+
return Object.freeze(value.map((item, i) => Object.freeze(parseItem(item, `${where}[${i}]`))));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function uniqueBy(items, where, keyOf) {
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
for (const item of items) {
|
|
45
|
+
const key = keyOf(item);
|
|
46
|
+
if (seen.has(key)) {fail(where, `declares "${key}" twice`);}
|
|
47
|
+
seen.add(key);
|
|
48
|
+
}
|
|
49
|
+
return items;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A repository handle: `repos/<r>` or `submodules/<r>`, the sources-root layout. */
|
|
53
|
+
const REPO_HANDLE = /^(?:repos|submodules)\/[a-z0-9][a-z0-9-]*$/;
|
|
54
|
+
const SOURCE_ID = /^[a-z][a-z0-9-]*$/;
|
|
55
|
+
|
|
56
|
+
function repoHandle(value, where) {
|
|
57
|
+
if (typeof value !== 'string' || !REPO_HANDLE.test(value)) {
|
|
58
|
+
fail(where, `must be a source checkout handle repos/<name> or submodules/<name>; got ${JSON.stringify(value)}`);
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const RuntimeSubjectKind = Object.freeze({
|
|
64
|
+
Service: 'service',
|
|
65
|
+
Host: 'host',
|
|
66
|
+
RuntimeComponent: 'runtime-component',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const SUBJECT_KINDS = Object.values(RuntimeSubjectKind);
|
|
70
|
+
|
|
71
|
+
function subjectKind(value, where) {
|
|
72
|
+
if (!SUBJECT_KINDS.includes(value)) {fail(where, `must be one of ${SUBJECT_KINDS.join(', ')}`);}
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function parseFirstPartySources(value) {
|
|
77
|
+
const where = '"firstPartySources"';
|
|
78
|
+
if (!isObject(value) || Object.keys(value).length === 0) {fail(where, 'must be a non-empty {repo handle: source id} object');}
|
|
79
|
+
const entries = Object.entries(value).map(([repo, id]) => {
|
|
80
|
+
repoHandle(repo, `${where} key`);
|
|
81
|
+
if (typeof id !== 'string' || !SOURCE_ID.test(id)) {
|
|
82
|
+
fail(`${where}["${repo}"]`, `must be a lowercase kebab-case source id; got ${JSON.stringify(id)}`);
|
|
83
|
+
}
|
|
84
|
+
return [repo, id];
|
|
85
|
+
});
|
|
86
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function parseRuntimeBinding(value, where) {
|
|
90
|
+
if (value === null) {return null;}
|
|
91
|
+
exactObject(value, where, ['subjectKind', 'subjectId']);
|
|
92
|
+
return { subjectKind: subjectKind(value.subjectKind, `${where}.subjectKind`), subjectId: text(value.subjectId, `${where}.subjectId`) };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function parsePlatformServiceSources(value) {
|
|
96
|
+
const where = '"platformServiceSources"';
|
|
97
|
+
const items = list(value, where, (item, at) => {
|
|
98
|
+
exactObject(item, at, ['name', 'tier', 'repo', 'manifestPath', 'manifestName', 'imageKey', 'runtimeBinding'], ['installationClass']);
|
|
99
|
+
return {
|
|
100
|
+
name: text(item.name, `${at}.name`),
|
|
101
|
+
tier: text(item.tier, `${at}.tier`),
|
|
102
|
+
...(item.installationClass === undefined ? {} : { installationClass: text(item.installationClass, `${at}.installationClass`) }),
|
|
103
|
+
repo: repoHandle(item.repo, `${at}.repo`),
|
|
104
|
+
manifestPath: text(item.manifestPath, `${at}.manifestPath`),
|
|
105
|
+
manifestName: text(item.manifestName, `${at}.manifestName`),
|
|
106
|
+
imageKey: text(item.imageKey, `${at}.imageKey`),
|
|
107
|
+
runtimeBinding: parseRuntimeBinding(item.runtimeBinding, `${at}.runtimeBinding`),
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
if (items.length === 0) {fail(where, 'must declare at least one platform service');}
|
|
111
|
+
uniqueBy(items, where, (item) => item.name);
|
|
112
|
+
uniqueBy(items, `${where} imageKey`, (item) => item.imageKey);
|
|
113
|
+
return items;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function parseConnectorSources(value) {
|
|
117
|
+
const where = '"connectorSources"';
|
|
118
|
+
exactObject(value, where, ['repository', 'bindings', 'nonProductionIds', 'buildInput']);
|
|
119
|
+
const bindings = list(value.bindings, `${where}.bindings`, (item, at) => {
|
|
120
|
+
exactObject(item, at, ['id', 'path']);
|
|
121
|
+
return { id: text(item.id, `${at}.id`), path: text(item.path, `${at}.path`) };
|
|
122
|
+
});
|
|
123
|
+
uniqueBy(bindings, `${where}.bindings`, (item) => item.id);
|
|
124
|
+
const buildInput = exactObject(value.buildInput, `${where}.buildInput`, ['consumerRepo', 'consumerService', 'destinationRoot']);
|
|
125
|
+
return Object.freeze({
|
|
126
|
+
repository: repoHandle(value.repository, `${where}.repository`),
|
|
127
|
+
bindings,
|
|
128
|
+
nonProductionIds: textList(value.nonProductionIds, `${where}.nonProductionIds`),
|
|
129
|
+
buildInput: Object.freeze({
|
|
130
|
+
consumerRepo: repoHandle(buildInput.consumerRepo, `${where}.buildInput.consumerRepo`),
|
|
131
|
+
consumerService: text(buildInput.consumerService, `${where}.buildInput.consumerService`),
|
|
132
|
+
destinationRoot: text(buildInput.destinationRoot, `${where}.buildInput.destinationRoot`),
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function parseRuntimeImageSources(value) {
|
|
138
|
+
const where = '"runtimeImageSources"';
|
|
139
|
+
exactObject(value, where, ['supplementalSources', 'crossRepoBuildInputs', 'buildStepContextDirectories']);
|
|
140
|
+
const supplementalSources = list(value.supplementalSources, `${where}.supplementalSources`, (item, at) => {
|
|
141
|
+
exactObject(item, at, ['kind', 'id', 'repo', 'path', 'sourceManifestPath']);
|
|
142
|
+
return {
|
|
143
|
+
kind: subjectKind(item.kind, `${at}.kind`),
|
|
144
|
+
id: text(item.id, `${at}.id`),
|
|
145
|
+
repo: repoHandle(item.repo, `${at}.repo`),
|
|
146
|
+
path: text(item.path, `${at}.path`),
|
|
147
|
+
sourceManifestPath: text(item.sourceManifestPath, `${at}.sourceManifestPath`),
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
uniqueBy(supplementalSources, `${where}.supplementalSources`, (item) => `${item.kind}/${item.id}`);
|
|
151
|
+
const crossRepoBuildInputs = list(value.crossRepoBuildInputs, `${where}.crossRepoBuildInputs`, (item, at) => {
|
|
152
|
+
exactObject(item, at, ['consumerRepo', 'consumerService', 'sourceRepo', 'sourcePath', 'destinationPath']);
|
|
153
|
+
return {
|
|
154
|
+
consumerRepo: repoHandle(item.consumerRepo, `${at}.consumerRepo`),
|
|
155
|
+
consumerService: item.consumerService === null ? null : text(item.consumerService, `${at}.consumerService`),
|
|
156
|
+
sourceRepo: repoHandle(item.sourceRepo, `${at}.sourceRepo`),
|
|
157
|
+
sourcePath: text(item.sourcePath, `${at}.sourcePath`),
|
|
158
|
+
destinationPath: text(item.destinationPath, `${at}.destinationPath`),
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
const buildStepContextDirectories = list(value.buildStepContextDirectories, `${where}.buildStepContextDirectories`, (item, at) => {
|
|
162
|
+
exactObject(item, at, ['repo', 'path', 'reason']);
|
|
163
|
+
return { repo: repoHandle(item.repo, `${at}.repo`), path: text(item.path, `${at}.path`), reason: text(item.reason, `${at}.reason`) };
|
|
164
|
+
});
|
|
165
|
+
return Object.freeze({ supplementalSources, crossRepoBuildInputs, buildStepContextDirectories });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** The pin roles are a closed set the library defines; their repository keys are data. */
|
|
169
|
+
export const PinRole = Object.freeze({
|
|
170
|
+
Data: 'data',
|
|
171
|
+
Kernel: 'kernel',
|
|
172
|
+
Deploy: 'deploy',
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
export function parsePinRoles(value) {
|
|
176
|
+
const where = '"pinRoles"';
|
|
177
|
+
exactObject(value, where, Object.values(PinRole));
|
|
178
|
+
const keys = Object.values(PinRole).map((role) => [role, text(value[role], `${where}.${role}`)]);
|
|
179
|
+
uniqueBy(keys, where, ([, key]) => key);
|
|
180
|
+
return Object.freeze(Object.fromEntries(keys));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function parseConfinedBiomes(value) {
|
|
184
|
+
const where = '"confinedBiomes"';
|
|
185
|
+
const items = list(value, where, (item, at) => {
|
|
186
|
+
exactObject(item, at, ['biomeId', 'holds', 'consequence', 'admittedEditions']);
|
|
187
|
+
return {
|
|
188
|
+
biomeId: text(item.biomeId, `${at}.biomeId`),
|
|
189
|
+
holds: text(item.holds, `${at}.holds`),
|
|
190
|
+
consequence: text(item.consequence, `${at}.consequence`),
|
|
191
|
+
admittedEditions: textList(item.admittedEditions, `${at}.admittedEditions`),
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
return uniqueBy(items, where, (item) => item.biomeId);
|
|
195
|
+
}
|
|
@@ -35,6 +35,7 @@ sources:
|
|
|
35
35
|
url: https://github.com/acme/xema-biomes.git
|
|
36
36
|
ref: v2.1.0
|
|
37
37
|
authTokenEnv: GIT_TOKEN_ACME # export GIT_TOKEN_ACME=... (never inlined)
|
|
38
|
+
authUsername: x-access-token # the git username the token authenticates as (declared, no default)
|
|
38
39
|
|
|
39
40
|
# 4. NPM — biome packages from any registry. INSTALL-TIME: these install into a
|
|
40
41
|
# running platform via `xema biome install` (the biome-fetcher path); they
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/xema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/xema-dev/xema-cli.git",
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dist",
|
|
35
|
+
"edition/**/*.mjs",
|
|
36
|
+
"edition/*.json",
|
|
37
|
+
"!edition/**/*.test.mjs",
|
|
38
|
+
"!edition/**/*-contract-tests.mjs",
|
|
39
|
+
"!edition/test-fixtures/**",
|
|
40
|
+
"edition/README.md",
|
|
35
41
|
"xema.config.example.yaml",
|
|
36
42
|
"examples/**/*"
|
|
37
43
|
],
|
|
@@ -45,10 +51,9 @@
|
|
|
45
51
|
"@nestjs/platform-express": "^11.1.28",
|
|
46
52
|
"@xemahq/biome-sdk": "^18.1.0",
|
|
47
53
|
"@xemahq/biome-supply-chain": "^0.5.0",
|
|
48
|
-
"@xemahq/distribution-resolver": "^0.8.0",
|
|
49
54
|
"@xemahq/dsl": "^0.23.0",
|
|
50
55
|
"@xemahq/identity-client": "^0.16.0",
|
|
51
|
-
"@xemahq/contracts": "^0.
|
|
56
|
+
"@xemahq/contracts": "^0.76.0",
|
|
52
57
|
"@xemahq/kernel-state-runtime": "^0.8.0",
|
|
53
58
|
"@xemahq/license-verifier": "^0.2.0",
|
|
54
59
|
"@xemahq/service-registry-nest": "^0.12.2",
|
|
@@ -63,7 +68,9 @@
|
|
|
63
68
|
"@types/jest": "^30.0.0",
|
|
64
69
|
"@types/node": "25.2.3",
|
|
65
70
|
"@xemahq/biome-host-api-client": "^0.3.31",
|
|
71
|
+
"@xemahq/distribution-source-hash": "^0.3.0",
|
|
66
72
|
"@xemahq/eslint-config": "^0.9.2",
|
|
73
|
+
"esbuild": "0.28.2",
|
|
67
74
|
"eslint": "^9.39.4",
|
|
68
75
|
"jest": "^30.3.0",
|
|
69
76
|
"prettier": "3.6.2",
|
|
@@ -73,17 +80,18 @@
|
|
|
73
80
|
},
|
|
74
81
|
"scripts": {
|
|
75
82
|
"clean": "rm -rf dist",
|
|
76
|
-
"build": "tsc -p tsconfig.build.json && node ./scripts/post-build.cjs",
|
|
83
|
+
"build": "tsc -p tsconfig.build.json && node ./scripts/post-build.cjs && node ./scripts/build-evidence-verifier.mjs",
|
|
77
84
|
"sync:assets": "node ./scripts/sync-distribution-assets.cjs",
|
|
78
85
|
"verify:pack": "node ./scripts/verify-packed-assets.cjs",
|
|
79
86
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
80
87
|
"start": "node ./dist/cli.js",
|
|
81
88
|
"lint": "eslint .",
|
|
82
89
|
"lint:fix": "eslint . --fix",
|
|
83
|
-
"test": "jest --config jest.config.cjs",
|
|
90
|
+
"test": "jest --config jest.config.cjs && pnpm run test:edition",
|
|
91
|
+
"test:edition": "node --test \"edition/*.test.mjs\" \"edition/*-contract-tests.mjs\"",
|
|
84
92
|
"typecheck": "tsc --noEmit"
|
|
85
93
|
},
|
|
86
94
|
"xemaRelease": {
|
|
87
|
-
"sourceDigest": "sha256:
|
|
95
|
+
"sourceDigest": "sha256:c33104cb26add433525e6447c931da38c0fc51a552b7f61f59b293734aeeb23c"
|
|
88
96
|
}
|
|
89
97
|
}
|
package/dist/commands/dist.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander';
|
|
2
|
-
interface DistBuildOptions {
|
|
3
|
-
id?: string;
|
|
4
|
-
base?: string;
|
|
5
|
-
config?: string;
|
|
6
|
-
git?: string[];
|
|
7
|
-
source?: string[];
|
|
8
|
-
platform?: string[];
|
|
9
|
-
allowThirdParty?: boolean;
|
|
10
|
-
outDir?: string;
|
|
11
|
-
configOut?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function registerCommand(program: Command): void;
|
|
14
|
-
export declare function runDistBuild(opts: DistBuildOptions): void;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=dist.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist.d.ts","sourceRoot":"","sources":["../../src/commands/dist.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6CtD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAwEzD"}
|
package/dist/commands/dist.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerCommand = registerCommand;
|
|
4
|
-
exports.runDistBuild = runDistBuild;
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const node_os_1 = require("node:os");
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
const distribution_1 = require("@xemahq/contracts/distribution");
|
|
9
|
-
const yaml_1 = require("yaml");
|
|
10
|
-
const exit_codes_1 = require("../lib/exit-codes");
|
|
11
|
-
const loader_1 = require("../runtime/config/loader");
|
|
12
|
-
const compose_1 = require("../runtime/distribution/compose");
|
|
13
|
-
const paths_1 = require("../runtime/paths");
|
|
14
|
-
const credentials_1 = require("../runtime/sources/credentials");
|
|
15
|
-
const git_1 = require("../runtime/sources/kinds/git");
|
|
16
|
-
const schema_1 = require("../runtime/sources/schema");
|
|
17
|
-
const DEFAULT_BASE = 'oss';
|
|
18
|
-
const DEFAULT_OUT_DIR = (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'distributions');
|
|
19
|
-
const PLATFORM_KEYS = Object.values(distribution_1.RuntimeImagePlatformKey).join(', ');
|
|
20
|
-
function collect(value, previous = []) {
|
|
21
|
-
return [...previous, value];
|
|
22
|
-
}
|
|
23
|
-
function registerCommand(program) {
|
|
24
|
-
const dist = program.command('dist').summary('Compose a distribution (build your own platform)');
|
|
25
|
-
dist
|
|
26
|
-
.command('build')
|
|
27
|
-
.summary('Compose a distribution from a base edition + your own biomes')
|
|
28
|
-
.description('Seed a base edition (--base) with its first-party biomes, add your own ' +
|
|
29
|
-
'biomes from git/workspace sources (--git / --source, or a --config ' +
|
|
30
|
-
'sources: block), resolve + validate the whole set with the distribution ' +
|
|
31
|
-
'resolver, and write the distribution (xema-distribution.json + ' +
|
|
32
|
-
'distribution.lock.json) plus a launch xema.config.yaml.\n\n' +
|
|
33
|
-
'--platform is REQUIRED and has no default: it is the architecture ' +
|
|
34
|
-
'commitment every runtime image of your distribution must be published ' +
|
|
35
|
-
'for, and delivery verifies it against the real registry. A base ' +
|
|
36
|
-
"edition's lock does not carry it, so it cannot be inherited — state " +
|
|
37
|
-
'the platforms your images are actually built for.')
|
|
38
|
-
.requiredOption('--id <name>', 'Id for the composed distribution (kebab-case)')
|
|
39
|
-
.option('--platform <keys>', `REQUIRED. OCI platform(s) the distribution requires — repeatable or comma-separated (${PLATFORM_KEYS})`, collect)
|
|
40
|
-
.option('--base <edition>', `Base edition to extend (default: ${DEFAULT_BASE})`)
|
|
41
|
-
.option('--git <name=url>', 'Add a git biome source (repeatable)', collect, [])
|
|
42
|
-
.option('--source <name=path>', 'Add a local biome dir / workspace (repeatable)', collect, [])
|
|
43
|
-
.option('--config <path>', 'Read additional biome sources from a xema.config.yaml')
|
|
44
|
-
.option('--no-allow-third-party', 'Reject third-party (user) biomes (first-party only)')
|
|
45
|
-
.option('--out-dir <dir>', `Where to write the distribution (default: ${DEFAULT_OUT_DIR})`)
|
|
46
|
-
.option('--config-out <path>', 'Also write a launch xema.config.yaml referencing it')
|
|
47
|
-
.action((opts) => {
|
|
48
|
-
try {
|
|
49
|
-
runDistBuild(opts);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
53
|
-
(0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.GenericError, `xema dist build failed: ${message}`);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function runDistBuild(opts) {
|
|
58
|
-
const cliSpecs = [
|
|
59
|
-
...(opts.git ?? []).map((source) => gitSpecFrom(source)),
|
|
60
|
-
...(opts.source ?? []).map((source) => workspaceSpecFrom(source)),
|
|
61
|
-
];
|
|
62
|
-
const id = opts.id;
|
|
63
|
-
if (id === undefined || !/^[a-z][a-z0-9-]*$/.test(id)) {
|
|
64
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `--id must be lowercase kebab-case (got "${String(id)}").`);
|
|
65
|
-
}
|
|
66
|
-
const requiredPlatforms = parseRequiredPlatforms(opts.platform ?? []);
|
|
67
|
-
const base = opts.base ?? DEFAULT_BASE;
|
|
68
|
-
const log = (line) => console.log(` ${line}`);
|
|
69
|
-
const specs = [...cliSpecs, ...sourcesFromConfig(opts.config)];
|
|
70
|
-
const credentials = new credentials_1.CredentialResolver();
|
|
71
|
-
const userSources = specs.map((spec) => resolveSourceRoot(spec, credentials, log));
|
|
72
|
-
const allowThirdParty = opts.allowThirdParty !== false;
|
|
73
|
-
console.log(`xema dist build — composing "${id}" from base "${base}"`);
|
|
74
|
-
console.log('-'.repeat(60));
|
|
75
|
-
const result = (0, compose_1.composeDistribution)({
|
|
76
|
-
id,
|
|
77
|
-
baseEdition: base,
|
|
78
|
-
requiredPlatforms,
|
|
79
|
-
userSources,
|
|
80
|
-
allowThirdParty,
|
|
81
|
-
resolvedAt: new Date().toISOString(),
|
|
82
|
-
});
|
|
83
|
-
const outDir = (0, node_path_1.resolve)(process.cwd(), opts.outDir ?? DEFAULT_OUT_DIR, id);
|
|
84
|
-
(0, node_fs_1.mkdirSync)(outDir, { recursive: true });
|
|
85
|
-
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(outDir, 'xema-distribution.json'), `${JSON.stringify(result.definition, null, 2)}\n`, 'utf8');
|
|
86
|
-
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(outDir, 'distribution.lock.json'), `${JSON.stringify(result.lock, null, 2)}\n`, 'utf8');
|
|
87
|
-
if (opts.configOut !== undefined) {
|
|
88
|
-
const configPath = (0, node_path_1.resolve)(process.cwd(), opts.configOut);
|
|
89
|
-
(0, node_fs_1.writeFileSync)(configPath, renderLaunchConfig(base, specs), 'utf8');
|
|
90
|
-
}
|
|
91
|
-
console.log('');
|
|
92
|
-
console.log(`✓ Composed "${id}": ${String(result.lock.biomes.length)} biome(s) ` +
|
|
93
|
-
`(${String(result.baseBiomeCount)} base + ${String(result.userBiomeCount)} user` +
|
|
94
|
-
`${result.overridden.length > 0 ? `, ${String(result.overridden.length)} overridden` : ''}).`);
|
|
95
|
-
console.log(` distribution → ${outDir}/`);
|
|
96
|
-
if (opts.configOut !== undefined) {
|
|
97
|
-
console.log(` launch config → ${(0, node_path_1.resolve)(process.cwd(), opts.configOut)}`);
|
|
98
|
-
console.log('');
|
|
99
|
-
console.log(`Next: xema up --config ${opts.configOut} (native — user biomes run from source)`);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
console.log('');
|
|
103
|
-
console.log(`Next: xema up --edition ${id} (add a launch config with --config-out for your git biomes)`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function resolveSourceRoot(spec, credentials, log) {
|
|
107
|
-
if (spec.kind === schema_1.SourceKind.Workspace) {
|
|
108
|
-
const root = spec.root !== undefined ? (0, node_path_1.resolve)(process.cwd(), spec.root) : (0, paths_1.findMonorepoRoot)();
|
|
109
|
-
if (root === null) {
|
|
110
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `source "${spec.name}": no root (not in a monorepo and no path given).`);
|
|
111
|
-
}
|
|
112
|
-
return { name: spec.name, root };
|
|
113
|
-
}
|
|
114
|
-
if (spec.kind === schema_1.SourceKind.Git) {
|
|
115
|
-
log(`cloning ${spec.url}${spec.ref !== undefined ? `@${spec.ref}` : ''} …`);
|
|
116
|
-
return { name: spec.name, root: (0, git_1.checkoutGitSource)(spec, credentials, log) };
|
|
117
|
-
}
|
|
118
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `source "${spec.name}" (${spec.kind}) can't seed a composition — use workspace or git ` +
|
|
119
|
-
`(npm/oci are install-time).`);
|
|
120
|
-
}
|
|
121
|
-
function parseRequiredPlatforms(raw) {
|
|
122
|
-
const keys = raw
|
|
123
|
-
.flatMap((value) => value.split(','))
|
|
124
|
-
.map((value) => value.trim())
|
|
125
|
-
.filter((value) => value.length > 0);
|
|
126
|
-
if (keys.length === 0) {
|
|
127
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, '--platform is required and has no default: it declares the OCI platform(s) ' +
|
|
128
|
-
'every runtime image of this distribution must be published for, and delivery ' +
|
|
129
|
-
'verifies that set against the real registry. A base edition\'s lock does not ' +
|
|
130
|
-
'carry it, so it cannot be inherited — state it explicitly, e.g. ' +
|
|
131
|
-
`--platform ${distribution_1.RuntimeImagePlatformKey.LinuxAmd64} (choose from: ${PLATFORM_KEYS}).`);
|
|
132
|
-
}
|
|
133
|
-
const parsed = distribution_1.DistributionRequiredPlatformsSchema.safeParse([...keys].sort());
|
|
134
|
-
if (parsed.success) {
|
|
135
|
-
return parsed.data;
|
|
136
|
-
}
|
|
137
|
-
const details = [...new Set(parsed.error.issues.map((issue) => issue.message))].join('; ');
|
|
138
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `--platform is invalid: ${details}. Choose from: ${PLATFORM_KEYS}.`);
|
|
139
|
-
}
|
|
140
|
-
function gitSpecFrom(raw) {
|
|
141
|
-
const { name, value } = splitNameValue(raw, '--git');
|
|
142
|
-
return parseCliSourceSpec({ name, kind: schema_1.SourceKind.Git, url: value }, '--git');
|
|
143
|
-
}
|
|
144
|
-
function workspaceSpecFrom(raw) {
|
|
145
|
-
const { name, value } = splitNameValue(raw, '--source');
|
|
146
|
-
return parseCliSourceSpec({ name, kind: schema_1.SourceKind.Workspace, root: value }, '--source');
|
|
147
|
-
}
|
|
148
|
-
function parseCliSourceSpec(raw, flag) {
|
|
149
|
-
const parsed = schema_1.SourceSpecSchema.safeParse(raw);
|
|
150
|
-
if (parsed.success) {
|
|
151
|
-
return parsed.data;
|
|
152
|
-
}
|
|
153
|
-
const details = [
|
|
154
|
-
...new Set(parsed.error.issues.map((issue) => issue.message)),
|
|
155
|
-
].join('; ');
|
|
156
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `${flag} source is invalid: ${details}`);
|
|
157
|
-
}
|
|
158
|
-
function splitNameValue(raw, flag) {
|
|
159
|
-
const eq = raw.indexOf('=');
|
|
160
|
-
if (eq <= 0) {
|
|
161
|
-
return (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `${flag} expects <name>=<value>`);
|
|
162
|
-
}
|
|
163
|
-
return { name: raw.slice(0, eq).trim(), value: raw.slice(eq + 1).trim() };
|
|
164
|
-
}
|
|
165
|
-
function sourcesFromConfig(configPath) {
|
|
166
|
-
if (configPath === undefined) {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
const loaded = (0, loader_1.loadXemaConfig)({ explicit: configPath });
|
|
170
|
-
return loaded.config.sources.filter((s) => s.kind === schema_1.SourceKind.Workspace || s.kind === schema_1.SourceKind.Git);
|
|
171
|
-
}
|
|
172
|
-
function renderLaunchConfig(baseEdition, sources) {
|
|
173
|
-
const config = {
|
|
174
|
-
edition: baseEdition,
|
|
175
|
-
app: { substrate: 'native' },
|
|
176
|
-
sources,
|
|
177
|
-
};
|
|
178
|
-
const header = '# xema.config.yaml — generated by `xema dist build`\n' +
|
|
179
|
-
`# Base edition "${baseEdition}" + your biome sources (launched natively from source).\n\n`;
|
|
180
|
-
return header + (0, yaml_1.stringify)(config, { aliasDuplicateObjects: false });
|
|
181
|
-
}
|
|
182
|
-
//# sourceMappingURL=dist.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist.js","sourceRoot":"","sources":["../../src/commands/dist.ts"],"names":[],"mappings":";;AAwDA,0CA6CC;AAED,oCAwEC;AA/KD,qCAAmD;AACnD,qCAAkC;AAClC,yCAAyD;AAEzD,iEAGwC;AACxC,+BAAkD;AAGlD,kDAA8D;AAC9D,qDAA0D;AAC1D,6DAA4F;AAC5F,4CAAoD;AACpD,gEAAoE;AAC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AAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;AAC5E,CAAC;AAGD,SAAS,iBAAiB,CAAC,UAA8B;IACvD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CACjC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAU,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAU,CAAC,GAAG,CACpE,CAAC;AACJ,CAAC;AAGD,SAAS,kBAAkB,CAAC,WAAmB,EAAE,OAA8B;IAC7E,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,WAAW;QACpB,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC5B,OAAO;KACR,CAAC;IACF,MAAM,MAAM,GACV,uDAAuD;QACvD,mBAAmB,WAAW,6DAA6D,CAAC;IAC9F,OAAO,MAAM,GAAG,IAAA,gBAAa,EAAC,MAAM,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DiscoveredBiome } from '../sources/manifest-walk';
|
|
2
|
-
import type { LockedBiome } from '@xemahq/contracts/distribution';
|
|
3
|
-
import type { AvailableBiome } from '@xemahq/distribution-resolver';
|
|
4
|
-
export declare function lockedBiomeToAvailable(b: LockedBiome): AvailableBiome;
|
|
5
|
-
export declare function discoveredBiomeToAvailable(b: DiscoveredBiome, sourceName: string): AvailableBiome;
|
|
6
|
-
export declare function mergeAvailableBiomes(base: readonly AvailableBiome[], user: readonly AvailableBiome[]): {
|
|
7
|
-
biomes: AvailableBiome[];
|
|
8
|
-
overridden: string[];
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=available-biome.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"available-biome.d.ts","sourceRoot":"","sources":["../../../src/runtime/distribution/available-biome.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAmBpE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,WAAW,GAAG,cAAc,CAGrE;AASD,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CA6GjG;AA2GD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,cAAc,EAAE,EAC/B,IAAI,EAAE,SAAS,cAAc,EAAE,GAC9B;IAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAapD"}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lockedBiomeToAvailable = lockedBiomeToAvailable;
|
|
4
|
-
exports.discoveredBiomeToAvailable = discoveredBiomeToAvailable;
|
|
5
|
-
exports.mergeAvailableBiomes = mergeAvailableBiomes;
|
|
6
|
-
const biome_1 = require("@xemahq/contracts/biome");
|
|
7
|
-
const distribution_1 = require("@xemahq/contracts/distribution");
|
|
8
|
-
function lockedBiomeToAvailable(b) {
|
|
9
|
-
const { mandatory: _mandatory, installPolicy: _installPolicy, ...rest } = b;
|
|
10
|
-
return rest;
|
|
11
|
-
}
|
|
12
|
-
function discoveredBiomeToAvailable(b, sourceName) {
|
|
13
|
-
const manifest = b.manifest;
|
|
14
|
-
const trustTier = 'trustTier' in manifest.xema ? manifest.xema.trustTier : undefined;
|
|
15
|
-
const xema = manifest.xema;
|
|
16
|
-
const components = xema.target === 'server' ? xema.components : [];
|
|
17
|
-
const serviceDatabases = {};
|
|
18
|
-
for (const component of components) {
|
|
19
|
-
if (component.protocol.kind === biome_1.BiomeComponentProtocolKind.Http &&
|
|
20
|
-
component.protocol.databaseKey !== undefined) {
|
|
21
|
-
serviceDatabases[component.protocol.serviceName] = component.protocol.databaseKey;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
for (const component of components) {
|
|
25
|
-
if (component.protocol.kind === biome_1.BiomeComponentProtocolKind.Http &&
|
|
26
|
-
(component.protocol.requiresServices ?? []).length > 0) {
|
|
27
|
-
throw new Error(`Biome "${b.id}" (source "${sourceName}") declares requiresServices on ` +
|
|
28
|
-
`component "${component.key}". A composed distribution cannot bind the ` +
|
|
29
|
-
`exact owner identity of a required service — that needs the platform's ` +
|
|
30
|
-
`own biome and platform-service indexes. Publish this biome through the ` +
|
|
31
|
-
`distribution plane instead of composing it from a user source.`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const installationClass = (0, biome_1.foldInstallationClass)(components.map((component) => component.installationClass));
|
|
35
|
-
return {
|
|
36
|
-
id: b.id,
|
|
37
|
-
version: b.version,
|
|
38
|
-
tier: b.tier,
|
|
39
|
-
target: b.target === 'server' ? biome_1.BiomeTarget.Server : biome_1.BiomeTarget.Web,
|
|
40
|
-
origin: trustTier ?? biome_1.BiomeOrigin.ThirdParty,
|
|
41
|
-
audience: (0, biome_1.getBiomeAudience)(manifest),
|
|
42
|
-
launch: distribution_1.BiomeLaunchMode.Static,
|
|
43
|
-
requiresServerBiomes: b.requires,
|
|
44
|
-
repo: `source:${sourceName}`,
|
|
45
|
-
path: b.biomeDir.length > 0 ? b.biomeDir : '.',
|
|
46
|
-
services: b.services.map((s) => s.name),
|
|
47
|
-
serviceDatabases,
|
|
48
|
-
runtimeComponents: b.runtimeComponents.map((s) => s.name),
|
|
49
|
-
hostModules: projectHostModules(b, xema),
|
|
50
|
-
serviceDependencies: [],
|
|
51
|
-
displayName: xema.displayName,
|
|
52
|
-
packageName: b.packageName,
|
|
53
|
-
optionalServerBiomes: xema.target === 'web' ? (xema.optionalServerBiomes ?? []) : [],
|
|
54
|
-
storeListed: (0, biome_1.isBiomeStoreListed)(manifest),
|
|
55
|
-
systemSurface: (0, biome_1.isSystemSurface)(manifest),
|
|
56
|
-
sourceManifestHash: b.sourceManifestHash,
|
|
57
|
-
...(installationClass !== undefined ? { installationClass } : {}),
|
|
58
|
-
...projectNexusFacts(xema),
|
|
59
|
-
...(xema.display !== undefined
|
|
60
|
-
? {
|
|
61
|
-
display: {
|
|
62
|
-
...(xema.display.icon !== undefined ? { icon: xema.display.icon } : {}),
|
|
63
|
-
...(xema.display.category !== undefined
|
|
64
|
-
? { category: xema.display.category }
|
|
65
|
-
: {}),
|
|
66
|
-
...(xema.display.summary !== undefined
|
|
67
|
-
? { summary: xema.display.summary }
|
|
68
|
-
: {}),
|
|
69
|
-
...(xema.display.accent !== undefined ? { accent: xema.display.accent } : {}),
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
: {}),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function projectNexusFacts(xema) {
|
|
76
|
-
if (xema.target !== 'server') {
|
|
77
|
-
return {};
|
|
78
|
-
}
|
|
79
|
-
const nexusProvides = [];
|
|
80
|
-
const nexusRequires = [];
|
|
81
|
-
for (const component of xema.components) {
|
|
82
|
-
if (component.kind !== biome_1.BiomeComponentKind.Worker ||
|
|
83
|
-
component.protocol.kind !== biome_1.BiomeComponentProtocolKind.Worker ||
|
|
84
|
-
!('nexus' in component.protocol) ||
|
|
85
|
-
component.protocol.nexus === undefined) {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
for (const entry of component.protocol.nexus.provides ?? []) {
|
|
89
|
-
nexusProvides.push({
|
|
90
|
-
component: component.key,
|
|
91
|
-
service: entry.service,
|
|
92
|
-
version: entry.version,
|
|
93
|
-
taskQueue: entry.taskQueue,
|
|
94
|
-
operations: entry.operations.map((operation) => operation.name),
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
for (const entry of component.protocol.nexus.requires ?? []) {
|
|
98
|
-
nexusRequires.push({
|
|
99
|
-
component: component.key,
|
|
100
|
-
service: entry.service,
|
|
101
|
-
version: entry.version,
|
|
102
|
-
operations: [...entry.operations],
|
|
103
|
-
...(entry.optional === true ? { optional: true } : {}),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return (0, distribution_1.canonicalNexusFacts)({ nexusProvides, nexusRequires });
|
|
108
|
-
}
|
|
109
|
-
function projectHostModules(b, xema) {
|
|
110
|
-
if (xema.target !== 'server') {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
const modules = [];
|
|
114
|
-
for (const component of xema.components) {
|
|
115
|
-
if (component.artifact.kind !== biome_1.BiomeComponentArtifactKind.HostModule) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (xema.bundleSource === undefined) {
|
|
119
|
-
throw new Error(`Biome "${b.id}" ships host module "${component.key}" but declares no ` +
|
|
120
|
-
`xema.bundleSource. A distribution host fetches the executable — it ` +
|
|
121
|
-
`cannot load one from a source-tree path.`);
|
|
122
|
-
}
|
|
123
|
-
if (component.entrypoint?.kind !== biome_1.BiomeComponentEntrypointKind.ModuleExport ||
|
|
124
|
-
component.hostAbi === undefined) {
|
|
125
|
-
throw new Error(`Biome "${b.id}" host module "${component.key}" must declare a ` +
|
|
126
|
-
`module-export entrypoint and a hostAbi.`);
|
|
127
|
-
}
|
|
128
|
-
modules.push({
|
|
129
|
-
componentKey: component.key,
|
|
130
|
-
artifactPath: component.artifact.path,
|
|
131
|
-
modulePath: component.entrypoint.module,
|
|
132
|
-
exportName: component.entrypoint.exportName,
|
|
133
|
-
hostAbi: {
|
|
134
|
-
name: component.hostAbi.name,
|
|
135
|
-
versionRange: component.hostAbi.versionRange,
|
|
136
|
-
},
|
|
137
|
-
bundleSource: xema.bundleSource,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
return modules.sort((left, right) => left.componentKey.localeCompare(right.componentKey));
|
|
141
|
-
}
|
|
142
|
-
function mergeAvailableBiomes(base, user) {
|
|
143
|
-
const byId = new Map();
|
|
144
|
-
for (const b of base) {
|
|
145
|
-
byId.set(b.id, b);
|
|
146
|
-
}
|
|
147
|
-
const overridden = [];
|
|
148
|
-
for (const b of user) {
|
|
149
|
-
if (byId.has(b.id)) {
|
|
150
|
-
overridden.push(b.id);
|
|
151
|
-
}
|
|
152
|
-
byId.set(b.id, b);
|
|
153
|
-
}
|
|
154
|
-
return { biomes: [...byId.values()], overridden };
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=available-biome.js.map
|