@xemahq/composed-process-host 0.0.0-stage → 0.2.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.
Files changed (54) hide show
  1. package/LICENSE +175 -0
  2. package/bin/xema-composed-process.cjs +3 -0
  3. package/dist/bin/xema-composed-process.d.ts +3 -0
  4. package/dist/bin/xema-composed-process.d.ts.map +1 -0
  5. package/dist/bin/xema-composed-process.js +40 -0
  6. package/dist/bin/xema-composed-process.js.map +1 -0
  7. package/dist/biome-host-registry.d.ts +4 -0
  8. package/dist/biome-host-registry.d.ts.map +1 -0
  9. package/dist/biome-host-registry.js +48 -0
  10. package/dist/biome-host-registry.js.map +1 -0
  11. package/dist/composed-process-host.d.ts +24 -0
  12. package/dist/composed-process-host.d.ts.map +1 -0
  13. package/dist/composed-process-host.js +138 -0
  14. package/dist/composed-process-host.js.map +1 -0
  15. package/dist/event-hub-command-stream.d.ts +23 -0
  16. package/dist/event-hub-command-stream.d.ts.map +1 -0
  17. package/dist/event-hub-command-stream.js +28 -0
  18. package/dist/event-hub-command-stream.js.map +1 -0
  19. package/dist/generation-entry.d.ts +3 -0
  20. package/dist/generation-entry.d.ts.map +1 -0
  21. package/dist/generation-entry.js +26 -0
  22. package/dist/generation-entry.js.map +1 -0
  23. package/dist/host-platform.d.ts +7 -0
  24. package/dist/host-platform.d.ts.map +1 -0
  25. package/dist/host-platform.js +29 -0
  26. package/dist/host-platform.js.map +1 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +36 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/oci-bundle-store.d.ts +14 -0
  32. package/dist/oci-bundle-store.d.ts.map +1 -0
  33. package/dist/oci-bundle-store.js +46 -0
  34. package/dist/oci-bundle-store.js.map +1 -0
  35. package/dist/pack-bundle-reader.d.ts +3 -0
  36. package/dist/pack-bundle-reader.d.ts.map +1 -0
  37. package/dist/pack-bundle-reader.js +21 -0
  38. package/dist/pack-bundle-reader.js.map +1 -0
  39. package/dist/seed-closure.d.ts +33 -0
  40. package/dist/seed-closure.d.ts.map +1 -0
  41. package/dist/seed-closure.js +81 -0
  42. package/dist/seed-closure.js.map +1 -0
  43. package/dist/seed-closure.json +239 -0
  44. package/dist/seed-platform-registration.d.ts +17 -0
  45. package/dist/seed-platform-registration.d.ts.map +1 -0
  46. package/dist/seed-platform-registration.js +44 -0
  47. package/dist/seed-platform-registration.js.map +1 -0
  48. package/dist/seed-processes.d.ts +22 -0
  49. package/dist/seed-processes.d.ts.map +1 -0
  50. package/dist/seed-processes.js +123 -0
  51. package/dist/seed-processes.js.map +1 -0
  52. package/package.json +71 -4
  53. package/scripts/write-seed-closure.mjs +25 -0
  54. package/README.md +0 -3
@@ -0,0 +1,11 @@
1
+ export { biomeHostRegistry } from './biome-host-registry';
2
+ export { COMPOSED_GENERATION_ENTRY, runComposedProcessHost, type ComposedProcessHostOptions, type RunningComposedProcessHost, } from './composed-process-host';
3
+ export { consumeCommandStream, replayStreamerFor, type CommandStreamHandlers, type ReplayStreamer, } from './event-hub-command-stream';
4
+ export { currentBundlePlatform } from './host-platform';
5
+ export { ociBundleStore, type BundleArchiveReader, type OciBundleStoreOptions } from './oci-bundle-store';
6
+ export { loadSeedClosure, readSeedClosure, readSeedProcesses, SEED_CLOSURE_IMAGE_PATH, SEED_CLOSURE_FILE, seedClosureFileOf, SeedClosureSchema, type SeedClosure, } from './seed-closure';
7
+ export { seedPlatformServicesOf, seedProcessesOf, seedProcessNamed, SeedProcessNameClaimedError, type SeedProcess, } from './seed-processes';
8
+ export { registerSeedPlatformServices, type RegisterSeedPlatformServicesInput, type SeedPlatformRegistration } from './seed-platform-registration';
9
+ export { packBundleReader } from './pack-bundle-reader';
10
+ export { SUPERVISOR_LAUNCH_ENV, SUPERVISOR_LAUNCH_FLAGS } from '@xemahq/xema-service-nest';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC1G,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACnJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUPERVISOR_LAUNCH_FLAGS = exports.SUPERVISOR_LAUNCH_ENV = exports.packBundleReader = exports.registerSeedPlatformServices = exports.SeedProcessNameClaimedError = exports.seedProcessNamed = exports.seedProcessesOf = exports.seedPlatformServicesOf = exports.SeedClosureSchema = exports.seedClosureFileOf = exports.SEED_CLOSURE_FILE = exports.SEED_CLOSURE_IMAGE_PATH = exports.readSeedProcesses = exports.readSeedClosure = exports.loadSeedClosure = exports.ociBundleStore = exports.currentBundlePlatform = exports.replayStreamerFor = exports.consumeCommandStream = exports.runComposedProcessHost = exports.COMPOSED_GENERATION_ENTRY = exports.biomeHostRegistry = void 0;
4
+ var biome_host_registry_1 = require("./biome-host-registry");
5
+ Object.defineProperty(exports, "biomeHostRegistry", { enumerable: true, get: function () { return biome_host_registry_1.biomeHostRegistry; } });
6
+ var composed_process_host_1 = require("./composed-process-host");
7
+ Object.defineProperty(exports, "COMPOSED_GENERATION_ENTRY", { enumerable: true, get: function () { return composed_process_host_1.COMPOSED_GENERATION_ENTRY; } });
8
+ Object.defineProperty(exports, "runComposedProcessHost", { enumerable: true, get: function () { return composed_process_host_1.runComposedProcessHost; } });
9
+ var event_hub_command_stream_1 = require("./event-hub-command-stream");
10
+ Object.defineProperty(exports, "consumeCommandStream", { enumerable: true, get: function () { return event_hub_command_stream_1.consumeCommandStream; } });
11
+ Object.defineProperty(exports, "replayStreamerFor", { enumerable: true, get: function () { return event_hub_command_stream_1.replayStreamerFor; } });
12
+ var host_platform_1 = require("./host-platform");
13
+ Object.defineProperty(exports, "currentBundlePlatform", { enumerable: true, get: function () { return host_platform_1.currentBundlePlatform; } });
14
+ var oci_bundle_store_1 = require("./oci-bundle-store");
15
+ Object.defineProperty(exports, "ociBundleStore", { enumerable: true, get: function () { return oci_bundle_store_1.ociBundleStore; } });
16
+ var seed_closure_1 = require("./seed-closure");
17
+ Object.defineProperty(exports, "loadSeedClosure", { enumerable: true, get: function () { return seed_closure_1.loadSeedClosure; } });
18
+ Object.defineProperty(exports, "readSeedClosure", { enumerable: true, get: function () { return seed_closure_1.readSeedClosure; } });
19
+ Object.defineProperty(exports, "readSeedProcesses", { enumerable: true, get: function () { return seed_closure_1.readSeedProcesses; } });
20
+ Object.defineProperty(exports, "SEED_CLOSURE_IMAGE_PATH", { enumerable: true, get: function () { return seed_closure_1.SEED_CLOSURE_IMAGE_PATH; } });
21
+ Object.defineProperty(exports, "SEED_CLOSURE_FILE", { enumerable: true, get: function () { return seed_closure_1.SEED_CLOSURE_FILE; } });
22
+ Object.defineProperty(exports, "seedClosureFileOf", { enumerable: true, get: function () { return seed_closure_1.seedClosureFileOf; } });
23
+ Object.defineProperty(exports, "SeedClosureSchema", { enumerable: true, get: function () { return seed_closure_1.SeedClosureSchema; } });
24
+ var seed_processes_1 = require("./seed-processes");
25
+ Object.defineProperty(exports, "seedPlatformServicesOf", { enumerable: true, get: function () { return seed_processes_1.seedPlatformServicesOf; } });
26
+ Object.defineProperty(exports, "seedProcessesOf", { enumerable: true, get: function () { return seed_processes_1.seedProcessesOf; } });
27
+ Object.defineProperty(exports, "seedProcessNamed", { enumerable: true, get: function () { return seed_processes_1.seedProcessNamed; } });
28
+ Object.defineProperty(exports, "SeedProcessNameClaimedError", { enumerable: true, get: function () { return seed_processes_1.SeedProcessNameClaimedError; } });
29
+ var seed_platform_registration_1 = require("./seed-platform-registration");
30
+ Object.defineProperty(exports, "registerSeedPlatformServices", { enumerable: true, get: function () { return seed_platform_registration_1.registerSeedPlatformServices; } });
31
+ var pack_bundle_reader_1 = require("./pack-bundle-reader");
32
+ Object.defineProperty(exports, "packBundleReader", { enumerable: true, get: function () { return pack_bundle_reader_1.packBundleReader; } });
33
+ var xema_service_nest_1 = require("@xemahq/xema-service-nest");
34
+ Object.defineProperty(exports, "SUPERVISOR_LAUNCH_ENV", { enumerable: true, get: function () { return xema_service_nest_1.SUPERVISOR_LAUNCH_ENV; } });
35
+ Object.defineProperty(exports, "SUPERVISOR_LAUNCH_FLAGS", { enumerable: true, get: function () { return xema_service_nest_1.SUPERVISOR_LAUNCH_FLAGS; } });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,iEAKiC;AAJ/B,kIAAA,yBAAyB,OAAA;AACzB,+HAAA,sBAAsB,OAAA;AAIxB,uEAKoC;AAJlC,gIAAA,oBAAoB,OAAA;AACpB,6HAAA,iBAAiB,OAAA;AAInB,iDAAwD;AAA/C,sHAAA,qBAAqB,OAAA;AAC9B,uDAA0G;AAAjG,kHAAA,cAAc,OAAA;AACvB,+CASwB;AARtB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AACf,iHAAA,iBAAiB,OAAA;AACjB,uHAAA,uBAAuB,OAAA;AACvB,iHAAA,iBAAiB,OAAA;AACjB,iHAAA,iBAAiB,OAAA;AACjB,iHAAA,iBAAiB,OAAA;AAGnB,mDAM0B;AALxB,wHAAA,sBAAsB,OAAA;AACtB,iHAAA,eAAe,OAAA;AACf,kHAAA,gBAAgB,OAAA;AAChB,6HAAA,2BAA2B,OAAA;AAG7B,2EAAmJ;AAA1I,0IAAA,4BAA4B,OAAA;AACrC,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AAEzB,+DAA2F;AAAlF,0HAAA,qBAAqB,OAAA;AAAE,4HAAA,uBAAuB,OAAA"}
@@ -0,0 +1,14 @@
1
+ import { type Oras } from '@xemahq/oci-closure';
2
+ import type { ExecutorBundleStore } from '@xemahq/xema-service-nest';
3
+ export interface BundleArchiveReader {
4
+ unpack(archive: Buffer, directory: string, expectedDigest: string): void;
5
+ contentDigest(directory: string): string;
6
+ }
7
+ export interface OciBundleStoreOptions {
8
+ readonly reader: BundleArchiveReader;
9
+ readonly oras: Oras;
10
+ readonly bundleRegistry: string;
11
+ readonly cacheDir: string;
12
+ }
13
+ export declare function ociBundleStore(options: OciBundleStoreOptions): ExecutorBundleStore;
14
+ //# sourceMappingURL=oci-bundle-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oci-bundle-store.d.ts","sourceRoot":"","sources":["../src/oci-bundle-store.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,2BAA2B,CAAC;AAMpF,MAAM,WAAW,mBAAmB;IAElC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAUD,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,mBAAmB,CAkClF"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ociBundleStore = ociBundleStore;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const biome_bundle_1 = require("@xemahq/contracts/biome-bundle");
7
+ const oci_closure_1 = require("@xemahq/oci-closure");
8
+ const xema_service_nest_1 = require("@xemahq/xema-service-nest");
9
+ function ociBundleStore(options) {
10
+ const { oras, reader, bundleRegistry, cacheDir } = options;
11
+ return {
12
+ fetch: (biome, digest) => Promise.resolve().then(() => {
13
+ const final = (0, node_path_1.join)(cacheDir, digest);
14
+ if (!(0, node_fs_1.existsSync)(final)) {
15
+ (0, node_fs_1.mkdirSync)(cacheDir, { recursive: true });
16
+ const work = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)(cacheDir, '.fetch-'));
17
+ try {
18
+ const pulled = (0, node_path_1.join)(work, 'pulled');
19
+ const tree = (0, node_path_1.join)(work, 'tree');
20
+ (0, node_fs_1.mkdirSync)(tree);
21
+ (0, oci_closure_1.pullArtifact)({
22
+ oras,
23
+ repository: `${bundleRegistry.replace(/\/+$/, '')}/bundles/${biome}`,
24
+ pointer: (0, biome_bundle_1.bundleArchiveTag)(digest),
25
+ outputDir: pulled,
26
+ });
27
+ reader.unpack((0, node_fs_1.readFileSync)((0, node_path_1.join)(pulled, biome_bundle_1.BUNDLE_OCI.archiveFile)), tree, digest);
28
+ const manifest = readManifest(tree);
29
+ const content = reader.contentDigest(tree);
30
+ if (content !== manifest.contentDigest) {
31
+ throw new xema_service_nest_1.BundleContentMismatchError(`The unpacked bundle ${digest} has content digest ${content}, its manifest declares ${manifest.contentDigest}.`);
32
+ }
33
+ (0, node_fs_1.renameSync)(tree, final);
34
+ }
35
+ finally {
36
+ (0, node_fs_1.rmSync)(work, { recursive: true, force: true });
37
+ }
38
+ }
39
+ return { directory: final, manifest: readManifest(final) };
40
+ }),
41
+ };
42
+ }
43
+ function readManifest(directory) {
44
+ return biome_bundle_1.BiomeBundleManifestSchema.parse(JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(directory, biome_bundle_1.BIOME_BUNDLE_MANIFEST_FILE), 'utf8')));
45
+ }
46
+ //# sourceMappingURL=oci-bundle-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oci-bundle-store.js","sourceRoot":"","sources":["../src/oci-bundle-store.ts"],"names":[],"mappings":";;AA0CA,wCAkCC;AA5ED,qCAA+F;AAC/F,yCAAiC;AAEjC,iEAKwC;AACxC,qDAA8D;AAC9D,iEAAuE;AAgCvE,SAAgB,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC3D,OAAO;QACL,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAkB,EAAE;YACnE,MAAM,KAAK,GAAG,IAAA,gBAAI,EAAC,QAAQ,EAAE,MAAM,CAAC,CA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,gBAAM,EAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;YACD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7D,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,SAAiB;IACrC,OAAO,wCAAyB,CAAC,KAAK,CACpC,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,yCAA0B,CAAC,EAAE,MAAM,CAAC,CAAC,CAC9E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BundleArchiveReader } from './oci-bundle-store';
2
+ export declare const packBundleReader: BundleArchiveReader;
3
+ //# sourceMappingURL=pack-bundle-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-bundle-reader.d.ts","sourceRoot":"","sources":["../src/pack-bundle-reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,eAAO,MAAM,gBAAgB,EAAE,mBAY9B,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packBundleReader = void 0;
4
+ const content_1 = require("@xemahq/biome-bundle-pack/content");
5
+ const unpack_1 = require("@xemahq/biome-bundle-pack/unpack");
6
+ const xema_service_nest_1 = require("@xemahq/xema-service-nest");
7
+ exports.packBundleReader = {
8
+ unpack(archive, directory, expectedDigest) {
9
+ try {
10
+ (0, unpack_1.unpackBundle)(archive, directory, { expectedDigest });
11
+ }
12
+ catch (error) {
13
+ if (error instanceof unpack_1.BundleArchiveDigestMismatchError) {
14
+ throw new xema_service_nest_1.BundleContentMismatchError(error.message);
15
+ }
16
+ throw error;
17
+ }
18
+ },
19
+ contentDigest: content_1.bundleContentDigest,
20
+ };
21
+ //# sourceMappingURL=pack-bundle-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-bundle-reader.js","sourceRoot":"","sources":["../src/pack-bundle-reader.ts"],"names":[],"mappings":";;;AAAA,+DAAwE;AACxE,6DAAkG;AAClG,iEAAuE;AAK1D,QAAA,gBAAgB,GAAwB;IACnD,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc;QACvC,IAAI,CAAC;YACH,IAAA,qBAAY,EAAC,OAAO,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,yCAAgC,EAAE,CAAC;gBACtD,MAAM,IAAI,8CAA0B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACtD,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,aAAa,EAAE,6BAAmB;CACnC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { type SeedProcess } from './seed-processes';
3
+ import type { ComposedProcessInputs } from '@xemahq/xema-service-nest';
4
+ export declare const SEED_CLOSURE_IMAGE_PATH = "/monorepo/packages/sdks/composed-process-host/dist/seed-closure.json";
5
+ export declare const SEED_CLOSURE_FILE = "seed-closure.json";
6
+ export declare const SeedClosureSchema: z.ZodObject<{
7
+ schemaVersion: z.ZodLiteral<3>;
8
+ workspaceRoot: z.ZodString;
9
+ root: z.ZodString;
10
+ memberFacts: z.ZodArray<z.ZodType<import("@xemahq/contracts/process-topology").ProcessMemberFacts, unknown, z.core.$ZodTypeInternals<import("@xemahq/contracts/process-topology").ProcessMemberFacts, unknown>>>;
11
+ members: z.ZodArray<z.ZodObject<{
12
+ member: z.ZodObject<{
13
+ biomeId: z.ZodString;
14
+ componentKey: z.ZodString;
15
+ }, z.core.$strip>;
16
+ serviceName: z.ZodString;
17
+ entry: z.ZodString;
18
+ kind: z.ZodEnum<typeof import("@xemahq/contracts/process-topology").ProcessMemberKind>;
19
+ requiredEnvVars: z.ZodArray<z.ZodString>;
20
+ startupRequires: z.ZodArray<z.ZodString>;
21
+ }, z.core.$strict>>;
22
+ }, z.core.$strict>;
23
+ export type SeedClosure = z.infer<typeof SeedClosureSchema>;
24
+ export declare function loadSeedClosure(file: string): SeedClosure;
25
+ export declare function readSeedProcesses(file: string): SeedProcess[];
26
+ export declare function readSeedClosure(input: {
27
+ readonly file: string;
28
+ readonly processName: string;
29
+ readonly probePort: number;
30
+ }): ComposedProcessInputs;
31
+ export declare const seedClosureFileOf: (packageRoot: string) => string;
32
+ export declare const packageRootOf: (moduleDirectory: string) => string;
33
+ //# sourceMappingURL=seed-closure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-closure.d.ts","sourceRoot":"","sources":["../src/seed-closure.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,eAAO,MAAM,uBAAuB,yEAAyE,CAAC;AAG9G,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAkBrD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;kBA2BnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAG5D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAazD;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAE7D;AASD,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,GAAG,qBAAqB,CAwBxB;AAGD,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MAAsD,CAAC;AAG/G,eAAO,MAAM,aAAa,GAAI,iBAAiB,MAAM,KAAG,MAAkC,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.packageRootOf = exports.seedClosureFileOf = exports.SeedClosureSchema = exports.SEED_CLOSURE_FILE = exports.SEED_CLOSURE_IMAGE_PATH = void 0;
4
+ exports.loadSeedClosure = loadSeedClosure;
5
+ exports.readSeedProcesses = readSeedProcesses;
6
+ exports.readSeedClosure = readSeedClosure;
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = require("node:path");
9
+ const process_topology_1 = require("@xemahq/contracts/process-topology");
10
+ const zod_1 = require("zod");
11
+ const seed_processes_1 = require("./seed-processes");
12
+ exports.SEED_CLOSURE_IMAGE_PATH = '/monorepo/packages/sdks/composed-process-host/dist/seed-closure.json';
13
+ exports.SEED_CLOSURE_FILE = 'seed-closure.json';
14
+ const NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
15
+ const MemberKeySchema = zod_1.z.object({
16
+ biomeId: zod_1.z.string().regex(NAME_PATTERN),
17
+ componentKey: zod_1.z.string().regex(NAME_PATTERN),
18
+ });
19
+ exports.SeedClosureSchema = zod_1.z
20
+ .object({
21
+ schemaVersion: zod_1.z.literal(3),
22
+ workspaceRoot: zod_1.z.string().min(1),
23
+ root: zod_1.z.string().regex(NAME_PATTERN),
24
+ memberFacts: zod_1.z.array(process_topology_1.ProcessMemberFactsSchema).min(1),
25
+ members: zod_1.z
26
+ .array(zod_1.z
27
+ .object({
28
+ member: MemberKeySchema,
29
+ serviceName: zod_1.z.string().regex(NAME_PATTERN),
30
+ entry: zod_1.z.string().min(1),
31
+ kind: process_topology_1.ProcessMemberKindSchema,
32
+ requiredEnvVars: process_topology_1.MemberRequiredEnvVarsSchema,
33
+ startupRequires: zod_1.z.array(zod_1.z.string().regex(NAME_PATTERN)),
34
+ })
35
+ .strict())
36
+ .min(1),
37
+ })
38
+ .strict();
39
+ function loadSeedClosure(file) {
40
+ let text;
41
+ try {
42
+ text = (0, node_fs_1.readFileSync)(file, 'utf8');
43
+ }
44
+ catch (error) {
45
+ throw new Error(`The seed's bootstrap closure ${file} cannot be read; it is written by this package's build: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
46
+ }
47
+ return exports.SeedClosureSchema.parse(JSON.parse(text));
48
+ }
49
+ function readSeedProcesses(file) {
50
+ return (0, seed_processes_1.seedProcessesOf)(loadSeedClosure(file));
51
+ }
52
+ function readSeedClosure(input) {
53
+ const closure = loadSeedClosure(input.file);
54
+ const process = (0, seed_processes_1.seedProcessNamed)((0, seed_processes_1.seedProcessesOf)(closure), input.processName);
55
+ const placed = new Set(process.members.map((member) => (0, process_topology_1.processMemberKey)(member)));
56
+ const workspaceRoot = (0, node_path_1.resolve)((0, node_path_1.dirname)(input.file), closure.workspaceRoot);
57
+ const members = closure.members
58
+ .filter((entry) => placed.has((0, process_topology_1.processMemberKey)(entry.member)))
59
+ .map((entry) => {
60
+ const outside = (0, node_path_1.relative)(workspaceRoot, (0, node_path_1.join)(workspaceRoot, entry.entry));
61
+ if ((0, node_path_1.isAbsolute)(entry.entry) || outside.startsWith('..')) {
62
+ throw new Error(`The seed closure entry "${entry.entry}" leaves the workspace root.`);
63
+ }
64
+ return { member: entry.member, kind: entry.kind, entry: (0, node_path_1.join)(workspaceRoot, entry.entry), env: {} };
65
+ });
66
+ return {
67
+ definition: {
68
+ name: process.name,
69
+ members: members.map((m) => m.member),
70
+ replicas: { min: 1, max: 1 },
71
+ listen: { port: input.probePort },
72
+ },
73
+ memberFacts: closure.memberFacts.filter((facts) => placed.has((0, process_topology_1.processMemberKey)(facts))),
74
+ members,
75
+ };
76
+ }
77
+ const seedClosureFileOf = (packageRoot) => (0, node_path_1.join)(packageRoot, 'dist', exports.SEED_CLOSURE_FILE);
78
+ exports.seedClosureFileOf = seedClosureFileOf;
79
+ const packageRootOf = (moduleDirectory) => (0, node_path_1.dirname)(moduleDirectory);
80
+ exports.packageRootOf = packageRootOf;
81
+ //# sourceMappingURL=seed-closure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-closure.js","sourceRoot":"","sources":["../src/seed-closure.ts"],"names":[],"mappings":";;;AA+DA,0CAaC;AAGD,8CAEC;AASD,0CA4BC;AAtHD,qCAAuC;AACvC,yCAAyE;AAEzE,yEAAsJ;AACtJ,6BAAwB;AAExB,qDAAuF;AAK1E,QAAA,uBAAuB,GAAG,sEAAsE,CAAC;AAGjG,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEzC,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;IACvC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;CAC7C,CAAC,CAAC;AAWU,QAAA,iBAAiB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;IACpC,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,2CAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,OAAC;SACP,KAAK,CACJ,OAAC;SACE,MAAM,CAAC;QACN,MAAM,EAAE,eAAe;QAEvB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;QAC3C,K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AE;SAClC;QACD,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAA,mCAAgB,EAAC,KAAK,CAAC,CAAC,CAAC;QACvF,OAAO;KACR,CAAC;AACJ,CAAC;AAGM,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAU,EAAE,CAAC,IAAA,gBAAI,EAAC,WAAW,EAAE,MAAM,EAAE,yBAAiB,CAAC,CAAC;AAAlG,QAAA,iBAAiB,qBAAiF;AAGxG,MAAM,aAAa,GAAG,CAAC,eAAuB,EAAU,EAAE,CAAC,IAAA,mBAAO,EAAC,eAAe,CAAC,CAAC;AAA9E,QAAA,aAAa,iBAAiE"}
@@ -0,0 +1,239 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "workspaceRoot": "../../../..",
4
+ "root": "biome-host",
5
+ "memberFacts": [
6
+ {
7
+ "biomeId": "authorization",
8
+ "componentKey": "authorization-api",
9
+ "componentKind": "service",
10
+ "scheduler": "platform",
11
+ "scalingMode": "horizontal",
12
+ "origin": "first-party",
13
+ "version": "0.1.0",
14
+ "buildSource": {
15
+ "repository": "xema-dev/xema-base",
16
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
17
+ }
18
+ },
19
+ {
20
+ "biomeId": "biome-fetcher",
21
+ "componentKey": "biome-fetcher-api",
22
+ "componentKind": "service",
23
+ "scheduler": "platform",
24
+ "scalingMode": "horizontal",
25
+ "origin": "first-party",
26
+ "version": "0.1.0",
27
+ "buildSource": {
28
+ "repository": "xema-dev/xema-base",
29
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
30
+ }
31
+ },
32
+ {
33
+ "biomeId": "biome-host",
34
+ "componentKey": "biome-host-api",
35
+ "componentKind": "service",
36
+ "scheduler": "platform",
37
+ "scalingMode": "horizontal",
38
+ "origin": "first-party",
39
+ "version": "0.1.0",
40
+ "buildSource": {
41
+ "repository": "xema-dev/xema-base",
42
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
43
+ }
44
+ },
45
+ {
46
+ "biomeId": "capability-registry",
47
+ "componentKey": "capability-registry-api",
48
+ "componentKind": "service",
49
+ "scheduler": "platform",
50
+ "scalingMode": "horizontal",
51
+ "origin": "first-party",
52
+ "version": "0.1.0",
53
+ "buildSource": {
54
+ "repository": "xema-dev/xema-base",
55
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
56
+ }
57
+ },
58
+ {
59
+ "biomeId": "org-database-pool",
60
+ "componentKey": "org-database-pool-api",
61
+ "componentKind": "service",
62
+ "scheduler": "platform",
63
+ "scalingMode": "horizontal",
64
+ "origin": "first-party",
65
+ "version": "0.1.0",
66
+ "buildSource": {
67
+ "repository": "xema-dev/xema-base",
68
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
69
+ }
70
+ },
71
+ {
72
+ "biomeId": "space-registry",
73
+ "componentKey": "space-registry-api",
74
+ "componentKind": "service",
75
+ "scheduler": "platform",
76
+ "scalingMode": "horizontal",
77
+ "origin": "first-party",
78
+ "version": "0.1.0",
79
+ "buildSource": {
80
+ "repository": "xema-dev/xema-base",
81
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
82
+ }
83
+ },
84
+ {
85
+ "biomeId": "xema-capability-router",
86
+ "componentKey": "xema-capability-router",
87
+ "componentKind": "service",
88
+ "scheduler": "platform",
89
+ "scalingMode": "horizontal",
90
+ "processFacts": {
91
+ "credentialCustody": true
92
+ },
93
+ "origin": "first-party",
94
+ "version": "0.1.0",
95
+ "buildSource": {
96
+ "repository": "xema-dev/xema-base",
97
+ "commit": "f738af85247264f331538dfa62145d495c83e857"
98
+ }
99
+ }
100
+ ],
101
+ "members": [
102
+ {
103
+ "member": {
104
+ "biomeId": "authorization",
105
+ "componentKey": "authorization-api"
106
+ },
107
+ "serviceName": "authorization-api",
108
+ "entry": "biomes/authorization/api/authorization-api/dist/main.js",
109
+ "kind": "http",
110
+ "requiredEnvVars": [
111
+ "JWT_ISSUER",
112
+ "OPENFGA_API_URL",
113
+ "OPENFGA_PRESHARED_KEY",
114
+ "OPENFGA_STORE_NAME"
115
+ ],
116
+ "startupRequires": [
117
+ "capability-registry-api",
118
+ "event-hub-api",
119
+ "identity-api",
120
+ "org-database-pool-api"
121
+ ]
122
+ },
123
+ {
124
+ "member": {
125
+ "biomeId": "biome-fetcher",
126
+ "componentKey": "biome-fetcher-api"
127
+ },
128
+ "serviceName": "biome-fetcher-api",
129
+ "entry": "biomes/biome-fetcher/api/biome-fetcher-api/dist/main.js",
130
+ "kind": "http",
131
+ "requiredEnvVars": [
132
+ "BLOB_CONTAINER_PREFIX",
133
+ "BLOB_STORAGE_BACKEND",
134
+ "JWT_ISSUER",
135
+ "JWT_PUBLIC_KEY_URL"
136
+ ],
137
+ "startupRequires": [
138
+ "identity-api"
139
+ ]
140
+ },
141
+ {
142
+ "member": {
143
+ "biomeId": "biome-host",
144
+ "componentKey": "biome-host-api"
145
+ },
146
+ "serviceName": "biome-host-api",
147
+ "entry": "biomes/biome-host/api/biome-host-api/dist/main.js",
148
+ "kind": "http",
149
+ "requiredEnvVars": [
150
+ "BIOME_SANDBOX_PTY_PROVIDER",
151
+ "BLOB_CONTAINER_PREFIX",
152
+ "BLOB_STORAGE_BACKEND",
153
+ "IDENTITY_DOMAIN_ID",
154
+ "JWT_ISSUER",
155
+ "JWT_PUBLIC_KEY_URL"
156
+ ],
157
+ "startupRequires": [
158
+ "authorization-api",
159
+ "biome-fetcher-api",
160
+ "event-hub-api",
161
+ "identity-api",
162
+ "org-database-pool-api"
163
+ ]
164
+ },
165
+ {
166
+ "member": {
167
+ "biomeId": "capability-registry",
168
+ "componentKey": "capability-registry-api"
169
+ },
170
+ "serviceName": "capability-registry-api",
171
+ "entry": "biomes/capability-registry/api/capability-registry-api/dist/main.js",
172
+ "kind": "http",
173
+ "requiredEnvVars": [
174
+ "JWT_ISSUER",
175
+ "JWT_PUBLIC_KEY_URL"
176
+ ],
177
+ "startupRequires": [
178
+ "event-hub-api",
179
+ "identity-api",
180
+ "org-database-pool-api"
181
+ ]
182
+ },
183
+ {
184
+ "member": {
185
+ "biomeId": "org-database-pool",
186
+ "componentKey": "org-database-pool-api"
187
+ },
188
+ "serviceName": "org-database-pool-api",
189
+ "entry": "biomes/org-database-pool/api/org-database-pool-api/dist/main.js",
190
+ "kind": "http",
191
+ "requiredEnvVars": [
192
+ "DATABASE_URL",
193
+ "JWT_ISSUER",
194
+ "TEMPORAL_ADDRESS"
195
+ ],
196
+ "startupRequires": [
197
+ "event-hub-api",
198
+ "identity-api"
199
+ ]
200
+ },
201
+ {
202
+ "member": {
203
+ "biomeId": "space-registry",
204
+ "componentKey": "space-registry-api"
205
+ },
206
+ "serviceName": "space-registry-api",
207
+ "entry": "biomes/space-registry/api/space-registry-api/dist/main.js",
208
+ "kind": "http",
209
+ "requiredEnvVars": [
210
+ "JWT_ISSUER",
211
+ "JWT_PUBLIC_KEY_URL"
212
+ ],
213
+ "startupRequires": [
214
+ "authorization-api",
215
+ "event-hub-api",
216
+ "identity-api",
217
+ "org-database-pool-api"
218
+ ]
219
+ },
220
+ {
221
+ "member": {
222
+ "biomeId": "xema-capability-router",
223
+ "componentKey": "xema-capability-router"
224
+ },
225
+ "serviceName": "xema-capability-router",
226
+ "entry": "biomes/xema-capability-router/api/xema-capability-router/dist/main.js",
227
+ "kind": "http",
228
+ "requiredEnvVars": [
229
+ "JWT_ISSUER"
230
+ ],
231
+ "startupRequires": [
232
+ "authorization-api",
233
+ "event-hub-api",
234
+ "identity-api",
235
+ "org-database-pool-api"
236
+ ]
237
+ }
238
+ ]
239
+ }
@@ -0,0 +1,17 @@
1
+ import type { ServiceRegistry } from '@xemahq/contracts/service-registry';
2
+ type Env = Readonly<Record<string, string | undefined>>;
3
+ export interface RegisterSeedPlatformServicesInput {
4
+ readonly closureFile: string;
5
+ readonly processName: string;
6
+ readonly env: Env;
7
+ readonly instanceSuffix: string;
8
+ readonly write: (line: string) => void;
9
+ readonly onFatal: (error: Error) => void;
10
+ readonly registryFor?: (env: Env) => ServiceRegistry;
11
+ }
12
+ export interface SeedPlatformRegistration {
13
+ stop(): Promise<void>;
14
+ }
15
+ export declare function registerSeedPlatformServices(input: RegisterSeedPlatformServicesInput): Promise<SeedPlatformRegistration | undefined>;
16
+ export {};
17
+ //# sourceMappingURL=seed-platform-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-platform-registration.d.ts","sourceRoot":"","sources":["../src/seed-platform-registration.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,KAAK,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAExD,MAAM,WAAW,iCAAiC;IAEhD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAElB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEzC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,eAAe,CAAC;CACtD;AAGD,MAAM,WAAW,wBAAwB;IACvC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AA2BD,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CA6B/C"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerSeedPlatformServices = registerSeedPlatformServices;
4
+ const member_config_1 = require("@xemahq/installation-tenancy/member-config");
5
+ const kernel_state_runtime_1 = require("@xemahq/kernel-state-runtime");
6
+ const service_registry_nest_1 = require("@xemahq/service-registry-nest");
7
+ const seed_closure_1 = require("./seed-closure");
8
+ const seed_processes_1 = require("./seed-processes");
9
+ function kernelStateRegistry(env) {
10
+ const read = (name) => env[name];
11
+ return new service_registry_nest_1.KernelStateServiceRegistry((0, kernel_state_runtime_1.createKernelState)({
12
+ profile: (0, service_registry_nest_1.parseKernelStateProfile)(read('XEMA_KERNEL_STATE_PROFILE')),
13
+ etcd: (0, kernel_state_runtime_1.etcdKernelStateOptionsFromEnv)(read),
14
+ }));
15
+ }
16
+ async function registerSeedPlatformServices(input) {
17
+ const closure = (0, seed_closure_1.loadSeedClosure)(input.closureFile);
18
+ if (!(0, seed_processes_1.seedProcessNamed)((0, seed_processes_1.seedProcessesOf)(closure), input.processName).hostsRoot) {
19
+ return undefined;
20
+ }
21
+ const services = (0, seed_processes_1.seedPlatformServicesOf)(closure);
22
+ if (services.length === 0) {
23
+ return undefined;
24
+ }
25
+ const inventoryFile = input.env[member_config_1.INSTALLATION_INVENTORY_FILE_ENV];
26
+ if (inventoryFile === undefined || inventoryFile === '') {
27
+ throw new Error(`xema-composed-process: ${member_config_1.INSTALLATION_INVENTORY_FILE_ENV} is required: the seed registers ${services.join(', ')} on behalf from the installation inventory's declared servers`);
28
+ }
29
+ const declarations = (0, member_config_1.platformServiceDeclarations)((0, member_config_1.readInventory)(inventoryFile), services);
30
+ const registrar = new service_registry_nest_1.OnBehalfRegistrar({
31
+ registry: (input.registryFor ?? kernelStateRegistry)(input.env),
32
+ services: declarations,
33
+ instanceSuffix: input.instanceSuffix,
34
+ logger: {
35
+ log: (message) => input.write(`[composed-process-host] ${message}\n`),
36
+ warn: (message) => input.write(`[composed-process-host] WARN ${message}\n`),
37
+ error: (message) => input.write(`[composed-process-host] ERROR ${message}\n`),
38
+ },
39
+ onUnrecoverable: ({ message, cause }) => input.onFatal(new Error(message, { cause })),
40
+ });
41
+ await registrar.start();
42
+ return { stop: () => registrar.stop() };
43
+ }
44
+ //# sourceMappingURL=seed-platform-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-platform-registration.js","sourceRoot":"","sources":["../src/seed-platform-registration.ts"],"names":[],"mappings":";;AAwDA,oEA+BC;AAvFD,8EAAyI;AACzI,uEAAgG;AAChG,yEAAuH;AAEvH,iDAAiD;AACjD,qDAA6F;AA+B7F,SAAS,mBAAmB,CAAC,GAAQ;IACnC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAsB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,IAAI,kDAA0B,CACnC,IAAA,wCAAiB,EAAC;QAChB,OAAO,EAAE,IAAA,+CAAuB,EAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACnE,IAAI,EAAE,IAAA,oDAA6B,EAAC,IAAI,CAAC;KAC1C,CAAC,CACH,CAAC;AACJ,CAAC;AAYM,KAAK,UAAU,4BAA4B,CAChD,KAAwC;IAExC,MAAM,OAAO,GAAG,IAAA,8BAAe,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnD,IAAI,CAAC,IAAA,iCAAgB,EAAC,IAAA,gCAAe,EAAC,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,SAAS,EAAE,CAAC;QAC7E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,IAAA,uCAAsB,EAAC,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,+CAA+B,CAAC,CAAC;IACjE,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,KAAK,EAAE,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,0BAA0B,+CAA+B,oCAAoC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,+DAA+D,CAChL,CAAC;IACJ,CAAC;IACD,MAAM,YAAY,GAAG,IAAA,2CAA2B,EAAC,IAAA,6BAAa,EAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzF,MAAM,SAAS,GAAG,IAAI,yCAAiB,CAAC;QACtC,QAAQ,EAAE,CAAC,KAAK,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAC/D,QAAQ,EAAE,YAAY;QACtB,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,MAAM,EAAE;YACN,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC;YACrE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,gCAAgC,OAAO,IAAI,CAAC;YAC3E,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,OAAO,IAAI,CAAC;SAC9E;QACD,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;KACtF,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type ProcessMember } from '@xemahq/contracts/process-topology';
2
+ import { type SeedPartition } from '@xemahq/xema-service-nest';
3
+ import type { SeedClosure } from './seed-closure';
4
+ export interface SeedProcess {
5
+ readonly name: string;
6
+ readonly trustDomain: string;
7
+ readonly credentialCustody: boolean;
8
+ readonly seedPartition: SeedPartition;
9
+ readonly members: readonly ProcessMember[];
10
+ readonly serviceNames: readonly string[];
11
+ readonly requiredEnvVars: Readonly<Record<string, readonly string[]>>;
12
+ readonly startsAfter: readonly string[];
13
+ readonly hostsRoot: boolean;
14
+ }
15
+ export declare class SeedProcessNameClaimedError extends Error {
16
+ readonly serviceName: string;
17
+ constructor(serviceName: string);
18
+ }
19
+ export declare function seedProcessesOf(closure: SeedClosure): SeedProcess[];
20
+ export declare function seedProcessNamed(processes: readonly SeedProcess[], name: string): SeedProcess;
21
+ export declare function seedPlatformServicesOf(closure: SeedClosure): string[];
22
+ //# sourceMappingURL=seed-processes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-processes.d.ts","sourceRoot":"","sources":["../src/seed-processes.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAgE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE7H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoBlD,MAAM,WAAW,WAAW;IAE1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAEpC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAE3C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAEzC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAEtE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAExC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAKD,qBAAa,2BAA4B,SAAQ,KAAK;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM;gBAAnB,WAAW,EAAE,MAAM;CAMzC;AAoDD,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CA4DnE;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAQ7F;AAOD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,EAAE,CASrE"}