@wildo-ai/wildo-cli 1.1.12 → 1.1.14
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/src/commands/build/approve.command.d.ts +4 -0
- package/dist/src/commands/build/approve.command.d.ts.map +1 -1
- package/dist/src/commands/build/approve.command.js +14 -3
- package/dist/src/commands/build/approve.command.js.map +1 -1
- package/dist/src/commands/build/close.command.d.ts +4 -0
- package/dist/src/commands/build/close.command.d.ts.map +1 -1
- package/dist/src/commands/build/close.command.js +17 -3
- package/dist/src/commands/build/close.command.js.map +1 -1
- package/dist/src/commands/config/sync.command.d.ts.map +1 -1
- package/dist/src/commands/config/sync.command.js +22 -1
- package/dist/src/commands/config/sync.command.js.map +1 -1
- package/dist/src/commands/context/journey.command.d.ts.map +1 -1
- package/dist/src/commands/context/journey.command.js +8 -0
- package/dist/src/commands/context/journey.command.js.map +1 -1
- package/dist/src/commands/creation/drive.command.d.ts.map +1 -1
- package/dist/src/commands/creation/drive.command.js +2 -0
- package/dist/src/commands/creation/drive.command.js.map +1 -1
- package/dist/src/commands/creation/feed.command.d.ts.map +1 -1
- package/dist/src/commands/creation/feed.command.js +6 -3
- package/dist/src/commands/creation/feed.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.d.ts +13 -0
- package/dist/src/commands/fwk/publish-all.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.js +64 -2
- package/dist/src/commands/fwk/publish-all.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-docker.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-docker.command.js +16 -1
- package/dist/src/commands/fwk/publish-docker.command.js.map +1 -1
- package/dist/src/commands/fwk/registry-host.command.d.ts +19 -1
- package/dist/src/commands/fwk/registry-host.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/registry-host.command.js +78 -3
- package/dist/src/commands/fwk/registry-host.command.js.map +1 -1
- package/dist/src/commands/init.command.d.ts +14 -0
- package/dist/src/commands/init.command.d.ts.map +1 -1
- package/dist/src/commands/init.command.js +29 -3
- package/dist/src/commands/init.command.js.map +1 -1
- package/dist/src/commands/local/dev.command.d.ts +68 -0
- package/dist/src/commands/local/dev.command.d.ts.map +1 -1
- package/dist/src/commands/local/dev.command.js +216 -8
- package/dist/src/commands/local/dev.command.js.map +1 -1
- package/dist/src/commands/local/doctor.command.d.ts +22 -9
- package/dist/src/commands/local/doctor.command.d.ts.map +1 -1
- package/dist/src/commands/local/doctor.command.js +45 -42
- package/dist/src/commands/local/doctor.command.js.map +1 -1
- package/dist/src/commands/providers/connect.command.d.ts.map +1 -1
- package/dist/src/commands/providers/connect.command.js +11 -1
- package/dist/src/commands/providers/connect.command.js.map +1 -1
- package/dist/src/commands/registry/repair-lockfile.command.d.ts.map +1 -1
- package/dist/src/commands/registry/repair-lockfile.command.js +1 -0
- package/dist/src/commands/registry/repair-lockfile.command.js.map +1 -1
- package/dist/src/commands/registry/update.command.d.ts.map +1 -1
- package/dist/src/commands/registry/update.command.js +1 -0
- package/dist/src/commands/registry/update.command.js.map +1 -1
- package/dist/src/commands/seal/currency.command.d.ts +13 -0
- package/dist/src/commands/seal/currency.command.d.ts.map +1 -0
- package/dist/src/commands/seal/currency.command.js +52 -0
- package/dist/src/commands/seal/currency.command.js.map +1 -0
- package/dist/src/commands/seal/seal-admin-door.utils.d.ts.map +1 -1
- package/dist/src/commands/seal/seal-admin-door.utils.js +2 -0
- package/dist/src/commands/seal/seal-admin-door.utils.js.map +1 -1
- package/dist/src/commands/seal/verify.command.d.ts +23 -0
- package/dist/src/commands/seal/verify.command.d.ts.map +1 -1
- package/dist/src/commands/seal/verify.command.js +88 -3
- package/dist/src/commands/seal/verify.command.js.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts +19 -0
- package/dist/src/services/application/content-guardrail-classifier.service.d.ts.map +1 -1
- package/dist/src/services/application/content-guardrail-classifier.service.js +75 -11
- package/dist/src/services/application/content-guardrail-classifier.service.js.map +1 -1
- package/dist/src/services/application/local-provider-doubles.service.d.ts +98 -0
- package/dist/src/services/application/local-provider-doubles.service.d.ts.map +1 -0
- package/dist/src/services/application/local-provider-doubles.service.js +214 -0
- package/dist/src/services/application/local-provider-doubles.service.js.map +1 -0
- package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
- package/dist/src/services/application/provider-runtime-sync.service.js +26 -1
- package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.js +24 -2
- package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
- package/dist/src/services/application/system-of-record-simulators.service.d.ts +21 -2
- package/dist/src/services/application/system-of-record-simulators.service.d.ts.map +1 -1
- package/dist/src/services/application/system-of-record-simulators.service.js +21 -12
- package/dist/src/services/application/system-of-record-simulators.service.js.map +1 -1
- package/dist/src/services/companion/build-console.service.d.ts +39 -2
- package/dist/src/services/companion/build-console.service.d.ts.map +1 -1
- package/dist/src/services/companion/build-console.service.js +54 -4
- package/dist/src/services/companion/build-console.service.js.map +1 -1
- package/dist/src/services/companion/creation-console.service.d.ts +6 -1
- package/dist/src/services/companion/creation-console.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-console.service.js +14 -2
- package/dist/src/services/companion/creation-console.service.js.map +1 -1
- package/dist/src/services/companion/creation-drive.service.d.ts +32 -2
- package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-drive.service.js +66 -6
- package/dist/src/services/companion/creation-drive.service.js.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.js +14 -2
- package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.d.ts +6 -0
- package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.js +7 -1
- package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.d.ts.map +1 -1
- package/dist/src/services/credentials/provider-env-vars.utils.js +11 -3
- package/dist/src/services/credentials/provider-env-vars.utils.js.map +1 -1
- package/dist/src/services/credentials/secret-requirements.service.d.ts +2 -1
- package/dist/src/services/credentials/secret-requirements.service.d.ts.map +1 -1
- package/dist/src/services/credentials/secret-requirements.service.js +17 -1
- package/dist/src/services/credentials/secret-requirements.service.js.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.d.ts +9 -0
- package/dist/src/services/data-services/data-services.schemas.d.ts.map +1 -1
- package/dist/src/services/data-services/data-services.schemas.js +9 -0
- package/dist/src/services/data-services/data-services.schemas.js.map +1 -1
- package/dist/src/services/deployment/application-runtime-environment.d.ts.map +1 -1
- package/dist/src/services/deployment/application-runtime-environment.js +3 -13
- package/dist/src/services/deployment/application-runtime-environment.js.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js +15 -4
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.d.ts +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.js +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.js.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js +3 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.d.ts.map +1 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js +22 -1
- package/dist/src/services/deployment/local-dev-session-lease.service.js.map +1 -1
- package/dist/src/services/deployment/local-precondition-checks.service.d.ts.map +1 -1
- package/dist/src/services/deployment/local-precondition-checks.service.js +4 -2
- package/dist/src/services/deployment/local-precondition-checks.service.js.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-config.utils.js +1 -0
- package/dist/src/services/environment/authored-infra-config.utils.js.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.d.ts.map +1 -1
- package/dist/src/services/environment/authored-infra-member-authority.js +5 -0
- package/dist/src/services/environment/authored-infra-member-authority.js.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.js +14 -6
- package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.d.ts +6 -0
- package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.js +24 -1
- package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.d.ts.map +1 -1
- package/dist/src/services/environment/environment-hydration.utils.js +1 -0
- package/dist/src/services/environment/environment-hydration.utils.js.map +1 -1
- package/dist/src/services/environment/environment-service-profile.utils.d.ts +8 -1
- package/dist/src/services/environment/environment-service-profile.utils.d.ts.map +1 -1
- package/dist/src/services/environment/environment-service-profile.utils.js +14 -1
- package/dist/src/services/environment/environment-service-profile.utils.js.map +1 -1
- package/dist/src/services/environment/environment.schemas.d.ts +7 -1
- package/dist/src/services/environment/environment.schemas.d.ts.map +1 -1
- package/dist/src/services/environment/environment.schemas.js.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts +2 -0
- package/dist/src/services/environment/runtime-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/environment/runtime-bootstrap.service.js +4 -0
- package/dist/src/services/environment/runtime-bootstrap.service.js.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.d.ts +102 -0
- package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.js +204 -25
- package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
- package/dist/src/services/framework/github-actions-annotation.d.ts +19 -0
- package/dist/src/services/framework/github-actions-annotation.d.ts.map +1 -0
- package/dist/src/services/framework/github-actions-annotation.js +25 -0
- package/dist/src/services/framework/github-actions-annotation.js.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.d.ts +43 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.d.ts.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.js +117 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.js.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host.service.d.ts +1 -1
- package/dist/src/services/framework/registry-host/registry-host.service.d.ts.map +1 -1
- package/dist/src/services/framework/registry-host/registry-host.service.js +2 -0
- package/dist/src/services/framework/registry-host/registry-host.service.js.map +1 -1
- package/dist/src/services/registry/installed-file-state.utils.d.ts +8 -0
- package/dist/src/services/registry/installed-file-state.utils.d.ts.map +1 -1
- package/dist/src/services/registry/installed-file-state.utils.js +9 -1
- package/dist/src/services/registry/installed-file-state.utils.js.map +1 -1
- package/dist/src/services/registry/module-install.service.d.ts.map +1 -1
- package/dist/src/services/registry/module-install.service.js +1 -0
- package/dist/src/services/registry/module-install.service.js.map +1 -1
- package/dist/src/services/registry/provider-connect.service.d.ts +57 -1
- package/dist/src/services/registry/provider-connect.service.d.ts.map +1 -1
- package/dist/src/services/registry/provider-connect.service.js +63 -2
- package/dist/src/services/registry/provider-connect.service.js.map +1 -1
- package/dist/src/services/registry/provider-module-scaffold.service.d.ts.map +1 -1
- package/dist/src/services/registry/provider-module-scaffold.service.js +4 -0
- package/dist/src/services/registry/provider-module-scaffold.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/framework-root-package.json +3 -3
- package/package.json +22 -22
- package/scripts/app-dependency-alignment/propagated-engine-overrides.json +2 -2
- package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +17 -2
- package/templates/infra/registry-host/docker-compose.yml +9 -2
- package/templates/infra/registry-host/upgrade-image.sh +108 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/create.users-custom_ready/labels.fr.ts +22 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/create.users-custom_received/labels.fr.ts +23 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/update.users-custom_extended/labels.fr.ts +23 -0
- package/templates/saas/i18n/email/resources/organizationSsoConfig/repairUnreadableConfiguration.organization-users/labels.fr.ts +23 -0
- package/templates/saas/i18n/engine/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.ts +28 -0
- package/templates/saas/i18n/engine/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.ts +28 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_APPROVAL.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_APPROVAL.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.ts +6 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.ts +6 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_APPROVAL_SEAL.en.ts +40 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_APPROVAL_SEAL.fr.ts +40 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_FORM_FIELD_STRING.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_FORM_FIELD_STRING.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_TERMS.en.ts +3 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_TERMS.fr.ts +3 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_USER_AUTH.en.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_USER_AUTH.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_FILTERS.en.ts +3 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_FILTERS.fr.ts +4 -2
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_LIST.en.ts +18 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_LIST.fr.ts +18 -1
- package/templates/saas/i18n/engine/resources/actorSystemExecutions.en.ts +10 -82
- package/templates/saas/i18n/engine/resources/actorSystemExecutions.fr.ts +0 -72
- package/templates/saas/i18n/engine/resources/actorTasks.en.ts +0 -33
- package/templates/saas/i18n/engine/resources/actorTasks.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/agentBehaviorReports.en.ts +0 -108
- package/templates/saas/i18n/engine/resources/agentBehaviorReports.fr.ts +0 -108
- package/templates/saas/i18n/engine/resources/agentOperationRecords.en.ts +8 -24
- package/templates/saas/i18n/engine/resources/agentOperationRecords.fr.ts +10 -26
- package/templates/saas/i18n/engine/resources/agentWorkCaptureSettings.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/agentWorkCaptureSettings.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/anonymous_users.en.ts +8 -74
- package/templates/saas/i18n/engine/resources/anonymous_users.fr.ts +0 -66
- package/templates/saas/i18n/engine/resources/applicationA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/applicationA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/applicationA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationAccessGrants.en.ts +13 -55
- package/templates/saas/i18n/engine/resources/applicationAccessGrants.fr.ts +0 -42
- package/templates/saas/i18n/engine/resources/applicationAgentPolicies.en.ts +8 -24
- package/templates/saas/i18n/engine/resources/applicationAgentPolicies.fr.ts +8 -24
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationApiKeys.en.ts +2 -70
- package/templates/saas/i18n/engine/resources/applicationApiKeys.fr.ts +2 -70
- package/templates/saas/i18n/engine/resources/applicationAuditLogs.en.ts +41 -94
- package/templates/saas/i18n/engine/resources/applicationAuditLogs.fr.ts +41 -94
- package/templates/saas/i18n/engine/resources/applicationDataKeys.en.ts +2 -22
- package/templates/saas/i18n/engine/resources/applicationDataKeys.fr.ts +2 -22
- package/templates/saas/i18n/engine/resources/applicationFeatures.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationFeatures.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/applicationFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/applicationFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/applicationFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/applicationInboundDeliveries.en.ts +92 -23
- package/templates/saas/i18n/engine/resources/applicationInboundDeliveries.fr.ts +95 -26
- package/templates/saas/i18n/engine/resources/applicationM2mWebhookDeliveryLog.en.ts +1 -25
- package/templates/saas/i18n/engine/resources/applicationM2mWebhookDeliveryLog.fr.ts +4 -28
- package/templates/saas/i18n/engine/resources/applicationMetadata.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationMetadata.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationOAuthClients.en.ts +2 -58
- package/templates/saas/i18n/engine/resources/applicationOAuthClients.fr.ts +2 -58
- package/templates/saas/i18n/engine/resources/applicationProviderCredentials.en.ts +168 -0
- package/templates/saas/i18n/engine/resources/applicationProviderCredentials.fr.ts +168 -0
- package/templates/saas/i18n/engine/resources/applicationScimProvisioningConfig.en.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationScimProvisioningConfig.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryDlq.en.ts +3 -42
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryDlq.fr.ts +5 -44
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryOutbox.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryOutbox.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationSiemExportConfig.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationSiemExportConfig.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationSsoConfig.en.ts +113 -61
- package/templates/saas/i18n/engine/resources/applicationSsoConfig.fr.ts +113 -61
- package/templates/saas/i18n/engine/resources/applicationSsoConnections.en.ts +0 -138
- package/templates/saas/i18n/engine/resources/applicationSsoConnections.fr.ts +0 -138
- package/templates/saas/i18n/engine/resources/applicationVersions.en.ts +3 -27
- package/templates/saas/i18n/engine/resources/applicationVersions.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationWebhookConfig.en.ts +5 -54
- package/templates/saas/i18n/engine/resources/applicationWebhookConfig.fr.ts +5 -54
- package/templates/saas/i18n/engine/resources/applications.en.ts +39 -2177
- package/templates/saas/i18n/engine/resources/applications.fr.ts +39 -2177
- package/templates/saas/i18n/engine/resources/approvalSeals.en.ts +38 -31
- package/templates/saas/i18n/engine/resources/approvalSeals.fr.ts +38 -31
- package/templates/saas/i18n/engine/resources/auditLogs.en.ts +78 -111
- package/templates/saas/i18n/engine/resources/auditLogs.fr.ts +78 -111
- package/templates/saas/i18n/engine/resources/billingEffectOutbox.en.ts +2 -4
- package/templates/saas/i18n/engine/resources/billingEffectOutbox.fr.ts +2 -4
- package/templates/saas/i18n/engine/resources/billingSubscriptionMutationIntents.en.ts +8 -6
- package/templates/saas/i18n/engine/resources/billingSubscriptionMutationIntents.fr.ts +8 -6
- package/templates/saas/i18n/engine/resources/chatConversations.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/chatConversations.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/chatIdentityLinks.en.ts +0 -44
- package/templates/saas/i18n/engine/resources/chatIdentityLinks.fr.ts +0 -44
- package/templates/saas/i18n/engine/resources/consumableTokens.en.ts +4 -43
- package/templates/saas/i18n/engine/resources/consumableTokens.fr.ts +4 -43
- package/templates/saas/i18n/engine/resources/conversationMessages.en.ts +16 -27
- package/templates/saas/i18n/engine/resources/conversationMessages.fr.ts +16 -27
- package/templates/saas/i18n/engine/resources/conversationReplyTokens.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationReplyTokens.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationThreads.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationThreads.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/dataSeedRuns.en.ts +22 -17
- package/templates/saas/i18n/engine/resources/dataSeedRuns.fr.ts +22 -17
- package/templates/saas/i18n/engine/resources/dataSubjectRequests.en.ts +410 -0
- package/templates/saas/i18n/engine/resources/dataSubjectRequests.fr.ts +410 -0
- package/templates/saas/i18n/engine/resources/etlPipelineStates.en.ts +128 -146
- package/templates/saas/i18n/engine/resources/etlPipelineStates.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/evaluationDatasetExports.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/evaluationDatasetExports.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/evaluationExportAuthorizations.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/evaluationExportAuthorizations.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/externalDataErasureSuppressions.en.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataErasureSuppressions.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataOutboundChanges.en.ts +24 -45
- package/templates/saas/i18n/engine/resources/externalDataOutboundChanges.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPendingReferences.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPendingReferences.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineMembershipKeys.en.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPipelineMembershipKeys.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPipelineMemberships.en.ts +8 -14
- package/templates/saas/i18n/engine/resources/externalDataPipelineMemberships.fr.ts +0 -6
- package/templates/saas/i18n/engine/resources/externalDataPipelineRequestedKeys.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineRequestedKeys.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineRunRecords.en.ts +150 -174
- package/templates/saas/i18n/engine/resources/externalDataPipelineRunRecords.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataRemoteVersions.en.ts +12 -33
- package/templates/saas/i18n/engine/resources/externalDataRemoteVersions.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalEffectReservations.en.ts +147 -0
- package/templates/saas/i18n/engine/resources/externalEffectReservations.fr.ts +147 -0
- package/templates/saas/i18n/engine/resources/files.en.ts +0 -39
- package/templates/saas/i18n/engine/resources/files.fr.ts +0 -39
- package/templates/saas/i18n/engine/resources/humanDecisionNoticeStays.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/humanDecisionNoticeStays.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/idempotentRequestOutcomes.en.ts +115 -0
- package/templates/saas/i18n/engine/resources/idempotentRequestOutcomes.fr.ts +115 -0
- package/templates/saas/i18n/engine/resources/inboundAddressTombstones.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundAddressTombstones.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundContacts.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/inboundContacts.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundEmails.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundEmails.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/jobExecutions.en.ts +11 -25
- package/templates/saas/i18n/engine/resources/jobExecutions.fr.ts +11 -25
- package/templates/saas/i18n/engine/resources/jobPayloadStorage.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/jobPayloadStorage.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/legalHolds.en.ts +0 -88
- package/templates/saas/i18n/engine/resources/legalHolds.fr.ts +0 -88
- package/templates/saas/i18n/engine/resources/modelCallAttributions.en.ts +16 -40
- package/templates/saas/i18n/engine/resources/modelCallAttributions.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/modelCostPeriodAggregates.en.ts +13 -37
- package/templates/saas/i18n/engine/resources/modelCostPeriodAggregates.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/oauthConsentGrants.en.ts +10 -40
- package/templates/saas/i18n/engine/resources/oauthConsentGrants.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/operationApprovalRequests.en.ts +120 -60
- package/templates/saas/i18n/engine/resources/operationApprovalRequests.fr.ts +120 -60
- package/templates/saas/i18n/engine/resources/organizationA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/organizationA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/organizationA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/organizationA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/organizationAgentPolicies.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentPolicies.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/organizationApiKeys.en.ts +2 -79
- package/templates/saas/i18n/engine/resources/organizationApiKeys.fr.ts +2 -79
- package/templates/saas/i18n/engine/resources/organizationBillingAccounts.en.ts +0 -549
- package/templates/saas/i18n/engine/resources/organizationBillingAccounts.fr.ts +0 -549
- package/templates/saas/i18n/engine/resources/organizationChatSettings.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationChatSettings.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationCreditPools.en.ts +13 -18
- package/templates/saas/i18n/engine/resources/organizationCreditPools.fr.ts +13 -18
- package/templates/saas/i18n/engine/resources/organizationCustomDomains.en.ts +195 -0
- package/templates/saas/i18n/engine/resources/organizationCustomDomains.fr.ts +195 -0
- package/templates/saas/i18n/engine/resources/organizationDashboardLayouts.en.ts +153 -0
- package/templates/saas/i18n/engine/resources/organizationDashboardLayouts.fr.ts +153 -0
- package/templates/saas/i18n/engine/resources/organizationEmailDomains.en.ts +0 -39
- package/templates/saas/i18n/engine/resources/organizationEmailDomains.fr.ts +0 -39
- package/templates/saas/i18n/engine/resources/organizationFeatures.en.ts +0 -34
- package/templates/saas/i18n/engine/resources/organizationFeatures.fr.ts +0 -34
- package/templates/saas/i18n/engine/resources/organizationFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/organizationFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/organizationFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/organizationFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/organizationGuidanceState.en.ts +3 -18
- package/templates/saas/i18n/engine/resources/organizationGuidanceState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/organizationInboundDeliveries.en.ts +95 -26
- package/templates/saas/i18n/engine/resources/organizationInboundDeliveries.fr.ts +95 -26
- package/templates/saas/i18n/engine/resources/organizationInvoiceRefs.en.ts +14 -45
- package/templates/saas/i18n/engine/resources/organizationInvoiceRefs.fr.ts +14 -45
- package/templates/saas/i18n/engine/resources/organizationLifecycleState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationLifecycleState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationM2mWebhookDeliveryLog.en.ts +2 -26
- package/templates/saas/i18n/engine/resources/organizationM2mWebhookDeliveryLog.fr.ts +4 -28
- package/templates/saas/i18n/engine/resources/organizationMembers.en.ts +2 -95
- package/templates/saas/i18n/engine/resources/organizationMembers.fr.ts +2 -95
- package/templates/saas/i18n/engine/resources/organizationModelUsageCeilingState.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationModelUsageCeilingState.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationNotificationBadges.en.ts +3 -36
- package/templates/saas/i18n/engine/resources/organizationNotificationBadges.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/organizationNotifications.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/organizationNotifications.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/organizationOAuthClients.en.ts +2 -67
- package/templates/saas/i18n/engine/resources/organizationOAuthClients.fr.ts +2 -67
- package/templates/saas/i18n/engine/resources/organizationOnboardingOperations.en.ts +0 -9
- package/templates/saas/i18n/engine/resources/organizationOnboardingOperations.fr.ts +0 -9
- package/templates/saas/i18n/engine/resources/organizationPersonTokenCeilingState.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationPersonTokenCeilingState.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationPreferences.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationPreferences.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProfiles.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProfiles.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProgressionState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationProgressionState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationProviderCredentials.en.ts +0 -58
- package/templates/saas/i18n/engine/resources/organizationProviderCredentials.fr.ts +0 -58
- package/templates/saas/i18n/engine/resources/organizationRelationships.en.ts +0 -128
- package/templates/saas/i18n/engine/resources/organizationRelationships.fr.ts +0 -128
- package/templates/saas/i18n/engine/resources/organizationRepresentations.en.ts +0 -83
- package/templates/saas/i18n/engine/resources/organizationRepresentations.fr.ts +0 -83
- package/templates/saas/i18n/engine/resources/organizationScimProvisioningConfig.en.ts +0 -43
- package/templates/saas/i18n/engine/resources/organizationScimProvisioningConfig.fr.ts +0 -43
- package/templates/saas/i18n/engine/resources/organizationScimTokens.en.ts +5 -76
- package/templates/saas/i18n/engine/resources/organizationScimTokens.fr.ts +5 -76
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryDlq.en.ts +4 -43
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryDlq.fr.ts +6 -45
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryOutbox.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryOutbox.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationSiemExportConfig.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationSiemExportConfig.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationSsoConfig.en.ts +113 -74
- package/templates/saas/i18n/engine/resources/organizationSsoConfig.fr.ts +113 -74
- package/templates/saas/i18n/engine/resources/organizationSsoConnections.en.ts +0 -148
- package/templates/saas/i18n/engine/resources/organizationSsoConnections.fr.ts +0 -148
- package/templates/saas/i18n/engine/resources/organizationSubscriptions.en.ts +40 -78
- package/templates/saas/i18n/engine/resources/organizationSubscriptions.fr.ts +42 -80
- package/templates/saas/i18n/engine/resources/organizationUnitMembers.en.ts +2 -50
- package/templates/saas/i18n/engine/resources/organizationUnitMembers.fr.ts +2 -50
- package/templates/saas/i18n/engine/resources/organizationUnits.en.ts +0 -49
- package/templates/saas/i18n/engine/resources/organizationUnits.fr.ts +0 -49
- package/templates/saas/i18n/engine/resources/organizationUsageRecords.en.ts +13 -37
- package/templates/saas/i18n/engine/resources/organizationUsageRecords.fr.ts +13 -37
- package/templates/saas/i18n/engine/resources/organizationWebhookConfig.en.ts +5 -67
- package/templates/saas/i18n/engine/resources/organizationWebhookConfig.fr.ts +5 -67
- package/templates/saas/i18n/engine/resources/organizations.en.ts +34 -637
- package/templates/saas/i18n/engine/resources/organizations.fr.ts +32 -635
- package/templates/saas/i18n/engine/resources/platformAccessGrants.en.ts +0 -91
- package/templates/saas/i18n/engine/resources/platformAccessGrants.fr.ts +0 -91
- package/templates/saas/i18n/engine/resources/postCommitEffectOutbox.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/postCommitEffectOutbox.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/prices.en.ts +47 -108
- package/templates/saas/i18n/engine/resources/prices.fr.ts +48 -109
- package/templates/saas/i18n/engine/resources/products.en.ts +24 -68
- package/templates/saas/i18n/engine/resources/products.fr.ts +24 -68
- package/templates/saas/i18n/engine/resources/professionalQualifications.en.ts +0 -87
- package/templates/saas/i18n/engine/resources/professionalQualifications.fr.ts +0 -87
- package/templates/saas/i18n/engine/resources/promotions.en.ts +4 -56
- package/templates/saas/i18n/engine/resources/promotions.fr.ts +6 -58
- package/templates/saas/i18n/engine/resources/providerCallRecords.en.ts +77 -101
- package/templates/saas/i18n/engine/resources/providerCallRecords.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/publishedVerificationKeys.en.ts +2 -25
- package/templates/saas/i18n/engine/resources/publishedVerificationKeys.fr.ts +2 -25
- package/templates/saas/i18n/engine/resources/referrals.en.ts +21 -18
- package/templates/saas/i18n/engine/resources/referrals.fr.ts +21 -18
- package/templates/saas/i18n/engine/resources/relationshipCapabilityGrants.en.ts +0 -80
- package/templates/saas/i18n/engine/resources/relationshipCapabilityGrants.fr.ts +0 -80
- package/templates/saas/i18n/engine/resources/relationshipInvitations.en.ts +0 -89
- package/templates/saas/i18n/engine/resources/relationshipInvitations.fr.ts +0 -89
- package/templates/saas/i18n/engine/resources/relationshipMailboxes.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/relationshipMailboxes.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/representativeAssignments.en.ts +108 -112
- package/templates/saas/i18n/engine/resources/representativeAssignments.fr.ts +108 -112
- package/templates/saas/i18n/engine/resources/retentionEnforcementRecords.en.ts +8 -21
- package/templates/saas/i18n/engine/resources/retentionEnforcementRecords.fr.ts +8 -21
- package/templates/saas/i18n/engine/resources/signatureRequestSigners.en.ts +141 -0
- package/templates/saas/i18n/engine/resources/signatureRequestSigners.fr.ts +141 -0
- package/templates/saas/i18n/engine/resources/signatureRequests.en.ts +205 -0
- package/templates/saas/i18n/engine/resources/signatureRequests.fr.ts +205 -0
- package/templates/saas/i18n/engine/resources/smsNumberAssignments.en.ts +101 -0
- package/templates/saas/i18n/engine/resources/smsNumberAssignments.fr.ts +101 -0
- package/templates/saas/i18n/engine/resources/smsOptOuts.en.ts +166 -0
- package/templates/saas/i18n/engine/resources/smsOptOuts.fr.ts +166 -0
- package/templates/saas/i18n/engine/resources/smsProviderEvents.en.ts +195 -0
- package/templates/saas/i18n/engine/resources/smsProviderEvents.fr.ts +195 -0
- package/templates/saas/i18n/engine/resources/ssoDomainReservations.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/ssoDomainReservations.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/systemOfRecordPartitionAssignments.en.ts +3 -39
- package/templates/saas/i18n/engine/resources/systemOfRecordPartitionAssignments.fr.ts +0 -36
- package/templates/saas/i18n/engine/resources/systemOfRecordWriteAdmissions.en.ts +0 -3
- package/templates/saas/i18n/engine/resources/systemOfRecordWriteAdmissions.fr.ts +0 -3
- package/templates/saas/i18n/engine/resources/transactionalCommitReceipts.en.ts +0 -6
- package/templates/saas/i18n/engine/resources/transactionalCommitReceipts.fr.ts +0 -6
- package/templates/saas/i18n/engine/resources/userA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/userA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/userA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/userA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/userCredentials.en.ts +3 -87
- package/templates/saas/i18n/engine/resources/userCredentials.fr.ts +0 -84
- package/templates/saas/i18n/engine/resources/userFeatures.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/userFeatures.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/userFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/userFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/userFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/userFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/userGovernedDocumentAcceptances.en.ts +13 -18
- package/templates/saas/i18n/engine/resources/userGovernedDocumentAcceptances.fr.ts +13 -18
- package/templates/saas/i18n/engine/resources/userGuidanceState.en.ts +3 -18
- package/templates/saas/i18n/engine/resources/userGuidanceState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/userIdentityLinks.en.ts +13 -40
- package/templates/saas/i18n/engine/resources/userIdentityLinks.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/userLifecycleState.en.ts +0 -15
- package/templates/saas/i18n/engine/resources/userLifecycleState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/userNotificationBadges.en.ts +3 -36
- package/templates/saas/i18n/engine/resources/userNotificationBadges.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/userPreferences.en.ts +8 -60
- package/templates/saas/i18n/engine/resources/userPreferences.fr.ts +8 -60
- package/templates/saas/i18n/engine/resources/userProfiles.en.ts +5 -56
- package/templates/saas/i18n/engine/resources/userProfiles.fr.ts +0 -51
- package/templates/saas/i18n/engine/resources/userProgressionState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/userProgressionState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/userProviderCredentials.en.ts +0 -52
- package/templates/saas/i18n/engine/resources/userProviderCredentials.fr.ts +0 -52
- package/templates/saas/i18n/engine/resources/userSelfPreferences.en.ts +8 -56
- package/templates/saas/i18n/engine/resources/userSelfPreferences.fr.ts +8 -56
- package/templates/saas/i18n/engine/resources/userSelfProfiles.en.ts +5 -61
- package/templates/saas/i18n/engine/resources/userSelfProfiles.fr.ts +0 -56
- package/templates/saas/i18n/engine/resources/user_self.en.ts +37 -214
- package/templates/saas/i18n/engine/resources/user_self.fr.ts +37 -214
- package/templates/saas/i18n/engine/resources/users.en.ts +53 -180
- package/templates/saas/i18n/engine/resources/users.fr.ts +53 -180
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/Dockerfile +4 -1
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/plugins/api-reference-pages.ts +9 -1
- package/templates/saas/scenarios/add-website/files/website/Dockerfile +4 -1
- package/templates/saas/scenarios/add-website/files/website/astro.config.ts.hbs +4 -0
- package/templates/saas/scenarios/add-website/files/website/package.json.hbs +1 -1
- package/templates/saas/scenarios/add-worker-node/files/workers/__workerDir__/Dockerfile.hbs +3 -1
- package/templates/saas/skeleton/backend-api/Dockerfile +5 -2
- package/templates/saas/skeleton/frontend/Dockerfile +4 -1
- package/templates/saas/skeleton/frontend/vite-engine-dependency-prebundle.ts +10 -1
- package/templates/saas/skeleton/frontend/vite.config.ts.hbs +14 -3
- package/wildo-framework.info.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type readRegistryHostTemplates } from '../../../services/framework/registry-host/registry-host.service';
|
|
2
|
+
/** The script on the host; also the deploy key's forced command. */
|
|
3
|
+
export declare const REGISTRY_HOST_UPGRADE_SCRIPT = "/opt/wildo-registry/upgrade-image.sh";
|
|
4
|
+
/** The comment that names the release's deploy key in `authorized_keys`, so authorizing again replaces it. */
|
|
5
|
+
export declare const REGISTRY_HOST_CI_KEY_COMMENT = "wildo-release-ci";
|
|
6
|
+
/** The deployed files whose digests `upgrade-image.sh --inspect` reports, in its order. */
|
|
7
|
+
export declare const REGISTRY_HOST_UPGRADE_COMPARED_FILES: readonly ["docker-compose.yml", "Caddyfile", "upgrade-image.sh"];
|
|
8
|
+
/** A tag the release publishes, and the only shape the host script accepts (`^[0-9]+\.[0-9]+\.[0-9]+$` there too). */
|
|
9
|
+
export declare function isRegistryHostReleaseTag(tag: string): boolean;
|
|
10
|
+
/** What `upgrade-image.sh --inspect` reports. A file the host does not have is `null`. */
|
|
11
|
+
export interface RegistryHostInspection {
|
|
12
|
+
readonly image: string;
|
|
13
|
+
readonly files: Readonly<Record<string, string | null>>;
|
|
14
|
+
readonly envKeys: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/** Parse `--inspect`'s lines; throws on an answer missing its image or key list, which no healthy host gives. */
|
|
17
|
+
export declare function parseRegistryHostInspection(stdout: string): RegistryHostInspection;
|
|
18
|
+
/**
|
|
19
|
+
* The `.env` variable NAMES this checkout's `deploy` writes. Computed from throwaway secrets, so it needs none of the real
|
|
20
|
+
* ones and runs in CI: the set is fixed by `buildRegistryHostEnv`, never by the values.
|
|
21
|
+
*/
|
|
22
|
+
export declare function registryHostEnvKeyNames(): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Why moving the image alone would leave the registry wrong: each file the host runs that differs from this checkout's,
|
|
25
|
+
* and each variable this checkout's `deploy` writes that the host's `.env` lacks. Empty means the upgrade is enough.
|
|
26
|
+
*/
|
|
27
|
+
export declare function upgradeBlockers(input: {
|
|
28
|
+
inspection: RegistryHostInspection;
|
|
29
|
+
templates: ReturnType<typeof readRegistryHostTemplates>;
|
|
30
|
+
envKeyNames: readonly string[];
|
|
31
|
+
}): string[];
|
|
32
|
+
/**
|
|
33
|
+
* The `authorized_keys` line for the release's deploy key: the forced command (whatever the client asks, sshd runs the
|
|
34
|
+
* upgrade script and passes the request in SSH_ORIGINAL_COMMAND) and `restrict` (no forwarding, no PTY, no agent).
|
|
35
|
+
* Refuses anything but one public key, so a private key or a pasted options string can never reach the file.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildRegistryHostCiAuthorizedKeyLine(publicKey: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* The remote script that installs (or, with `revoke`, removes) the release's deploy key, reading the line from stdin:
|
|
40
|
+
* every existing line carrying the CI comment goes first, so authorizing again replaces the key rather than adding one.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildAuthorizeCiRemoteScript(revoke: boolean): string;
|
|
43
|
+
//# sourceMappingURL=registry-host-upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-host-upgrade.d.ts","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host-upgrade.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAiD,KAAK,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AAElK,oEAAoE;AACpE,eAAO,MAAM,4BAA4B,yCAAgD,CAAC;AAE1F,8GAA8G;AAC9G,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,oCAAoC,kEAAmE,CAAC;AAErH,sHAAsH;AACtH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,iHAAiH;AACjH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,CAclF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CAGlD;AAOD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,UAAU,EAAE,sBAAsB,CAAC;IACnC,SAAS,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;IACxD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC,GAAG,MAAM,EAAE,CAWX;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAI9E;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAYpE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moving the public module registry to the platform image a release just published, from the release itself (#3795).
|
|
3
|
+
*
|
|
4
|
+
* The registry server validates every module manifest it receives with its OWN schema. A release that publishes
|
|
5
|
+
* modules written against a newer engine therefore needs the server on that engine first: release 1.1.13 published
|
|
6
|
+
* `providers/openai-moderation`, whose `OUTPUT_MODERATION` capability the 1.1.11 server did not know, and was answered
|
|
7
|
+
* `400 VALIDATION`. A dry run cannot see that; it never asks the server to validate.
|
|
8
|
+
*
|
|
9
|
+
* ## Why an image-only upgrade, and not `deploy`
|
|
10
|
+
*
|
|
11
|
+
* `wildo fwk registry-host deploy` rewrites the host's `.env` from the framework secrets file: every database, broker and
|
|
12
|
+
* signing secret, the administrator and the backup keys. Running it from CI would mean copying that whole set into
|
|
13
|
+
* GitHub. Moving the image needs none of it: the host already holds its `.env`, and only `PLATFORM_IMAGE` changes. So
|
|
14
|
+
* the host carries `upgrade-image.sh` (written by `deploy`), and the release reaches it with a key that can run that
|
|
15
|
+
* script and nothing else (an `authorized_keys` forced command, `authorize-ci`).
|
|
16
|
+
*
|
|
17
|
+
* ## What it refuses to do
|
|
18
|
+
*
|
|
19
|
+
* A release whose registry needs more than an image (a changed compose file or Caddyfile, a new `.env` variable, such as
|
|
20
|
+
* the key vault's recovery token 1.1.13 introduced) is not upgraded: it is reported, naming the full `deploy` an
|
|
21
|
+
* operator runs by hand. `upgradeBlockers` decides that by comparing the host's `--inspect` answer (file digests and the
|
|
22
|
+
* `.env` KEY NAMES, never a value) with what this checkout would deploy.
|
|
23
|
+
*/
|
|
24
|
+
import { createHash } from 'node:crypto';
|
|
25
|
+
import { PlatformEnvSecretsJson_Schema } from '../../../services/credentials/credentials.schemas.js';
|
|
26
|
+
import { provisionFrameworkManagedSecrets } from '../../../services/credentials/framework-managed-secrets.js';
|
|
27
|
+
import { buildRegistryHostEnv, REGISTRY_HOST_DIRECTORY } from '../../../services/framework/registry-host/registry-host.service.js';
|
|
28
|
+
/** The script on the host; also the deploy key's forced command. */
|
|
29
|
+
export const REGISTRY_HOST_UPGRADE_SCRIPT = `${REGISTRY_HOST_DIRECTORY}/upgrade-image.sh`;
|
|
30
|
+
/** The comment that names the release's deploy key in `authorized_keys`, so authorizing again replaces it. */
|
|
31
|
+
export const REGISTRY_HOST_CI_KEY_COMMENT = 'wildo-release-ci';
|
|
32
|
+
/** The deployed files whose digests `upgrade-image.sh --inspect` reports, in its order. */
|
|
33
|
+
export const REGISTRY_HOST_UPGRADE_COMPARED_FILES = ['docker-compose.yml', 'Caddyfile', 'upgrade-image.sh'];
|
|
34
|
+
/** A tag the release publishes, and the only shape the host script accepts (`^[0-9]+\.[0-9]+\.[0-9]+$` there too). */
|
|
35
|
+
export function isRegistryHostReleaseTag(tag) {
|
|
36
|
+
return /^\d+\.\d+\.\d+$/.test(tag);
|
|
37
|
+
}
|
|
38
|
+
/** Parse `--inspect`'s lines; throws on an answer missing its image or key list, which no healthy host gives. */
|
|
39
|
+
export function parseRegistryHostInspection(stdout) {
|
|
40
|
+
let image = null;
|
|
41
|
+
let envKeys = null;
|
|
42
|
+
const files = {};
|
|
43
|
+
for (const line of stdout.split('\n').map((entry) => entry.trim()).filter(Boolean)) {
|
|
44
|
+
if (line.startsWith('image '))
|
|
45
|
+
image = line.slice('image '.length).trim();
|
|
46
|
+
else if (line.startsWith('env-keys'))
|
|
47
|
+
envKeys = line.slice('env-keys'.length).trim().split(/\s+/).filter(Boolean);
|
|
48
|
+
else if (line.startsWith('file ')) {
|
|
49
|
+
const [, name, digest] = line.split(/\s+/);
|
|
50
|
+
if (name)
|
|
51
|
+
files[name] = digest && digest !== 'absent' ? digest : null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (image === null || envKeys === null)
|
|
55
|
+
throw new Error(`The registry host answered --inspect without an image or a key list:\n${stdout.trim()}`);
|
|
56
|
+
return { image, files, envKeys };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The `.env` variable NAMES this checkout's `deploy` writes. Computed from throwaway secrets, so it needs none of the real
|
|
60
|
+
* ones and runs in CI: the set is fixed by `buildRegistryHostEnv`, never by the values.
|
|
61
|
+
*/
|
|
62
|
+
export function registryHostEnvKeyNames() {
|
|
63
|
+
const { secrets } = provisionFrameworkManagedSecrets({ admin: { email: 'key-names@wildo.invalid', firstName: 'Key', lastName: 'Names' } });
|
|
64
|
+
return Object.keys(buildRegistryHostEnv({ platformImage: 'unused', secrets: PlatformEnvSecretsJson_Schema.parse(secrets) }));
|
|
65
|
+
}
|
|
66
|
+
/** The sha256 of a template, as the host's `sha256sum` prints it. */
|
|
67
|
+
function digest(content) {
|
|
68
|
+
return createHash('sha256').update(content).digest('hex');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Why moving the image alone would leave the registry wrong: each file the host runs that differs from this checkout's,
|
|
72
|
+
* and each variable this checkout's `deploy` writes that the host's `.env` lacks. Empty means the upgrade is enough.
|
|
73
|
+
*/
|
|
74
|
+
export function upgradeBlockers(input) {
|
|
75
|
+
const blockers = [];
|
|
76
|
+
for (const file of REGISTRY_HOST_UPGRADE_COMPARED_FILES) {
|
|
77
|
+
const onHost = input.inspection.files[file] ?? null;
|
|
78
|
+
if (onHost === null)
|
|
79
|
+
blockers.push(`the host has no ${file}`);
|
|
80
|
+
else if (onHost !== digest(input.templates[file]))
|
|
81
|
+
blockers.push(`${file} on the host differs from this checkout's`);
|
|
82
|
+
}
|
|
83
|
+
const present = new Set(input.inspection.envKeys);
|
|
84
|
+
const missing = input.envKeyNames.filter((name) => !present.has(name));
|
|
85
|
+
if (missing.length > 0)
|
|
86
|
+
blockers.push(`the host's .env lacks ${missing.join(', ')}`);
|
|
87
|
+
return blockers;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The `authorized_keys` line for the release's deploy key: the forced command (whatever the client asks, sshd runs the
|
|
91
|
+
* upgrade script and passes the request in SSH_ORIGINAL_COMMAND) and `restrict` (no forwarding, no PTY, no agent).
|
|
92
|
+
* Refuses anything but one public key, so a private key or a pasted options string can never reach the file.
|
|
93
|
+
*/
|
|
94
|
+
export function buildRegistryHostCiAuthorizedKeyLine(publicKey) {
|
|
95
|
+
const match = /^(ssh-ed25519|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-rsa) ([A-Za-z0-9+/]+={0,3})(?: .*)?$/.exec(publicKey.trim());
|
|
96
|
+
if (!match || publicKey.trim().includes('\n'))
|
|
97
|
+
throw new Error('Expected one SSH public key (`ssh-ed25519 AAAA… comment`), as `ssh-keygen` writes it to the .pub file.');
|
|
98
|
+
return `command="${REGISTRY_HOST_UPGRADE_SCRIPT}",restrict ${match[1]} ${match[2]} ${REGISTRY_HOST_CI_KEY_COMMENT}`;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The remote script that installs (or, with `revoke`, removes) the release's deploy key, reading the line from stdin:
|
|
102
|
+
* every existing line carrying the CI comment goes first, so authorizing again replaces the key rather than adding one.
|
|
103
|
+
*/
|
|
104
|
+
export function buildAuthorizeCiRemoteScript(revoke) {
|
|
105
|
+
return [
|
|
106
|
+
'set -eu',
|
|
107
|
+
'umask 077',
|
|
108
|
+
'mkdir -p ~/.ssh',
|
|
109
|
+
'touch ~/.ssh/authorized_keys',
|
|
110
|
+
`grep -v ' ${REGISTRY_HOST_CI_KEY_COMMENT}$' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.next || true`,
|
|
111
|
+
...(revoke ? [] : ['cat >> ~/.ssh/authorized_keys.next']),
|
|
112
|
+
'cat ~/.ssh/authorized_keys.next > ~/.ssh/authorized_keys',
|
|
113
|
+
'rm -f ~/.ssh/authorized_keys.next',
|
|
114
|
+
`grep -c ' ${REGISTRY_HOST_CI_KEY_COMMENT}$' ~/.ssh/authorized_keys || true`,
|
|
115
|
+
].join('\n');
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=registry-host-upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-host-upgrade.js","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host-upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AACpG,OAAO,EAAE,gCAAgC,EAAgC,MAAM,2DAA2D,CAAC;AAC3I,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAkC,MAAM,mEAAmE,CAAC;AAElK,oEAAoE;AACpE,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,uBAAuB,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AC","sourcesContent":["/**\n * Moving the public module registry to the platform image a release just published, from the release itself (#3795).\n *\n * The registry server validates every module manifest it receives with its OWN schema. A release that publishes\n * modules written against a newer engine therefore needs the server on that engine first: release 1.1.13 published\n * `providers/openai-moderation`, whose `OUTPUT_MODERATION` capability the 1.1.11 server did not know, and was answered\n * `400 VALIDATION`. A dry run cannot see that; it never asks the server to validate.\n *\n * ## Why an image-only upgrade, and not `deploy`\n *\n * `wildo fwk registry-host deploy` rewrites the host's `.env` from the framework secrets file: every database, broker and\n * signing secret, the administrator and the backup keys. Running it from CI would mean copying that whole set into\n * GitHub. Moving the image needs none of it: the host already holds its `.env`, and only `PLATFORM_IMAGE` changes. So\n * the host carries `upgrade-image.sh` (written by `deploy`), and the release reaches it with a key that can run that\n * script and nothing else (an `authorized_keys` forced command, `authorize-ci`).\n *\n * ## What it refuses to do\n *\n * A release whose registry needs more than an image (a changed compose file or Caddyfile, a new `.env` variable, such as\n * the key vault's recovery token 1.1.13 introduced) is not upgraded: it is reported, naming the full `deploy` an\n * operator runs by hand. `upgradeBlockers` decides that by comparing the host's `--inspect` answer (file digests and the\n * `.env` KEY NAMES, never a value) with what this checkout would deploy.\n */\nimport { createHash } from 'node:crypto';\nimport { PlatformEnvSecretsJson_Schema } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { provisionFrameworkManagedSecrets, type PlatformEnvSecretsDraft } from '~wildo-cli/services/credentials/framework-managed-secrets';\nimport { buildRegistryHostEnv, REGISTRY_HOST_DIRECTORY, type readRegistryHostTemplates } from '~wildo-cli/services/framework/registry-host/registry-host.service';\n\n/** The script on the host; also the deploy key's forced command. */\nexport const REGISTRY_HOST_UPGRADE_SCRIPT = `${REGISTRY_HOST_DIRECTORY}/upgrade-image.sh`;\n\n/** The comment that names the release's deploy key in `authorized_keys`, so authorizing again replaces it. */\nexport const REGISTRY_HOST_CI_KEY_COMMENT = 'wildo-release-ci';\n\n/** The deployed files whose digests `upgrade-image.sh --inspect` reports, in its order. */\nexport const REGISTRY_HOST_UPGRADE_COMPARED_FILES = ['docker-compose.yml', 'Caddyfile', 'upgrade-image.sh'] as const;\n\n/** A tag the release publishes, and the only shape the host script accepts (`^[0-9]+\\.[0-9]+\\.[0-9]+$` there too). */\nexport function isRegistryHostReleaseTag(tag: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+$/.test(tag);\n}\n\n/** What `upgrade-image.sh --inspect` reports. A file the host does not have is `null`. */\nexport interface RegistryHostInspection {\n readonly image: string;\n readonly files: Readonly<Record<string, string | null>>;\n readonly envKeys: readonly string[];\n}\n\n/** Parse `--inspect`'s lines; throws on an answer missing its image or key list, which no healthy host gives. */\nexport function parseRegistryHostInspection(stdout: string): RegistryHostInspection {\n let image: string | null = null;\n let envKeys: string[] | null = null;\n const files: Record<string, string | null> = {};\n for (const line of stdout.split('\\n').map((entry) => entry.trim()).filter(Boolean)) {\n if (line.startsWith('image ')) image = line.slice('image '.length).trim();\n else if (line.startsWith('env-keys')) envKeys = line.slice('env-keys'.length).trim().split(/\\s+/).filter(Boolean);\n else if (line.startsWith('file ')) {\n const [, name, digest] = line.split(/\\s+/);\n if (name) files[name] = digest && digest !== 'absent' ? digest : null;\n }\n }\n if (image === null || envKeys === null) throw new Error(`The registry host answered --inspect without an image or a key list:\\n${stdout.trim()}`);\n return { image, files, envKeys };\n}\n\n/**\n * The `.env` variable NAMES this checkout's `deploy` writes. Computed from throwaway secrets, so it needs none of the real\n * ones and runs in CI: the set is fixed by `buildRegistryHostEnv`, never by the values.\n */\nexport function registryHostEnvKeyNames(): string[] {\n const { secrets } = provisionFrameworkManagedSecrets({ admin: { email: 'key-names@wildo.invalid', firstName: 'Key', lastName: 'Names' } } as PlatformEnvSecretsDraft);\n return Object.keys(buildRegistryHostEnv({ platformImage: 'unused', secrets: PlatformEnvSecretsJson_Schema.parse(secrets) }));\n}\n\n/** The sha256 of a template, as the host's `sha256sum` prints it. */\nfunction digest(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\n/**\n * Why moving the image alone would leave the registry wrong: each file the host runs that differs from this checkout's,\n * and each variable this checkout's `deploy` writes that the host's `.env` lacks. Empty means the upgrade is enough.\n */\nexport function upgradeBlockers(input: {\n inspection: RegistryHostInspection;\n templates: ReturnType<typeof readRegistryHostTemplates>;\n envKeyNames: readonly string[];\n}): string[] {\n const blockers: string[] = [];\n for (const file of REGISTRY_HOST_UPGRADE_COMPARED_FILES) {\n const onHost = input.inspection.files[file] ?? null;\n if (onHost === null) blockers.push(`the host has no ${file}`);\n else if (onHost !== digest(input.templates[file])) blockers.push(`${file} on the host differs from this checkout's`);\n }\n const present = new Set(input.inspection.envKeys);\n const missing = input.envKeyNames.filter((name) => !present.has(name));\n if (missing.length > 0) blockers.push(`the host's .env lacks ${missing.join(', ')}`);\n return blockers;\n}\n\n/**\n * The `authorized_keys` line for the release's deploy key: the forced command (whatever the client asks, sshd runs the\n * upgrade script and passes the request in SSH_ORIGINAL_COMMAND) and `restrict` (no forwarding, no PTY, no agent).\n * Refuses anything but one public key, so a private key or a pasted options string can never reach the file.\n */\nexport function buildRegistryHostCiAuthorizedKeyLine(publicKey: string): string {\n const match = /^(ssh-ed25519|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-rsa) ([A-Za-z0-9+/]+={0,3})(?: .*)?$/.exec(publicKey.trim());\n if (!match || publicKey.trim().includes('\\n')) throw new Error('Expected one SSH public key (`ssh-ed25519 AAAA… comment`), as `ssh-keygen` writes it to the .pub file.');\n return `command=\"${REGISTRY_HOST_UPGRADE_SCRIPT}\",restrict ${match[1]} ${match[2]} ${REGISTRY_HOST_CI_KEY_COMMENT}`;\n}\n\n/**\n * The remote script that installs (or, with `revoke`, removes) the release's deploy key, reading the line from stdin:\n * every existing line carrying the CI comment goes first, so authorizing again replaces the key rather than adding one.\n */\nexport function buildAuthorizeCiRemoteScript(revoke: boolean): string {\n return [\n 'set -eu',\n 'umask 077',\n 'mkdir -p ~/.ssh',\n 'touch ~/.ssh/authorized_keys',\n `grep -v ' ${REGISTRY_HOST_CI_KEY_COMMENT}$' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.next || true`,\n ...(revoke ? [] : ['cat >> ~/.ssh/authorized_keys.next']),\n 'cat ~/.ssh/authorized_keys.next > ~/.ssh/authorized_keys',\n 'rm -f ~/.ssh/authorized_keys.next',\n `grep -c ' ${REGISTRY_HOST_CI_KEY_COMMENT}$' ~/.ssh/authorized_keys || true`,\n ].join('\\n');\n}\n"]}
|
|
@@ -14,7 +14,7 @@ export declare const REGISTRY_HOST_ENVIRONMENT_ID = "registry";
|
|
|
14
14
|
/** Where the compose project lives on the host. */
|
|
15
15
|
export declare const REGISTRY_HOST_DIRECTORY = "/opt/wildo-registry";
|
|
16
16
|
/** The template files deployed as-is, relative to the framework's `templates/infra/registry-host/`. */
|
|
17
|
-
export declare const REGISTRY_HOST_TEMPLATE_FILES: readonly ["docker-compose.yml", "Caddyfile", "backup.sh", "restore-check.sh", "wildo-registry-backup.service", "wildo-registry-backup.timer"];
|
|
17
|
+
export declare const REGISTRY_HOST_TEMPLATE_FILES: readonly ["docker-compose.yml", "Caddyfile", "backup.sh", "restore-check.sh", "upgrade-image.sh", "wildo-registry-backup.service", "wildo-registry-backup.timer"];
|
|
18
18
|
/** The systemd units of the nightly backup, installed into /etc/systemd/system. */
|
|
19
19
|
export declare const REGISTRY_BACKUP_SYSTEMD_UNITS: readonly ["wildo-registry-backup.service", "wildo-registry-backup.timer"];
|
|
20
20
|
/** restic, pinned: the backup's format and the restore's. A bump is a deliberate change, recorded here. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-host.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host.service.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAEL,KAAK,gCAAgC,EAMrC,KAAK,gCAAgC,EAErC,KAAK,sBAAsB,EAe5B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAYjI;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAUjH;AAED,oHAAoH;AACpH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,gCAAgC,GAAG,IAAI,CAEzG;AAED,qHAAqH;AACrH,eAAO,MAAM,4BAA4B,aAAa,CAAC;AACvD,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAG7D,uGAAuG;AACvG,eAAO,MAAM,4BAA4B
|
|
1
|
+
{"version":3,"file":"registry-host.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host.service.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAEL,KAAK,gCAAgC,EAMrC,KAAK,gCAAgC,EAErC,KAAK,sBAAsB,EAe5B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAYjI;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAUjH;AAED,oHAAoH;AACpH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,gCAAgC,GAAG,IAAI,CAEzG;AAED,qHAAqH;AACrH,eAAO,MAAM,4BAA4B,aAAa,CAAC;AACvD,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAG7D,uGAAuG;AACvG,eAAO,MA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C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAO5E;AAED,qEAAqE;AACrE,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAM9H;AAKD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1E;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAWvF;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAI9E;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,gCAAgC,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAkB5J"}
|
|
@@ -63,6 +63,8 @@ export const REGISTRY_HOST_TEMPLATE_FILES = [
|
|
|
63
63
|
'Caddyfile',
|
|
64
64
|
'backup.sh',
|
|
65
65
|
'restore-check.sh',
|
|
66
|
+
// The image-only upgrade a release runs, and the forced command of its deploy key (#3795, registry-host-upgrade.ts).
|
|
67
|
+
'upgrade-image.sh',
|
|
66
68
|
'wildo-registry-backup.service',
|
|
67
69
|
'wildo-registry-backup.timer',
|
|
68
70
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-host.service.js","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAA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E,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,qFAAqF,CAAC,CAAC;QAC5I,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC","sourcesContent":["/**\n * The public module registry's host (#2135): what `wildo fwk registry-host` writes there, and the secrets behind it.\n *\n * The host runs `templates/infra/registry-host/docker-compose.yml`: the registry, the apps-manager it needs (storage\n * credentials and API keys come from it), PostgreSQL, Valkey, RabbitMQ, MinIO and a Caddy TLS edge. This module renders\n * the `.env` that file reads and keeps the secrets in it stable across deploys.\n *\n * ## Secrets\n *\n * Generated once, by the same registry of framework-managed materials every platform uses\n * (`provisionFrameworkManagedSecrets`), and kept in the gitignored framework secrets file under `registryHost`. A\n * redeploy reuses them: PostgreSQL, RabbitMQ and the signing keys hold state that a new password would lock out.\n * Only what is missing is ever generated. The host's `.env` (0600) is the other copy.\n *\n * The administrator apps-manager seeds at INIT is an operator identity, never generated: it is taken from flags,\n * else from the stored secrets, else from this machine's git identity, the person running the deploy.\n */\nimport { execFileSync } from 'node:child_process';\nimport { z } from 'zod';\nimport { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport {\n APPS_MANAGER_ADMIN_SECRET_HEADER,\n type WildoFrameworkRegistryHostBackup,\n APPS_MANAGER_API_PREFIX,\n DEFAULT_PUBLIC_REGISTRY_URL,\n FRAMEWORK_SECRETS_MODULE_REGISTRY_HOST_KEY,\n REGISTRY_KEYS_ADMIN_PATH,\n WildoFrameworkModuleRegistryHostSchema,\n type WildoFrameworkModuleRegistryHost,\n RegistryKeyMintRequestSchema,\n type RegistryKeyMintRequest,\n PLATFORM_DEFAULT_PORTS,\n PLATFORM_POSTGRES_DATABASE,\n PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n PlatformAdminEnvKeys,\n PlatformInfrastructureEnvKeys,\n PlatformIngressEnvKeys,\n PlatformProcessEnvKeys,\n PlatformSecurityEnvKeys,\n PlatformServiceUrlEnvKeys,\n PlatformWildoServices,\n ApplicationBackendBootstrapEnvKeys,\n buildRuntimeResponseVerificationKeySet,\n STORAGE_DEFAULTS,\n resolveFrameworkLayout,\n} from '@wildo-ai/platform-config-lib';\nimport { ApplicationBackendDataEnvKeys } from '@wildo-ai/platform-core-shared';\nimport { PersistenceAdapter } from '@wildo-ai/saas-models';\nimport { PLATFORM_INIT_MEMORY, PLATFORM_SERVICE_CATALOG } from '~wildo-cli/services/catalog/service-catalog.schemas';\nimport { PlatformEnvSecretsJson_Schema, type PlatformEnvSecretsJson } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { provisionFrameworkManagedSecrets, type PlatformEnvSecretsDraft } from '~wildo-cli/services/credentials/framework-managed-secrets';\nimport {\n MINIO_CREDENTIAL_ENV_KEYS,\n POSTGRESQL_CREDENTIAL_ENV_KEYS,\n RABBITMQ_CREDENTIAL_ENV_KEYS,\n VALKEY_CREDENTIAL_ENV_KEYS,\n} from '~wildo-cli/services/data-services/data-services.schemas';\nimport { encodeComposeEnvValue } from '~wildo-cli/services/deployment/docker/docker-compose-generator.service';\nimport { FrameworkReleaseService } from '~wildo-cli/services/framework/framework-release.service';\nimport { DEV_COMPILE_STATUS_RELATIVE } from '~wildo-cli/services/framework/dev-compile-status.paths';\n\n/**\n * One section of the gitignored framework secrets file, read raw and validated ALONE. Not through the whole-file\n * schema: a malformed section must name itself, not break every command that parses the file (the `providers.slack`\n * lesson in framework-secrets.schemas.ts). `null` when the section is absent.\n */\nexport function loadFrameworkSecretsSection<T>(frameworkRoot: string, key: string, schema: z.ZodType<T>): T | null {\n const secretsPath = FrameworkReleaseService.resolveFrameworkSecretsPath(frameworkRoot);\n if (!existsSync(secretsPath)) return null;\n const section = (JSON.parse(readFileSync(secretsPath, 'utf8')) as Record<string, unknown>)[key];\n if (section === undefined) return null;\n const parsed = schema.safeParse(section);\n if (!parsed.success) {\n throw new Error(`${key} in ${secretsPath} is malformed: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`).join('; ')}`);\n }\n return parsed.data;\n}\n\n/** How to reach the registry host: `moduleRegistryHost`, never tracked config (the address is the CDN's origin). */\nexport function loadRegistryHostConnection(frameworkRoot: string): WildoFrameworkModuleRegistryHost | null {\n return loadFrameworkSecretsSection(frameworkRoot, FRAMEWORK_SECRETS_MODULE_REGISTRY_HOST_KEY, WildoFrameworkModuleRegistryHostSchema);\n}\n\n/** The platform environment id the host's services run under. Not `local`, which would claim a developer machine. */\nexport const REGISTRY_HOST_ENVIRONMENT_ID = 'registry';\n/** Where the compose project lives on the host. */\nexport const REGISTRY_HOST_DIRECTORY = '/opt/wildo-registry';\n/** The key under which the framework secrets file holds this host's secrets. */\nconst FRAMEWORK_SECRETS_SECTION = 'registryHost';\n/** The template files deployed as-is, relative to the framework's `templates/infra/registry-host/`. */\nexport const REGISTRY_HOST_TEMPLATE_FILES = [\n 'docker-compose.yml',\n 'Caddyfile',\n 'backup.sh',\n 'restore-check.sh',\n 'wildo-registry-backup.service',\n 'wildo-registry-backup.timer',\n] as const;\n/** The systemd units of the nightly backup, installed into /etc/systemd/system. */\nexport const REGISTRY_BACKUP_SYSTEMD_UNITS = ['wildo-registry-backup.service', 'wildo-registry-backup.timer'] as const;\n/** restic, pinned: the backup's format and the restore's. A bump is a deliberate change, recorded here. */\nexport const REGISTRY_BACKUP_RESTIC_IMAGE = 'restic/restic:0.18.1';\n\n/** The public name the registry is served under: the address every CLI resolves `--registry public` to. */\nexport function registryHostDomain(): string {\n return new URL(DEFAULT_PUBLIC_REGISTRY_URL).hostname;\n}\n\n/**\n * The platform's public domain: the registry's name without its first label (`registry.wildo.ai` → `wildo.ai`).\n * apps-manager documents `WILDO_PUBLIC_DOMAIN` as runtime-agnostic, `wildo.ai` for production, and requires it outside\n * `local`; on this host it builds no URL, because the host serves no application.\n */\nexport function registryHostPublicDomain(): string {\n return registryHostDomain().split('.').slice(1).join('.');\n}\n\nexport interface RegistryHostAdminIdentity {\n readonly email: string;\n readonly firstName: string;\n readonly lastName: string;\n}\n\nexport interface RegistryHostSecretsResult {\n readonly secrets: PlatformEnvSecretsJson;\n /** Flattened keys generated by this call; empty when everything was already stored. */\n readonly generatedKeys: readonly string[];\n}\n\n/** The git identity of this machine, as the administrator identity when none is stored or given. */\nexport function gitAdminIdentity(frameworkRoot: string): Partial<RegistryHostAdminIdentity> {\n const read = (key: string): string | undefined => {\n try {\n return execFileSync('git', ['config', key], { cwd: frameworkRoot, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || undefined;\n } catch {\n return undefined;\n }\n };\n const [firstName, ...rest] = (read('user.name') ?? '').split(/\\s+/).filter((part) => part.length > 0);\n return { email: read('user.email'), firstName, lastName: rest.length > 0 ? rest.join(' ') : undefined };\n}\n\n/**\n * The host's secrets: the stored ones, completed with whatever is missing. `persist: false` (a dry run) generates in\n * memory and writes nothing, so a later real run generates its own.\n */\nexport function resolveRegistryHostSecrets(input: {\n frameworkRoot: string;\n /** Given by the operator: wins over what is stored. */\n admin: Partial<RegistryHostAdminIdentity>;\n /** Used only for a field neither given nor stored (the machine's git identity). */\n fallbackAdmin?: Partial<RegistryHostAdminIdentity>;\n persist: boolean;\n}): RegistryHostSecretsResult {\n const secretsPath = FrameworkReleaseService.resolveFrameworkSecretsPath(input.frameworkRoot);\n // RAW JSON, as `saveFrameworkNpmPublishToken` reads it: every other section must survive the write-back.\n const file: Record<string, unknown> = existsSync(secretsPath) ? (JSON.parse(readFileSync(secretsPath, 'utf8')) as Record<string, unknown>) : {};\n const stored = (file[FRAMEWORK_SECRETS_SECTION] ?? {}) as PlatformEnvSecretsDraft;\n const draft = JSON.parse(JSON.stringify(stored)) as PlatformEnvSecretsDraft;\n\n const admin = { ...draft.admin } as Record<string, string | undefined>;\n for (const field of ['email', 'firstName', 'lastName'] as const) {\n const given = input.admin[field]?.trim();\n if (given) admin[field] = given;\n else if (!admin[field]?.trim() && input.fallbackAdmin?.[field]?.trim()) admin[field] = input.fallbackAdmin[field]!.trim();\n }\n const missing = (['email', 'firstName', 'lastName'] as const).filter((field) => !admin[field]);\n if (missing.length > 0) {\n throw new Error(\n `The registry host's administrator has no ${missing.join(', ')}. Pass --adminEmail, --adminFirstName and --adminLastName `\n + '(they are stored after the first deploy), or set this checkout\\'s git user.name and user.email.',\n );\n }\n draft.admin = admin as PlatformEnvSecretsDraft['admin'];\n\n const { secrets, mintedKeys } = provisionFrameworkManagedSecrets(draft);\n const identityChanged = JSON.stringify(stored.admin ?? {}) !== JSON.stringify(admin);\n const parsed = PlatformEnvSecretsJson_Schema.parse(secrets);\n if (input.persist && (mintedKeys.length > 0 || identityChanged)) {\n mkdirSync(dirname(secretsPath), { recursive: true });\n writeFileSync(secretsPath, `${JSON.stringify({ ...file, [FRAMEWORK_SECRETS_SECTION]: secrets }, null, 2)}\\n`, { mode: 0o600 });\n // `mode` applies only when the write CREATES the file; a secrets file that already existed keeps its own.\n chmodSync(secretsPath, 0o600);\n }\n return { secrets: parsed, generatedKeys: mintedKeys };\n}\n\n/** The image every platform service on the host runs, and the domain and contact the TLS edge uses. */\nexport interface RegistryHostEnvInput {\n readonly platformImage: string;\n readonly secrets: PlatformEnvSecretsJson;\n}\n\n/**\n * Every variable `templates/infra/registry-host/docker-compose.yml` reads. Container-internal addresses are the compose\n * service names on the one internal network.\n */\nexport function buildRegistryHostEnv(input: RegistryHostEnvInput): Record<string, string> {\n const { secrets } = input;\n const responseSigning = secrets.platform.appsManagerResponseSigning;\n const keyEncryptionRoot = secrets.platform.keyEncryptionRoot;\n if (!secrets.postgresql || !secrets.valkey || !secrets.platform.crontabsBatchesManager || !responseSigning || !keyEncryptionRoot?.current) {\n throw new Error(\n 'The registry host secrets are incomplete (postgresql, valkey, the crontabs keypair, the apps-manager response keys or the key-encryption root); this is a provisioning bug.',\n );\n }\n const appsManager = PLATFORM_SERVICE_CATALOG[PlatformWildoServices.APPS_MANAGER].memory;\n const registry = PLATFORM_SERVICE_CATALOG[PlatformWildoServices.MODULE_REGISTRY].memory;\n const pgUser = encodeURIComponent(secrets.postgresql.adminUser);\n const pgPassword = encodeURIComponent(secrets.postgresql.adminPassword);\n const sslMode = 'disable'; // the internal network only; nothing leaves the machine\n return {\n PLATFORM_IMAGE: input.platformImage,\n REGISTRY_DOMAIN: registryHostDomain(),\n // Let's Encrypt's expiry notices go to the person who deploys: the administrator.\n TLS_EMAIL: secrets.admin.email,\n\n INIT_MEM_LIMIT_MB: String(PLATFORM_INIT_MEMORY.containerLimitMb),\n INIT_HEAP_CEILING_MB: String(PLATFORM_INIT_MEMORY.heapCeilingMb),\n APPS_MANAGER_MEM_LIMIT_MB: String(appsManager.containerLimitMb),\n APPS_MANAGER_HEAP_CEILING_MB: String(appsManager.heapCeilingMb),\n MODULE_REGISTRY_MEM_LIMIT_MB: String(registry.containerLimitMb),\n MODULE_REGISTRY_HEAP_CEILING_MB: String(registry.heapCeilingMb),\n\n [PlatformProcessEnvKeys.PLATFORM_ENVIRONMENT_ID]: REGISTRY_HOST_ENVIRONMENT_ID,\n [PlatformProcessEnvKeys.APPLICATION_ENV]: 'production',\n [PlatformIngressEnvKeys.WILDO_PUBLIC_DOMAIN]: registryHostPublicDomain(),\n\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_USER]: secrets.postgresql.adminUser,\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_PASSWORD]: secrets.postgresql.adminPassword,\n // The container's initdb database. apps-manager creates the platform's own database itself at INIT.\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_DATABASE]: PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n [PlatformInfrastructureEnvKeys.PG_HOST]: 'postgresql',\n [PlatformInfrastructureEnvKeys.PG_PORT]: '5432',\n [PlatformInfrastructureEnvKeys.PG_ADMIN_USER]: secrets.postgresql.adminUser,\n [PlatformInfrastructureEnvKeys.PG_ADMIN_PASSWORD]: secrets.postgresql.adminPassword,\n [PlatformInfrastructureEnvKeys.PG_ADMIN_DATABASE]: PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n [PlatformInfrastructureEnvKeys.PG_SSL_MODE]: sslMode,\n [PlatformInfrastructureEnvKeys.PG_CONNECT_URL]: `postgresql://${pgUser}:${pgPassword}@postgresql:5432/${encodeURIComponent(PLATFORM_POSTGRES_DATABASE)}?sslmode=${sslMode}`,\n [ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER]: PersistenceAdapter.POSTGRESQL,\n\n [VALKEY_CREDENTIAL_ENV_KEYS.PASSWORD]: secrets.valkey.adminPassword,\n [PlatformInfrastructureEnvKeys.REDIS_HOST]: 'valkey',\n [PlatformInfrastructureEnvKeys.REDIS_PORT]: '6379',\n [PlatformInfrastructureEnvKeys.REDIS_ADMIN_USER]: secrets.valkey.adminUser,\n [PlatformInfrastructureEnvKeys.REDIS_ADMIN_PASSWORD]: secrets.valkey.adminPassword,\n\n [RABBITMQ_CREDENTIAL_ENV_KEYS.DEFAULT_USER]: secrets.rabbitmq.adminUsername,\n [RABBITMQ_CREDENTIAL_ENV_KEYS.DEFAULT_PASS]: secrets.rabbitmq.adminPassword,\n [RABBITMQ_CREDENTIAL_ENV_KEYS.ERLANG_COOKIE]: secrets.rabbitmq.erlangCookie,\n [PlatformInfrastructureEnvKeys.RABBITMQ_HOST]: 'rabbitmq',\n [PlatformInfrastructureEnvKeys.RABBITMQ_PORT]: '5672',\n [PlatformInfrastructureEnvKeys.RABBITMQ_MANAGEMENT_PORT]: '15672',\n [PlatformInfrastructureEnvKeys.RABBITMQ_ADMIN_USERNAME]: secrets.rabbitmq.adminUsername,\n [PlatformInfrastructureEnvKeys.RABBITMQ_ADMIN_PASSWORD]: secrets.rabbitmq.adminPassword,\n\n [MINIO_CREDENTIAL_ENV_KEYS.ROOT_USER]: secrets.storage.accessKey,\n [MINIO_CREDENTIAL_ENV_KEYS.ROOT_PASSWORD]: secrets.storage.secretKey,\n [PlatformInfrastructureEnvKeys.STORAGE_PROVIDER]: STORAGE_DEFAULTS.PROVIDER,\n [PlatformInfrastructureEnvKeys.STORAGE_ENDPOINT]: 'minio',\n [PlatformInfrastructureEnvKeys.STORAGE_PORT]: '9000',\n [PlatformInfrastructureEnvKeys.STORAGE_USE_SSL]: 'false',\n [PlatformInfrastructureEnvKeys.STORAGE_BUCKET]: STORAGE_DEFAULTS.BUCKET,\n [PlatformInfrastructureEnvKeys.STORAGE_ACCESS_KEY]: secrets.storage.accessKey,\n [PlatformInfrastructureEnvKeys.STORAGE_SECRET_KEY]: secrets.storage.secretKey,\n\n [PlatformServiceUrlEnvKeys.PLATFORM_APPS_MANAGER_URL]: `http://platform-apps-manager:${PLATFORM_DEFAULT_PORTS.APPS_MANAGER}`,\n // No crontabs manager runs here, but every platform service's env schema requires a URL for it.\n [PlatformServiceUrlEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_URL]: `http://platform-crontabs-batches-manager:${PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER}`,\n [PlatformServiceUrlEnvKeys.PLATFORM_MODULE_REGISTRY_URL]: `http://platform-module-registry:${PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY}`,\n\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_PRIVATE_KEY]: secrets.platform.appsManager.privateKey,\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_PUBLIC_KEY]: secrets.platform.appsManager.publicKey,\n // #2921, #2898 — apps-manager signs its answers to application runtimes and platform services with this key, and checks at startup that it is in the published set.\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY]: responseSigning.privateKey,\n [ApplicationBackendBootstrapEnvKeys.PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS]: buildRuntimeResponseVerificationKeySet([\n responseSigning.publicKey,\n responseSigning.nextPublicKey,\n ]),\n // #2891 — apps-manager seals every LOCAL private key under this root; the previous one only until the re-seal.\n [PlatformSecurityEnvKeys.PLATFORM_KEY_ENCRYPTION_ROOT]: keyEncryptionRoot.current,\n [PlatformSecurityEnvKeys.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT]:\n keyEncryptionRoot.previous && keyEncryptionRoot.previous !== keyEncryptionRoot.current ? keyEncryptionRoot.previous : '',\n [PlatformSecurityEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY]: secrets.platform.crontabsBatchesManager.privateKey,\n [PlatformSecurityEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY]: secrets.platform.crontabsBatchesManager.publicKey,\n [PlatformSecurityEnvKeys.PLATFORM_APPLICATION_PRIMARY_SECRET]: secrets.platform.primarySecret,\n [PlatformSecurityEnvKeys.PLATFORM_ADMIN_SECRET]: secrets.platform.adminSecret,\n\n [PlatformAdminEnvKeys.ADMIN_EMAIL]: secrets.admin.email,\n [PlatformAdminEnvKeys.ADMIN_PASSWORD]: secrets.admin.password,\n [PlatformAdminEnvKeys.ADMIN_FIRST_NAME]: secrets.admin.firstName,\n [PlatformAdminEnvKeys.ADMIN_LAST_NAME]: secrets.admin.lastName,\n };\n}\n\n/**\n * The `.env` file content. Encoded once, by the same encoder as the platform's `.env.wildo-platform`. A `$` is refused:\n * Compose interpolates it inside an env file, so a value carrying one would arrive changed. Generated material never\n * contains one; an operator-typed value could.\n */\nexport function serializeRegistryHostEnv(env: Record<string, string>): string {\n const lines = ['# Written by `wildo fwk registry-host deploy`. Rewritten on every deploy; do not edit here.'];\n for (const [key, value] of Object.entries(env)) {\n if (value.includes('$')) throw new Error(`${key} contains \"$\", which Docker Compose would interpolate. Change the value.`);\n lines.push(`${key}=${encodeComposeEnvValue(value)}`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** The deployed template files, read from the framework checkout. */\nexport function readRegistryHostTemplates(frameworkRoot: string): Record<(typeof REGISTRY_HOST_TEMPLATE_FILES)[number], string> {\n const directory = join(resolveFrameworkLayout(frameworkRoot).templatesHome, 'infra', 'registry-host');\n return Object.fromEntries(REGISTRY_HOST_TEMPLATE_FILES.map((file) => [file, readFileSync(join(directory, file), 'utf8')])) as Record<\n (typeof REGISTRY_HOST_TEMPLATE_FILES)[number],\n string\n >;\n}\n\n/** The checkout trees whose compiled output the platform image runs (`Dockerfile.platform-base` copies the checkout). */\nconst IMAGE_RUNTIME_PACKAGE_ROOTS = ['engine/', 'platform/platform-core/', 'platform/platform-back-office/'] as const;\n\n/**\n * The packages whose compiled output is not settled, so an image built from this checkout now would ship it: any\n * package the image runs that the dev watchers record as not `ready`, or as carrying a current failure. In a checkout\n * several sessions compile at once, this is the difference between shipping the tree and shipping a half-compiled one\n * (#2135 review M3). Without the watchers' record nothing is proven, and every package is reported unsettled.\n */\nexport function findUnsettledImagePackages(frameworkRoot: string): string[] {\n let status: { packages?: Record<string, { relativePackageRoot?: string; status?: string; currentFailureDiagnostic?: unknown }> };\n try {\n status = JSON.parse(readFileSync(join(frameworkRoot, DEV_COMPILE_STATUS_RELATIVE), 'utf8')) as typeof status;\n } catch {\n return [`(no compile record at ${DEV_COMPILE_STATUS_RELATIVE}: start the dev watchers, which own every dist)`];\n }\n return Object.entries(status.packages ?? {})\n .filter(([, record]) => IMAGE_RUNTIME_PACKAGE_ROOTS.some((root) => (record.relativePackageRoot ?? '').startsWith(root)))\n // semantic-literal-boundary: `ready` is the orchestrator's status vocabulary, owned by a plain .mjs script this package cannot import\n .filter(([, record]) => record.status !== 'ready' || Boolean(record.currentFailureDiagnostic))\n .map(([name, record]) => `${name} (${record.status ?? 'unknown'})`)\n .sort();\n}\n\n/**\n * The command, run ON the host, that mints a registry key through apps-manager's admin door (`/admin/registry/keys`).\n *\n * The door listens only on the host's loopback (`127.0.0.1:5151`), so the request is made there, over SSH, with no\n * tunnel. The admin secret never appears in an argument vector, on either machine: the host reads it from its own\n * `.env`, and `curl` receives the header on stdin (`-H @-`). The request body names no secret and is passed as data.\n */\nexport function buildRegistryHostKeyMintCommand(request: RegistryKeyMintRequest): string {\n const body = JSON.stringify(RegistryKeyMintRequestSchema.parse(request));\n const url = `http://127.0.0.1:${PLATFORM_DEFAULT_PORTS.APPS_MANAGER}${APPS_MANAGER_API_PREFIX}${REGISTRY_KEYS_ADMIN_PATH}`;\n const quote = (value: string) => `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n return [\n `cd ${quote(REGISTRY_HOST_DIRECTORY)}`,\n // An unquoted alphanumeric value in the compose env file; quotes are stripped in case an encoder ever adds them.\n `secret=$(sed -n 's/^${PlatformSecurityEnvKeys.PLATFORM_ADMIN_SECRET}=//p' .env | sed 's/^\"//;s/\"$//')`,\n 'test -n \"$secret\"',\n `printf '%s: %s\\\\n' ${quote(APPS_MANAGER_ADMIN_SECRET_HEADER)} \"$secret\" | curl -sS --fail-with-body -X POST ${quote(url)} -H @- -H 'content-type: application/json' --data ${quote(body)}`,\n ].join(' && ');\n}\n\n/**\n * The object store client image the backup mirrors buckets with: the compose file's own `minio-init` image, so the\n * backup always speaks to the store with the client the stack itself runs, and changes when the store changes.\n */\nexport function registryHostObjectStoreClientImage(composeYaml: string): string {\n const image = (parseYaml(composeYaml) as { services?: Record<string, { image?: string }> }).services?.['minio-init']?.image;\n if (!image) throw new Error('The registry host compose file has no `minio-init` image, which the backup mirrors buckets with.');\n return image;\n}\n\n/**\n * The backup job's settings (`/opt/wildo-registry/backup.env`, 0600). Read twice on the host, by bash (`. backup.env`)\n * and by `docker run --env-file`, which disagree about quoting, so a value either reads identically in both or is\n * refused: no whitespace, quotes, `$`, backticks, backslashes or `#`.\n */\nexport function buildRegistryHostBackupEnv(input: { backup: WildoFrameworkRegistryHostBackup; heartbeatUrl: string; objectStoreClientImage: string }): string {\n const values: Record<string, string> = {\n RESTIC_REPOSITORY: `s3:${input.backup.endpoint.replace(/\\/+$/, '')}/${input.backup.bucket}/registry`,\n RESTIC_PASSWORD: input.backup.resticPassword,\n AWS_ACCESS_KEY_ID: input.backup.accessKey,\n AWS_SECRET_ACCESS_KEY: input.backup.secretKey,\n AWS_DEFAULT_REGION: input.backup.scalewayRegion,\n HEARTBEAT_URL: input.heartbeatUrl,\n MC_IMAGE: input.objectStoreClientImage,\n RESTIC_IMAGE: REGISTRY_BACKUP_RESTIC_IMAGE,\n BACKUP_HOST: registryHostDomain(),\n };\n const lines = ['# Written by `wildo fwk registry-host deploy` for backup.sh. Rewritten on every deploy; do not edit here.'];\n for (const [key, value] of Object.entries(values)) {\n if (/[\\s\"'$`\\\\#]/.test(value)) throw new Error(`${key} has a character backup.env cannot carry for both of its readers; change the value.`);\n lines.push(`${key}=${value}`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"registry-host.service.js","sourceRoot":"","sources":["../../../../../src/services/framework/registry-host/registry-host.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EACL,gCAAgC,EAEhC,uBAAuB,EACvB,2BAA2B,EAC3B,0CAA0C,EAC1C,wBAAwB,EACxB,sCAAsC,EAEtC,4BAA4B,EAE5B,sBAAsB,EACtB,0BAA0B,EAC1B,sCAAsC,EACtC,oBAAoB,EACpB,6BAA6B,EAC7B,sBAAsB,EAC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IAAI,CAAC,IAAI,CAAC;AACjC,CAAC","sourcesContent":["/**\n * The public module registry's host (#2135): what `wildo fwk registry-host` writes there, and the secrets behind it.\n *\n * The host runs `templates/infra/registry-host/docker-compose.yml`: the registry, the apps-manager it needs (storage\n * credentials and API keys come from it), PostgreSQL, Valkey, RabbitMQ, MinIO and a Caddy TLS edge. This module renders\n * the `.env` that file reads and keeps the secrets in it stable across deploys.\n *\n * ## Secrets\n *\n * Generated once, by the same registry of framework-managed materials every platform uses\n * (`provisionFrameworkManagedSecrets`), and kept in the gitignored framework secrets file under `registryHost`. A\n * redeploy reuses them: PostgreSQL, RabbitMQ and the signing keys hold state that a new password would lock out.\n * Only what is missing is ever generated. The host's `.env` (0600) is the other copy.\n *\n * The administrator apps-manager seeds at INIT is an operator identity, never generated: it is taken from flags,\n * else from the stored secrets, else from this machine's git identity, the person running the deploy.\n */\nimport { execFileSync } from 'node:child_process';\nimport { z } from 'zod';\nimport { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\nimport {\n APPS_MANAGER_ADMIN_SECRET_HEADER,\n type WildoFrameworkRegistryHostBackup,\n APPS_MANAGER_API_PREFIX,\n DEFAULT_PUBLIC_REGISTRY_URL,\n FRAMEWORK_SECRETS_MODULE_REGISTRY_HOST_KEY,\n REGISTRY_KEYS_ADMIN_PATH,\n WildoFrameworkModuleRegistryHostSchema,\n type WildoFrameworkModuleRegistryHost,\n RegistryKeyMintRequestSchema,\n type RegistryKeyMintRequest,\n PLATFORM_DEFAULT_PORTS,\n PLATFORM_POSTGRES_DATABASE,\n PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n PlatformAdminEnvKeys,\n PlatformInfrastructureEnvKeys,\n PlatformIngressEnvKeys,\n PlatformProcessEnvKeys,\n PlatformSecurityEnvKeys,\n PlatformServiceUrlEnvKeys,\n PlatformWildoServices,\n ApplicationBackendBootstrapEnvKeys,\n buildRuntimeResponseVerificationKeySet,\n STORAGE_DEFAULTS,\n resolveFrameworkLayout,\n} from '@wildo-ai/platform-config-lib';\nimport { ApplicationBackendDataEnvKeys } from '@wildo-ai/platform-core-shared';\nimport { PersistenceAdapter } from '@wildo-ai/saas-models';\nimport { PLATFORM_INIT_MEMORY, PLATFORM_SERVICE_CATALOG } from '~wildo-cli/services/catalog/service-catalog.schemas';\nimport { PlatformEnvSecretsJson_Schema, type PlatformEnvSecretsJson } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { provisionFrameworkManagedSecrets, type PlatformEnvSecretsDraft } from '~wildo-cli/services/credentials/framework-managed-secrets';\nimport {\n MINIO_CREDENTIAL_ENV_KEYS,\n POSTGRESQL_CREDENTIAL_ENV_KEYS,\n RABBITMQ_CREDENTIAL_ENV_KEYS,\n VALKEY_CREDENTIAL_ENV_KEYS,\n} from '~wildo-cli/services/data-services/data-services.schemas';\nimport { encodeComposeEnvValue } from '~wildo-cli/services/deployment/docker/docker-compose-generator.service';\nimport { FrameworkReleaseService } from '~wildo-cli/services/framework/framework-release.service';\nimport { DEV_COMPILE_STATUS_RELATIVE } from '~wildo-cli/services/framework/dev-compile-status.paths';\n\n/**\n * One section of the gitignored framework secrets file, read raw and validated ALONE. Not through the whole-file\n * schema: a malformed section must name itself, not break every command that parses the file (the `providers.slack`\n * lesson in framework-secrets.schemas.ts). `null` when the section is absent.\n */\nexport function loadFrameworkSecretsSection<T>(frameworkRoot: string, key: string, schema: z.ZodType<T>): T | null {\n const secretsPath = FrameworkReleaseService.resolveFrameworkSecretsPath(frameworkRoot);\n if (!existsSync(secretsPath)) return null;\n const section = (JSON.parse(readFileSync(secretsPath, 'utf8')) as Record<string, unknown>)[key];\n if (section === undefined) return null;\n const parsed = schema.safeParse(section);\n if (!parsed.success) {\n throw new Error(`${key} in ${secretsPath} is malformed: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`).join('; ')}`);\n }\n return parsed.data;\n}\n\n/** How to reach the registry host: `moduleRegistryHost`, never tracked config (the address is the CDN's origin). */\nexport function loadRegistryHostConnection(frameworkRoot: string): WildoFrameworkModuleRegistryHost | null {\n return loadFrameworkSecretsSection(frameworkRoot, FRAMEWORK_SECRETS_MODULE_REGISTRY_HOST_KEY, WildoFrameworkModuleRegistryHostSchema);\n}\n\n/** The platform environment id the host's services run under. Not `local`, which would claim a developer machine. */\nexport const REGISTRY_HOST_ENVIRONMENT_ID = 'registry';\n/** Where the compose project lives on the host. */\nexport const REGISTRY_HOST_DIRECTORY = '/opt/wildo-registry';\n/** The key under which the framework secrets file holds this host's secrets. */\nconst FRAMEWORK_SECRETS_SECTION = 'registryHost';\n/** The template files deployed as-is, relative to the framework's `templates/infra/registry-host/`. */\nexport const REGISTRY_HOST_TEMPLATE_FILES = [\n 'docker-compose.yml',\n 'Caddyfile',\n 'backup.sh',\n 'restore-check.sh',\n // The image-only upgrade a release runs, and the forced command of its deploy key (#3795, registry-host-upgrade.ts).\n 'upgrade-image.sh',\n 'wildo-registry-backup.service',\n 'wildo-registry-backup.timer',\n] as const;\n/** The systemd units of the nightly backup, installed into /etc/systemd/system. */\nexport const REGISTRY_BACKUP_SYSTEMD_UNITS = ['wildo-registry-backup.service', 'wildo-registry-backup.timer'] as const;\n/** restic, pinned: the backup's format and the restore's. A bump is a deliberate change, recorded here. */\nexport const REGISTRY_BACKUP_RESTIC_IMAGE = 'restic/restic:0.18.1';\n\n/** The public name the registry is served under: the address every CLI resolves `--registry public` to. */\nexport function registryHostDomain(): string {\n return new URL(DEFAULT_PUBLIC_REGISTRY_URL).hostname;\n}\n\n/**\n * The platform's public domain: the registry's name without its first label (`registry.wildo.ai` → `wildo.ai`).\n * apps-manager documents `WILDO_PUBLIC_DOMAIN` as runtime-agnostic, `wildo.ai` for production, and requires it outside\n * `local`; on this host it builds no URL, because the host serves no application.\n */\nexport function registryHostPublicDomain(): string {\n return registryHostDomain().split('.').slice(1).join('.');\n}\n\nexport interface RegistryHostAdminIdentity {\n readonly email: string;\n readonly firstName: string;\n readonly lastName: string;\n}\n\nexport interface RegistryHostSecretsResult {\n readonly secrets: PlatformEnvSecretsJson;\n /** Flattened keys generated by this call; empty when everything was already stored. */\n readonly generatedKeys: readonly string[];\n}\n\n/** The git identity of this machine, as the administrator identity when none is stored or given. */\nexport function gitAdminIdentity(frameworkRoot: string): Partial<RegistryHostAdminIdentity> {\n const read = (key: string): string | undefined => {\n try {\n return execFileSync('git', ['config', key], { cwd: frameworkRoot, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || undefined;\n } catch {\n return undefined;\n }\n };\n const [firstName, ...rest] = (read('user.name') ?? '').split(/\\s+/).filter((part) => part.length > 0);\n return { email: read('user.email'), firstName, lastName: rest.length > 0 ? rest.join(' ') : undefined };\n}\n\n/**\n * The host's secrets: the stored ones, completed with whatever is missing. `persist: false` (a dry run) generates in\n * memory and writes nothing, so a later real run generates its own.\n */\nexport function resolveRegistryHostSecrets(input: {\n frameworkRoot: string;\n /** Given by the operator: wins over what is stored. */\n admin: Partial<RegistryHostAdminIdentity>;\n /** Used only for a field neither given nor stored (the machine's git identity). */\n fallbackAdmin?: Partial<RegistryHostAdminIdentity>;\n persist: boolean;\n}): RegistryHostSecretsResult {\n const secretsPath = FrameworkReleaseService.resolveFrameworkSecretsPath(input.frameworkRoot);\n // RAW JSON, as `saveFrameworkNpmPublishToken` reads it: every other section must survive the write-back.\n const file: Record<string, unknown> = existsSync(secretsPath) ? (JSON.parse(readFileSync(secretsPath, 'utf8')) as Record<string, unknown>) : {};\n const stored = (file[FRAMEWORK_SECRETS_SECTION] ?? {}) as PlatformEnvSecretsDraft;\n const draft = JSON.parse(JSON.stringify(stored)) as PlatformEnvSecretsDraft;\n\n const admin = { ...draft.admin } as Record<string, string | undefined>;\n for (const field of ['email', 'firstName', 'lastName'] as const) {\n const given = input.admin[field]?.trim();\n if (given) admin[field] = given;\n else if (!admin[field]?.trim() && input.fallbackAdmin?.[field]?.trim()) admin[field] = input.fallbackAdmin[field]!.trim();\n }\n const missing = (['email', 'firstName', 'lastName'] as const).filter((field) => !admin[field]);\n if (missing.length > 0) {\n throw new Error(\n `The registry host's administrator has no ${missing.join(', ')}. Pass --adminEmail, --adminFirstName and --adminLastName `\n + '(they are stored after the first deploy), or set this checkout\\'s git user.name and user.email.',\n );\n }\n draft.admin = admin as PlatformEnvSecretsDraft['admin'];\n\n const { secrets, mintedKeys } = provisionFrameworkManagedSecrets(draft);\n const identityChanged = JSON.stringify(stored.admin ?? {}) !== JSON.stringify(admin);\n const parsed = PlatformEnvSecretsJson_Schema.parse(secrets);\n if (input.persist && (mintedKeys.length > 0 || identityChanged)) {\n mkdirSync(dirname(secretsPath), { recursive: true });\n writeFileSync(secretsPath, `${JSON.stringify({ ...file, [FRAMEWORK_SECRETS_SECTION]: secrets }, null, 2)}\\n`, { mode: 0o600 });\n // `mode` applies only when the write CREATES the file; a secrets file that already existed keeps its own.\n chmodSync(secretsPath, 0o600);\n }\n return { secrets: parsed, generatedKeys: mintedKeys };\n}\n\n/** The image every platform service on the host runs, and the domain and contact the TLS edge uses. */\nexport interface RegistryHostEnvInput {\n readonly platformImage: string;\n readonly secrets: PlatformEnvSecretsJson;\n}\n\n/**\n * Every variable `templates/infra/registry-host/docker-compose.yml` reads. Container-internal addresses are the compose\n * service names on the one internal network.\n */\nexport function buildRegistryHostEnv(input: RegistryHostEnvInput): Record<string, string> {\n const { secrets } = input;\n const responseSigning = secrets.platform.appsManagerResponseSigning;\n const keyEncryptionRoot = secrets.platform.keyEncryptionRoot;\n if (!secrets.postgresql || !secrets.valkey || !secrets.platform.crontabsBatchesManager || !responseSigning || !keyEncryptionRoot?.current) {\n throw new Error(\n 'The registry host secrets are incomplete (postgresql, valkey, the crontabs keypair, the apps-manager response keys or the key-encryption root); this is a provisioning bug.',\n );\n }\n const appsManager = PLATFORM_SERVICE_CATALOG[PlatformWildoServices.APPS_MANAGER].memory;\n const registry = PLATFORM_SERVICE_CATALOG[PlatformWildoServices.MODULE_REGISTRY].memory;\n const pgUser = encodeURIComponent(secrets.postgresql.adminUser);\n const pgPassword = encodeURIComponent(secrets.postgresql.adminPassword);\n const sslMode = 'disable'; // the internal network only; nothing leaves the machine\n return {\n PLATFORM_IMAGE: input.platformImage,\n REGISTRY_DOMAIN: registryHostDomain(),\n // Let's Encrypt's expiry notices go to the person who deploys: the administrator.\n TLS_EMAIL: secrets.admin.email,\n\n INIT_MEM_LIMIT_MB: String(PLATFORM_INIT_MEMORY.containerLimitMb),\n INIT_HEAP_CEILING_MB: String(PLATFORM_INIT_MEMORY.heapCeilingMb),\n APPS_MANAGER_MEM_LIMIT_MB: String(appsManager.containerLimitMb),\n APPS_MANAGER_HEAP_CEILING_MB: String(appsManager.heapCeilingMb),\n MODULE_REGISTRY_MEM_LIMIT_MB: String(registry.containerLimitMb),\n MODULE_REGISTRY_HEAP_CEILING_MB: String(registry.heapCeilingMb),\n\n [PlatformProcessEnvKeys.PLATFORM_ENVIRONMENT_ID]: REGISTRY_HOST_ENVIRONMENT_ID,\n [PlatformProcessEnvKeys.APPLICATION_ENV]: 'production',\n [PlatformIngressEnvKeys.WILDO_PUBLIC_DOMAIN]: registryHostPublicDomain(),\n\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_USER]: secrets.postgresql.adminUser,\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_PASSWORD]: secrets.postgresql.adminPassword,\n // The container's initdb database. apps-manager creates the platform's own database itself at INIT.\n [POSTGRESQL_CREDENTIAL_ENV_KEYS.ADMIN_DATABASE]: PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n [PlatformInfrastructureEnvKeys.PG_HOST]: 'postgresql',\n [PlatformInfrastructureEnvKeys.PG_PORT]: '5432',\n [PlatformInfrastructureEnvKeys.PG_ADMIN_USER]: secrets.postgresql.adminUser,\n [PlatformInfrastructureEnvKeys.PG_ADMIN_PASSWORD]: secrets.postgresql.adminPassword,\n [PlatformInfrastructureEnvKeys.PG_ADMIN_DATABASE]: PLATFORM_POSTGRES_MAINTENANCE_DATABASE,\n [PlatformInfrastructureEnvKeys.PG_SSL_MODE]: sslMode,\n [PlatformInfrastructureEnvKeys.PG_CONNECT_URL]: `postgresql://${pgUser}:${pgPassword}@postgresql:5432/${encodeURIComponent(PLATFORM_POSTGRES_DATABASE)}?sslmode=${sslMode}`,\n [ApplicationBackendDataEnvKeys.DATABASE_DEFAULT_ADAPTER]: PersistenceAdapter.POSTGRESQL,\n\n [VALKEY_CREDENTIAL_ENV_KEYS.PASSWORD]: secrets.valkey.adminPassword,\n [PlatformInfrastructureEnvKeys.REDIS_HOST]: 'valkey',\n [PlatformInfrastructureEnvKeys.REDIS_PORT]: '6379',\n [PlatformInfrastructureEnvKeys.REDIS_ADMIN_USER]: secrets.valkey.adminUser,\n [PlatformInfrastructureEnvKeys.REDIS_ADMIN_PASSWORD]: secrets.valkey.adminPassword,\n\n [RABBITMQ_CREDENTIAL_ENV_KEYS.DEFAULT_USER]: secrets.rabbitmq.adminUsername,\n [RABBITMQ_CREDENTIAL_ENV_KEYS.DEFAULT_PASS]: secrets.rabbitmq.adminPassword,\n [RABBITMQ_CREDENTIAL_ENV_KEYS.ERLANG_COOKIE]: secrets.rabbitmq.erlangCookie,\n [PlatformInfrastructureEnvKeys.RABBITMQ_HOST]: 'rabbitmq',\n [PlatformInfrastructureEnvKeys.RABBITMQ_PORT]: '5672',\n [PlatformInfrastructureEnvKeys.RABBITMQ_MANAGEMENT_PORT]: '15672',\n [PlatformInfrastructureEnvKeys.RABBITMQ_ADMIN_USERNAME]: secrets.rabbitmq.adminUsername,\n [PlatformInfrastructureEnvKeys.RABBITMQ_ADMIN_PASSWORD]: secrets.rabbitmq.adminPassword,\n\n [MINIO_CREDENTIAL_ENV_KEYS.ROOT_USER]: secrets.storage.accessKey,\n [MINIO_CREDENTIAL_ENV_KEYS.ROOT_PASSWORD]: secrets.storage.secretKey,\n [PlatformInfrastructureEnvKeys.STORAGE_PROVIDER]: STORAGE_DEFAULTS.PROVIDER,\n [PlatformInfrastructureEnvKeys.STORAGE_ENDPOINT]: 'minio',\n [PlatformInfrastructureEnvKeys.STORAGE_PORT]: '9000',\n [PlatformInfrastructureEnvKeys.STORAGE_USE_SSL]: 'false',\n [PlatformInfrastructureEnvKeys.STORAGE_BUCKET]: STORAGE_DEFAULTS.BUCKET,\n [PlatformInfrastructureEnvKeys.STORAGE_ACCESS_KEY]: secrets.storage.accessKey,\n [PlatformInfrastructureEnvKeys.STORAGE_SECRET_KEY]: secrets.storage.secretKey,\n\n [PlatformServiceUrlEnvKeys.PLATFORM_APPS_MANAGER_URL]: `http://platform-apps-manager:${PLATFORM_DEFAULT_PORTS.APPS_MANAGER}`,\n // No crontabs manager runs here, but every platform service's env schema requires a URL for it.\n [PlatformServiceUrlEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_URL]: `http://platform-crontabs-batches-manager:${PLATFORM_DEFAULT_PORTS.CRONTABS_BATCHES_MANAGER}`,\n [PlatformServiceUrlEnvKeys.PLATFORM_MODULE_REGISTRY_URL]: `http://platform-module-registry:${PLATFORM_DEFAULT_PORTS.MODULE_REGISTRY}`,\n\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_PRIVATE_KEY]: secrets.platform.appsManager.privateKey,\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_PUBLIC_KEY]: secrets.platform.appsManager.publicKey,\n // #2921, #2898 — apps-manager signs its answers to application runtimes and platform services with this key, and checks at startup that it is in the published set.\n [PlatformSecurityEnvKeys.PLATFORM_APPS_MANAGER_RESPONSE_SIGNING_PRIVATE_KEY]: responseSigning.privateKey,\n [ApplicationBackendBootstrapEnvKeys.PLATFORM_APPS_MANAGER_RESPONSE_VERIFICATION_KEYS]: buildRuntimeResponseVerificationKeySet([\n responseSigning.publicKey,\n responseSigning.nextPublicKey,\n ]),\n // #2891 — apps-manager seals every LOCAL private key under this root; the previous one only until the re-seal.\n [PlatformSecurityEnvKeys.PLATFORM_KEY_ENCRYPTION_ROOT]: keyEncryptionRoot.current,\n [PlatformSecurityEnvKeys.PLATFORM_KEY_ENCRYPTION_PREVIOUS_ROOT]:\n keyEncryptionRoot.previous && keyEncryptionRoot.previous !== keyEncryptionRoot.current ? keyEncryptionRoot.previous : '',\n [PlatformSecurityEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_PRIVATE_KEY]: secrets.platform.crontabsBatchesManager.privateKey,\n [PlatformSecurityEnvKeys.PLATFORM_CRONTABS_BATCHES_MANAGER_PUBLIC_KEY]: secrets.platform.crontabsBatchesManager.publicKey,\n [PlatformSecurityEnvKeys.PLATFORM_APPLICATION_PRIMARY_SECRET]: secrets.platform.primarySecret,\n [PlatformSecurityEnvKeys.PLATFORM_ADMIN_SECRET]: secrets.platform.adminSecret,\n\n [PlatformAdminEnvKeys.ADMIN_EMAIL]: secrets.admin.email,\n [PlatformAdminEnvKeys.ADMIN_PASSWORD]: secrets.admin.password,\n [PlatformAdminEnvKeys.ADMIN_FIRST_NAME]: secrets.admin.firstName,\n [PlatformAdminEnvKeys.ADMIN_LAST_NAME]: secrets.admin.lastName,\n };\n}\n\n/**\n * The `.env` file content. Encoded once, by the same encoder as the platform's `.env.wildo-platform`. A `$` is refused:\n * Compose interpolates it inside an env file, so a value carrying one would arrive changed. Generated material never\n * contains one; an operator-typed value could.\n */\nexport function serializeRegistryHostEnv(env: Record<string, string>): string {\n const lines = ['# Written by `wildo fwk registry-host deploy`. Rewritten on every deploy; do not edit here.'];\n for (const [key, value] of Object.entries(env)) {\n if (value.includes('$')) throw new Error(`${key} contains \"$\", which Docker Compose would interpolate. Change the value.`);\n lines.push(`${key}=${encodeComposeEnvValue(value)}`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** The deployed template files, read from the framework checkout. */\nexport function readRegistryHostTemplates(frameworkRoot: string): Record<(typeof REGISTRY_HOST_TEMPLATE_FILES)[number], string> {\n const directory = join(resolveFrameworkLayout(frameworkRoot).templatesHome, 'infra', 'registry-host');\n return Object.fromEntries(REGISTRY_HOST_TEMPLATE_FILES.map((file) => [file, readFileSync(join(directory, file), 'utf8')])) as Record<\n (typeof REGISTRY_HOST_TEMPLATE_FILES)[number],\n string\n >;\n}\n\n/** The checkout trees whose compiled output the platform image runs (`Dockerfile.platform-base` copies the checkout). */\nconst IMAGE_RUNTIME_PACKAGE_ROOTS = ['engine/', 'platform/platform-core/', 'platform/platform-back-office/'] as const;\n\n/**\n * The packages whose compiled output is not settled, so an image built from this checkout now would ship it: any\n * package the image runs that the dev watchers record as not `ready`, or as carrying a current failure. In a checkout\n * several sessions compile at once, this is the difference between shipping the tree and shipping a half-compiled one\n * (#2135 review M3). Without the watchers' record nothing is proven, and every package is reported unsettled.\n */\nexport function findUnsettledImagePackages(frameworkRoot: string): string[] {\n let status: { packages?: Record<string, { relativePackageRoot?: string; status?: string; currentFailureDiagnostic?: unknown }> };\n try {\n status = JSON.parse(readFileSync(join(frameworkRoot, DEV_COMPILE_STATUS_RELATIVE), 'utf8')) as typeof status;\n } catch {\n return [`(no compile record at ${DEV_COMPILE_STATUS_RELATIVE}: start the dev watchers, which own every dist)`];\n }\n return Object.entries(status.packages ?? {})\n .filter(([, record]) => IMAGE_RUNTIME_PACKAGE_ROOTS.some((root) => (record.relativePackageRoot ?? '').startsWith(root)))\n // semantic-literal-boundary: `ready` is the orchestrator's status vocabulary, owned by a plain .mjs script this package cannot import\n .filter(([, record]) => record.status !== 'ready' || Boolean(record.currentFailureDiagnostic))\n .map(([name, record]) => `${name} (${record.status ?? 'unknown'})`)\n .sort();\n}\n\n/**\n * The command, run ON the host, that mints a registry key through apps-manager's admin door (`/admin/registry/keys`).\n *\n * The door listens only on the host's loopback (`127.0.0.1:5151`), so the request is made there, over SSH, with no\n * tunnel. The admin secret never appears in an argument vector, on either machine: the host reads it from its own\n * `.env`, and `curl` receives the header on stdin (`-H @-`). The request body names no secret and is passed as data.\n */\nexport function buildRegistryHostKeyMintCommand(request: RegistryKeyMintRequest): string {\n const body = JSON.stringify(RegistryKeyMintRequestSchema.parse(request));\n const url = `http://127.0.0.1:${PLATFORM_DEFAULT_PORTS.APPS_MANAGER}${APPS_MANAGER_API_PREFIX}${REGISTRY_KEYS_ADMIN_PATH}`;\n const quote = (value: string) => `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n return [\n `cd ${quote(REGISTRY_HOST_DIRECTORY)}`,\n // An unquoted alphanumeric value in the compose env file; quotes are stripped in case an encoder ever adds them.\n `secret=$(sed -n 's/^${PlatformSecurityEnvKeys.PLATFORM_ADMIN_SECRET}=//p' .env | sed 's/^\"//;s/\"$//')`,\n 'test -n \"$secret\"',\n `printf '%s: %s\\\\n' ${quote(APPS_MANAGER_ADMIN_SECRET_HEADER)} \"$secret\" | curl -sS --fail-with-body -X POST ${quote(url)} -H @- -H 'content-type: application/json' --data ${quote(body)}`,\n ].join(' && ');\n}\n\n/**\n * The object store client image the backup mirrors buckets with: the compose file's own `minio-init` image, so the\n * backup always speaks to the store with the client the stack itself runs, and changes when the store changes.\n */\nexport function registryHostObjectStoreClientImage(composeYaml: string): string {\n const image = (parseYaml(composeYaml) as { services?: Record<string, { image?: string }> }).services?.['minio-init']?.image;\n if (!image) throw new Error('The registry host compose file has no `minio-init` image, which the backup mirrors buckets with.');\n return image;\n}\n\n/**\n * The backup job's settings (`/opt/wildo-registry/backup.env`, 0600). Read twice on the host, by bash (`. backup.env`)\n * and by `docker run --env-file`, which disagree about quoting, so a value either reads identically in both or is\n * refused: no whitespace, quotes, `$`, backticks, backslashes or `#`.\n */\nexport function buildRegistryHostBackupEnv(input: { backup: WildoFrameworkRegistryHostBackup; heartbeatUrl: string; objectStoreClientImage: string }): string {\n const values: Record<string, string> = {\n RESTIC_REPOSITORY: `s3:${input.backup.endpoint.replace(/\\/+$/, '')}/${input.backup.bucket}/registry`,\n RESTIC_PASSWORD: input.backup.resticPassword,\n AWS_ACCESS_KEY_ID: input.backup.accessKey,\n AWS_SECRET_ACCESS_KEY: input.backup.secretKey,\n AWS_DEFAULT_REGION: input.backup.scalewayRegion,\n HEARTBEAT_URL: input.heartbeatUrl,\n MC_IMAGE: input.objectStoreClientImage,\n RESTIC_IMAGE: REGISTRY_BACKUP_RESTIC_IMAGE,\n BACKUP_HOST: registryHostDomain(),\n };\n const lines = ['# Written by `wildo fwk registry-host deploy` for backup.sh. Rewritten on every deploy; do not edit here.'];\n for (const [key, value] of Object.entries(values)) {\n if (/[\\s\"'$`\\\\#]/.test(value)) throw new Error(`${key} has a character backup.env cannot carry for both of its readers; change the value.`);\n lines.push(`${key}=${value}`);\n }\n return `${lines.join('\\n')}\\n`;\n}\n"]}
|
|
@@ -74,6 +74,7 @@ export interface ProtectedWritePlan {
|
|
|
74
74
|
* | recorded by this module? | on disk | action |
|
|
75
75
|
* |---|---|---|
|
|
76
76
|
* | yes, untouched | yes | overwrite |
|
|
77
|
+
* | yes, edited or unknown, and byte-identical to the new version | yes | overwrite (a no-op), recording the new hash |
|
|
77
78
|
* | yes, edited or unknown | yes | keep (or `--force`: back up, then overwrite) |
|
|
78
79
|
* | yes | no (deleted) | not recreated (`restoreMissing` or `--force`: recreate) |
|
|
79
80
|
* | no, another module owns it | yes | overwrite, with the fan-out's overlap warning |
|
|
@@ -87,6 +88,13 @@ export declare function planProtectedWrite(args: {
|
|
|
87
88
|
saasRoot: string;
|
|
88
89
|
moduleId: string;
|
|
89
90
|
stagedPaths: readonly string[];
|
|
91
|
+
/**
|
|
92
|
+
* Where the new version is staged: each staged path is read from `<extractDir>/<path>`. An edited file whose bytes
|
|
93
|
+
* already equal the new version's is not a conflict: there is nothing of the application's to keep, and keeping it
|
|
94
|
+
* would carry the OLD install hash forward, so every later update would report it edited again (#3816: Wonder Todos'
|
|
95
|
+
* Teams `backend.exports.ts` carried, by hand, the exact change 1.2.1 ships, and `update` kept it as "changed").
|
|
96
|
+
*/
|
|
97
|
+
extractDir: string;
|
|
90
98
|
/** The module's current entry; absent for a first install. */
|
|
91
99
|
recorded?: Pick<RegistryModulesLockEntry, 'files' | 'installedFileHashes'>;
|
|
92
100
|
force: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-file-state.utils.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/installed-file-state.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGlG;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,yFAAyF;IACzF,SAAS,cAAc;IACvB,6GAA6G;IAC7G,MAAM,WAAW;IACjB;;;OAGG;IACH,OAAO,YAAY;IACnB,8EAA8E;IAC9E,OAAO,YAAY;CACpB;AAED,uEAAuE;AACvE,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,kBAAkB,CAAoE,CAAC;AAEjJ,yEAAyE;AACzE,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExE;AAED,gEAAgE;AAChE,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAM7H;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1I;AAED,yDAAyD;AACzD,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,EAC5D,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAa7B;AAED,6EAA6E;AAC7E,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,OAAO,GAAG,qBAAqB,CAAC,GACrE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAI1C;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAE/G;AAED,sGAAsG;AACtG,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK/H;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9G;AAED,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,kBAAkB,CAAC;CAC3B;AAED,+GAA+G;AAC/G,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,uFAAuF;IACvF,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,6DAA6D;IAC7D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,4FAA4F;IAC5F,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED
|
|
1
|
+
{"version":3,"file":"installed-file-state.utils.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/installed-file-state.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAsB,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGlG;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,yFAAyF;IACzF,SAAS,cAAc;IACvB,6GAA6G;IAC7G,MAAM,WAAW;IACj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B;IACnC,qEAAqE;IACrE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,uGAAuG;IACvG,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wFAAwF;IACxF,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;IAC7D,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgBhC;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;CAClE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAWlC"}
|
|
@@ -104,6 +104,7 @@ export function describeProtectedFile(appRelativePath, state, verb) {
|
|
|
104
104
|
* | recorded by this module? | on disk | action |
|
|
105
105
|
* |---|---|---|
|
|
106
106
|
* | yes, untouched | yes | overwrite |
|
|
107
|
+
* | yes, edited or unknown, and byte-identical to the new version | yes | overwrite (a no-op), recording the new hash |
|
|
107
108
|
* | yes, edited or unknown | yes | keep (or `--force`: back up, then overwrite) |
|
|
108
109
|
* | yes | no (deleted) | not recreated (`restoreMissing` or `--force`: recreate) |
|
|
109
110
|
* | no, another module owns it | yes | overwrite, with the fan-out's overlap warning |
|
|
@@ -121,7 +122,7 @@ export async function planProtectedWrite(args) {
|
|
|
121
122
|
for (const stagedPath of stagedPaths) {
|
|
122
123
|
if (recordedSet.has(stagedPath)) {
|
|
123
124
|
const state = await classifyInstalledFile(saasRoot, recorded, stagedPath);
|
|
124
|
-
if (PROTECTED_INSTALLED_FILE_STATES.has(state)) {
|
|
125
|
+
if (PROTECTED_INSTALLED_FILE_STATES.has(state) && !(await matchesStagedFile(saasRoot, args.extractDir, stagedPath))) {
|
|
125
126
|
if (force) {
|
|
126
127
|
plan.forced.push({ path: stagedPath, backup: await backupApplicationFile(saasRoot, stagedPath, backupDirectory) });
|
|
127
128
|
}
|
|
@@ -196,6 +197,13 @@ export async function nextInstalledFileHashes(args) {
|
|
|
196
197
|
}
|
|
197
198
|
return hashes;
|
|
198
199
|
}
|
|
200
|
+
/** Whether the application's file is byte-identical to the staged one (both regular files). */
|
|
201
|
+
async function matchesStagedFile(saasRoot, extractDir, appRelativePath) {
|
|
202
|
+
const stagedPath = path.join(extractDir, ...appRelativePath.split('/'));
|
|
203
|
+
if (!(await isExistingFile(stagedPath)))
|
|
204
|
+
return false;
|
|
205
|
+
return (await sha256OfFile(resolveRecordedModuleFile(saasRoot, appRelativePath))) === (await sha256OfFile(stagedPath));
|
|
206
|
+
}
|
|
199
207
|
async function isExistingFile(absolutePath) {
|
|
200
208
|
try {
|
|
201
209
|
return (await fs.stat(absolutePath)).isFile();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-file-state.utils.js","sourceRoot":"","sources":["../../../../src/services/registry/installed-file-state.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AA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C,CAAC,CAAC,SAAS,CAAC;YACnF,IAAI,OAAO,KAAK,SAAS;gBAAE,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;YACnD,SAAS;QACX,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,YAAoB;IAChD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["/**\n * Which installed module files the application changed (#2016).\n *\n * Paul, 2026-09-29: a module copied into an application (the shadcn model) is the application's to edit,\n * so updating it needs \"hash matching … with warning for potential override of the end user\". The\n * installer records the SHA-256 of every file it writes (`installedFileHashes` on the lockfile entry);\n * `update`, `remove` and `repair` compare the file on disk to that hash before touching it.\n *\n * The same shape as Debian and RPM conffile handling: a file the administrator never touched is replaced;\n * one they changed is kept, with a notice.\n */\n\nimport { createHash } from 'node:crypto';\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { Sha256DigestSchema, type RegistryModulesLockEntry } from '@wildo-ai/platform-config-lib';\nimport { resolveRecordedModuleFile } from './boundary-fanout.utils';\n\n/**\n * What the application has done to one installed file, measured against the hash the installer\n * recorded when it wrote it.\n */\nexport enum InstalledFileState {\n /** On disk and byte-identical to what the installer wrote: safe to replace or delete. */\n UNTOUCHED = 'untouched',\n /** On disk and different from what the installer wrote: the application changed it. Kept, with a warning. */\n EDITED = 'edited',\n /**\n * On disk, but no valid hash was recorded for it, so whether it changed cannot be known. Treated as\n * EDITED (kept, with a warning): a missing fingerprint may only make a command more careful.\n */\n UNKNOWN = 'unknown',\n /** Recorded, but not on disk: the application deleted it (or it was lost). */\n MISSING = 'missing',\n}\n\n/** States a command must not overwrite or delete without `--force`. */\nexport const PROTECTED_INSTALLED_FILE_STATES: ReadonlySet<InstalledFileState> = new Set([InstalledFileState.EDITED, InstalledFileState.UNKNOWN]);\n\n/** `sha256:<hex>` of a file's bytes, in the lockfile's digest format. */\nexport async function sha256OfFile(absolutePath: string): Promise<string> {\n return `sha256:${createHash('sha256').update(await fs.readFile(absolutePath)).digest('hex')}`;\n}\n\n/** The hash of each written file, as the installer wrote it. */\nexport async function hashWrittenFiles(saasRoot: string, appRelativePaths: readonly string[]): Promise<Record<string, string>> {\n const hashes: Record<string, string> = {};\n for (const appRelativePath of appRelativePaths) {\n hashes[appRelativePath] = await sha256OfFile(path.resolve(saasRoot, appRelativePath));\n }\n return hashes;\n}\n\n/** The recorded hash of one file, or `undefined` when none was recorded or it is malformed. */\nexport function recordedFileHash(entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>, appRelativePath: string): string | undefined {\n const recorded = entry.installedFileHashes?.[appRelativePath];\n return recorded !== undefined && Sha256DigestSchema.safeParse(recorded).success ? recorded : undefined;\n}\n\n/** Classify one recorded file of an installed module. */\nexport async function classifyInstalledFile(\n saasRoot: string,\n entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>,\n appRelativePath: string,\n): Promise<InstalledFileState> {\n const absolutePath = resolveRecordedModuleFile(saasRoot, appRelativePath);\n let isFile: boolean;\n try {\n isFile = (await fs.stat(absolutePath)).isFile();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return InstalledFileState.MISSING;\n throw error;\n }\n if (!isFile) return InstalledFileState.UNKNOWN;\n const recorded = recordedFileHash(entry, appRelativePath);\n if (recorded === undefined) return InstalledFileState.UNKNOWN;\n return (await sha256OfFile(absolutePath)) === recorded ? InstalledFileState.UNTOUCHED : InstalledFileState.EDITED;\n}\n\n/** Classify every recorded file of an installed module, in `files` order. */\nexport async function classifyInstalledFiles(\n saasRoot: string,\n entry: Pick<RegistryModulesLockEntry, 'files' | 'installedFileHashes'>,\n): Promise<Map<string, InstalledFileState>> {\n const states = new Map<string, InstalledFileState>();\n for (const appRelativePath of entry.files) states.set(appRelativePath, await classifyInstalledFile(saasRoot, entry, appRelativePath));\n return states;\n}\n\n/**\n * Where `--force` keeps the application's version of a file before overwriting or deleting it:\n * `.wildo-saas/tmp/registry-backups/<moduleId>/<timestamp>/`. A per-run directory, so two forced runs\n * never overwrite each other's backups.\n */\nexport function registryForceBackupDirectory(saasRoot: string, moduleId: string, now: Date = new Date()): string {\n return path.join(saasRoot, '.wildo-saas', 'tmp', 'registry-backups', ...moduleId.split('/'), now.toISOString().replace(/[:.]/g, '-'));\n}\n\n/** Copy one application file into a force-backup directory, keeping its application-relative path. */\nexport async function backupApplicationFile(saasRoot: string, appRelativePath: string, backupDirectory: string): Promise<string> {\n const destination = path.join(backupDirectory, ...appRelativePath.split('/'));\n await fs.mkdir(path.dirname(destination), { recursive: true });\n await fs.copyFile(path.resolve(saasRoot, appRelativePath), destination);\n return destination;\n}\n\n/** One human line for a protected file a command left in place. */\nexport function describeProtectedFile(appRelativePath: string, state: InstalledFileState, verb: string): string {\n return state === InstalledFileState.UNKNOWN\n ? `kept ${appRelativePath}: no install hash is recorded for it, so whether you changed it cannot be told. Not ${verb}; pass --force to ${verb} it (a backup is kept).`\n : `kept ${appRelativePath}: you changed it since it was installed. Not ${verb}; pass --force to ${verb} it (a backup is kept), or merge the new version by hand.`;\n}\n\n/** A recorded file a command left in place, and why. */\nexport interface KeptInstalledFile {\n path: string;\n state: InstalledFileState;\n}\n\n/** What a write (add, update, repair) will do to each file the new version ships, decided before it writes. */\nexport interface ProtectedWritePlan {\n /** Passed to the fan-out as `skipPaths`: files that stay as the application has them. */\n skip: Set<string>;\n /** Recorded files the application changed (or that carry no hash): not overwritten. */\n kept: KeptInstalledFile[];\n /** Recorded files the application deleted: not recreated. */\n notRestored: string[];\n /** Files overwritten under `--force`, each with the backup of the application's version. */\n forced: Array<{ path: string; backup: string }>;\n}\n\n/**\n * Decide, per file the new version ships, whether a write may overwrite what is on disk (#2016):\n *\n * | recorded by this module? | on disk | action |\n * |---|---|---|\n * | yes, untouched | yes | overwrite |\n * | yes, edited or unknown | yes | keep (or `--force`: back up, then overwrite) |\n * | yes | no (deleted) | not recreated (`restoreMissing` or `--force`: recreate) |\n * | no, another module owns it | yes | overwrite, with the fan-out's overlap warning |\n * | no, NO module owns it | yes | refuse, nothing written (or `--force`: back up, then overwrite) |\n * | no | no | create |\n *\n * The refusal is collected across every file and thrown before anything is written: a new version\n * must never silently replace a file the application authored itself.\n */\nexport async function planProtectedWrite(args: {\n saasRoot: string;\n moduleId: string;\n stagedPaths: readonly string[];\n /** The module's current entry; absent for a first install. */\n recorded?: Pick<RegistryModulesLockEntry, 'files' | 'installedFileHashes'>;\n force: boolean;\n /** `repair` recreates missing files: that is what it is for. */\n restoreMissing: boolean;\n backupDirectory: string;\n /** Who else owns a path; injected so the plan can be tested without a lockfile. */\n findOtherOwners: (paths: readonly string[]) => Promise<ReadonlyMap<string, readonly string[]>>;\n}): Promise<ProtectedWritePlan> {\n const { saasRoot, moduleId, stagedPaths, recorded, force, restoreMissing, backupDirectory } = args;\n const recordedSet = new Set(recorded?.files ?? []);\n const plan: ProtectedWritePlan = { skip: new Set(), kept: [], notRestored: [], forced: [] };\n const unrecordedPresent: string[] = [];\n\n for (const stagedPath of stagedPaths) {\n if (recordedSet.has(stagedPath)) {\n const state = await classifyInstalledFile(saasRoot, recorded!, stagedPath);\n if (PROTECTED_INSTALLED_FILE_STATES.has(state)) {\n if (force) {\n plan.forced.push({ path: stagedPath, backup: await backupApplicationFile(saasRoot, stagedPath, backupDirectory) });\n } else {\n plan.skip.add(stagedPath);\n plan.kept.push({ path: stagedPath, state });\n }\n } else if (state === InstalledFileState.MISSING && !restoreMissing && !force) {\n plan.skip.add(stagedPath);\n plan.notRestored.push(stagedPath);\n }\n continue;\n }\n if (await isExistingFile(path.resolve(saasRoot, stagedPath))) unrecordedPresent.push(stagedPath);\n }\n\n if (unrecordedPresent.length > 0) {\n const owners = await args.findOtherOwners(unrecordedPresent);\n const unowned = unrecordedPresent.filter((candidate) => (owners.get(candidate) ?? []).length === 0);\n if (unowned.length > 0 && !force) {\n throw new Error(\n `Refusing to install \"${moduleId}\": it would overwrite ${unowned.length} file(s) the application has and no module installed `\n + `(${unowned.join(', ')}). Nothing was written. Move them aside, or pass --force to overwrite them (a backup is kept).`,\n );\n }\n for (const candidate of unowned) {\n plan.forced.push({ path: candidate, backup: await backupApplicationFile(saasRoot, candidate, backupDirectory) });\n }\n }\n return plan;\n}\n\n/** What a removal (remove, or an update dropping files) will do to each recorded file, decided before it deletes. */\nexport interface ProtectedRemovalPlan {\n /** Untouched files, or edited ones under `--force`: delete these. */\n remove: string[];\n /** Files the application changed (or that carry no hash): left in place, now the application's own. */\n kept: KeptInstalledFile[];\n /** Files already gone. */\n gone: string[];\n /** Files deleted under `--force`, each with the backup of the application's version. */\n forced: Array<{ path: string; backup: string }>;\n}\n\n/**\n * Decide, per recorded file about to leave the module, whether it may be deleted (#2016). An edited\n * file is kept and becomes the application's own; `--force` deletes it after a backup.\n */\nexport async function planProtectedRemoval(args: {\n saasRoot: string;\n entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>;\n paths: readonly string[];\n force: boolean;\n backupDirectory: string;\n}): Promise<ProtectedRemovalPlan> {\n const plan: ProtectedRemovalPlan = { remove: [], kept: [], gone: [], forced: [] };\n for (const recordedPath of args.paths) {\n const state = await classifyInstalledFile(args.saasRoot, args.entry, recordedPath);\n if (state === InstalledFileState.MISSING) {\n plan.gone.push(recordedPath);\n } else if (state === InstalledFileState.UNTOUCHED) {\n plan.remove.push(recordedPath);\n } else if (args.force) {\n plan.forced.push({ path: recordedPath, backup: await backupApplicationFile(args.saasRoot, recordedPath, args.backupDirectory) });\n plan.remove.push(recordedPath);\n } else {\n plan.kept.push({ path: recordedPath, state });\n }\n }\n return plan;\n}\n\n/**\n * The `installedFileHashes` to record after a write: the hash of what was WRITTEN for every file the\n * write touched, and the PREVIOUS recorded hash for every file it kept.\n *\n * Carrying the previous hash is the whole point for a kept file: recording the hash of the\n * application's edited content would make the next update see it as untouched and overwrite it.\n */\nexport async function nextInstalledFileHashes(args: {\n saasRoot: string;\n ownedFiles: readonly string[];\n skipped: ReadonlySet<string>;\n previous?: Pick<RegistryModulesLockEntry, 'installedFileHashes'>;\n}): Promise<Record<string, string>> {\n const hashes: Record<string, string> = {};\n for (const owned of args.ownedFiles) {\n if (args.skipped.has(owned)) {\n const carried = args.previous ? recordedFileHash(args.previous, owned) : undefined;\n if (carried !== undefined) hashes[owned] = carried;\n continue;\n }\n hashes[owned] = await sha256OfFile(path.resolve(args.saasRoot, owned));\n }\n return hashes;\n}\n\nasync function isExistingFile(absolutePath: string): Promise<boolean> {\n try {\n return (await fs.stat(absolutePath)).isFile();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false;\n throw error;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"installed-file-state.utils.js","sourceRoot":"","sources":["../../../../src/services/registry/installed-file-state.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAiC,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B,yFAAyF;IACzF,6CAAuB,CAAA;IACvB,6GAA6G;I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;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,+FAA+F;AAC/F,KAAK,UAAU,iBAAiB,CAAC,QAAgB,EAAE,UAAkB,EAAE,eAAuB;IAC5F,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,IAAI,CAAC,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,CAAC,MAAM,YAAY,CAAC,yBAAyB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AACzH,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,YAAoB;IAChD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["/**\n * Which installed module files the application changed (#2016).\n *\n * Paul, 2026-09-29: a module copied into an application (the shadcn model) is the application's to edit,\n * so updating it needs \"hash matching … with warning for potential override of the end user\". The\n * installer records the SHA-256 of every file it writes (`installedFileHashes` on the lockfile entry);\n * `update`, `remove` and `repair` compare the file on disk to that hash before touching it.\n *\n * The same shape as Debian and RPM conffile handling: a file the administrator never touched is replaced;\n * one they changed is kept, with a notice.\n */\n\nimport { createHash } from 'node:crypto';\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { Sha256DigestSchema, type RegistryModulesLockEntry } from '@wildo-ai/platform-config-lib';\nimport { resolveRecordedModuleFile } from './boundary-fanout.utils';\n\n/**\n * What the application has done to one installed file, measured against the hash the installer\n * recorded when it wrote it.\n */\nexport enum InstalledFileState {\n /** On disk and byte-identical to what the installer wrote: safe to replace or delete. */\n UNTOUCHED = 'untouched',\n /** On disk and different from what the installer wrote: the application changed it. Kept, with a warning. */\n EDITED = 'edited',\n /**\n * On disk, but no valid hash was recorded for it, so whether it changed cannot be known. Treated as\n * EDITED (kept, with a warning): a missing fingerprint may only make a command more careful.\n */\n UNKNOWN = 'unknown',\n /** Recorded, but not on disk: the application deleted it (or it was lost). */\n MISSING = 'missing',\n}\n\n/** States a command must not overwrite or delete without `--force`. */\nexport const PROTECTED_INSTALLED_FILE_STATES: ReadonlySet<InstalledFileState> = new Set([InstalledFileState.EDITED, InstalledFileState.UNKNOWN]);\n\n/** `sha256:<hex>` of a file's bytes, in the lockfile's digest format. */\nexport async function sha256OfFile(absolutePath: string): Promise<string> {\n return `sha256:${createHash('sha256').update(await fs.readFile(absolutePath)).digest('hex')}`;\n}\n\n/** The hash of each written file, as the installer wrote it. */\nexport async function hashWrittenFiles(saasRoot: string, appRelativePaths: readonly string[]): Promise<Record<string, string>> {\n const hashes: Record<string, string> = {};\n for (const appRelativePath of appRelativePaths) {\n hashes[appRelativePath] = await sha256OfFile(path.resolve(saasRoot, appRelativePath));\n }\n return hashes;\n}\n\n/** The recorded hash of one file, or `undefined` when none was recorded or it is malformed. */\nexport function recordedFileHash(entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>, appRelativePath: string): string | undefined {\n const recorded = entry.installedFileHashes?.[appRelativePath];\n return recorded !== undefined && Sha256DigestSchema.safeParse(recorded).success ? recorded : undefined;\n}\n\n/** Classify one recorded file of an installed module. */\nexport async function classifyInstalledFile(\n saasRoot: string,\n entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>,\n appRelativePath: string,\n): Promise<InstalledFileState> {\n const absolutePath = resolveRecordedModuleFile(saasRoot, appRelativePath);\n let isFile: boolean;\n try {\n isFile = (await fs.stat(absolutePath)).isFile();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return InstalledFileState.MISSING;\n throw error;\n }\n if (!isFile) return InstalledFileState.UNKNOWN;\n const recorded = recordedFileHash(entry, appRelativePath);\n if (recorded === undefined) return InstalledFileState.UNKNOWN;\n return (await sha256OfFile(absolutePath)) === recorded ? InstalledFileState.UNTOUCHED : InstalledFileState.EDITED;\n}\n\n/** Classify every recorded file of an installed module, in `files` order. */\nexport async function classifyInstalledFiles(\n saasRoot: string,\n entry: Pick<RegistryModulesLockEntry, 'files' | 'installedFileHashes'>,\n): Promise<Map<string, InstalledFileState>> {\n const states = new Map<string, InstalledFileState>();\n for (const appRelativePath of entry.files) states.set(appRelativePath, await classifyInstalledFile(saasRoot, entry, appRelativePath));\n return states;\n}\n\n/**\n * Where `--force` keeps the application's version of a file before overwriting or deleting it:\n * `.wildo-saas/tmp/registry-backups/<moduleId>/<timestamp>/`. A per-run directory, so two forced runs\n * never overwrite each other's backups.\n */\nexport function registryForceBackupDirectory(saasRoot: string, moduleId: string, now: Date = new Date()): string {\n return path.join(saasRoot, '.wildo-saas', 'tmp', 'registry-backups', ...moduleId.split('/'), now.toISOString().replace(/[:.]/g, '-'));\n}\n\n/** Copy one application file into a force-backup directory, keeping its application-relative path. */\nexport async function backupApplicationFile(saasRoot: string, appRelativePath: string, backupDirectory: string): Promise<string> {\n const destination = path.join(backupDirectory, ...appRelativePath.split('/'));\n await fs.mkdir(path.dirname(destination), { recursive: true });\n await fs.copyFile(path.resolve(saasRoot, appRelativePath), destination);\n return destination;\n}\n\n/** One human line for a protected file a command left in place. */\nexport function describeProtectedFile(appRelativePath: string, state: InstalledFileState, verb: string): string {\n return state === InstalledFileState.UNKNOWN\n ? `kept ${appRelativePath}: no install hash is recorded for it, so whether you changed it cannot be told. Not ${verb}; pass --force to ${verb} it (a backup is kept).`\n : `kept ${appRelativePath}: you changed it since it was installed. Not ${verb}; pass --force to ${verb} it (a backup is kept), or merge the new version by hand.`;\n}\n\n/** A recorded file a command left in place, and why. */\nexport interface KeptInstalledFile {\n path: string;\n state: InstalledFileState;\n}\n\n/** What a write (add, update, repair) will do to each file the new version ships, decided before it writes. */\nexport interface ProtectedWritePlan {\n /** Passed to the fan-out as `skipPaths`: files that stay as the application has them. */\n skip: Set<string>;\n /** Recorded files the application changed (or that carry no hash): not overwritten. */\n kept: KeptInstalledFile[];\n /** Recorded files the application deleted: not recreated. */\n notRestored: string[];\n /** Files overwritten under `--force`, each with the backup of the application's version. */\n forced: Array<{ path: string; backup: string }>;\n}\n\n/**\n * Decide, per file the new version ships, whether a write may overwrite what is on disk (#2016):\n *\n * | recorded by this module? | on disk | action |\n * |---|---|---|\n * | yes, untouched | yes | overwrite |\n * | yes, edited or unknown, and byte-identical to the new version | yes | overwrite (a no-op), recording the new hash |\n * | yes, edited or unknown | yes | keep (or `--force`: back up, then overwrite) |\n * | yes | no (deleted) | not recreated (`restoreMissing` or `--force`: recreate) |\n * | no, another module owns it | yes | overwrite, with the fan-out's overlap warning |\n * | no, NO module owns it | yes | refuse, nothing written (or `--force`: back up, then overwrite) |\n * | no | no | create |\n *\n * The refusal is collected across every file and thrown before anything is written: a new version\n * must never silently replace a file the application authored itself.\n */\nexport async function planProtectedWrite(args: {\n saasRoot: string;\n moduleId: string;\n stagedPaths: readonly string[];\n /**\n * Where the new version is staged: each staged path is read from `<extractDir>/<path>`. An edited file whose bytes\n * already equal the new version's is not a conflict: there is nothing of the application's to keep, and keeping it\n * would carry the OLD install hash forward, so every later update would report it edited again (#3816: Wonder Todos'\n * Teams `backend.exports.ts` carried, by hand, the exact change 1.2.1 ships, and `update` kept it as \"changed\").\n */\n extractDir: string;\n /** The module's current entry; absent for a first install. */\n recorded?: Pick<RegistryModulesLockEntry, 'files' | 'installedFileHashes'>;\n force: boolean;\n /** `repair` recreates missing files: that is what it is for. */\n restoreMissing: boolean;\n backupDirectory: string;\n /** Who else owns a path; injected so the plan can be tested without a lockfile. */\n findOtherOwners: (paths: readonly string[]) => Promise<ReadonlyMap<string, readonly string[]>>;\n}): Promise<ProtectedWritePlan> {\n const { saasRoot, moduleId, stagedPaths, recorded, force, restoreMissing, backupDirectory } = args;\n const recordedSet = new Set(recorded?.files ?? []);\n const plan: ProtectedWritePlan = { skip: new Set(), kept: [], notRestored: [], forced: [] };\n const unrecordedPresent: string[] = [];\n\n for (const stagedPath of stagedPaths) {\n if (recordedSet.has(stagedPath)) {\n const state = await classifyInstalledFile(saasRoot, recorded!, stagedPath);\n if (PROTECTED_INSTALLED_FILE_STATES.has(state) && !(await matchesStagedFile(saasRoot, args.extractDir, stagedPath))) {\n if (force) {\n plan.forced.push({ path: stagedPath, backup: await backupApplicationFile(saasRoot, stagedPath, backupDirectory) });\n } else {\n plan.skip.add(stagedPath);\n plan.kept.push({ path: stagedPath, state });\n }\n } else if (state === InstalledFileState.MISSING && !restoreMissing && !force) {\n plan.skip.add(stagedPath);\n plan.notRestored.push(stagedPath);\n }\n continue;\n }\n if (await isExistingFile(path.resolve(saasRoot, stagedPath))) unrecordedPresent.push(stagedPath);\n }\n\n if (unrecordedPresent.length > 0) {\n const owners = await args.findOtherOwners(unrecordedPresent);\n const unowned = unrecordedPresent.filter((candidate) => (owners.get(candidate) ?? []).length === 0);\n if (unowned.length > 0 && !force) {\n throw new Error(\n `Refusing to install \"${moduleId}\": it would overwrite ${unowned.length} file(s) the application has and no module installed `\n + `(${unowned.join(', ')}). Nothing was written. Move them aside, or pass --force to overwrite them (a backup is kept).`,\n );\n }\n for (const candidate of unowned) {\n plan.forced.push({ path: candidate, backup: await backupApplicationFile(saasRoot, candidate, backupDirectory) });\n }\n }\n return plan;\n}\n\n/** What a removal (remove, or an update dropping files) will do to each recorded file, decided before it deletes. */\nexport interface ProtectedRemovalPlan {\n /** Untouched files, or edited ones under `--force`: delete these. */\n remove: string[];\n /** Files the application changed (or that carry no hash): left in place, now the application's own. */\n kept: KeptInstalledFile[];\n /** Files already gone. */\n gone: string[];\n /** Files deleted under `--force`, each with the backup of the application's version. */\n forced: Array<{ path: string; backup: string }>;\n}\n\n/**\n * Decide, per recorded file about to leave the module, whether it may be deleted (#2016). An edited\n * file is kept and becomes the application's own; `--force` deletes it after a backup.\n */\nexport async function planProtectedRemoval(args: {\n saasRoot: string;\n entry: Pick<RegistryModulesLockEntry, 'installedFileHashes'>;\n paths: readonly string[];\n force: boolean;\n backupDirectory: string;\n}): Promise<ProtectedRemovalPlan> {\n const plan: ProtectedRemovalPlan = { remove: [], kept: [], gone: [], forced: [] };\n for (const recordedPath of args.paths) {\n const state = await classifyInstalledFile(args.saasRoot, args.entry, recordedPath);\n if (state === InstalledFileState.MISSING) {\n plan.gone.push(recordedPath);\n } else if (state === InstalledFileState.UNTOUCHED) {\n plan.remove.push(recordedPath);\n } else if (args.force) {\n plan.forced.push({ path: recordedPath, backup: await backupApplicationFile(args.saasRoot, recordedPath, args.backupDirectory) });\n plan.remove.push(recordedPath);\n } else {\n plan.kept.push({ path: recordedPath, state });\n }\n }\n return plan;\n}\n\n/**\n * The `installedFileHashes` to record after a write: the hash of what was WRITTEN for every file the\n * write touched, and the PREVIOUS recorded hash for every file it kept.\n *\n * Carrying the previous hash is the whole point for a kept file: recording the hash of the\n * application's edited content would make the next update see it as untouched and overwrite it.\n */\nexport async function nextInstalledFileHashes(args: {\n saasRoot: string;\n ownedFiles: readonly string[];\n skipped: ReadonlySet<string>;\n previous?: Pick<RegistryModulesLockEntry, 'installedFileHashes'>;\n}): Promise<Record<string, string>> {\n const hashes: Record<string, string> = {};\n for (const owned of args.ownedFiles) {\n if (args.skipped.has(owned)) {\n const carried = args.previous ? recordedFileHash(args.previous, owned) : undefined;\n if (carried !== undefined) hashes[owned] = carried;\n continue;\n }\n hashes[owned] = await sha256OfFile(path.resolve(args.saasRoot, owned));\n }\n return hashes;\n}\n\n/** Whether the application's file is byte-identical to the staged one (both regular files). */\nasync function matchesStagedFile(saasRoot: string, extractDir: string, appRelativePath: string): Promise<boolean> {\n const stagedPath = path.join(extractDir, ...appRelativePath.split('/'));\n if (!(await isExistingFile(stagedPath))) return false;\n return (await sha256OfFile(resolveRecordedModuleFile(saasRoot, appRelativePath))) === (await sha256OfFile(stagedPath));\n}\n\nasync function isExistingFile(absolutePath: string): Promise<boolean> {\n try {\n return (await fs.stat(absolutePath)).isFile();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false;\n throw error;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-install.service.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/module-install.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAuD,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACnI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAIpC,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAErD,kHAAkH;AAClH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,mHAAmH;IACnH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,gBAAgB;AACxB,mHAAmH;AACnH,KAAK,EAAE;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpH,OAAO,CAAC,cAAc,CAAC,CAuCzB;AAED,8DAA8D;AAC9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sGAAsG;IACtG,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,yCAAyC;IACzC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,iGAAiG;IACjG,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,uFAAuF;IACvF,QAAQ,CAAC,0BAA0B,EAAE,SAAS,MAAM,EAAE,CAAC;IACvD,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,wGAAwG;IACxG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;CAChC,GAAG,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"module-install.service.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/module-install.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAuD,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACnI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;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