@jini-ai/devops 0.7.3-next.1 → 0.7.3-next.3
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 +6 -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 +161 -0
- package/dist/backup/site/backup-service.d.ts +331 -0
- package/dist/backup/site/backup-service.js +125 -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 +82 -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 +40 -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 +195 -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 +193 -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 +109 -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 +76 -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 +201 -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/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 +155 -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 +132 -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 +322 -0
- package/dist/deploy/site/publish-credentials/store.js +372 -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 +116 -0
- package/dist/deploy/site/static-publish/credentials.d.ts +110 -0
- package/dist/deploy/site/static-publish/credentials.js +290 -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 +165 -0
- package/dist/deploy/site/static-publish/types.js +2 -0
- package/dist/deploy/site/static-publish/verify.d.ts +217 -0
- package/dist/deploy/site/static-publish/verify.js +248 -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/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/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/package.json +912 -8
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { UserFacingError } from "@jini-ai/core";
|
|
2
|
+
import type { useStaticPublish } from "./use-static-publish.hooks.js";
|
|
3
|
+
export declare function useStaticPublishRun({ port, locale, hooks, deps }: Parameters<typeof useStaticPublish>[0], _optional?: {}): {
|
|
4
|
+
run: import("./use-static-publish.hooks.js").AdminPublishRunSnapshot | undefined;
|
|
5
|
+
setRun: import("react").Dispatch<import("react").SetStateAction<import("./use-static-publish.hooks.js").AdminPublishRunSnapshot | undefined>>;
|
|
6
|
+
publishing: boolean;
|
|
7
|
+
setPublishing: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
publishError: string | null;
|
|
9
|
+
setPublishError: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
10
|
+
publishFailure: UserFacingError | null;
|
|
11
|
+
setPublishFailure: import("react").Dispatch<import("react").SetStateAction<UserFacingError | null>>;
|
|
12
|
+
pollError: string | null;
|
|
13
|
+
setPollError: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
14
|
+
seededRef: import("react").RefObject<boolean>;
|
|
15
|
+
loadError: string | null;
|
|
16
|
+
pollFailuresRef: import("react").RefObject<number>;
|
|
17
|
+
publishingRef: import("react").RefObject<boolean>;
|
|
18
|
+
isPublishing: boolean;
|
|
19
|
+
pollInputs: import("react").RefObject<{
|
|
20
|
+
port: import("@jini-ai/core/contracts/site/deployment-admin").StaticPublishPort<import("../rules.js").AdminPublishTargetDescriptor, import("./use-static-publish.hooks.js").AdminStaticPublishConfig, import("./use-static-publish.hooks.js").AdminStaticPublishPreview, import("./use-static-publish.hooks.js").AdminPublishRunSnapshot>;
|
|
21
|
+
locale: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export declare function useStaticPublishPolling({ state, deps }: {
|
|
25
|
+
state: ReturnType<typeof useStaticPublishRun>;
|
|
26
|
+
deps: Parameters<typeof useStaticPublish>[0]["deps"];
|
|
27
|
+
}, _optional?: {}): void;
|
|
28
|
+
//# sourceMappingURL=static-publish-run.hooks.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { UNKNOWN_ERROR } from "./static-publish-actions.js";
|
|
3
|
+
/** Same interval `use-static-export.hooks.ts` polls its own run at — see that constant's doc for
|
|
4
|
+
* why this width. Publishing additionally blocks on an external provider's own build (up to
|
|
5
|
+
* roughly a minute per `publish-site.ts`'s header), so this loop simply runs for longer, not
|
|
6
|
+
* faster or slower. */
|
|
7
|
+
const PUBLISH_POLL_INTERVAL_MS = 1500;
|
|
8
|
+
/** Same bound and same rationale as `use-static-export.hooks.ts`'s own `POLL_FAILURE_LIMIT` — how
|
|
9
|
+
* many CONSECUTIVE poll failures the loop below tolerates before giving up and surfacing
|
|
10
|
+
* {@link StaticPublishController.pollError} instead of retrying forever. */
|
|
11
|
+
const PUBLISH_POLL_FAILURE_LIMIT = 3;
|
|
12
|
+
export function useStaticPublishRun({ port, locale, hooks, deps }, _optional = {}) {
|
|
13
|
+
const { useFetchQuery } = hooks;
|
|
14
|
+
const { publishLoadErrorMessage, describeApiError } = deps;
|
|
15
|
+
const query = useFetchQuery({ key: ["deployment", "publish"], fetch: () => port.getPublishStatus() });
|
|
16
|
+
const [run, setRun] = useState(undefined);
|
|
17
|
+
const [publishing, setPublishing] = useState(false);
|
|
18
|
+
const [publishError, setPublishError] = useState(null);
|
|
19
|
+
const [publishFailure, setPublishFailure] = useState(null);
|
|
20
|
+
const [pollError, setPollError] = useState(null);
|
|
21
|
+
// Seeds `run` from the query's first successful load, exactly once — same shape
|
|
22
|
+
// `use-static-export.hooks.ts`'s own `seededRef` uses, and for the same reason (a reload mid-
|
|
23
|
+
// publish, or a second tab, should show the real state rather than a blank "not started").
|
|
24
|
+
const seededRef = useRef(false);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (seededRef.current || query.status === "loading" || !query.data)
|
|
27
|
+
return;
|
|
28
|
+
seededRef.current = true;
|
|
29
|
+
setRun(query.data);
|
|
30
|
+
}, [query.status, query.data]);
|
|
31
|
+
const loadError = query.error ? publishLoadErrorMessage({ locale, error: describeApiError({ e: query.error, fallback: UNKNOWN_ERROR }) }) : null;
|
|
32
|
+
// Counts CONSECUTIVE poll failures for the `PUBLISH_POLL_FAILURE_LIMIT` bound below — same ref-not-
|
|
33
|
+
// state reasoning `use-static-export.hooks.ts`'s own `pollFailuresRef` documents.
|
|
34
|
+
const pollFailuresRef = useRef(0);
|
|
35
|
+
// Synchronous duplicate-submit guard for `publish()` — a ref, not the `publishing` state, because a
|
|
36
|
+
// true double-click can fire two calls in the same synchronous tick, before React has re-rendered
|
|
37
|
+
// with `publishing: true`; `publishing` (state) still exists to let the UI disable the button, but
|
|
38
|
+
// the guard that actually stops a second POST from ever being sent has to be synchronous (C4 fix).
|
|
39
|
+
const publishingRef = useRef(false);
|
|
40
|
+
const isPublishing = run?.status === "running" && pollError === null;
|
|
41
|
+
const pollInputs = useRef({ port, locale });
|
|
42
|
+
pollInputs.current = { port, locale };
|
|
43
|
+
return { run, setRun, publishing, setPublishing, publishError, setPublishError, publishFailure, setPublishFailure, pollError, setPollError, seededRef, loadError, pollFailuresRef, publishingRef, isPublishing, pollInputs };
|
|
44
|
+
}
|
|
45
|
+
export function useStaticPublishPolling({ state, deps }, _optional = {}) {
|
|
46
|
+
const { isPublishing, pollInputs, pollFailuresRef, setRun, setPollError } = state;
|
|
47
|
+
const { setTimeout, clearTimeout, publishPollErrorMessage, describeApiError } = deps;
|
|
48
|
+
// Self-scheduling poll loop, re-armed only when `isPublishing` flips true — identical shape and
|
|
49
|
+
// identical reasoning to `use-static-export.hooks.ts`'s own poll effect; see that file's comment
|
|
50
|
+
// for why `run`/`port` are deliberately excluded from the dependency list.
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!isPublishing)
|
|
53
|
+
return undefined;
|
|
54
|
+
const { port: pollPort, locale: pollLocale } = pollInputs.current;
|
|
55
|
+
let cancelled = false;
|
|
56
|
+
let timer;
|
|
57
|
+
function scheduleNext() {
|
|
58
|
+
timer = setTimeout(poll, PUBLISH_POLL_INTERVAL_MS);
|
|
59
|
+
}
|
|
60
|
+
async function poll() {
|
|
61
|
+
try {
|
|
62
|
+
const status = await pollPort.getPublishStatus();
|
|
63
|
+
if (cancelled)
|
|
64
|
+
return;
|
|
65
|
+
pollFailuresRef.current = 0;
|
|
66
|
+
setRun(status);
|
|
67
|
+
if (status.status === "running")
|
|
68
|
+
scheduleNext();
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (cancelled)
|
|
72
|
+
return;
|
|
73
|
+
pollFailuresRef.current += 1;
|
|
74
|
+
if (pollFailuresRef.current >= PUBLISH_POLL_FAILURE_LIMIT) {
|
|
75
|
+
// Bounded (C2, same shape as use-static-export.hooks.ts's own fix): give up rather than
|
|
76
|
+
// retry forever. Setting `pollError` also flips `isPublishing` false on the next render,
|
|
77
|
+
// which re-arms this effect's own cleanup — but `return` here (no `scheduleNext()`) is
|
|
78
|
+
// what actually stops the loop; it must not depend on that later render having happened.
|
|
79
|
+
setPollError(publishPollErrorMessage({ locale: pollLocale, error: describeApiError({ e: err, fallback: UNKNOWN_ERROR }) }));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
scheduleNext();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
scheduleNext();
|
|
86
|
+
return () => {
|
|
87
|
+
cancelled = true;
|
|
88
|
+
clearTimeout(timer);
|
|
89
|
+
};
|
|
90
|
+
}, [isPublishing]);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=static-publish-run.hooks.js.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { FetchQueryAdapter } from "@jini-ai/core/fetch";
|
|
2
|
+
import type { DockerfileSourceSnapshot } from "../../site/dockerfile.js";
|
|
3
|
+
import { type Translate } from '@jini-ai/core/text';
|
|
4
|
+
/**
|
|
5
|
+
* @file Everything the Dockerfile tab does — load, edit, save, and the copy-to-clipboard
|
|
6
|
+
* interaction — so `DockerfileTab.tsx` is only markup.
|
|
7
|
+
*
|
|
8
|
+
* ## 2026-08-15 — the tab gained a write half
|
|
9
|
+
*
|
|
10
|
+
* The backend (`PUT .../system/dockerfile`, `api.setDockerfileSource`,
|
|
11
|
+
* `features/deployments/dockerfile.ts`'s `writeDockerfileSource`) landed the same day as this
|
|
12
|
+
* change and was already wired through `dockerfile-source-port.hooks.ts` (in `@jini-ai/admin`)/
|
|
13
|
+
* `dockerfile-source-dependencies.hooks.ts` before this hook touched it — see those files' own
|
|
14
|
+
* headers. `DockerfileTab.tsx`'s OWN header used to claim "there is no write route" as the reason
|
|
15
|
+
* this tab was read-only; that had gone stale (the write route existed, the frontend just hadn't
|
|
16
|
+
* been wired to it yet) and is corrected as part of this pass, not left standing.
|
|
17
|
+
*
|
|
18
|
+
* `snapshot`/`draft` are deliberately two different pieces of state, not one: `snapshot` is the
|
|
19
|
+
* last value this hook knows the SERVER holds (from the initial load, or echoed back by a
|
|
20
|
+
* successful save); `draft` is the operator's live edit buffer, seeded from `snapshot` once and
|
|
21
|
+
* otherwise touched only by `setDraft`/a successful `save()`. Same split `Jini forms/react/hooks/use-form-editor.hooks.ts`
|
|
22
|
+
* draws between `list.data` and `form`/`name`/`slug`/etc., and for the identical reason: an
|
|
23
|
+
* in-progress edit must survive a background refresh of the same query key without being clobbered
|
|
24
|
+
* (see `seededRef` below).
|
|
25
|
+
*
|
|
26
|
+
* `save()` calls `setDockerfileSource` through `useFetchMutation` with NO `invalidates` — there is
|
|
27
|
+
* no sibling list resource for a single repo-root file, and the mutation's own response is a fresher
|
|
28
|
+
* answer than a redundant re-`GET` of the same key would be. `snapshot`/`draft` are set directly
|
|
29
|
+
* from that response instead, mirroring `Jini forms/react/hooks/use-form-editor.hooks.ts`'s `handleSave` (which invalidates
|
|
30
|
+
* only the sibling `KEYS.list`, never its own `KEYS.form(id)` read) and
|
|
31
|
+
* `use-widget-region-editor.hooks.ts`'s `save()` (though that one DOES re-`load()`, for a reason
|
|
32
|
+
* that does not apply here — it reconciles a version counter for OTHER placements that may have
|
|
33
|
+
* changed shape; a Dockerfile write has no analogous server-side transform to reconcile).
|
|
34
|
+
*
|
|
35
|
+
* ## 2026-08-15 — optimistic concurrency (Terra audit finding C5)
|
|
36
|
+
*
|
|
37
|
+
* `snapshot.etag` (from `AdminDockerfileSource.etag`, itself read off the server's `ETag` response
|
|
38
|
+
* header — see that field's own doc in `lib/api.ts`) is sent as `save()`'s `ifMatch`, so a save that
|
|
39
|
+
* is based on stale contents — e.g. the AI assistant's own `deployment_set_dockerfile` tool saved a
|
|
40
|
+
* different version in between this hook's last load and this `save()` call — is refused by the
|
|
41
|
+
* server (`412`) instead of silently overwriting it. On that refusal, {@link save} does the opposite
|
|
42
|
+
* of every other failure path here: it does NOT let the generic `saveError` machinery describe it,
|
|
43
|
+
* and it does NOT touch `draft` at all. Instead it populates {@link saveConflict} with the real
|
|
44
|
+
* current contents the `412` response carried, so `DockerfileTab.tsx` can show them next to the
|
|
45
|
+
* operator's own untouched `draft` for a side-by-side comparison — "a generic save error" is
|
|
46
|
+
* explicitly the thing this is not (the brief for this change named that distinction directly).
|
|
47
|
+
* {@link reloadAfterConflict} is the operator's way out: a fresh `GET`, replacing `snapshot` (and
|
|
48
|
+
* therefore the etag the NEXT `save()` will use) with the server's current state, while still
|
|
49
|
+
* leaving `draft` alone — the operator reconciles their own edit by hand against what
|
|
50
|
+
* {@link saveConflict} showed them, then saves again.
|
|
51
|
+
*/
|
|
52
|
+
export interface DockerfileSourceController {
|
|
53
|
+
/** The last value this hook knows the server holds — `undefined` until the first successful
|
|
54
|
+
* load. Distinct from {@link draft}: see this file's header for why the split exists. */
|
|
55
|
+
snapshot: DockerfileSourceSnapshot | undefined;
|
|
56
|
+
/** The editable buffer `DockerfileTab.tsx`'s textarea is bound to. Seeded from `snapshot` once
|
|
57
|
+
* it first loads (or once a save creates it, for the "no Dockerfile yet" case), and otherwise
|
|
58
|
+
* driven entirely by {@link setDraft} and a successful {@link save}. */
|
|
59
|
+
draft: string;
|
|
60
|
+
setDraft: (value: string) => void;
|
|
61
|
+
/** Whether `draft` differs from `snapshot`'s own contents — drives the "Unsaved changes" pill
|
|
62
|
+
* and, via `useDirtyGuard`, a native `beforeunload` prompt against losing an un-saved edit by
|
|
63
|
+
* closing or reloading the tab. Always `false` before `snapshot` has loaded. */
|
|
64
|
+
isDirty: boolean;
|
|
65
|
+
/** Already-formatted, translated LOAD error — `null` while loading or once loaded successfully.
|
|
66
|
+
* Distinct from {@link saveError}: a failed load and a failed save are different failures that
|
|
67
|
+
* can both be true at once (load succeeded earlier, THIS save attempt just failed). */
|
|
68
|
+
error: string | null;
|
|
69
|
+
/** True while a `save()` call is in flight. */
|
|
70
|
+
saving: boolean;
|
|
71
|
+
/** Already-formatted, translated SAVE error from the most recent {@link save} call — `null` until
|
|
72
|
+
* a save fails, and reset to `null` at the start of every new attempt. A `412` conflict does NOT
|
|
73
|
+
* populate this — see {@link saveConflict} instead, and this file's header for why the two are
|
|
74
|
+
* kept deliberately distinct. */
|
|
75
|
+
saveError: string | null;
|
|
76
|
+
/** Set only when the most recent {@link save} was refused with a `412` conflict — the real current
|
|
77
|
+
* `{exists, contents}` the server reported at that moment, for `DockerfileTab.tsx` to show next to
|
|
78
|
+
* the operator's own {@link draft} so they can reconcile by hand. `null` otherwise, and reset to
|
|
79
|
+
* `null` at the start of every new {@link save} attempt (a fresh attempt deserves a fresh
|
|
80
|
+
* judgment, not a stale conflict banner left over from a previous one) and by
|
|
81
|
+
* {@link reloadAfterConflict}. */
|
|
82
|
+
saveConflict: {
|
|
83
|
+
exists: boolean;
|
|
84
|
+
contents: string | null;
|
|
85
|
+
} | null;
|
|
86
|
+
/** Recovery action for a {@link saveConflict}: re-reads the Dockerfile from the server, replacing
|
|
87
|
+
* {@link snapshot} (and therefore the etag the next {@link save} call will use) with the fresh
|
|
88
|
+
* result, and clears {@link saveConflict}. Deliberately does NOT touch {@link draft} — the
|
|
89
|
+
* operator's in-progress edit survives so they can reconcile it by hand against what
|
|
90
|
+
* {@link saveConflict} just showed them before saving again. Resolves either way; a failed reload
|
|
91
|
+
* simply leaves {@link saveConflict} exactly as it was (nothing new to surface — the operator can
|
|
92
|
+
* still read the conflict's own contents and retry this action). */
|
|
93
|
+
reloadAfterConflict: () => Promise<void>;
|
|
94
|
+
/** True for a short window right after a successful {@link save} — drives a transient "Saved"
|
|
95
|
+
* confirmation next to the Save button, on the theory that "the Unsaved-changes pill went away"
|
|
96
|
+
* is not, by itself, an obviously-noticed success signal. Same `setTimeout(..., 1500)` reset
|
|
97
|
+
* idiom as {@link copied}. */
|
|
98
|
+
saved: boolean;
|
|
99
|
+
/** True for a short window right after a successful {@link copy} — drives the button's
|
|
100
|
+
* "Copied!" label. Mirrors `copyHash`'s `setTimeout(..., 1500)` reset in
|
|
101
|
+
* `use-edit-media-panel.hooks.ts`. */
|
|
102
|
+
copied: boolean;
|
|
103
|
+
/** Writes {@link draft} (not `snapshot` — the operator's current edit, which is what's actually
|
|
104
|
+
* on screen) to the clipboard, if there's anything to write. Swallows a denied clipboard
|
|
105
|
+
* permission the same way `copyHash`/`copyUrl` do. */
|
|
106
|
+
copy: () => Promise<void>;
|
|
107
|
+
/** Persists {@link draft} via `PUT .../system/dockerfile` (with `snapshot`'s etag as `ifMatch`),
|
|
108
|
+
* creating the file if it didn't exist yet. Resolves either way — a failure surfaces through
|
|
109
|
+
* {@link saveError} for an ordinary failure, or {@link saveConflict} for a `412` — never a thrown
|
|
110
|
+
* rejection, so callers don't need a try/catch of their own. */
|
|
111
|
+
save: () => Promise<void>;
|
|
112
|
+
/** Bound translator — see this file's header. */
|
|
113
|
+
t: Translate;
|
|
114
|
+
}
|
|
115
|
+
export declare function useDockerfileSource({ port, t, locale, useFetchQueryHook, useFetchMutationHook, useDirtyGuardHook, readSaveConflict, describeFailure, writeClipboard }: {
|
|
116
|
+
port: {
|
|
117
|
+
getDockerfileSource(): Promise<DockerfileSourceSnapshot>;
|
|
118
|
+
setDockerfileSource(required: {
|
|
119
|
+
contents: string;
|
|
120
|
+
ifMatch: string;
|
|
121
|
+
}, optional?: Record<string, never>): Promise<DockerfileSourceSnapshot>;
|
|
122
|
+
};
|
|
123
|
+
t: Translate;
|
|
124
|
+
locale: string;
|
|
125
|
+
useFetchQueryHook: FetchQueryAdapter["useFetchQuery"];
|
|
126
|
+
useFetchMutationHook: FetchQueryAdapter["useFetchMutation"];
|
|
127
|
+
useDirtyGuardHook(required: {
|
|
128
|
+
current: string;
|
|
129
|
+
original: string | null;
|
|
130
|
+
}): {
|
|
131
|
+
isDirty: boolean;
|
|
132
|
+
};
|
|
133
|
+
readSaveConflict(required: {
|
|
134
|
+
error: unknown;
|
|
135
|
+
}): {
|
|
136
|
+
exists: boolean;
|
|
137
|
+
contents: string | null;
|
|
138
|
+
} | null;
|
|
139
|
+
describeFailure(required: {
|
|
140
|
+
error: unknown;
|
|
141
|
+
locale: string;
|
|
142
|
+
operation: "load" | "save";
|
|
143
|
+
}): string;
|
|
144
|
+
writeClipboard(required: {
|
|
145
|
+
contents: string;
|
|
146
|
+
}): Promise<void>;
|
|
147
|
+
}, _options?: {}): DockerfileSourceController;
|
|
148
|
+
//# sourceMappingURL=use-dockerfile-source.hooks.d.ts.map
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import {} from '@jini-ai/core/text';
|
|
3
|
+
/** Loads the file once and seeds the editable draft from it; later refetches never clobber an unsaved edit. */
|
|
4
|
+
function useDockerfileDraft({ port, locale, useFetchQueryHook, describeFailure }) {
|
|
5
|
+
const query = useFetchQueryHook({
|
|
6
|
+
key: ["deployment", "dockerfile"],
|
|
7
|
+
fetch: () => port.getDockerfileSource(),
|
|
8
|
+
});
|
|
9
|
+
const [snapshot, setSnapshot] = useState(undefined);
|
|
10
|
+
const [draft, setDraft] = useState("");
|
|
11
|
+
// Seeds `snapshot`/`draft` from the query's first successful load, exactly once — a LATER
|
|
12
|
+
// background refetch of the same `["deployment", "dockerfile"]` key (the 10s `staleTime` window,
|
|
13
|
+
// or a remount) must not clobber an in-progress, unsaved edit. Same guard shape
|
|
14
|
+
// `Jini forms/react/hooks/use-form-editor.hooks.ts`'s `seededFormIdRef` uses; a plain boolean here rather than an
|
|
15
|
+
// identity comparison because this key has no id to key off — it names one fixed file.
|
|
16
|
+
const seededRef = useRef(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (seededRef.current || query.status === "loading" || !query.data)
|
|
19
|
+
return;
|
|
20
|
+
seededRef.current = true;
|
|
21
|
+
setSnapshot(query.data);
|
|
22
|
+
setDraft(query.data.contents ?? "");
|
|
23
|
+
}, [query.status, query.data]);
|
|
24
|
+
const error = query.error
|
|
25
|
+
? describeFailure({ error: query.error, locale, operation: "load" })
|
|
26
|
+
: null;
|
|
27
|
+
return { snapshot, setSnapshot, draft, setDraft, error };
|
|
28
|
+
}
|
|
29
|
+
/** The "Copied!" confirmation window and the clipboard write of the current draft. */
|
|
30
|
+
function useDockerfileCopy({ draft, writeClipboard }) {
|
|
31
|
+
const [copied, setCopied] = useState(false);
|
|
32
|
+
async function copy() {
|
|
33
|
+
if (!draft)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
await writeClipboard({ contents: draft });
|
|
37
|
+
setCopied(true);
|
|
38
|
+
setTimeout(() => setCopied(false), 1500);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Clipboard access can be denied (permissions, insecure context) — see this file's header.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { copied, copy };
|
|
45
|
+
}
|
|
46
|
+
async function saveDockerfile({ snapshot, draft, savingRef, setSaveConflict, saveMutation, setSnapshot, setDraft, setSaved, readSaveConflict }) {
|
|
47
|
+
// No etag to compare `ifMatch` against before the initial load has resolved — unreachable via
|
|
48
|
+
// the UI anyway (`DockerfileTab.tsx` shows "Loading…" and renders no Save button while
|
|
49
|
+
// `!snapshot`), but a direct caller (a test, or a future caller) gets a clean no-op instead of
|
|
50
|
+
// sending a request the server would refuse for a reason that has nothing to do with THIS call.
|
|
51
|
+
if (!snapshot)
|
|
52
|
+
return;
|
|
53
|
+
// A second call while the first is still in flight is a duplicate submit — ignore it here too,
|
|
54
|
+
// not just via the UI's `saving`-gated disabled Save button, so the race can't still send two
|
|
55
|
+
// PUTs (C4 fix; see `savingRef`'s own doc above for why this check must be synchronous).
|
|
56
|
+
if (savingRef.current)
|
|
57
|
+
return;
|
|
58
|
+
savingRef.current = true;
|
|
59
|
+
// A fresh attempt deserves a fresh judgment, not a conflict banner left over from a previous
|
|
60
|
+
// one — see this file's header.
|
|
61
|
+
setSaveConflict(null);
|
|
62
|
+
const sent = draft;
|
|
63
|
+
try {
|
|
64
|
+
const updated = await saveMutation.mutate({ input: { contents: sent, ifMatch: snapshot.etag } });
|
|
65
|
+
setSnapshot(updated);
|
|
66
|
+
// The response describes what was SENT. An edit typed while the PUT was in flight is newer than
|
|
67
|
+
// both, so the buffer adopts the server's copy only if it still holds exactly what was sent
|
|
68
|
+
// (terra review 2026-09-20, finding 4) — otherwise it stays, dirty against the new snapshot.
|
|
69
|
+
setDraft((current) => (current === sent ? (updated.contents ?? "") : current));
|
|
70
|
+
setSaved(true);
|
|
71
|
+
setTimeout(() => setSaved(false), 1500);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
const conflict = readSaveConflict({ error: err });
|
|
75
|
+
if (conflict !== null) {
|
|
76
|
+
setSaveConflict(conflict);
|
|
77
|
+
// A conflict is deliberately NOT a generic save error (see this file's header) — `reset()`
|
|
78
|
+
// clears the mutation's own error state so the `saveError` derivation below reports `null`
|
|
79
|
+
// on the next render instead of describing this same rejection a second, blander way.
|
|
80
|
+
saveMutation.reset();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// any other failure: already surfaced through saveMutation.error -> saveError below
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
// Unconditional and in `finally` specifically — every branch above (success, conflict,
|
|
87
|
+
// ordinary failure) must release this guard, or one failed save would permanently wedge
|
|
88
|
+
// every future Save click into a silent no-op with no error surfaced anywhere.
|
|
89
|
+
savingRef.current = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Saving with an `If-Match` etag: duplicate-submit guard, 412 conflict capture and the transient "Saved" flag. */
|
|
93
|
+
function useDockerfileSave({ port, locale, source, useFetchMutationHook, readSaveConflict, describeFailure }) {
|
|
94
|
+
const { snapshot, setSnapshot, draft, setDraft } = source;
|
|
95
|
+
const [saved, setSaved] = useState(false);
|
|
96
|
+
const [saveConflict, setSaveConflict] = useState(null);
|
|
97
|
+
// No `invalidates` — see this file's header for why a redundant re-`GET` of this hook's own read
|
|
98
|
+
// key would be strictly worse than the response already in hand.
|
|
99
|
+
const saveMutation = useFetchMutationHook({
|
|
100
|
+
run: ({ input }) => port.setDockerfileSource(input),
|
|
101
|
+
});
|
|
102
|
+
// Synchronous duplicate-submit guard for `save()` — a ref, not the `saving` (state) value below,
|
|
103
|
+
// because a true double-click/double-Enter can fire two `save()` calls in the same synchronous
|
|
104
|
+
// tick, before React has re-rendered with `saving: true`. `saving` (derived from
|
|
105
|
+
// `saveMutation.status`) still exists to let the UI disable the Save button, but the guard that
|
|
106
|
+
// actually stops a second PUT from ever being sent has to be synchronous — same shape and same
|
|
107
|
+
// reasoning as `use-static-publish.hooks.ts`'s own `publishingRef` (C4 fix, fixed the same night).
|
|
108
|
+
// Without this, two rapid Saves could both read the SAME `snapshot.etag` as `ifMatch` (neither has
|
|
109
|
+
// committed yet), send two writes, and let the second one's `412` come back for a save the
|
|
110
|
+
// operator never actually made twice on purpose — a self-inflicted version of the exact race this
|
|
111
|
+
// whole change exists to close.
|
|
112
|
+
const savingRef = useRef(false);
|
|
113
|
+
function save() {
|
|
114
|
+
return saveDockerfile({ snapshot, draft, savingRef, setSaveConflict, saveMutation, setSnapshot, setDraft, setSaved, readSaveConflict });
|
|
115
|
+
}
|
|
116
|
+
const saveError = saveMutation.error
|
|
117
|
+
? describeFailure({ error: saveMutation.error, locale, operation: "save" })
|
|
118
|
+
: null;
|
|
119
|
+
async function reloadAfterConflict() {
|
|
120
|
+
try {
|
|
121
|
+
const fresh = await port.getDockerfileSource();
|
|
122
|
+
setSnapshot(fresh);
|
|
123
|
+
setSaveConflict(null);
|
|
124
|
+
// `draft` is deliberately left untouched here — see this file's header for why: the
|
|
125
|
+
// operator's in-progress edit must survive so they can reconcile it by hand against what
|
|
126
|
+
// `saveConflict` just showed them, then save again.
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// A failed reload leaves `saveConflict` exactly as it was — the operator can still read the
|
|
130
|
+
// conflict's own contents and retry this action; nothing new needs surfacing here.
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { saving: saveMutation.status === "pending", saveError, saveConflict, reloadAfterConflict, saved, save };
|
|
134
|
+
}
|
|
135
|
+
export function useDockerfileSource({ port, t, locale, useFetchQueryHook, useFetchMutationHook, useDirtyGuardHook, readSaveConflict, describeFailure, writeClipboard }, _options = {}) {
|
|
136
|
+
const source = useDockerfileDraft({ port, locale, useFetchQueryHook, describeFailure });
|
|
137
|
+
const { snapshot, draft, setDraft, error } = source;
|
|
138
|
+
// No `translate`: this hook reads only `isDirty`, never the guard's translated leave-confirm, so
|
|
139
|
+
// the identity translator it used to pass was never called (and equals the guard's own default).
|
|
140
|
+
const { isDirty } = useDirtyGuardHook({ current: draft, original: snapshot ? (snapshot.contents ?? "") : null });
|
|
141
|
+
const { copied, copy } = useDockerfileCopy({ draft, writeClipboard });
|
|
142
|
+
const save = useDockerfileSave({ port, locale, source, useFetchMutationHook, readSaveConflict, describeFailure });
|
|
143
|
+
return {
|
|
144
|
+
snapshot,
|
|
145
|
+
draft,
|
|
146
|
+
setDraft,
|
|
147
|
+
isDirty,
|
|
148
|
+
error,
|
|
149
|
+
...save,
|
|
150
|
+
copied,
|
|
151
|
+
copy,
|
|
152
|
+
t,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=use-dockerfile-source.hooks.js.map
|