diff --git a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts index 4bcd3d5946..531b30cd25 100644 --- a/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts +++ b/container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts @@ -301,6 +301,20 @@ export class SystemForEmbassy implements System { await effects.setMainStatus({ status: "stopped" }) await this.exportActions(effects) await this.exportNetwork(effects) + await this.containerSetDependencies(effects) + } + async containerSetDependencies(effects: T.Effects) { + const oldDeps: Record = Object.fromEntries( + await effects + .getDependencies() + .then((x) => + x.flatMap((x) => + x.kind === "running" ? [[x.id, x?.healthChecks || []]] : [], + ), + ) + .catch(() => []), + ) + await this.setDependencies(effects, oldDeps) } async exit(): Promise { @@ -650,7 +664,7 @@ export class SystemForEmbassy implements System { ), ) const dependsOn = answer["depends-on"] ?? answer.dependsOn ?? {} - await this.setConfigSetConfig(effects, dependsOn) + await this.setDependencies(effects, dependsOn) return } else if (setConfigValue.type === "script") { const moduleCode = await this.moduleCode @@ -673,31 +687,60 @@ export class SystemForEmbassy implements System { }), ) const dependsOn = answer["depends-on"] ?? answer.dependsOn ?? {} - await this.setConfigSetConfig(effects, dependsOn) + await this.setDependencies(effects, dependsOn) return } } - private async setConfigSetConfig( + private async setDependencies( effects: Effects, - dependsOn: { [x: string]: readonly string[] }, + rawDepends: { [x: string]: readonly string[] }, ) { + const dependsOn: Record = { + ...Object.fromEntries( + Object.entries(this.manifest.dependencies || {})?.map((x) => [ + x[0], + null, + ]) || [], + ), + ...rawDepends, + } await effects.setDependencies({ - dependencies: Object.entries(dependsOn).flatMap(([key, value]) => { - const dependency = this.manifest.dependencies?.[key] - if (!dependency) return [] - const versionRange = dependency.version - const registryUrl = DEFAULT_REGISTRY - const kind = "running" - return [ - { - id: key, - versionRange, - registryUrl, - kind, - healthChecks: [...value], - }, - ] - }), + dependencies: Object.entries(dependsOn).flatMap( + ([key, value]): T.Dependencies => { + const dependency = this.manifest.dependencies?.[key] + if (!dependency) return [] + if (value == null) { + const versionRange = dependency.version + if (dependency.requirement.type === "required") { + return [ + { + id: key, + versionRange, + kind: "running", + healthChecks: [], + }, + ] + } + return [ + { + kind: "exists", + id: key, + versionRange, + }, + ] + } + const versionRange = dependency.version + const kind = "running" + return [ + { + id: key, + versionRange, + kind, + healthChecks: [...value], + }, + ] + }, + ), }) } diff --git a/package-lock.json b/package-lock.json index 497f28c49a..9a9ca8f481 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "embassy-os", + "name": "start-os", "lockfileVersion": 2, "requires": true, "packages": {} diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index a2e672b204..844094e3aa 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1191,11 +1191,11 @@ export module Mock { name: 'Datetime', required: false, }), - file: ISB.Value.file({ - name: 'File', - required: false, - extensions: ['png', 'pdf'], - }), + // file: ISB.Value.file({ + // name: 'File', + // required: false, + // extensions: ['png', 'pdf'], + // }), users: ISB.Value.multiselect({ name: 'Users', default: [],