@jini-ai/devops 0.7.3-next.2 → 0.7.4
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/CHANGELOG.md +7 -0
- package/README.md +16 -0
- package/dist/backup/site/archive-extensions.d.ts +73 -0
- package/dist/backup/site/archive-extensions.js +129 -0
- package/dist/backup/site/archive-manifest.d.ts +85 -0
- package/dist/backup/site/archive-manifest.js +176 -0
- package/dist/backup/site/archive-media.d.ts +121 -0
- package/dist/backup/site/archive-media.js +93 -0
- package/dist/backup/site/backup-service.credentials.d.ts +31 -0
- package/dist/backup/site/backup-service.credentials.js +158 -0
- package/dist/backup/site/backup-service.d.ts +336 -0
- package/dist/backup/site/backup-service.js +127 -0
- package/dist/backup/site/backup-service.plan.d.ts +64 -0
- package/dist/backup/site/backup-service.plan.js +207 -0
- package/dist/backup/site/backup-service.push.d.ts +29 -0
- package/dist/backup/site/backup-service.push.js +94 -0
- package/dist/backup/site/backup-service.shared.d.ts +40 -0
- package/dist/backup/site/backup-service.shared.js +37 -0
- package/dist/backup/site/bundled-export-file-policy.d.ts +38 -0
- package/dist/backup/site/bundled-export-file-policy.js +39 -0
- package/dist/backup/site/credential-warnings.d.ts +41 -0
- package/dist/backup/site/credential-warnings.js +50 -0
- package/dist/backup/site/import-backend-steps.d.ts +167 -0
- package/dist/backup/site/import-backend-steps.js +170 -0
- package/dist/backup/site/import-backend.d.ts +167 -0
- package/dist/backup/site/import-backend.js +298 -0
- package/dist/backup/site/import-database.d.ts +118 -0
- package/dist/backup/site/import-database.js +167 -0
- package/dist/backup/site/import-index/admission.d.ts +54 -0
- package/dist/backup/site/import-index/admission.js +46 -0
- package/dist/backup/site/import-index/backfill.d.ts +106 -0
- package/dist/backup/site/import-index/backfill.js +137 -0
- package/dist/backup/site/import-index/errors.d.ts +28 -0
- package/dist/backup/site/import-index/errors.js +38 -0
- package/dist/backup/site/import-index/migrations/checksums.d.ts +4 -0
- package/dist/backup/site/import-index/migrations/checksums.js +4 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.d.ts +2 -0
- package/dist/backup/site/import-index/migrations/site-imports-v1.js +10 -0
- package/dist/backup/site/import-index/mode.d.ts +191 -0
- package/dist/backup/site/import-index/mode.js +272 -0
- package/dist/backup/site/import-index/open.d.ts +40 -0
- package/dist/backup/site/import-index/open.js +87 -0
- package/dist/backup/site/import-index/paging.d.ts +28 -0
- package/dist/backup/site/import-index/paging.js +66 -0
- package/dist/backup/site/import-index/payload-namespace.d.ts +80 -0
- package/dist/backup/site/import-index/payload-namespace.js +156 -0
- package/dist/backup/site/import-index/rows.d.ts +32 -0
- package/dist/backup/site/import-index/rows.js +61 -0
- package/dist/backup/site/import-index/schema.d.ts +8 -0
- package/dist/backup/site/import-index/schema.js +31 -0
- package/dist/backup/site/import-index/store.d.ts +27 -0
- package/dist/backup/site/import-index/store.js +33 -0
- package/dist/backup/site/import-index/sweep.d.ts +10 -0
- package/dist/backup/site/import-index/sweep.js +26 -0
- package/dist/backup/site/import-keep-off.d.ts +128 -0
- package/dist/backup/site/import-keep-off.js +204 -0
- package/dist/backup/site/import-plugin-state.d.ts +74 -0
- package/dist/backup/site/import-plugin-state.js +67 -0
- package/dist/backup/site/import-registry.d.ts +110 -0
- package/dist/backup/site/import-registry.js +205 -0
- package/dist/backup/site/import-restore-placement.d.ts +94 -0
- package/dist/backup/site/import-restore-placement.js +158 -0
- package/dist/backup/site/import-restore.d.ts +111 -0
- package/dist/backup/site/import-restore.js +120 -0
- package/dist/backup/site/import-verifier-inventory.d.ts +137 -0
- package/dist/backup/site/import-verifier-inventory.js +236 -0
- package/dist/backup/site/import-verifier-projection.d.ts +78 -0
- package/dist/backup/site/import-verifier-projection.js +100 -0
- package/dist/backup/site/import-verifier.d.ts +126 -0
- package/dist/backup/site/import-verifier.js +53 -0
- package/dist/backup/site/owned-temp-root.d.ts +12 -0
- package/dist/backup/site/owned-temp-root.js +2 -0
- package/dist/backup/site/package-file-inventory.d.ts +63 -0
- package/dist/backup/site/package-file-inventory.js +56 -0
- package/dist/backup/site/push-content.d.ts +70 -0
- package/dist/backup/site/push-content.js +56 -0
- package/dist/backup/site/react/ShowMoreImports.d.ts +21 -0
- package/dist/backup/site/react/ShowMoreImports.js +8 -0
- package/dist/backup/site/saved-keys-port.d.ts +47 -0
- package/dist/backup/site/saved-keys-port.js +3 -0
- package/dist/backup/site/saved-keys.d.ts +25 -0
- package/dist/backup/site/saved-keys.js +38 -0
- package/dist/backup/site/share-backend.d.ts +243 -0
- package/dist/backup/site/share-backend.js +284 -0
- package/dist/backup/site/share-database/projection.d.ts +197 -0
- package/dist/backup/site/share-database/projection.js +90 -0
- package/dist/backup/site/share-database/projection.media.d.ts +38 -0
- package/dist/backup/site/share-database/projection.media.js +179 -0
- package/dist/backup/site/share-database/projection.tables.d.ts +46 -0
- package/dist/backup/site/share-database/projection.tables.js +210 -0
- package/dist/backup/site/share-expiry.d.ts +75 -0
- package/dist/backup/site/share-expiry.js +49 -0
- package/dist/backup/site/share-export-failure.d.ts +17 -0
- package/dist/backup/site/share-export-failure.js +16 -0
- package/dist/backup/site/share-file-policy.d.ts +60 -0
- package/dist/backup/site/share-file-policy.js +146 -0
- package/dist/backup/site/share-hosting.d.ts +107 -0
- package/dist/backup/site/share-hosting.js +148 -0
- package/dist/backup/site/share-preparation-steps.d.ts +180 -0
- package/dist/backup/site/share-preparation-steps.js +107 -0
- package/dist/backup/site/share-preparation.d.ts +122 -0
- package/dist/backup/site/share-preparation.js +43 -0
- package/dist/backup/site/share-refusal.d.ts +21 -0
- package/dist/backup/site/share-refusal.js +20 -0
- package/dist/backup/site/share-registry.d.ts +124 -0
- package/dist/backup/site/share-registry.js +219 -0
- package/dist/backup/site/share-retention.d.ts +62 -0
- package/dist/backup/site/share-retention.js +126 -0
- package/dist/backup/site/share-service.d.ts +128 -0
- package/dist/backup/site/share-service.js +194 -0
- package/dist/backup/site/share-zip.d.ts +115 -0
- package/dist/backup/site/share-zip.js +144 -0
- package/dist/backup/site/sources.d.ts +344 -0
- package/dist/backup/site/sources.js +595 -0
- package/dist/backup/site/static-copy.d.ts +122 -0
- package/dist/backup/site/static-copy.js +165 -0
- package/dist/backup/site/static-download-html.d.ts +76 -0
- package/dist/backup/site/static-download-html.js +149 -0
- package/dist/backup/site/static-download-landing.d.ts +52 -0
- package/dist/backup/site/static-download-landing.js +95 -0
- package/dist/backup/site/static-download-layout.d.ts +96 -0
- package/dist/backup/site/static-download-layout.js +325 -0
- package/dist/backup/site/static-export-selection.d.ts +50 -0
- package/dist/backup/site/static-export-selection.js +75 -0
- package/dist/backup/site/static-site-packager.d.ts +42 -0
- package/dist/backup/site/static-site-packager.js +32 -0
- package/dist/backup/site/tool-registrations.d.ts +74 -0
- package/dist/backup/site/tool-registrations.js +204 -0
- package/dist/checks/complexity-debt.d.ts +100 -0
- package/dist/checks/complexity-debt.js +131 -0
- package/dist/checks/coverage/diff.js +5 -1
- package/dist/checks/coverage/lcov.js +1 -1
- package/dist/checks/env-access.d.ts +14 -1
- package/dist/checks/env-access.js +92 -6
- package/dist/checks/live-verify-checks.d.ts +29 -0
- package/dist/checks/live-verify-checks.js +30 -0
- package/dist/checks/quality-gates.d.ts +137 -0
- package/dist/checks/quality-gates.js +209 -0
- package/dist/core/deploy-types.d.ts +2 -0
- package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
- package/dist/deploy/admin-http/site-update-status.js +15 -0
- package/dist/deploy/host-kit.d.ts +3 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/index.js +6 -0
- package/dist/deploy/ops-runner.js +7 -0
- package/dist/deploy/ops-tool-contracts.d.ts +10 -1
- package/dist/deploy/react/Deployment.d.ts +37 -0
- package/dist/deploy/react/Deployment.js +94 -0
- package/dist/deploy/react/DockerfileTab.d.ts +72 -0
- package/dist/deploy/react/DockerfileTab.js +131 -0
- package/dist/deploy/react/HistoryTab.d.ts +43 -0
- package/dist/deploy/react/HistoryTab.js +12 -0
- package/dist/deploy/react/OverviewTab.d.ts +60 -0
- package/dist/deploy/react/OverviewTab.js +75 -0
- package/dist/deploy/react/PublishRunResult.d.ts +5 -1
- package/dist/deploy/react/PublishRunResult.js +4 -4
- package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
- package/dist/deploy/react/SiteUpdateNotice.js +25 -0
- package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
- package/dist/deploy/react/StaticCredentialFields.js +63 -0
- package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
- package/dist/deploy/react/StaticCredentialSteps.js +152 -0
- package/dist/deploy/react/StaticExportCard.d.ts +11 -0
- package/dist/deploy/react/StaticExportCard.js +97 -0
- package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
- package/dist/deploy/react/StaticPublishCredentials.js +77 -0
- package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
- package/dist/deploy/react/StaticPublishForm.js +91 -0
- package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
- package/dist/deploy/react/StaticSiteTab.js +117 -0
- package/dist/deploy/react/deployment-visuals.d.ts +207 -0
- package/dist/deploy/react/deployment-visuals.js +101 -0
- package/dist/deploy/react/download-dockerfile.d.ts +14 -0
- package/dist/deploy/react/download-dockerfile.js +15 -0
- package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
- package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
- package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
- package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
- package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
- package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
- package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
- package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
- package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
- package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
- package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
- package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
- package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
- package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
- package/dist/deploy/react/index.d.ts +4 -0
- package/dist/deploy/react/index.js +2 -0
- package/dist/deploy/react/rules.d.ts +363 -0
- package/dist/deploy/react/rules.js +314 -0
- package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
- package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
- package/dist/deploy/site/agent-tools.d.ts +42 -0
- package/dist/deploy/site/agent-tools.js +119 -0
- package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
- package/dist/deploy/site/deploy-config-registry.js +124 -0
- package/dist/deploy/site/deploy-config.d.ts +97 -0
- package/dist/deploy/site/deploy-config.js +115 -0
- package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
- package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
- package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
- package/dist/deploy/site/deploy-ops/registry.js +106 -0
- package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
- package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
- package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
- package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
- package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
- package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
- package/dist/deploy/site/deploy-targets/registry.js +130 -0
- package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
- package/dist/deploy/site/deploy-targets/types.js +2 -0
- package/dist/deploy/site/dockerfile.d.ts +137 -0
- package/dist/deploy/site/dockerfile.js +101 -0
- package/dist/deploy/site/export-run.d.ts +137 -0
- package/dist/deploy/site/export-run.js +152 -0
- package/dist/deploy/site/ports.d.ts +115 -0
- package/dist/deploy/site/ports.js +2 -0
- package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
- package/dist/deploy/site/publish-agent-tools.js +120 -0
- package/dist/deploy/site/publish-candidate.d.ts +26 -0
- package/dist/deploy/site/publish-candidate.js +37 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
- package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
- package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
- package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
- package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
- package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
- package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
- package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
- package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
- package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
- package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
- package/dist/deploy/site/publish-credentials/store.d.ts +321 -0
- package/dist/deploy/site/publish-credentials/store.js +367 -0
- package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
- package/dist/deploy/site/publish-credentials/types.js +2 -0
- package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
- package/dist/deploy/site/publish-tool-capabilities.js +175 -0
- package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
- package/dist/deploy/site/publish-tool-credential.js +284 -0
- package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
- package/dist/deploy/site/publish-tool-deps.js +15 -0
- package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
- package/dist/deploy/site/publish-tool-execution.js +313 -0
- package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
- package/dist/deploy/site/publish-tool-schema.js +38 -0
- package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
- package/dist/deploy/site/static-publish/adapter-export.js +89 -0
- package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
- package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
- package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
- package/dist/deploy/site/static-publish/adapter.js +321 -0
- package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
- package/dist/deploy/site/static-publish/admin-publish-read.js +118 -0
- package/dist/deploy/site/static-publish/credentials.d.ts +114 -0
- package/dist/deploy/site/static-publish/credentials.js +298 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
- package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
- package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
- package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
- package/dist/deploy/site/static-publish/inspection.js +69 -0
- package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
- package/dist/deploy/site/static-publish/publish-history.js +153 -0
- package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
- package/dist/deploy/site/static-publish/publish-run.js +186 -0
- package/dist/deploy/site/static-publish/types.d.ts +168 -0
- package/dist/deploy/site/static-publish/types.js +2 -0
- package/dist/deploy/site/static-publish/verify.d.ts +237 -0
- package/dist/deploy/site/static-publish/verify.js +284 -0
- package/dist/deploy/site/tool-registrations.d.ts +97 -0
- package/dist/deploy/site/tool-registrations.js +130 -0
- package/dist/deploy/site/types.d.ts +51 -0
- package/dist/deploy/site/types.js +2 -0
- package/dist/deploy/site-update/check-for-update.d.ts +19 -0
- package/dist/deploy/site-update/check-for-update.js +19 -0
- package/dist/deploy/site-update/contracts.d.ts +161 -0
- package/dist/deploy/site-update/contracts.js +94 -0
- package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
- package/dist/deploy/site-update/desktop-site-update.js +43 -0
- package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
- package/dist/deploy/site-update/fake-site-update.js +52 -0
- package/dist/deploy/site-update/run-site-update.d.ts +121 -0
- package/dist/deploy/site-update/run-site-update.js +219 -0
- package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
- package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
- package/dist/deploy/target-contracts.d.ts +3 -0
- package/dist/deploy/tool.d.ts +5 -8
- package/dist/deploy/tool.js +6 -9
- package/dist/dns/binding-sweeper.d.ts +72 -0
- package/dist/dns/binding-sweeper.js +53 -0
- package/dist/dns/index.d.ts +1 -0
- package/dist/dns/index.js +1 -0
- package/dist/dns/site/binding.repo.d.ts +71 -0
- package/dist/dns/site/binding.repo.js +45 -0
- package/dist/dns/site/dns-changes.d.ts +90 -0
- package/dist/dns/site/dns-changes.js +271 -0
- package/dist/dns/site/dns-tools.d.ts +46 -0
- package/dist/dns/site/dns-tools.js +204 -0
- package/dist/dns/site/mail-dns-status.d.ts +111 -0
- package/dist/dns/site/mail-dns-status.js +190 -0
- package/dist/dns/site/mail-dns-tools.d.ts +33 -0
- package/dist/dns/site/mail-dns-tools.js +62 -0
- package/dist/dns/site/mail-requirements.d.ts +30 -0
- package/dist/dns/site/mail-requirements.js +78 -0
- package/dist/dns/site/tool-deps.d.ts +21 -0
- package/dist/dns/site/tool-deps.js +2 -0
- package/dist/dns/site/tools.d.ts +74 -0
- package/dist/dns/site/tools.js +124 -0
- package/dist/local-dev/bind-host.d.ts +80 -0
- package/dist/local-dev/bind-host.js +90 -0
- package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
- package/dist/local-dev/dev-proxy-upstream.js +63 -0
- package/dist/local-dev/index.d.ts +28 -0
- package/dist/local-dev/index.js +25 -0
- package/dist/packaging/electron/archive.d.ts +2 -9
- package/dist/packaging/electron/asar-adapter.d.ts +2 -1
- package/dist/packaging/electron/entry.d.ts +2 -0
- package/dist/packaging/electron/move-to-applications.d.ts +165 -0
- package/dist/packaging/electron/move-to-applications.js +162 -0
- package/dist/packaging/electron/policies.d.ts +33 -4
- package/dist/packaging/electron/policies.js +29 -10
- package/dist/packaging/electron/ports.d.ts +1 -6
- package/dist/packaging/electron/staging.d.ts +11 -2
- package/dist/packaging/electron/staging.js +15 -5
- package/dist/packaging/electron/update-manifest-merge.js +0 -2
- package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
- package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
- package/dist/react/site-share-expiry/index.d.ts +2 -0
- package/dist/react/site-share-expiry/index.js +2 -0
- package/dist/source-control/react/ProvidersTab.d.ts +98 -0
- package/dist/source-control/react/ProvidersTab.js +195 -0
- package/dist/source-control/react/SourceControl.d.ts +51 -0
- package/dist/source-control/react/SourceControl.js +61 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
- package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
- package/dist/source-control/react/rules.d.ts +167 -0
- package/dist/source-control/react/rules.js +125 -0
- package/dist/source-control/react/source-control-visuals.d.ts +75 -0
- package/dist/source-control/react/source-control-visuals.js +48 -0
- package/dist/source-control/site/agent-tools.d.ts +5 -0
- package/dist/source-control/site/agent-tools.js +30 -0
- package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
- package/dist/source-control/site/bundled-provider-registry.js +37 -0
- package/dist/source-control/site/commit-schema.d.ts +40 -0
- package/dist/source-control/site/commit-schema.js +29 -0
- package/dist/source-control/site/commit-target.d.ts +26 -0
- package/dist/source-control/site/commit-target.js +58 -0
- package/dist/source-control/site/credential-form.d.ts +36 -0
- package/dist/source-control/site/credential-form.js +102 -0
- package/dist/source-control/site/credential-setup.d.ts +107 -0
- package/dist/source-control/site/credential-setup.js +216 -0
- package/dist/source-control/site/provider-kit.d.ts +37 -0
- package/dist/source-control/site/provider-kit.js +35 -0
- package/dist/source-control/site/provider-module.d.ts +251 -0
- package/dist/source-control/site/provider-module.js +2 -0
- package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
- package/dist/source-control/site/saved-key-bindings.js +4 -0
- package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
- package/dist/source-control/site/static-site-packager-port.js +2 -0
- package/dist/source-control/site/store.d.ts +209 -0
- package/dist/source-control/site/store.js +374 -0
- package/dist/source-control/site/store.validation.d.ts +72 -0
- package/dist/source-control/site/store.validation.js +168 -0
- package/dist/source-control/site/tool-registrations.d.ts +190 -0
- package/dist/source-control/site/tool-registrations.js +379 -0
- package/dist/static-export/asset-crawl.d.ts +30 -0
- package/dist/static-export/asset-crawl.js +71 -0
- package/dist/static-export/dynamic-asset-locations.d.ts +23 -0
- package/dist/static-export/dynamic-asset-locations.js +34 -0
- package/dist/static-export/html-url-locations.d.ts +3 -1
- package/dist/static-export/html-url-locations.js +43 -9
- package/dist/static-export/runner.js +26 -27
- package/dist/static-export/site/export-preflight.d.ts +48 -0
- package/dist/static-export/site/export-preflight.js +82 -0
- package/dist/static-export/site/media-original-urls.d.ts +57 -0
- package/dist/static-export/site/media-original-urls.js +109 -0
- package/dist/static-export/site/ports.d.ts +82 -0
- package/dist/static-export/site/ports.js +29 -0
- package/dist/static-export/site/public-origin-policy.d.ts +32 -0
- package/dist/static-export/site/public-origin-policy.js +68 -0
- package/dist/static-export/site/route-manifest.d.ts +65 -0
- package/dist/static-export/site/route-manifest.js +139 -0
- package/dist/static-export/site/site-exporter.d.ts +158 -0
- package/dist/static-export/site/site-exporter.js +112 -0
- package/dist/static-export/site/static-security-headers.d.ts +39 -0
- package/dist/static-export/site/static-security-headers.js +43 -0
- package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
- package/dist/static-export/site/theme-preview-manifest.js +28 -0
- package/dist/static-export/transforms.d.ts +1 -1
- package/dist/static-export/transforms.js +3 -3
- package/package.json +911 -7
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { requireInputRecord, requireString, adaptLegacyAuthorize, requireToolPermission } from "@jini-ai/core";
|
|
2
|
+
import {} from "./sources.js";
|
|
3
|
+
import { PLAN_TOOL_ID, SITE_BACKUP_PUSH_TOOL_ID, PUSH_WAIT_MS, inspect } from "./backup-service.shared.js";
|
|
4
|
+
export { PLAN_TOOL_ID, SITE_BACKUP_PUSH_TOOL_ID, PUSH_WAIT_MS } from "./backup-service.shared.js";
|
|
5
|
+
import { backupTarget, resolveBackupCredential } from "./backup-service.credentials.js";
|
|
6
|
+
import { requireUnreservedFolder, parsePlanInput, planResult, savePlan, prepareContent } from "./backup-service.plan.js";
|
|
7
|
+
import { runObservedBackupPush, PLAN_TAKE_MESSAGES, inProgressResult, pushWaitBudget } from "./backup-service.push.js";
|
|
8
|
+
/**
|
|
9
|
+
* @file The site-backup service behind the agent tools `site_backup_plan` (read-only) and
|
|
10
|
+
* `site_backup_push` (authorized, immediate) AND the admin Git backup route
|
|
11
|
+
* (`admin-http/routes/system/site-backups.ts`): one code path, so the screen and the assistant run
|
|
12
|
+
* the same checks under the same permissions. Together they put the site's content — the database, media, themes, plugins
|
|
13
|
+
* and settings — into ONE folder of a private repository on a plugin-provided git host, in one commit, through a saved
|
|
14
|
+
* custom credential (the same credentials `custom_credential_write_files` uses).
|
|
15
|
+
*
|
|
16
|
+
* Why two calls: the plan does every check that can fail (credential, repository visibility and
|
|
17
|
+
* permissions, branch, folder, database snapshot, sizes) and returns what WOULD be written, so the
|
|
18
|
+
* model can report the planned backup. The push uploads exactly what was planned: the database snapshot is
|
|
19
|
+
* held in memory with the plan (`plan-content.ts`), and each disk file is re-read and refused if it
|
|
20
|
+
* changed since (`readPlannedFile`).
|
|
21
|
+
*
|
|
22
|
+
* A large backup outlasts one tool call: the push runs as a job (`push-jobs.ts`), the call waits for
|
|
23
|
+
* it up to {@link PUSH_WAIT_MS} and otherwise returns its progress; calling the push again with the
|
|
24
|
+
* same planId keeps waiting on the same job. The upload itself is Jini's `backup/site/push-content`.
|
|
25
|
+
*
|
|
26
|
+
* Safety rules, each re-checked at push time where the world can change in between:
|
|
27
|
+
* - The database is the share projection ({@link captureBackupDatabase}): content, themes and
|
|
28
|
+
* settings, never accounts, members, RBAC, sessions or secrets.
|
|
29
|
+
* - Private repositories only (public and "internal" both refused), because the database holds
|
|
30
|
+
* unpublished content. Re-checked before pushing.
|
|
31
|
+
* - Never a force push, and never a surprise overwrite: the push commits on the PLAN's tip, and a
|
|
32
|
+
* branch that moved since is refused (`DIVERGED_BRANCH`) before a single blob is uploaded, and
|
|
33
|
+
* again by the host itself on the non-force ref update.
|
|
34
|
+
* - The token never leaves the server: not in any result, dialog or log line.
|
|
35
|
+
*
|
|
36
|
+
* Credential errors are split so an operator can act on them: a label with no saved row is
|
|
37
|
+
* `CREDENTIAL_NOT_FOUND` (with the labels that do exist), and a saved row this server cannot decrypt
|
|
38
|
+
* is `CREDENTIAL_UNREADABLE`, whose message says WHICH problem it is from THIS SITE's own site key
|
|
39
|
+
* status (`inspectSiteKeyMaterial` run over `siteKeySourcesForSiteDir`'s site-aware source ordering —
|
|
40
|
+
* site-key plan §A3b, the same composed helper the admin site key route reuses, so an active
|
|
41
|
+
* per-site key file is never mistaken for "no site key" — see `unreadableCredentialMessage`) —
|
|
42
|
+
* never from the decrypt error's own text, which can quote plaintext. (The same "unreadable reads as
|
|
43
|
+
* missing" confusion `ADS-memory/.local-artifacts/reports/2026-09-21-byok-triage.md` traced for BYOK
|
|
44
|
+
* keys.)
|
|
45
|
+
*
|
|
46
|
+
* Out of scope: restoring from a backup, and scheduled backups.
|
|
47
|
+
*/
|
|
48
|
+
export const SITE_BACKUP_DOMAIN = "site-backup";
|
|
49
|
+
const DOMAIN = SITE_BACKUP_DOMAIN;
|
|
50
|
+
/** The one permission that names this feature. Not in any built-in role but the owner's `*`. */
|
|
51
|
+
export const PUSH_PERMISSION = "site-backup.push";
|
|
52
|
+
/** Also required: the push sends a saved credential's token to its provider, which is exactly what
|
|
53
|
+
* `custom_credential_write_files` gates on this permission. */
|
|
54
|
+
const CREDENTIAL_WRITE_PERMISSION = "custom-credentials.write";
|
|
55
|
+
async function requireBackupPermissions(deps, ctx) {
|
|
56
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.request.authorize }), workspaceId: deps.request.workspaceId, principalId: ctx.principal.id, permission: PUSH_PERMISSION }, { entityType: DOMAIN });
|
|
57
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: deps.request.authorize }), workspaceId: deps.request.workspaceId, principalId: ctx.principal.id, permission: CREDENTIAL_WRITE_PERMISSION }, { entityType: "custom-credentials" });
|
|
58
|
+
}
|
|
59
|
+
const UNAVAILABLE = { ok: false, code: "UNAVAILABLE", message: "site backup is not available in this runtime: it has no site folder on disk" };
|
|
60
|
+
/**
|
|
61
|
+
* The plan (`site_backup_plan` and `POST …/site-backups/plan`): every check that can fail, in the order that wastes the least — validate, permissions,
|
|
62
|
+
* credential, repository (so a public repository is refused before a snapshot is taken), database
|
|
63
|
+
* snapshot, disk files, limits — then the in-memory plan.
|
|
64
|
+
*
|
|
65
|
+
* @complexity O(site files) for the walk, O(database size) for the snapshot, four GETs.
|
|
66
|
+
*/
|
|
67
|
+
export async function planSiteBackup(required, _optional = {}) {
|
|
68
|
+
const { deps, call: ctx } = required;
|
|
69
|
+
const input = parsePlanInput({ deps: deps.deps, rawInput: ctx.input, SITE_BACKUP_SCOPES: deps.siteBackupScopes });
|
|
70
|
+
await requireBackupPermissions(deps, ctx);
|
|
71
|
+
const sources = deps.request.siteBackupSources;
|
|
72
|
+
if (!sources)
|
|
73
|
+
return { planned: false, code: UNAVAILABLE.code, message: UNAVAILABLE.message };
|
|
74
|
+
const credential = await resolveBackupCredential({ deps, requested: input.credential });
|
|
75
|
+
if (!credential.ok)
|
|
76
|
+
return { planned: false, code: credential.code, message: credential.message };
|
|
77
|
+
const folderName = deps.siteFolderName({ siteDir: sources.siteDir });
|
|
78
|
+
const folder = input.folder ?? deps.deps.normalizeWriteFilePath({ rawPath: folderName });
|
|
79
|
+
const { owner, repo: repoName } = deps.validateRepositoryTarget({ owner: input.owner, repo: input.repo }, { ...(credential.provider.validateTarget === undefined ? {} : { validateTarget: credential.provider.validateTarget }) });
|
|
80
|
+
requireUnreservedFolder({ deps: deps.deps, folder, provider: credential.provider });
|
|
81
|
+
const target = backupTarget({ deps: deps.deps, credential, owner, repo: repoName });
|
|
82
|
+
const repo = await inspect({ deps, provider: credential.provider, toolId: PLAN_TOOL_ID, input: { ...target, ...(input.branch !== undefined ? { branch: input.branch } : {}), folder } });
|
|
83
|
+
if (!repo.ok)
|
|
84
|
+
return { planned: false, code: repo.code, message: repo.message };
|
|
85
|
+
const prepared = await prepareContent({ deps, sources, include: input.include, host: credential.provider });
|
|
86
|
+
if (!prepared.ok)
|
|
87
|
+
return { planned: false, code: prepared.code, message: prepared.message };
|
|
88
|
+
return planResult(await savePlan({ deps, ctx, sources, input, folderName, content: { credentialLabel: credential.label, owner, repo: repoName, folder, repository: repo.state, ...prepared.content } }), deps);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The push (`site_backup_push` and `POST …/site-backups/push`): consume the principal-bound plan and start its job — or, for a planId whose job is
|
|
92
|
+
* still running, wait on that job — then report its outcome or its progress.
|
|
93
|
+
*
|
|
94
|
+
* @complexity O(1) plan and job lookup; then see {@link pushPlannedBackup}.
|
|
95
|
+
*/
|
|
96
|
+
export async function pushSiteBackup(required, optional = {}) {
|
|
97
|
+
const { deps, call: ctx } = required;
|
|
98
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
99
|
+
const planId = requireString({ input, key: "planId" });
|
|
100
|
+
const acknowledgeCredentialWarnings = input["acknowledgeCredentialWarnings"] === true;
|
|
101
|
+
await requireBackupPermissions(deps, ctx);
|
|
102
|
+
if (ctx.signal.aborted)
|
|
103
|
+
return { pushed: false, cancelled: false, reason: "abandoned" };
|
|
104
|
+
const jobs = deps.request.siteBackupPushJobs ?? deps.siteBackupPushJobs;
|
|
105
|
+
const key = { planId, principalId: ctx.principal.id, workspaceId: deps.request.workspaceId };
|
|
106
|
+
let job = jobs.find(key);
|
|
107
|
+
if (!job) {
|
|
108
|
+
const taken = (deps.request.siteBackupPlanStore ?? deps.siteBackupPlanStore).take(key);
|
|
109
|
+
if (!taken.ok)
|
|
110
|
+
return { pushed: false, cancelled: false, code: taken.code, message: PLAN_TAKE_MESSAGES[taken.code] };
|
|
111
|
+
job = jobs.start({ key, progress: deps.initialPushProgress({ plan: taken.plan }), run: ({ signal, progress }) => runObservedBackupPush({ deps, plan: taken.plan, acknowledgeCredentialWarnings, run: { signal, progress } }) });
|
|
112
|
+
}
|
|
113
|
+
const waited = await jobs.wait({ job, signal: ctx.signal, budgetMs: pushWaitBudget({ deps, waitMs: optional.waitMs }) });
|
|
114
|
+
if (waited.state === "done")
|
|
115
|
+
return waited.result;
|
|
116
|
+
if (waited.state === "abandoned")
|
|
117
|
+
return { pushed: false, cancelled: false, reason: "abandoned" };
|
|
118
|
+
return inProgressResult({ formatByteSize: deps.formatByteSize, planId, progress: waited.progress, elapsedMs: waited.elapsedMs });
|
|
119
|
+
}
|
|
120
|
+
export function createSiteBackupService(required, _optional = {}) {
|
|
121
|
+
const siteBackupPushJobs = required.createSiteBackupPushJobs();
|
|
122
|
+
return {
|
|
123
|
+
planSiteBackup: ({ deps, call }, options = {}) => planSiteBackup({ deps: { ...required, request: deps, siteBackupPushJobs }, call }, options),
|
|
124
|
+
pushSiteBackup: ({ deps, call }, options = {}) => pushSiteBackup({ deps: { ...required, request: deps, siteBackupPushJobs }, call }, options),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=backup-service.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SourceControlProvider } from "../../source-control/site/provider-module.js";
|
|
2
|
+
import type { SiteBackupScope, SiteBackupSources, SiteBackupHostLimit, SiteBackupInclude } from "./sources.js";
|
|
3
|
+
import type { SiteBackupCall, SiteBackupRequestDeps, SiteBackupRepositoryPlanContent, SiteBackupToolDeps, SiteBackupPlan, Refusal } from "./backup-service.js";
|
|
4
|
+
interface ParsedPlanInput {
|
|
5
|
+
readonly credential: string | undefined;
|
|
6
|
+
/** Checked against the host's rules once the credential names it ({@link validateRepositoryTarget}). */
|
|
7
|
+
readonly owner: unknown;
|
|
8
|
+
readonly repo: unknown;
|
|
9
|
+
readonly branch: string | undefined;
|
|
10
|
+
readonly folder: string | undefined;
|
|
11
|
+
readonly include: SiteBackupInclude;
|
|
12
|
+
readonly commitMessage: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Refuses a backup folder inside one the host reserves (`SourceControlHostFacts.reservedPaths`; the
|
|
16
|
+
* `github` plugin declares `.github`, where GitHub runs workflows from). Before any network call.
|
|
17
|
+
*
|
|
18
|
+
* @throws {CustomCredentialValidationError} naming the reserved folder.
|
|
19
|
+
* @complexity O(r) reserved paths.
|
|
20
|
+
*/
|
|
21
|
+
export declare function requireUnreservedFolder({ folder, provider, deps }: {
|
|
22
|
+
deps: SiteBackupToolDeps["deps"];
|
|
23
|
+
folder: string;
|
|
24
|
+
provider: SourceControlProvider;
|
|
25
|
+
}, _optional?: Record<string, never>): void;
|
|
26
|
+
/** @throws {CustomCredentialValidationError} Any malformed field — before any permission check,
|
|
27
|
+
* decrypt or network call. Owner and repo are the host's to judge, after the credential is resolved. */
|
|
28
|
+
export declare function parsePlanInput({ rawInput, SITE_BACKUP_SCOPES, deps }: {
|
|
29
|
+
deps: SiteBackupToolDeps["deps"];
|
|
30
|
+
rawInput: unknown;
|
|
31
|
+
SITE_BACKUP_SCOPES: readonly SiteBackupScope[];
|
|
32
|
+
}, _optional?: Record<string, never>): ParsedPlanInput;
|
|
33
|
+
/** What the plan tool returns on success: every fact the human should see before confirming. */
|
|
34
|
+
export declare function planResult<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>(plan: SiteBackupPlan, deps: SiteBackupToolDeps<TSource, TContent, TRequest>): Record<string, unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Stores the checked plan under the caller's principal: stamps its creation time, the site's name,
|
|
37
|
+
* schema and version, and the default commit message when none was given.
|
|
38
|
+
*/
|
|
39
|
+
export declare function savePlan<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>(required: {
|
|
40
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
41
|
+
ctx: SiteBackupCall;
|
|
42
|
+
sources: TSource;
|
|
43
|
+
input: ParsedPlanInput;
|
|
44
|
+
folderName: string;
|
|
45
|
+
content: Pick<SiteBackupPlan, "credentialLabel" | "owner" | "repo" | "folder" | "repository"> & PreparedContent;
|
|
46
|
+
}): Promise<SiteBackupPlan<TContent>>;
|
|
47
|
+
type PreparedContent = Pick<SiteBackupPlan, "database" | "files" | "skipped" | "scopeNotes" | "totalBytes" | "credentialWarnings">;
|
|
48
|
+
/**
|
|
49
|
+
* The bytes a plan holds: the sanitized database (when included), the disk files, and the limit
|
|
50
|
+
* check over both, so the limits measure the uploaded bytes.
|
|
51
|
+
*
|
|
52
|
+
* @complexity O(database size + site files).
|
|
53
|
+
*/
|
|
54
|
+
export declare function prepareContent<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>({ deps, sources, include, host }: {
|
|
55
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
56
|
+
sources: TSource;
|
|
57
|
+
include: SiteBackupInclude;
|
|
58
|
+
host: SiteBackupHostLimit;
|
|
59
|
+
}, _options?: {}): Promise<{
|
|
60
|
+
ok: true;
|
|
61
|
+
content: PreparedContent;
|
|
62
|
+
} | Refusal>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=backup-service.plan.d.ts.map
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { requireInputRecord } from "@jini-ai/core";
|
|
2
|
+
import { SiteShareRefusal } from "./share-refusal.js";
|
|
3
|
+
import { PLAN_TOOL_ID, logFailureDetail } from "./backup-service.shared.js";
|
|
4
|
+
/** The restore-point name the database snapshot is captured under, so an orphan is recognizable. */
|
|
5
|
+
const SNAPSHOT_SCOPE_ID = "site-backup";
|
|
6
|
+
function optionalString({ raw, field, deps }, _optional = {}) {
|
|
7
|
+
const value = raw[field];
|
|
8
|
+
if (value === undefined)
|
|
9
|
+
return undefined;
|
|
10
|
+
if (typeof value !== "string")
|
|
11
|
+
throw new deps.CustomCredentialValidationError(`'${field}' must be a string`);
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
/** Every switch defaults to true; anything but a boolean for a known scope is refused. */
|
|
15
|
+
function parseInclude({ value, SITE_BACKUP_SCOPES, deps }, _optional = {}) {
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
return { database: true, media: true, themes: true, plugins: true, settings: true };
|
|
18
|
+
const include = readIncludeSwitches({ deps, raw: requireIncludeRecord({ deps, value, SITE_BACKUP_SCOPES }), SITE_BACKUP_SCOPES });
|
|
19
|
+
if (!SITE_BACKUP_SCOPES.some((scope) => include[scope]))
|
|
20
|
+
throw new deps.CustomCredentialValidationError("'include' switches everything off; there would be nothing to back up");
|
|
21
|
+
return include;
|
|
22
|
+
}
|
|
23
|
+
/** The `include` object itself: a plain object whose keys are all known scopes. */
|
|
24
|
+
function requireIncludeRecord(required) {
|
|
25
|
+
const { deps, value, SITE_BACKUP_SCOPES } = required;
|
|
26
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
27
|
+
throw new deps.CustomCredentialValidationError("'include' must be an object of true/false switches");
|
|
28
|
+
const raw = value;
|
|
29
|
+
const unknownKeys = Object.keys(raw).filter((key) => !SITE_BACKUP_SCOPES.includes(key));
|
|
30
|
+
if (unknownKeys.length > 0)
|
|
31
|
+
throw new deps.CustomCredentialValidationError(`'include' has unknown switch(es): ${unknownKeys.join(", ")} (known: ${SITE_BACKUP_SCOPES.join(", ")})`);
|
|
32
|
+
return raw;
|
|
33
|
+
}
|
|
34
|
+
/** Each scope's switch, true when absent; a non-boolean is refused by name. */
|
|
35
|
+
function readIncludeSwitches(required) {
|
|
36
|
+
const { deps, SITE_BACKUP_SCOPES } = required;
|
|
37
|
+
const include = {};
|
|
38
|
+
for (const scope of SITE_BACKUP_SCOPES) {
|
|
39
|
+
const flag = required.raw[scope];
|
|
40
|
+
if (flag !== undefined && typeof flag !== "boolean")
|
|
41
|
+
throw new deps.CustomCredentialValidationError(`'include.${scope}' must be true or false`);
|
|
42
|
+
include[scope] = flag ?? true;
|
|
43
|
+
}
|
|
44
|
+
return include;
|
|
45
|
+
}
|
|
46
|
+
/** The backup folder: repository-relative, never `.git`. The host's own reserved folders
|
|
47
|
+
* ({@link requireUnreservedFolder}) are checked once the credential names the host. */
|
|
48
|
+
function parseFolder({ raw, deps }, _optional = {}) {
|
|
49
|
+
if (raw === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
return deps.normalizeWriteFilePath({ rawPath: raw });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Refuses a backup folder inside one the host reserves (`SourceControlHostFacts.reservedPaths`; the
|
|
55
|
+
* `github` plugin declares `.github`, where GitHub runs workflows from). Before any network call.
|
|
56
|
+
*
|
|
57
|
+
* @throws {CustomCredentialValidationError} naming the reserved folder.
|
|
58
|
+
* @complexity O(r) reserved paths.
|
|
59
|
+
*/
|
|
60
|
+
export function requireUnreservedFolder({ folder, provider, deps }, _optional = {}) {
|
|
61
|
+
const reserved = deps.findReservedPath({ folder }, provider.reservedPaths === undefined ? {} : { reservedPaths: provider.reservedPaths });
|
|
62
|
+
if (reserved !== undefined)
|
|
63
|
+
throw new deps.CustomCredentialValidationError(`the backup folder must not be inside '${reserved}': '${folder}'`);
|
|
64
|
+
}
|
|
65
|
+
/** @throws {CustomCredentialValidationError} Any malformed field — before any permission check,
|
|
66
|
+
* decrypt or network call. Owner and repo are the host's to judge, after the credential is resolved. */
|
|
67
|
+
export function parsePlanInput({ rawInput, SITE_BACKUP_SCOPES, deps }, _optional = {}) {
|
|
68
|
+
const raw = requireInputRecord({ input: rawInput });
|
|
69
|
+
const branch = optionalString({ deps, raw, field: "branch" });
|
|
70
|
+
const commitMessage = optionalString({ deps, raw, field: "commitMessage" });
|
|
71
|
+
return {
|
|
72
|
+
credential: optionalString({ deps, raw, field: "credential" }),
|
|
73
|
+
owner: raw.owner,
|
|
74
|
+
repo: raw.repo,
|
|
75
|
+
branch: branch === undefined ? undefined : deps.validateBranch({ value: branch }),
|
|
76
|
+
folder: parseFolder({ deps, raw: optionalString({ deps, raw, field: "folder" }) }),
|
|
77
|
+
include: parseInclude({ deps, value: raw.include, SITE_BACKUP_SCOPES }),
|
|
78
|
+
commitMessage: commitMessage === undefined ? undefined : deps.validateCommitMessage({ value: commitMessage }),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** The site's display name from its `config.json`, falling back to the folder name. */
|
|
82
|
+
async function readSiteName({ siteDir, deps }, _optional = {}) {
|
|
83
|
+
try {
|
|
84
|
+
const config = JSON.parse(await deps.readConfigText({ siteDir }));
|
|
85
|
+
if (typeof config.name === "string" && config.name.trim() !== "")
|
|
86
|
+
return config.name;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// A missing or unreadable config.json only costs the nicer name.
|
|
90
|
+
}
|
|
91
|
+
return deps.siteFolderName({ siteDir });
|
|
92
|
+
}
|
|
93
|
+
/** What the plan tool returns on success: every fact the human should see before confirming. */
|
|
94
|
+
export function planResult(plan, deps) {
|
|
95
|
+
const files = [...(plan.database ? [{ path: deps.siteBackupDatabasePath, bytes: plan.database.bytes.length }] : []), ...plan.files.map((file) => ({ path: file.path, bytes: file.bytes }))];
|
|
96
|
+
return {
|
|
97
|
+
planned: true,
|
|
98
|
+
planId: plan.planId,
|
|
99
|
+
expiresAt: new Date(plan.expiresAtMs).toISOString(),
|
|
100
|
+
credential: plan.credentialLabel,
|
|
101
|
+
repository: `${plan.owner}/${plan.repo}`,
|
|
102
|
+
visibility: "private",
|
|
103
|
+
branch: plan.repository.branch,
|
|
104
|
+
folder: plan.folder,
|
|
105
|
+
folderExists: plan.repository.folderExists,
|
|
106
|
+
include: plan.include,
|
|
107
|
+
fileCount: files.length,
|
|
108
|
+
totalBytes: plan.totalBytes,
|
|
109
|
+
totalSize: deps.formatByteSize({ bytes: plan.totalBytes }),
|
|
110
|
+
files,
|
|
111
|
+
skipped: plan.skipped,
|
|
112
|
+
credentialWarnings: plan.credentialWarnings ?? [],
|
|
113
|
+
notes: deps.siteBackupScopes.flatMap((scope) => (plan.scopeNotes[scope] ? [plan.scopeNotes[scope]] : [])),
|
|
114
|
+
nextStep: `Show the human this plan: ${plan.owner}/${plan.repo}, branch '${plan.repository.branch}', folder '${plan.folder}' ` +
|
|
115
|
+
`(${plan.repository.folderExists ? "its current contents will be replaced" : "new"}), ${files.length} files (${deps.formatByteSize({ bytes: plan.totalBytes })}), plus anything skipped. ` +
|
|
116
|
+
`Then call site_backup_push with this planId within 10 minutes; it pushes the planned backup immediately (a large one may return inProgress: call it again with the same planId). A ${deps.manifestName} manifest is added at push time.`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Stores the checked plan under the caller's principal: stamps its creation time, the site's name,
|
|
121
|
+
* schema and version, and the default commit message when none was given.
|
|
122
|
+
*/
|
|
123
|
+
export async function savePlan(required) {
|
|
124
|
+
const { deps, input, content } = required;
|
|
125
|
+
const createdAt = (deps.request.siteBackupNow ?? deps.siteBackupNow)().toISOString();
|
|
126
|
+
const siteName = await readSiteName({ siteDir: required.sources.siteDir, deps });
|
|
127
|
+
return (deps.request.siteBackupPlanStore ?? deps.siteBackupPlanStore).save({
|
|
128
|
+
principalId: required.ctx.principal.id,
|
|
129
|
+
workspaceId: deps.request.workspaceId,
|
|
130
|
+
content: deps.completePlanContent({ content: {
|
|
131
|
+
target: { kind: "repository" },
|
|
132
|
+
credentialLabel: content.credentialLabel,
|
|
133
|
+
owner: content.owner,
|
|
134
|
+
repo: content.repo,
|
|
135
|
+
folder: content.folder,
|
|
136
|
+
commitMessage: input.commitMessage ?? deps.defaultCommitMessage({ siteName, createdAt }),
|
|
137
|
+
repository: content.repository,
|
|
138
|
+
include: input.include,
|
|
139
|
+
database: content.database,
|
|
140
|
+
files: content.files,
|
|
141
|
+
credentialWarnings: content.credentialWarnings ?? [],
|
|
142
|
+
skipped: content.skipped,
|
|
143
|
+
scopeNotes: content.scopeNotes,
|
|
144
|
+
totalBytes: content.totalBytes,
|
|
145
|
+
site: { name: siteName, folderName: required.folderName },
|
|
146
|
+
schema: deps.runtimeSchemaVersion(),
|
|
147
|
+
createdAt,
|
|
148
|
+
}, sources: required.sources }, {}),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The database a backup uploads: the snapshot rebuilt through the share projection.
|
|
153
|
+
* Why: the raw snapshot holds password hashes, sessions, magic-link tokens and sealed vault rows
|
|
154
|
+
* (security review SEC-1). Deleting rows would leave them in free pages, so the backup is a NEW
|
|
155
|
+
* database built by the same policy as share/export (owner decision 2026-10-26: one policy, never
|
|
156
|
+
* a second backup-only scrub). A share refusal (unknown populated table) is
|
|
157
|
+
* the plan's refusal.
|
|
158
|
+
*
|
|
159
|
+
* @complexity O(database size).
|
|
160
|
+
*/
|
|
161
|
+
async function captureBackupDatabase(required) {
|
|
162
|
+
const { deps } = required;
|
|
163
|
+
const snapshot = await deps.captureDatabaseSnapshot({ dbOps: deps.request.dbOps, scopeId: SNAPSHOT_SCOPE_ID });
|
|
164
|
+
if (!snapshot.ok) {
|
|
165
|
+
logFailureDetail({ deps, toolId: PLAN_TOOL_ID, failure: { code: "database-snapshot", ...(snapshot.logDetail !== undefined ? { logDetail: snapshot.logDetail } : {}) } });
|
|
166
|
+
return { ok: false, code: "DATABASE_SNAPSHOT_FAILED", message: snapshot.message };
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const projected = await (deps.request.siteBackupSanitize ?? deps.siteBackupSanitize)({ snapshot: snapshot.bytes });
|
|
170
|
+
return { ok: true, database: { bytes: projected.bytes, watermarkAtCapture: snapshot.watermarkAtCapture }, credentialWarnings: projected.credentialWarnings ?? [] };
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
if (err instanceof SiteShareRefusal)
|
|
174
|
+
return { ok: false, code: err.code, message: err.message };
|
|
175
|
+
throw err;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The bytes a plan holds: the sanitized database (when included), the disk files, and the limit
|
|
180
|
+
* check over both, so the limits measure the uploaded bytes.
|
|
181
|
+
*
|
|
182
|
+
* @complexity O(database size + site files).
|
|
183
|
+
*/
|
|
184
|
+
export async function prepareContent({ deps, sources, include, host }, _options = {}) {
|
|
185
|
+
let database = null;
|
|
186
|
+
const credentialWarnings = [];
|
|
187
|
+
if (include.database) {
|
|
188
|
+
const captured = await captureBackupDatabase({ deps });
|
|
189
|
+
if (!captured.ok)
|
|
190
|
+
return captured;
|
|
191
|
+
database = captured.database;
|
|
192
|
+
credentialWarnings.push(...captured.credentialWarnings);
|
|
193
|
+
}
|
|
194
|
+
const collected = await deps.collectSiteBackupFiles({ sources, include });
|
|
195
|
+
const fitting = deps.skipOversizedFiles({ files: collected.files, host });
|
|
196
|
+
const limits = deps.checkSiteBackupLimits({ files: [...(database ? [{ path: deps.siteBackupDatabasePath, bytes: database.bytes.length }] : []), ...fitting.files], host });
|
|
197
|
+
if (!limits.ok)
|
|
198
|
+
return { ok: false, code: "LIMIT_EXCEEDED", message: limits.message };
|
|
199
|
+
for (const file of fitting.files) {
|
|
200
|
+
const loaded = await deps.readPlannedFile(file);
|
|
201
|
+
if (!loaded.ok)
|
|
202
|
+
return { ok: false, code: "PLAN_STALE", message: loaded.message };
|
|
203
|
+
deps.requireShareSecretFree({ path: file.path, bytes: loaded.bytes }, { credentialWarnings });
|
|
204
|
+
}
|
|
205
|
+
return { ok: true, content: { database, credentialWarnings, files: fitting.files, skipped: [...collected.skipped, ...fitting.skipped], scopeNotes: collected.scopeNotes, totalBytes: limits.totalBytes } };
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=backup-service.plan.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SiteBackupSources } from "./sources.js";
|
|
2
|
+
import type { SiteBackupPushProgress } from "../push-jobs.js";
|
|
3
|
+
import type { SiteBackupRequestDeps, SiteBackupRepositoryPlanContent, SiteBackupToolDeps, SiteBackupPlan, SiteBackupPushInput, PushResult } from "./backup-service.js";
|
|
4
|
+
export declare function runObservedBackupPush<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>(required: {
|
|
5
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
6
|
+
plan: SiteBackupPlan<TContent>;
|
|
7
|
+
run: {
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
progress: SiteBackupPushProgress;
|
|
10
|
+
};
|
|
11
|
+
} & Pick<SiteBackupPushInput, "acknowledgeCredentialWarnings">): Promise<PushResult>;
|
|
12
|
+
export declare const PLAN_TAKE_MESSAGES: {
|
|
13
|
+
readonly PLAN_NOT_FOUND: "no backup plan with that planId is waiting (a planId works once, for this principal, and a server restart drops plans). Call site_backup_plan again.";
|
|
14
|
+
readonly PLAN_EXPIRED: "that backup plan expired (plans last 10 minutes). Call site_backup_plan again.";
|
|
15
|
+
};
|
|
16
|
+
/** What a call returns while its job is still uploading. */
|
|
17
|
+
export declare function inProgressResult({ formatByteSize, planId, progress, elapsedMs }: {
|
|
18
|
+
formatByteSize: SiteBackupToolDeps["formatByteSize"];
|
|
19
|
+
planId: string;
|
|
20
|
+
progress: SiteBackupPushProgress;
|
|
21
|
+
elapsedMs: number;
|
|
22
|
+
}, _optional?: Record<string, never>): PushResult;
|
|
23
|
+
export declare function pushWaitBudget({ deps, waitMs }: {
|
|
24
|
+
deps: {
|
|
25
|
+
request: Pick<SiteBackupRequestDeps, "siteBackupPushWaitMs">;
|
|
26
|
+
};
|
|
27
|
+
waitMs: number | undefined;
|
|
28
|
+
}, _options?: {}): number;
|
|
29
|
+
//# sourceMappingURL=backup-service.push.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PUSH_WAIT_MS, SITE_BACKUP_PUSH_TOOL_ID, providerRefusal, inspect } from "./backup-service.shared.js";
|
|
2
|
+
import { backupTarget, resolveBackupCredential } from "./backup-service.credentials.js";
|
|
3
|
+
function pushRefusal(refusal, cancelledCode) {
|
|
4
|
+
return refusal.code === cancelledCode ? { pushed: false, cancelled: false, reason: "abandoned" } : { pushed: false, cancelled: false, code: refusal.code, message: refusal.message };
|
|
5
|
+
}
|
|
6
|
+
function backupBlobUploadOptions(provider) {
|
|
7
|
+
return provider.backupInlineTextMaxBytes === undefined ? {} : { inlineTextMaxBytes: provider.backupInlineTextMaxBytes };
|
|
8
|
+
}
|
|
9
|
+
function unacknowledgedCredentialWarnings({ plan, acknowledgeCredentialWarnings }) {
|
|
10
|
+
if (!plan.credentialWarnings?.length || acknowledgeCredentialWarnings === true)
|
|
11
|
+
return undefined;
|
|
12
|
+
// The scanner stores redacted locations and fixed kind labels, never matched secret values.
|
|
13
|
+
const files = plan.credentialWarnings.map(({ path, kind }) => `${path} (${kind})`).join("; ");
|
|
14
|
+
return {
|
|
15
|
+
ok: false, code: "UNSAFE_FILE",
|
|
16
|
+
message: `The backup contains files with possible credentials: ${files}. Nothing was written. ` +
|
|
17
|
+
"Call site_backup_plan again, review every warning, then call site_backup_push with the new planId and acknowledgeCredentialWarnings: true to back up the original bytes to this private repository.",
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The authorized push: re-resolve the credential, re-check the repository (still
|
|
22
|
+
* private, branch not moved), upload, commit on the PLAN's parent. Stopping (`signal`) takes effect
|
|
23
|
+
* between files and before the commit, never half-way through one.
|
|
24
|
+
*
|
|
25
|
+
* @complexity O(total bytes); see Jini's `backup/site/push-content` for the uploads, plus a few fixed tree writes,
|
|
26
|
+
* one commit and one ref update.
|
|
27
|
+
*/
|
|
28
|
+
async function pushPlannedBackup({ deps, plan, run, acknowledgeCredentialWarnings = false }, _optional = {}) {
|
|
29
|
+
const credential = await resolveBackupCredential({ deps, requested: plan.credentialLabel });
|
|
30
|
+
if (!credential.ok)
|
|
31
|
+
return pushRefusal(credential, deps.cancelled.code);
|
|
32
|
+
const target = backupTarget({ deps: deps.deps, credential, owner: plan.owner, repo: plan.repo });
|
|
33
|
+
const repo = await inspect({ deps, provider: credential.provider, toolId: SITE_BACKUP_PUSH_TOOL_ID, input: { ...target, branch: plan.repository.branch, folder: plan.folder } });
|
|
34
|
+
if (!repo.ok)
|
|
35
|
+
return pushRefusal(repo, deps.cancelled.code);
|
|
36
|
+
if (repo.state.parentCommitSha !== plan.repository.parentCommitSha) {
|
|
37
|
+
return pushRefusal({
|
|
38
|
+
ok: false,
|
|
39
|
+
code: "DIVERGED_BRANCH",
|
|
40
|
+
message: `branch '${plan.repository.branch}' moved since the backup was planned (someone pushed to it). Nothing was written. Call site_backup_plan again.`,
|
|
41
|
+
}, deps.cancelled.code);
|
|
42
|
+
}
|
|
43
|
+
const warningRefusal = unacknowledgedCredentialWarnings({ plan, acknowledgeCredentialWarnings });
|
|
44
|
+
if (warningRefusal)
|
|
45
|
+
return pushRefusal(warningRefusal, deps.cancelled.code);
|
|
46
|
+
const uploaded = await deps.uploadBackupPlan({
|
|
47
|
+
plan, signal: run.signal, progress: run.progress, ...deps.backupPushUploadPolicy({ plan }),
|
|
48
|
+
uploadBlob: async (file, _optional = {}) => {
|
|
49
|
+
const uploaded = await credential.provider.uploadBackupBlob(target, file);
|
|
50
|
+
return uploaded.ok ? { ok: true, blobSha: uploaded.blob.blobSha } : providerRefusal({ deps, toolId: SITE_BACKUP_PUSH_TOOL_ID, failure: uploaded });
|
|
51
|
+
},
|
|
52
|
+
}, backupBlobUploadOptions(credential.provider));
|
|
53
|
+
if (!uploaded.ok)
|
|
54
|
+
return pushRefusal(uploaded, deps.cancelled.code);
|
|
55
|
+
if (run.signal.aborted)
|
|
56
|
+
return pushRefusal(deps.cancelled, deps.cancelled.code);
|
|
57
|
+
const committed = await deps.commitBackupPlan({ provider: credential.provider, target, plan, entries: uploaded.entries });
|
|
58
|
+
if (!committed.ok)
|
|
59
|
+
return pushRefusal(providerRefusal({ deps, toolId: SITE_BACKUP_PUSH_TOOL_ID, failure: committed }), deps.cancelled.code);
|
|
60
|
+
return committed.result;
|
|
61
|
+
}
|
|
62
|
+
export async function runObservedBackupPush(required) {
|
|
63
|
+
if (!required.deps.request.observability)
|
|
64
|
+
return pushPlannedBackup(required);
|
|
65
|
+
const operation = required.deps.request.observability.trackOperation({ name: "site.backup" });
|
|
66
|
+
return operation.run(() => pushPlannedBackup(required)).then(result => {
|
|
67
|
+
const cancelled = !result.pushed && (result.cancelled || ("reason" in result && result.reason === "abandoned"));
|
|
68
|
+
operation.end({ outcome: result.pushed ? "completed" : cancelled ? "cancelled" : "not_pushed", failed: !result.pushed && !cancelled });
|
|
69
|
+
return result;
|
|
70
|
+
}, error => {
|
|
71
|
+
operation.end({ outcome: "failed", failed: true });
|
|
72
|
+
throw error;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export const PLAN_TAKE_MESSAGES = {
|
|
76
|
+
PLAN_NOT_FOUND: "no backup plan with that planId is waiting (a planId works once, for this principal, and a server restart drops plans). Call site_backup_plan again.",
|
|
77
|
+
PLAN_EXPIRED: "that backup plan expired (plans last 10 minutes). Call site_backup_plan again.",
|
|
78
|
+
};
|
|
79
|
+
/** What a call returns while its job is still uploading. */
|
|
80
|
+
export function inProgressResult({ formatByteSize, planId, progress, elapsedMs }, _optional = {}) {
|
|
81
|
+
return {
|
|
82
|
+
pushed: false,
|
|
83
|
+
cancelled: false,
|
|
84
|
+
inProgress: true,
|
|
85
|
+
planId,
|
|
86
|
+
progress,
|
|
87
|
+
message: `Still uploading after ${Math.round(elapsedMs / 1000)} s: ${progress.filesDone} of ${progress.filesTotal} files (${formatByteSize({ bytes: progress.bytesDone })} of ${formatByteSize({ bytes: progress.bytesTotal })}). ` +
|
|
88
|
+
"Nothing is committed until every file is up. Call site_backup_push again with the same planId to keep waiting; it does not start a second upload.",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function pushWaitBudget({ deps, waitMs }, _options = {}) {
|
|
92
|
+
return waitMs ?? deps.request.siteBackupPushWaitMs ?? PUSH_WAIT_MS;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=backup-service.push.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SiteBackupSources } from "./sources.js";
|
|
2
|
+
import type { CredentialedRepositoryTarget, InspectBackupRepositoryResult, SourceControlProvider } from "../../source-control/site/provider-module.js";
|
|
3
|
+
import type { SiteBackupRequestDeps, SiteBackupRepositoryPlanContent, SiteBackupToolDeps, Refusal } from "./backup-service.js";
|
|
4
|
+
export declare const PLAN_TOOL_ID = "site_backup_plan";
|
|
5
|
+
export declare const SITE_BACKUP_PUSH_TOOL_ID = "site_backup_push";
|
|
6
|
+
/** How long one push call waits for its job before reporting progress: under the 6-minute cut-off
|
|
7
|
+
* of a delegated tool call (`push-jobs.ts`), with room for the checks before the upload. */
|
|
8
|
+
export declare const PUSH_WAIT_MS: number;
|
|
9
|
+
export declare function failureLog<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>(deps: SiteBackupToolDeps<TSource, TContent, TRequest>): (line: string) => void;
|
|
10
|
+
/** Logs a failure's server-only detail (a network failure's class and code). Never the token. */
|
|
11
|
+
export declare function logFailureDetail<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>({ deps, toolId, failure }: {
|
|
12
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
13
|
+
toolId: string;
|
|
14
|
+
failure: {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly logDetail?: string;
|
|
17
|
+
};
|
|
18
|
+
}, _optional?: Record<string, never>): void;
|
|
19
|
+
/** A provider failure as this tool's `{code, message}`, logging any server-only detail. */
|
|
20
|
+
export declare function providerRefusal<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>({ deps, toolId, failure }: {
|
|
21
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
22
|
+
toolId: string;
|
|
23
|
+
failure: {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly logDetail?: string;
|
|
27
|
+
};
|
|
28
|
+
}, _optional?: Record<string, never>): Refusal;
|
|
29
|
+
export declare function inspect<TSource extends SiteBackupSources, TContent extends SiteBackupRepositoryPlanContent, TRequest extends SiteBackupRequestDeps<TSource, TContent>>({ deps, provider, toolId, input }: {
|
|
30
|
+
deps: SiteBackupToolDeps<TSource, TContent, TRequest>;
|
|
31
|
+
provider: SourceControlProvider;
|
|
32
|
+
toolId: string;
|
|
33
|
+
input: CredentialedRepositoryTarget & {
|
|
34
|
+
branch?: string;
|
|
35
|
+
folder: string;
|
|
36
|
+
};
|
|
37
|
+
}, _optional?: Record<string, never>): Promise<Extract<InspectBackupRepositoryResult, {
|
|
38
|
+
ok: true;
|
|
39
|
+
}> | Refusal>;
|
|
40
|
+
//# sourceMappingURL=backup-service.shared.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const PLAN_TOOL_ID = "site_backup_plan";
|
|
2
|
+
export const SITE_BACKUP_PUSH_TOOL_ID = "site_backup_push";
|
|
3
|
+
/** How long one push call waits for its job before reporting progress: under the 6-minute cut-off
|
|
4
|
+
* of a delegated tool call (`push-jobs.ts`), with room for the checks before the upload. */
|
|
5
|
+
export const PUSH_WAIT_MS = 4 * 60 * 1000;
|
|
6
|
+
export function failureLog(deps) {
|
|
7
|
+
return deps.request.siteBackupFailureLog ?? deps.siteBackupFailureLog;
|
|
8
|
+
}
|
|
9
|
+
/** Logs a failure's server-only detail (a network failure's class and code). Never the token. */
|
|
10
|
+
export function logFailureDetail({ deps, toolId, failure }, _optional = {}) {
|
|
11
|
+
if (failure.logDetail !== undefined)
|
|
12
|
+
failureLog(deps)(`[site-backup] ${toolId}: failed code=${failure.code} detail=${failure.logDetail}`);
|
|
13
|
+
}
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Repository
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
const INSPECT_CODES = {
|
|
18
|
+
"repo-not-found": "REPOSITORY_NOT_FOUND",
|
|
19
|
+
"repo-not-private": "REPOSITORY_NOT_PRIVATE",
|
|
20
|
+
"no-push-permission": "NO_PUSH_PERMISSION",
|
|
21
|
+
"repo-empty": "REPOSITORY_EMPTY",
|
|
22
|
+
"branch-not-found": "BRANCH_NOT_FOUND",
|
|
23
|
+
"folder-is-file": "FOLDER_IS_FILE",
|
|
24
|
+
"provider-error": "PROVIDER_ERROR",
|
|
25
|
+
"network-unreachable": "NETWORK_UNREACHABLE",
|
|
26
|
+
diverged: "DIVERGED_BRANCH",
|
|
27
|
+
};
|
|
28
|
+
/** A provider failure as this tool's `{code, message}`, logging any server-only detail. */
|
|
29
|
+
export function providerRefusal({ deps, toolId, failure }, _optional = {}) {
|
|
30
|
+
logFailureDetail({ deps, toolId, failure });
|
|
31
|
+
return { ok: false, code: INSPECT_CODES[failure.code] ?? "PROVIDER_ERROR", message: failure.message };
|
|
32
|
+
}
|
|
33
|
+
export async function inspect({ deps, provider, toolId, input }, _optional = {}) {
|
|
34
|
+
const result = await provider.inspectBackupRepository(input);
|
|
35
|
+
return result.ok ? result : providerRefusal({ deps, toolId, failure: result });
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=backup-service.shared.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Per-entry export decision, independent of archive claims and execution trust. */
|
|
2
|
+
export type BundledExportFileDisposition = 'scan' | 'skip';
|
|
3
|
+
/** Reads the installed copy of one bundled plugin file; `null` when this build has no such copy. */
|
|
4
|
+
export type ReadBundledExportFile = (required: {
|
|
5
|
+
pluginId: string;
|
|
6
|
+
relativePath: string;
|
|
7
|
+
}) => Promise<Uint8Array | null>;
|
|
8
|
+
/** Per-entry export decision, independent of archive claims and execution trust. */
|
|
9
|
+
export type BundledExportFilePolicy = (required: {
|
|
10
|
+
path: string;
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
}) => Promise<BundledExportFileDisposition>;
|
|
13
|
+
/** The host's byte-comparison rule: whether an archive entry equals the installed bundled copy. */
|
|
14
|
+
export type ClassifyBundledExportFile = (required: {
|
|
15
|
+
pluginId: string;
|
|
16
|
+
relativePath: string;
|
|
17
|
+
bytes: Uint8Array;
|
|
18
|
+
readFile: ReadBundledExportFile;
|
|
19
|
+
}) => Promise<BundledExportFileDisposition>;
|
|
20
|
+
/** Host values the policy cannot know: which packages ship, how to find them, and how to compare. */
|
|
21
|
+
export interface BundledExportFilePolicyDeps {
|
|
22
|
+
/** Selected plugin id -> installed package specifier. */
|
|
23
|
+
selection: ReadonlyMap<string, string>;
|
|
24
|
+
/** Module resolution of the host's installed packages (`require.resolve` shape). */
|
|
25
|
+
resolve: (specifier: string) => string;
|
|
26
|
+
classifyBundledPluginFile: ClassifyBundledExportFile;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Wire a host byte comparison to the host's selected npm subpaths. Resolve each selected root once per
|
|
30
|
+
* export; read only the corresponding installed file. Custom paths and unavailable copies scan.
|
|
31
|
+
* @returns An export-local policy; no inventory, persistent cache, network or content mutation.
|
|
32
|
+
* @complexity One resolution per encountered plugin, one file read per selected package entry.
|
|
33
|
+
* @example const policy = createBundledExportFilePolicy({ selection, resolve, classifyBundledPluginFile }); await policy({ path, bytes });
|
|
34
|
+
*/
|
|
35
|
+
export declare function createBundledExportFilePolicy(required: BundledExportFilePolicyDeps, optional?: {
|
|
36
|
+
readFile?: (filename: string) => Promise<Uint8Array>;
|
|
37
|
+
}): BundledExportFilePolicy;
|
|
38
|
+
//# sourceMappingURL=bundled-export-file-policy.d.ts.map
|