@treeseed/sdk 0.11.0 → 0.12.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/README.md +9 -4
- package/dist/agent-capacity.d.ts +916 -0
- package/dist/agent-capacity.js +1600 -0
- package/dist/agent-tools.d.ts +37 -0
- package/dist/agent-tools.js +301 -0
- package/dist/api/app.d.ts +1 -1
- package/dist/api/auth/d1-database.d.ts +2 -2
- package/dist/api/auth/d1-provider.d.ts +4 -4
- package/dist/api/auth/d1-store.d.ts +2 -2
- package/dist/api/auth/memory-provider.d.ts +1 -1
- package/dist/api/auth/tokens.d.ts +1 -1
- package/dist/api/config.d.ts +3 -1
- package/dist/api/config.js +34 -10
- package/dist/api/http.d.ts +2 -2
- package/dist/api/index.d.ts +10 -10
- package/dist/api/index.js +4 -2
- package/dist/api/operations-routes.d.ts +3 -3
- package/dist/api/operations.d.ts +1 -1
- package/dist/api/providers.d.ts +1 -1
- package/dist/api/providers.js +21 -4
- package/dist/api/railway.d.ts +3 -2
- package/dist/api/sdk-dispatch.d.ts +4 -4
- package/dist/api/sdk-routes.d.ts +2 -2
- package/dist/api/templates.d.ts +2 -2
- package/dist/api/types.d.ts +3 -2
- package/dist/capacity-provider.d.ts +117 -60
- package/dist/capacity-provider.js +215 -43
- package/dist/capacity.d.ts +2 -2
- package/dist/cli-tools.d.ts +1 -1
- package/dist/content-operations.d.ts +97 -0
- package/dist/content-operations.js +250 -0
- package/dist/content-store.d.ts +4 -4
- package/dist/control-plane-client.d.ts +13 -18
- package/dist/control-plane-client.js +8 -86
- package/dist/control-plane.d.ts +2 -2
- package/dist/copilot.d.ts +3 -0
- package/dist/copilot.js +16 -1
- package/dist/d1-http.d.ts +1 -1
- package/dist/d1-store.d.ts +32 -57
- package/dist/d1-store.js +115 -318
- package/dist/db/d1.d.ts +1 -232
- package/dist/db/index.d.ts +3 -3
- package/dist/db/market-schema.d.ts +49037 -11843
- package/dist/db/market-schema.js +1788 -50
- package/dist/db/node-sqlite.d.ts +1 -232
- package/dist/db/schema.d.ts +0 -462
- package/dist/db/schema.js +2 -22
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +0 -11
- package/dist/fixture-support.js +52 -4
- package/dist/governance.d.ts +133 -0
- package/dist/governance.js +285 -0
- package/dist/graph/build.d.ts +2 -2
- package/dist/graph/context-query-contracts.d.ts +1 -1
- package/dist/graph/dsl.d.ts +1 -1
- package/dist/graph/query.d.ts +4 -4
- package/dist/graph/ranking.d.ts +1 -1
- package/dist/graph/schema.d.ts +1 -1
- package/dist/graph.d.ts +11 -11
- package/dist/guarantees/index.d.ts +425 -0
- package/dist/guarantees/index.js +1146 -0
- package/dist/hosting/apps.d.ts +1 -1
- package/dist/hosting/builtins.d.ts +1 -1
- package/dist/hosting/builtins.js +9 -198
- package/dist/hosting/contracts.d.ts +3 -2
- package/dist/hosting/graph.d.ts +24 -21
- package/dist/hosting/graph.js +280 -294
- package/dist/hosting/index.d.ts +4 -4
- package/dist/index.d.ts +88 -74
- package/dist/index.js +81 -10
- package/dist/local-dev/managed-dev.d.ts +85 -0
- package/dist/local-dev/managed-dev.js +368 -0
- package/dist/managed-dependencies.d.ts +9 -0
- package/dist/managed-dependencies.js +10 -8
- package/dist/market-client.d.ts +265 -7
- package/dist/market-client.js +381 -9
- package/dist/model-registry.d.ts +1 -1
- package/dist/model-registry.js +19 -19
- package/dist/operations/agent-tools.d.ts +2 -11
- package/dist/operations/agent-tools.js +2 -14
- package/dist/operations/providers/default.d.ts +1 -1
- package/dist/operations/providers/default.js +20 -37
- package/dist/operations/repository-operations.d.ts +26 -2
- package/dist/operations/repository-operations.js +159 -1
- package/dist/operations/runtime.d.ts +3 -3
- package/dist/operations/services/bootstrap-runner.d.ts +1 -1
- package/dist/operations/services/build-warning-policy.d.ts +34 -0
- package/dist/operations/services/build-warning-policy.js +81 -82
- package/dist/operations/services/commit-message-provider.js +4 -4
- package/dist/operations/services/config-runtime.d.ts +73 -19
- package/dist/operations/services/config-runtime.js +276 -100
- package/dist/operations/services/deploy.d.ts +41 -622
- package/dist/operations/services/deploy.js +181 -213
- package/dist/operations/services/deployment-readiness.d.ts +1 -1
- package/dist/operations/services/deployment-readiness.js +38 -7
- package/dist/operations/services/git-remote-policy.js +12 -4
- package/dist/operations/services/git-runner.d.ts +66 -0
- package/dist/operations/services/git-runner.js +479 -0
- package/dist/operations/services/git-workflow.d.ts +43 -5
- package/dist/operations/services/git-workflow.js +242 -20
- package/dist/operations/services/github-actions-verification.d.ts +3 -1
- package/dist/operations/services/github-actions-verification.js +11 -3
- package/dist/operations/services/github-api.js +21 -5
- package/dist/operations/services/github-automation.d.ts +3 -3
- package/dist/operations/services/github-automation.js +15 -18
- package/dist/operations/services/github-credentials.js +2 -1
- package/dist/operations/services/hosted-service-checks.d.ts +19 -1
- package/dist/operations/services/hosted-service-checks.js +162 -11
- package/dist/operations/services/hosting-audit.d.ts +2 -2
- package/dist/operations/services/hosting-audit.js +7 -7
- package/dist/operations/services/hub-launch.d.ts +1 -1
- package/dist/operations/services/hub-provider-launch.d.ts +5 -5
- package/dist/operations/services/hub-provider-launch.js +19 -14
- package/dist/operations/services/live-hosted-service-checks.d.ts +2 -1
- package/dist/operations/services/live-hosted-service-checks.js +193 -80
- package/dist/operations/services/local-dev.js +0 -1
- package/dist/operations/services/managed-host-security.d.ts +1 -1
- package/dist/operations/services/managed-repositories.d.ts +37 -0
- package/dist/operations/services/managed-repositories.js +177 -0
- package/dist/operations/services/operations-runner-smoke.d.ts +3 -2
- package/dist/operations/services/operations-runner-smoke.js +22 -4
- package/dist/operations/services/package-adapters.d.ts +77 -2
- package/dist/operations/services/package-adapters.js +627 -56
- package/dist/operations/services/package-reference-policy.d.ts +12 -88
- package/dist/operations/services/package-reference-policy.js +81 -213
- package/dist/operations/services/project-host-operations.d.ts +4 -4
- package/dist/operations/services/project-platform.d.ts +19 -193
- package/dist/operations/services/project-platform.js +31 -103
- package/dist/operations/services/project-web-monitor.d.ts +2 -2
- package/dist/operations/services/project-web-monitor.js +97 -2
- package/dist/operations/services/railway-api.d.ts +36 -7
- package/dist/operations/services/railway-api.js +331 -100
- package/dist/operations/services/railway-deploy.d.ts +7 -95
- package/dist/operations/services/railway-deploy.js +334 -742
- package/dist/operations/services/release-history.js +3 -4
- package/dist/operations/services/release-proof-ledger.d.ts +13 -0
- package/dist/operations/services/release-proof-ledger.js +81 -0
- package/dist/operations/services/release-proof-planner.d.ts +48 -0
- package/dist/operations/services/release-proof-planner.js +195 -0
- package/dist/operations/services/release-proof-runner.d.ts +16 -0
- package/dist/operations/services/release-proof-runner.js +169 -0
- package/dist/operations/services/release-proof.d.ts +81 -0
- package/dist/operations/services/release-proof.js +79 -0
- package/dist/operations/services/repository-save-orchestrator.d.ts +6 -7
- package/dist/operations/services/repository-save-orchestrator.js +353 -174
- package/dist/operations/services/runtime-paths.d.ts +1 -3
- package/dist/operations/services/runtime-paths.js +0 -4
- package/dist/operations/services/runtime-tools.d.ts +1 -192
- package/dist/operations/services/runtime-tools.js +4 -444
- package/dist/operations/services/save-deploy-preflight.js +9 -1
- package/dist/operations/services/template-host-bindings.d.ts +2 -2
- package/dist/operations/services/template-host-bindings.js +3 -2
- package/dist/operations/services/template-registry.d.ts +6 -6
- package/dist/operations/services/template-registry.js +33 -14
- package/dist/operations/services/template-secret-sync.d.ts +3 -3
- package/dist/operations/services/workflow-timing.d.ts +25 -0
- package/dist/operations/services/workflow-timing.js +79 -0
- package/dist/operations/services/workspace-dependency-mode.js +41 -4
- package/dist/operations/services/workspace-preflight.js +8 -8
- package/dist/operations/services/workspace-save-script.d.ts +4 -4
- package/dist/operations/services/workspace-save.d.ts +1 -0
- package/dist/operations/services/workspace-save.js +41 -18
- package/dist/operations/services/workspace-tools.js +40 -6
- package/dist/operations-registry.d.ts +1 -1
- package/dist/operations-registry.js +5 -6
- package/dist/operations-types.d.ts +1 -1
- package/dist/operations.d.ts +17 -11
- package/dist/operations.js +57 -3
- package/dist/platform/book-export.js +2 -0
- package/dist/platform/books-data.d.ts +1 -1
- package/dist/platform/config.d.ts +27 -0
- package/dist/platform/config.js +100 -0
- package/dist/platform/content-runtime-source.d.ts +54 -0
- package/dist/platform/content-runtime-source.js +169 -0
- package/dist/platform/contracts.d.ts +6 -1
- package/dist/platform/deploy-config.d.ts +1 -1
- package/dist/platform/deploy-config.js +7 -1
- package/dist/platform/deploy-runtime.d.ts +1 -1
- package/dist/platform/desired-state.d.ts +63 -0
- package/dist/platform/desired-state.js +1021 -0
- package/dist/platform/env.yaml +414 -19
- package/dist/platform/environment.d.ts +2 -2
- package/dist/platform/environment.js +54 -22
- package/dist/platform/local-content-materialization.d.ts +9 -0
- package/dist/platform/local-content-materialization.js +212 -0
- package/dist/platform/plugin.d.ts +5 -5
- package/dist/platform/plugins/runtime.d.ts +3 -3
- package/dist/platform/plugins/runtime.js +62 -1
- package/dist/platform/plugins.d.ts +6 -6
- package/dist/platform/published-content-pipeline.d.ts +3 -3
- package/dist/platform/published-content-pipeline.js +5 -1
- package/dist/platform/published-content.d.ts +4 -3
- package/dist/platform/site-config-schema.d.ts +1 -0
- package/dist/platform/site-config-schema.js +4 -1
- package/dist/platform/tenant/runtime-config.d.ts +152 -2
- package/dist/platform/tenant-config.d.ts +1 -1
- package/dist/platform/utils/site-config-schema.d.ts +154 -0
- package/dist/platform/utils/site-config-schema.js +400 -461
- package/dist/platform-operation-store.d.ts +1 -1
- package/dist/plugin-default.d.ts +1 -1
- package/dist/plugin-default.js +27 -12
- package/dist/project-import.d.ts +91 -0
- package/dist/project-import.js +257 -0
- package/dist/project-workflow.d.ts +1 -1
- package/dist/reconcile/bootstrap-systems.d.ts +2 -2
- package/dist/reconcile/bootstrap-systems.js +3 -3
- package/dist/reconcile/builtin-adapters.d.ts +7 -1
- package/dist/reconcile/builtin-adapters.js +2924 -346
- package/dist/reconcile/contracts.d.ts +15 -2
- package/dist/reconcile/desired-state.d.ts +2 -193
- package/dist/reconcile/desired-state.js +24 -33
- package/dist/reconcile/engine.d.ts +60 -397
- package/dist/reconcile/engine.js +182 -18
- package/dist/reconcile/index.d.ts +10 -10
- package/dist/reconcile/live-acceptance.d.ts +22 -1
- package/dist/reconcile/live-acceptance.js +456 -44
- package/dist/reconcile/providers/docker-private.d.ts +54 -0
- package/dist/reconcile/providers/docker-private.js +101 -0
- package/dist/reconcile/providers/github-private.d.ts +65 -0
- package/dist/reconcile/providers/github-private.js +119 -0
- package/dist/reconcile/providers/local-private.d.ts +28 -0
- package/dist/reconcile/providers/local-private.js +75 -0
- package/dist/reconcile/providers/railway-iac.d.ts +66 -0
- package/dist/reconcile/providers/railway-iac.js +275 -0
- package/dist/reconcile/providers/release-private.d.ts +92 -0
- package/dist/reconcile/providers/release-private.js +152 -0
- package/dist/reconcile/registry.d.ts +2 -2
- package/dist/reconcile/registry.js +16 -1
- package/dist/reconcile/state.d.ts +1 -1
- package/dist/reconcile/state.js +3 -40
- package/dist/reconcile/units.d.ts +1 -1
- package/dist/reconcile/units.js +7 -1
- package/dist/remote.d.ts +6 -6
- package/dist/scenes/artifacts.d.ts +16 -0
- package/dist/scenes/artifacts.js +61 -0
- package/dist/scenes/auth.d.ts +2 -0
- package/dist/scenes/auth.js +28 -0
- package/dist/scenes/base-url.d.ts +12 -0
- package/dist/scenes/base-url.js +123 -0
- package/dist/scenes/builtin-plugins.d.ts +2 -0
- package/dist/scenes/builtin-plugins.js +447 -0
- package/dist/scenes/checkpoints.d.ts +14 -0
- package/dist/scenes/checkpoints.js +33 -0
- package/dist/scenes/device-matrix.d.ts +2 -0
- package/dist/scenes/device-matrix.js +97 -0
- package/dist/scenes/devices.d.ts +11 -0
- package/dist/scenes/devices.js +22 -0
- package/dist/scenes/diagnostics.d.ts +5 -0
- package/dist/scenes/diagnostics.js +22 -0
- package/dist/scenes/diagram-providers.d.ts +2 -0
- package/dist/scenes/diagram-providers.js +181 -0
- package/dist/scenes/diagram-validation.d.ts +22 -0
- package/dist/scenes/diagram-validation.js +74 -0
- package/dist/scenes/environment.d.ts +2 -0
- package/dist/scenes/environment.js +65 -0
- package/dist/scenes/evidence-bundle.d.ts +5 -0
- package/dist/scenes/evidence-bundle.js +42 -0
- package/dist/scenes/evidence-report.d.ts +10 -0
- package/dist/scenes/evidence-report.js +73 -0
- package/dist/scenes/evidence.d.ts +16 -0
- package/dist/scenes/evidence.js +277 -0
- package/dist/scenes/index.d.ts +48 -0
- package/dist/scenes/index.js +312 -0
- package/dist/scenes/inspect.d.ts +9 -0
- package/dist/scenes/inspect.js +64 -0
- package/dist/scenes/loader.d.ts +3 -0
- package/dist/scenes/loader.js +38 -0
- package/dist/scenes/logs.d.ts +2 -0
- package/dist/scenes/logs.js +47 -0
- package/dist/scenes/operations.d.ts +3 -0
- package/dist/scenes/operations.js +128 -0
- package/dist/scenes/phase0.d.ts +9 -0
- package/dist/scenes/phase0.js +637 -0
- package/dist/scenes/planner.d.ts +12 -0
- package/dist/scenes/planner.js +166 -0
- package/dist/scenes/playwright-adapter.d.ts +2 -0
- package/dist/scenes/playwright-adapter.js +63 -0
- package/dist/scenes/plugins.d.ts +5 -0
- package/dist/scenes/plugins.js +115 -0
- package/dist/scenes/progress.d.ts +17 -0
- package/dist/scenes/progress.js +24 -0
- package/dist/scenes/publish-destinations.d.ts +12 -0
- package/dist/scenes/publish-destinations.js +99 -0
- package/dist/scenes/publish-plan-report.d.ts +10 -0
- package/dist/scenes/publish-plan-report.js +70 -0
- package/dist/scenes/publish-plan.d.ts +15 -0
- package/dist/scenes/publish-plan.js +248 -0
- package/dist/scenes/publish-redaction.d.ts +16 -0
- package/dist/scenes/publish-redaction.js +148 -0
- package/dist/scenes/publish-release-record.d.ts +13 -0
- package/dist/scenes/publish-release-record.js +34 -0
- package/dist/scenes/publish-report.d.ts +10 -0
- package/dist/scenes/publish-report.js +67 -0
- package/dist/scenes/publish.d.ts +16 -0
- package/dist/scenes/publish.js +298 -0
- package/dist/scenes/registry.d.ts +12 -0
- package/dist/scenes/registry.js +65 -0
- package/dist/scenes/remotion-adapter.d.ts +3 -0
- package/dist/scenes/remotion-adapter.js +94 -0
- package/dist/scenes/remotion-composition-registry.d.ts +2 -0
- package/dist/scenes/remotion-composition-registry.js +12 -0
- package/dist/scenes/remotion-compositions.d.ts +15 -0
- package/dist/scenes/remotion-compositions.js +464 -0
- package/dist/scenes/remotion-diagrams.d.ts +9 -0
- package/dist/scenes/remotion-diagrams.js +188 -0
- package/dist/scenes/remotion-input.d.ts +13 -0
- package/dist/scenes/remotion-input.js +291 -0
- package/dist/scenes/remotion-visuals.d.ts +29 -0
- package/dist/scenes/remotion-visuals.js +198 -0
- package/dist/scenes/render-media-assets.d.ts +9 -0
- package/dist/scenes/render-media-assets.js +117 -0
- package/dist/scenes/render-report.d.ts +10 -0
- package/dist/scenes/render-report.js +27 -0
- package/dist/scenes/render.d.ts +2 -0
- package/dist/scenes/render.js +218 -0
- package/dist/scenes/reporter.d.ts +3 -0
- package/dist/scenes/reporter.js +101 -0
- package/dist/scenes/resume.d.ts +2 -0
- package/dist/scenes/resume.js +79 -0
- package/dist/scenes/runner.d.ts +2 -0
- package/dist/scenes/runner.js +674 -0
- package/dist/scenes/schema.d.ts +6 -0
- package/dist/scenes/schema.js +994 -0
- package/dist/scenes/seed.d.ts +2 -0
- package/dist/scenes/seed.js +83 -0
- package/dist/scenes/segments.d.ts +15 -0
- package/dist/scenes/segments.js +79 -0
- package/dist/scenes/selectors.d.ts +3 -0
- package/dist/scenes/selectors.js +21 -0
- package/dist/scenes/timeline.d.ts +11 -0
- package/dist/scenes/timeline.js +26 -0
- package/dist/scenes/timeouts.d.ts +6 -0
- package/dist/scenes/timeouts.js +17 -0
- package/dist/scenes/training-captions.d.ts +14 -0
- package/dist/scenes/training-captions.js +98 -0
- package/dist/scenes/training-report.d.ts +10 -0
- package/dist/scenes/training-report.js +78 -0
- package/dist/scenes/training-transcript.d.ts +24 -0
- package/dist/scenes/training-transcript.js +204 -0
- package/dist/scenes/training.d.ts +10 -0
- package/dist/scenes/training.js +134 -0
- package/dist/scenes/types.d.ts +1872 -0
- package/dist/scenes/types.js +8 -0
- package/dist/scenes/visual-audit-contact-sheets.d.ts +6 -0
- package/dist/scenes/visual-audit-contact-sheets.js +119 -0
- package/dist/scenes/visual-audit-fixtures.d.ts +25 -0
- package/dist/scenes/visual-audit-fixtures.js +210 -0
- package/dist/scenes/visual-audit-report.d.ts +11 -0
- package/dist/scenes/visual-audit-report.js +85 -0
- package/dist/scenes/visual-audit-review.d.ts +23 -0
- package/dist/scenes/visual-audit-review.js +829 -0
- package/dist/scenes/visual-audit-routes.d.ts +13 -0
- package/dist/scenes/visual-audit-routes.js +308 -0
- package/dist/scenes/visual-audit.d.ts +3 -0
- package/dist/scenes/visual-audit.js +596 -0
- package/dist/scripts/build-dist.js +154 -40
- package/dist/scripts/check-build-warnings.js +42 -53
- package/dist/scripts/cleanup-markdown.js +1 -1
- package/dist/scripts/cli-test-fixtures.js +24 -28
- package/dist/scripts/migrate-journey-csv-to-guarantees.js +140 -0
- package/dist/scripts/package-tools.js +12 -1
- package/dist/scripts/prepare.js +3 -7
- package/dist/scripts/release-verify.js +2 -5
- package/dist/scripts/run-fixture-astro-command.js +1 -1
- package/dist/scripts/template-catalog.test.js +68 -82
- package/dist/scripts/tenant-dev.js +0 -10
- package/dist/scripts/test-cloudflare-local.js +1 -1
- package/dist/scripts/test-scaffold.js +0 -1
- package/dist/scripts/test-smoke.js +3 -3
- package/dist/scripts/treeseed-build-dist.js +4 -7
- package/dist/scripts/treeseed-release-verify.js +1 -1
- package/dist/scripts/verify-driver.js +30 -21
- package/dist/scripts/workflow-commands.test.js +18 -27
- package/dist/scripts/workspace-command-e2e.js +1 -1
- package/dist/scripts/workspace-lint.js +6 -0
- package/dist/scripts/workspace-release-test.js +90 -1
- package/dist/scripts/workspace-test.js +6 -0
- package/dist/sdk-dispatch.d.ts +1 -1
- package/dist/sdk-dispatch.js +0 -16
- package/dist/sdk-fields.d.ts +1 -1
- package/dist/sdk-filters.d.ts +1 -1
- package/dist/sdk-types.d.ts +1184 -113
- package/dist/sdk-types.js +393 -0
- package/dist/sdk.d.ts +74 -79
- package/dist/sdk.js +27 -36
- package/dist/secrets-capability.d.ts +421 -0
- package/dist/secrets-capability.js +530 -0
- package/dist/seeds/normalize.js +1 -0
- package/dist/seeds/planner.js +38 -0
- package/dist/seeds/schema.js +293 -4
- package/dist/seeds/types.d.ts +60 -0
- package/dist/seeds/types.js +9 -1
- package/dist/service-credentials.d.ts +54 -0
- package/dist/service-credentials.js +112 -0
- package/dist/stores/cursor-store.d.ts +2 -2
- package/dist/stores/envelopes.d.ts +1 -1
- package/dist/stores/helpers.d.ts +1 -1
- package/dist/stores/lease-store.d.ts +2 -2
- package/dist/stores/message-store.d.ts +2 -2
- package/dist/stores/operational-store.d.ts +3 -26
- package/dist/stores/operational-store.js +0 -225
- package/dist/stores/project-workflow-store.d.ts +2 -2
- package/dist/stores/run-store.d.ts +2 -3
- package/dist/stores/run-store.js +0 -98
- package/dist/stores/subscription-store.d.ts +2 -3
- package/dist/stores/subscription-store.js +0 -100
- package/dist/template-catalog.d.ts +1 -1
- package/dist/template-launch-requirements.d.ts +2 -2
- package/dist/template-launch-ui.d.ts +2 -2
- package/dist/treedx/adapters.d.ts +6 -6
- package/dist/treedx/client.d.ts +1 -1
- package/dist/treedx/errors.d.ts +1 -1
- package/dist/treedx/federated-client.d.ts +3 -3
- package/dist/treedx/graph-adapter.d.ts +2 -2
- package/dist/treedx/index.d.ts +14 -14
- package/dist/treedx/market-integration.d.ts +1 -1
- package/dist/treedx/ports.d.ts +30 -30
- package/dist/treedx/query-adapter.d.ts +3 -3
- package/dist/treedx/registry-client.d.ts +2 -2
- package/dist/treedx/repository-adapter.d.ts +4 -4
- package/dist/treedx/repository-adapter.js +14 -3
- package/dist/treedx/sdk-integration.d.ts +3 -3
- package/dist/treedx/types.d.ts +2 -2
- package/dist/treedx/workspace-adapter.d.ts +2 -2
- package/dist/treedx-backends.d.ts +13 -11
- package/dist/treedx-backends.js +52 -50
- package/dist/treedx-client.d.ts +3 -0
- package/dist/treedx-client.js +10 -1
- package/dist/treeseed/services/compose.yml +2 -3
- package/dist/treeseed/template-catalog/catalog.fixture.json +4 -4
- package/dist/types/agents.d.ts +256 -0
- package/dist/types/agents.js +42 -1
- package/dist/verification.d.ts +1 -0
- package/dist/verification.js +143 -14
- package/dist/workflow/operations.d.ts +510 -559
- package/dist/workflow/operations.js +1891 -1342
- package/dist/workflow/policy.js +19 -7
- package/dist/workflow/runs.d.ts +9 -3
- package/dist/workflow/runs.js +66 -26
- package/dist/workflow/session.d.ts +4 -1
- package/dist/workflow/session.js +50 -10
- package/dist/workflow/worktrees.d.ts +6 -2
- package/dist/workflow/worktrees.js +98 -15
- package/dist/workflow-state.d.ts +5 -5
- package/dist/workflow-state.js +27 -17
- package/dist/workflow-support.d.ts +26 -25
- package/dist/workflow-support.js +27 -31
- package/dist/workflow.d.ts +46 -16
- package/dist/workflow.js +19 -7
- package/drizzle/d1/0000_treeseed_d1.sql +0 -18
- package/drizzle/market/0000_market_control_plane.sql +1793 -1499
- package/drizzle/market/0005_agent_capacity_coordination.sql +145 -0
- package/drizzle/market/0006_provider_assignment_lifecycle.sql +9 -0
- package/drizzle/market/0007_agent_architecture_gap_closure.sql +157 -0
- package/drizzle/market/0008_agent_capacity_operational_closure.sql +27 -0
- package/drizzle/market/0009_agent_capacity_runtime_hardening.sql +29 -0
- package/drizzle/market/0010_secrets_capability_persistence.sql +130 -0
- package/drizzle/market/0011_github_app_adapter.sql +47 -0
- package/drizzle/market/0012_workday_test_runs.sql +44 -0
- package/drizzle/market/0013_runtime_task_lifecycle.sql +39 -0
- package/drizzle/market/0014_governance_pipeline.sql +189 -0
- package/package.json +75 -18
- package/scripts/{verify-driver.mjs → verify-driver.ts} +19 -4
- package/templates/github/deploy-web.workflow.yml +12 -8
- package/dist/operations/services/mailpit-runtime.d.ts +0 -20
- package/dist/operations/services/mailpit-runtime.js +0 -67
- package/dist/operations/services/release-candidate.d.ts +0 -60
- package/dist/operations/services/release-candidate.js +0 -953
- package/dist/scripts/ensure-mailpit.js +0 -48
- package/dist/scripts/logs-mailpit.js +0 -2
- package/dist/scripts/run-ts.js +0 -45
- package/dist/scripts/stop-mailpit.js +0 -5
- package/dist/scripts/treeseed-run-ts.js +0 -45
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { request as httpsRequest } from "node:https";
|
|
2
|
+
import { resolveTreeseedRailwayApiToken } from "../../service-credentials.js";
|
|
2
3
|
const DEFAULT_RAILWAY_API_URL = "https://backboard.railway.com/graphql/v2";
|
|
3
4
|
const DEFAULT_RAILWAY_WORKSPACE = "knowledge-coop";
|
|
4
5
|
function normalizeRailwayEnvironmentName(value) {
|
|
@@ -16,7 +17,7 @@ function isUsableRailwayToken(value) {
|
|
|
16
17
|
return typeof value === "string" && value.trim().length >= 8;
|
|
17
18
|
}
|
|
18
19
|
function resolveRailwayApiToken(env = process.env) {
|
|
19
|
-
const token =
|
|
20
|
+
const token = resolveTreeseedRailwayApiToken(env);
|
|
20
21
|
return isUsableRailwayToken(token) ? token : "";
|
|
21
22
|
}
|
|
22
23
|
function resolveRailwayApiUrl(env = process.env) {
|
|
@@ -111,15 +112,36 @@ function normalizeProject(node) {
|
|
|
111
112
|
if (!id || !name) {
|
|
112
113
|
return null;
|
|
113
114
|
}
|
|
115
|
+
const services = /* @__PURE__ */ new Map();
|
|
116
|
+
for (const service of normalizeConnectionNodes(node.services, normalizeService)) {
|
|
117
|
+
services.set(service.id, service);
|
|
118
|
+
}
|
|
119
|
+
for (const environment of normalizeConnectionNodes(node.environments, (entry) => entry)) {
|
|
120
|
+
for (const instance of normalizeConnectionNodes(environment.serviceInstances, (entry) => entry)) {
|
|
121
|
+
const serviceId = railwayConnectionLabel(instance.serviceId);
|
|
122
|
+
const serviceName = railwayConnectionLabel(instance.serviceName);
|
|
123
|
+
if (serviceId && serviceName) {
|
|
124
|
+
services.set(serviceId, { id: serviceId, name: serviceName });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
114
128
|
return {
|
|
115
129
|
id,
|
|
116
130
|
name,
|
|
117
131
|
workspaceId: railwayConnectionLabel(node.workspaceId) || null,
|
|
118
132
|
deletedAt: railwayConnectionLabel(node.deletedAt) || null,
|
|
119
133
|
environments: normalizeConnectionNodes(node.environments, normalizeEnvironment),
|
|
120
|
-
services:
|
|
134
|
+
services: [...services.values()]
|
|
121
135
|
};
|
|
122
136
|
}
|
|
137
|
+
function normalizeServiceInstanceService(node) {
|
|
138
|
+
const id = railwayConnectionLabel(node.serviceId);
|
|
139
|
+
const name = railwayConnectionLabel(node.serviceName);
|
|
140
|
+
if (!id || !name) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return { id, name };
|
|
144
|
+
}
|
|
123
145
|
function normalizeVariableMap(value) {
|
|
124
146
|
if (!value) {
|
|
125
147
|
return {};
|
|
@@ -231,13 +253,15 @@ function normalizeRailwayVolumeInstance(node) {
|
|
|
231
253
|
environmentId: railwayConnectionLabel(node.environmentId) || railwayConnectionLabel(node.environment?.id) || null,
|
|
232
254
|
mountPath: railwayConnectionLabel(node.mountPath) || railwayConnectionLabel(node.mount_path) || null,
|
|
233
255
|
state: railwayConnectionLabel(node.state) || null,
|
|
256
|
+
isPendingDeletion: node.isPendingDeletion === true || node.pendingDeletion === true,
|
|
257
|
+
deletedAt: railwayConnectionLabel(node.deletedAt) || null,
|
|
234
258
|
sizeGb,
|
|
235
259
|
usedGb
|
|
236
260
|
};
|
|
237
261
|
}
|
|
238
262
|
function isActiveRailwayVolumeInstance(instance) {
|
|
239
263
|
const state = String(instance.state ?? "READY").toUpperCase();
|
|
240
|
-
return state !== "DELETING" && state !== "DELETED";
|
|
264
|
+
return !instance.isPendingDeletion && !(typeof instance.deletedAt === "string" && instance.deletedAt.trim()) && state !== "DELETING" && state !== "DELETED";
|
|
241
265
|
}
|
|
242
266
|
function normalizeVolumeInstances(value) {
|
|
243
267
|
const direct = Array.isArray(value) ? value : null;
|
|
@@ -300,6 +324,13 @@ function collectRailwayVolumes(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
300
324
|
}
|
|
301
325
|
return [...byId.values()];
|
|
302
326
|
}
|
|
327
|
+
function railwayApiTimeoutMs(env, explicitTimeoutMs) {
|
|
328
|
+
if (typeof explicitTimeoutMs === "number" && Number.isFinite(explicitTimeoutMs) && explicitTimeoutMs > 0) {
|
|
329
|
+
return explicitTimeoutMs;
|
|
330
|
+
}
|
|
331
|
+
const configured = Number.parseInt(String(env.TREESEED_RAILWAY_API_TIMEOUT_MS ?? "").trim(), 10);
|
|
332
|
+
return Number.isFinite(configured) && configured > 0 ? configured : 12e4;
|
|
333
|
+
}
|
|
303
334
|
async function railwayGraphqlRequest({
|
|
304
335
|
query,
|
|
305
336
|
variables,
|
|
@@ -307,19 +338,20 @@ async function railwayGraphqlRequest({
|
|
|
307
338
|
apiToken,
|
|
308
339
|
apiUrl,
|
|
309
340
|
fetchImpl = fetch,
|
|
310
|
-
timeoutMs
|
|
311
|
-
retries =
|
|
341
|
+
timeoutMs,
|
|
342
|
+
retries = 4
|
|
312
343
|
}) {
|
|
313
344
|
const token = apiToken || resolveRailwayApiToken(env);
|
|
314
345
|
if (!token) {
|
|
315
|
-
throw new Error("Configure
|
|
346
|
+
throw new Error("Configure TREESEED_RAILWAY_API_TOKEN before invoking Railway APIs.");
|
|
316
347
|
}
|
|
348
|
+
const requestTimeoutMs = railwayApiTimeoutMs(env, timeoutMs);
|
|
317
349
|
let attempt = 0;
|
|
318
350
|
for (; ; ) {
|
|
319
351
|
const controller = new AbortController();
|
|
320
352
|
let timer = null;
|
|
321
353
|
try {
|
|
322
|
-
const response = fetchImpl === fetch ? await railwayGraphqlHttpsRequest(apiUrl || resolveRailwayApiUrl(env), token, { query, variables },
|
|
354
|
+
const response = fetchImpl === fetch ? await railwayGraphqlHttpsRequest(apiUrl || resolveRailwayApiUrl(env), token, { query, variables }, requestTimeoutMs) : await Promise.race([
|
|
323
355
|
fetchImpl(apiUrl || resolveRailwayApiUrl(env), {
|
|
324
356
|
method: "POST",
|
|
325
357
|
headers: {
|
|
@@ -337,8 +369,8 @@ async function railwayGraphqlRequest({
|
|
|
337
369
|
new Promise((_, reject) => {
|
|
338
370
|
timer = setTimeout(() => {
|
|
339
371
|
controller.abort();
|
|
340
|
-
reject(markRailwayTransientError(new Error(`Railway API request timed out after ${
|
|
341
|
-
},
|
|
372
|
+
reject(markRailwayTransientError(new Error(`Railway API request timed out after ${requestTimeoutMs}ms.`)));
|
|
373
|
+
}, requestTimeoutMs);
|
|
342
374
|
})
|
|
343
375
|
]);
|
|
344
376
|
const payload = response.payload;
|
|
@@ -372,7 +404,24 @@ async function railwayGraphqlRequest({
|
|
|
372
404
|
async function railwayGraphqlHttpsRequest(url, token, body, timeoutMs) {
|
|
373
405
|
const rawBody = JSON.stringify(body);
|
|
374
406
|
return new Promise((resolve, reject) => {
|
|
375
|
-
|
|
407
|
+
let settled = false;
|
|
408
|
+
let req = null;
|
|
409
|
+
const hardTimeout = setTimeout(() => {
|
|
410
|
+
if (settled) return;
|
|
411
|
+
settled = true;
|
|
412
|
+
const error = markRailwayTransientError(new Error(`Railway API request timed out after ${timeoutMs}ms.`));
|
|
413
|
+
if (req) {
|
|
414
|
+
req.destroy(error);
|
|
415
|
+
}
|
|
416
|
+
reject(error);
|
|
417
|
+
}, timeoutMs);
|
|
418
|
+
const finish = (callback) => {
|
|
419
|
+
if (settled) return;
|
|
420
|
+
settled = true;
|
|
421
|
+
clearTimeout(hardTimeout);
|
|
422
|
+
callback();
|
|
423
|
+
};
|
|
424
|
+
req = httpsRequest(url, {
|
|
376
425
|
method: "POST",
|
|
377
426
|
headers: {
|
|
378
427
|
authorization: `Bearer ${token}`,
|
|
@@ -394,18 +443,21 @@ async function railwayGraphqlHttpsRequest(url, token, body, timeoutMs) {
|
|
|
394
443
|
}
|
|
395
444
|
const status = res.statusCode ?? 0;
|
|
396
445
|
const retryAfterHeader = res.headers["retry-after"];
|
|
397
|
-
resolve({
|
|
446
|
+
finish(() => resolve({
|
|
398
447
|
ok: status >= 200 && status < 300,
|
|
399
448
|
status,
|
|
400
449
|
payload,
|
|
401
450
|
retryAfter: Array.isArray(retryAfterHeader) ? retryAfterHeader[0] ?? null : retryAfterHeader ?? null
|
|
402
|
-
});
|
|
451
|
+
}));
|
|
403
452
|
});
|
|
404
453
|
});
|
|
405
454
|
req.on("timeout", () => {
|
|
406
|
-
|
|
455
|
+
const error = markRailwayTransientError(new Error(`Railway API request timed out after ${timeoutMs}ms.`));
|
|
456
|
+
if (!settled) {
|
|
457
|
+
req?.destroy(error);
|
|
458
|
+
}
|
|
407
459
|
});
|
|
408
|
-
req.on("error", reject);
|
|
460
|
+
req.on("error", (error) => finish(() => reject(error)));
|
|
409
461
|
req.write(rawBody);
|
|
410
462
|
req.end();
|
|
411
463
|
});
|
|
@@ -660,28 +712,71 @@ query TreeseedRailwayProjectEnvironments($projectId: String!) {
|
|
|
660
712
|
});
|
|
661
713
|
return normalizeConnectionNodes(payload.data?.project ? payload.data.project.environments : null, normalizeEnvironment);
|
|
662
714
|
}
|
|
715
|
+
async function listRailwayEnvironmentServices({
|
|
716
|
+
environmentId,
|
|
717
|
+
env = process.env,
|
|
718
|
+
fetchImpl = fetch
|
|
719
|
+
}) {
|
|
720
|
+
const payload = await railwayGraphqlRequest({
|
|
721
|
+
query: `
|
|
722
|
+
query TreeseedRailwayEnvironmentServices($environmentId: String!) {
|
|
723
|
+
environment(id: $environmentId) {
|
|
724
|
+
id
|
|
725
|
+
name
|
|
726
|
+
serviceInstances(first: 100) {
|
|
727
|
+
edges {
|
|
728
|
+
node {
|
|
729
|
+
id
|
|
730
|
+
serviceId
|
|
731
|
+
serviceName
|
|
732
|
+
environmentId
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
`.trim(),
|
|
739
|
+
variables: { environmentId },
|
|
740
|
+
env,
|
|
741
|
+
fetchImpl
|
|
742
|
+
});
|
|
743
|
+
return normalizeConnectionNodes(
|
|
744
|
+
payload.data?.environment ? payload.data.environment.serviceInstances : null,
|
|
745
|
+
normalizeServiceInstanceService
|
|
746
|
+
);
|
|
747
|
+
}
|
|
663
748
|
async function ensureRailwayService({
|
|
664
749
|
projectId,
|
|
665
750
|
serviceName,
|
|
666
751
|
serviceId,
|
|
667
752
|
environmentId,
|
|
668
753
|
imageRef,
|
|
754
|
+
sourceRepo,
|
|
755
|
+
sourceBranch,
|
|
669
756
|
env = process.env,
|
|
670
757
|
fetchImpl = fetch
|
|
671
758
|
}) {
|
|
672
759
|
const services = await listRailwayServices({ projectId, env, fetchImpl });
|
|
673
760
|
const desiredServiceName = railwayConnectionLabel(serviceName);
|
|
674
761
|
const desiredServiceId = railwayConnectionLabel(serviceId);
|
|
675
|
-
|
|
762
|
+
let existing = services.find(
|
|
676
763
|
(service2) => desiredServiceId && service2.id === desiredServiceId || desiredServiceName && service2.name === desiredServiceName
|
|
677
764
|
) ?? null;
|
|
765
|
+
if (!existing && environmentId) {
|
|
766
|
+
const environmentServices = await listRailwayEnvironmentServices({ environmentId, env, fetchImpl }).catch(() => []);
|
|
767
|
+
existing = environmentServices.find(
|
|
768
|
+
(service2) => desiredServiceId && service2.id === desiredServiceId || desiredServiceName && service2.name === desiredServiceName
|
|
769
|
+
) ?? null;
|
|
770
|
+
}
|
|
678
771
|
if (existing) {
|
|
679
772
|
const desiredImageRef = railwayConnectionLabel(imageRef);
|
|
680
|
-
|
|
773
|
+
const desiredSourceRepo = railwayConnectionLabel(sourceRepo);
|
|
774
|
+
if (desiredSourceRepo) {
|
|
681
775
|
try {
|
|
682
|
-
await
|
|
776
|
+
await updateRailwayServiceGitSource({
|
|
683
777
|
serviceId: existing.id,
|
|
684
|
-
|
|
778
|
+
sourceRepo: desiredSourceRepo,
|
|
779
|
+
sourceBranch,
|
|
685
780
|
env,
|
|
686
781
|
fetchImpl
|
|
687
782
|
});
|
|
@@ -689,17 +784,27 @@ async function ensureRailwayService({
|
|
|
689
784
|
if (!looksLikeRailwayImageSourceUpdateUnsupported(error)) {
|
|
690
785
|
throw error;
|
|
691
786
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
787
|
+
throw new Error(
|
|
788
|
+
`Railway Git source update for existing service ${existing.name} (${existing.id}) is unsupported; refusing to delete and recreate an existing service. Repair the service in place or use a provider-supported source update.`
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
return { service: existing, created: false };
|
|
792
|
+
}
|
|
793
|
+
if (desiredImageRef) {
|
|
794
|
+
try {
|
|
795
|
+
await updateRailwayServiceImageSource({
|
|
796
|
+
serviceId: existing.id,
|
|
698
797
|
imageRef: desiredImageRef,
|
|
699
798
|
env,
|
|
700
799
|
fetchImpl
|
|
701
800
|
});
|
|
702
|
-
|
|
801
|
+
} catch (error) {
|
|
802
|
+
if (!looksLikeRailwayImageSourceUpdateUnsupported(error)) {
|
|
803
|
+
throw error;
|
|
804
|
+
}
|
|
805
|
+
throw new Error(
|
|
806
|
+
`Railway image source update for existing service ${existing.name} (${existing.id}) is unsupported; refusing to delete and recreate an existing service. Repair the service in place or use a provider-supported image source update.`
|
|
807
|
+
);
|
|
703
808
|
}
|
|
704
809
|
}
|
|
705
810
|
return { service: existing, created: false };
|
|
@@ -712,6 +817,8 @@ async function ensureRailwayService({
|
|
|
712
817
|
environmentId,
|
|
713
818
|
serviceName: desiredServiceName,
|
|
714
819
|
imageRef,
|
|
820
|
+
sourceRepo,
|
|
821
|
+
sourceBranch,
|
|
715
822
|
env,
|
|
716
823
|
fetchImpl
|
|
717
824
|
});
|
|
@@ -722,9 +829,13 @@ async function createRailwayImageService({
|
|
|
722
829
|
serviceName,
|
|
723
830
|
environmentId,
|
|
724
831
|
imageRef,
|
|
832
|
+
sourceRepo,
|
|
833
|
+
sourceBranch,
|
|
725
834
|
env = process.env,
|
|
726
835
|
fetchImpl = fetch
|
|
727
836
|
}) {
|
|
837
|
+
const desiredSourceRepo = railwayConnectionLabel(sourceRepo);
|
|
838
|
+
const desiredImageRef = railwayConnectionLabel(imageRef);
|
|
728
839
|
const created = await railwayGraphqlRequest({
|
|
729
840
|
query: `
|
|
730
841
|
mutation TreeseedRailwayServiceCreate($input: ServiceCreateInput!) {
|
|
@@ -739,9 +850,14 @@ mutation TreeseedRailwayServiceCreate($input: ServiceCreateInput!) {
|
|
|
739
850
|
projectId,
|
|
740
851
|
name: serviceName,
|
|
741
852
|
...railwayConnectionLabel(environmentId) ? { environmentId: railwayConnectionLabel(environmentId) } : {},
|
|
742
|
-
...
|
|
853
|
+
...desiredSourceRepo ? {
|
|
854
|
+
source: {
|
|
855
|
+
repo: desiredSourceRepo
|
|
856
|
+
},
|
|
857
|
+
...railwayConnectionLabel(sourceBranch) ? { branch: railwayConnectionLabel(sourceBranch) } : {}
|
|
858
|
+
} : desiredImageRef ? {
|
|
743
859
|
source: {
|
|
744
|
-
image:
|
|
860
|
+
image: desiredImageRef
|
|
745
861
|
}
|
|
746
862
|
} : {}
|
|
747
863
|
}
|
|
@@ -755,23 +871,6 @@ mutation TreeseedRailwayServiceCreate($input: ServiceCreateInput!) {
|
|
|
755
871
|
}
|
|
756
872
|
return service;
|
|
757
873
|
}
|
|
758
|
-
async function waitForRailwayServiceMissing({
|
|
759
|
-
projectId,
|
|
760
|
-
serviceId,
|
|
761
|
-
env = process.env,
|
|
762
|
-
fetchImpl = fetch,
|
|
763
|
-
attempts = 20,
|
|
764
|
-
delayMs = 1500
|
|
765
|
-
}) {
|
|
766
|
-
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
767
|
-
const services = await listRailwayServices({ projectId, env, fetchImpl }).catch(() => []);
|
|
768
|
-
if (!services.some((service) => service.id === serviceId)) {
|
|
769
|
-
return true;
|
|
770
|
-
}
|
|
771
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
772
|
-
}
|
|
773
|
-
throw new Error(`Railway service ${serviceId} was not deleted before image source replacement.`);
|
|
774
|
-
}
|
|
775
874
|
function looksLikeRailwayImageSourceUpdateUnsupported(error) {
|
|
776
875
|
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
777
876
|
return /Problem processing request|source|image|ServiceUpdateInput/iu.test(message);
|
|
@@ -788,8 +887,8 @@ async function updateRailwayServiceImageSource({
|
|
|
788
887
|
}
|
|
789
888
|
const payload = await railwayGraphqlRequest({
|
|
790
889
|
query: `
|
|
791
|
-
mutation TreeseedRailwayServiceImageSourceUpdate($id: String!, $input:
|
|
792
|
-
|
|
890
|
+
mutation TreeseedRailwayServiceImageSourceUpdate($id: String!, $input: ServiceConnectInput!) {
|
|
891
|
+
serviceConnect(id: $id, input: $input) {
|
|
793
892
|
id
|
|
794
893
|
name
|
|
795
894
|
}
|
|
@@ -798,20 +897,67 @@ mutation TreeseedRailwayServiceImageSourceUpdate($id: String!, $input: ServiceUp
|
|
|
798
897
|
variables: {
|
|
799
898
|
id: serviceId,
|
|
800
899
|
input: {
|
|
801
|
-
|
|
802
|
-
image: desiredImage
|
|
803
|
-
}
|
|
900
|
+
image: desiredImage
|
|
804
901
|
}
|
|
805
902
|
},
|
|
806
903
|
env,
|
|
807
904
|
fetchImpl
|
|
808
905
|
});
|
|
809
|
-
const service = payload.data?.
|
|
906
|
+
const service = payload.data?.serviceConnect ? normalizeService(payload.data.serviceConnect) : null;
|
|
810
907
|
if (!service) {
|
|
811
908
|
throw new Error(`Railway service image source update did not return a usable service for ${serviceId}.`);
|
|
812
909
|
}
|
|
813
910
|
return service;
|
|
814
911
|
}
|
|
912
|
+
async function updateRailwayServiceGitSource({
|
|
913
|
+
serviceId,
|
|
914
|
+
sourceRepo,
|
|
915
|
+
sourceBranch,
|
|
916
|
+
env = process.env,
|
|
917
|
+
fetchImpl = fetch
|
|
918
|
+
}) {
|
|
919
|
+
const desiredRepo = railwayConnectionLabel(sourceRepo);
|
|
920
|
+
if (!serviceId || !desiredRepo) {
|
|
921
|
+
throw new Error("Railway service Git source update requires a service id and repository slug.");
|
|
922
|
+
}
|
|
923
|
+
const connect = async (repo) => {
|
|
924
|
+
const payload2 = await railwayGraphqlRequest({
|
|
925
|
+
query: `
|
|
926
|
+
mutation TreeseedRailwayServiceGitSourceUpdate($id: String!, $input: ServiceConnectInput!) {
|
|
927
|
+
serviceConnect(id: $id, input: $input) {
|
|
928
|
+
id
|
|
929
|
+
name
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
`.trim(),
|
|
933
|
+
variables: {
|
|
934
|
+
id: serviceId,
|
|
935
|
+
input: {
|
|
936
|
+
repo,
|
|
937
|
+
...railwayConnectionLabel(sourceBranch) ? { branch: railwayConnectionLabel(sourceBranch) } : {}
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
env,
|
|
941
|
+
fetchImpl
|
|
942
|
+
});
|
|
943
|
+
return payload2;
|
|
944
|
+
};
|
|
945
|
+
let payload;
|
|
946
|
+
try {
|
|
947
|
+
payload = await connect(desiredRepo);
|
|
948
|
+
} catch (error) {
|
|
949
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
950
|
+
if (!/User does not have access to the repo/iu.test(message) || /^https?:\/\//iu.test(desiredRepo)) {
|
|
951
|
+
throw error;
|
|
952
|
+
}
|
|
953
|
+
payload = await connect(`https://github.com/${desiredRepo}`);
|
|
954
|
+
}
|
|
955
|
+
const service = payload.data?.serviceConnect ? normalizeService(payload.data.serviceConnect) : null;
|
|
956
|
+
if (!service) {
|
|
957
|
+
throw new Error(`Railway service Git source update did not return a usable service for ${serviceId}.`);
|
|
958
|
+
}
|
|
959
|
+
return service;
|
|
960
|
+
}
|
|
815
961
|
async function ensureRailwayGeneratedServiceDomain({
|
|
816
962
|
projectId,
|
|
817
963
|
environmentId,
|
|
@@ -986,7 +1132,9 @@ async function ensureRailwayPostgresService({
|
|
|
986
1132
|
if (proof.ok) {
|
|
987
1133
|
return { service: existing, created: false, proof };
|
|
988
1134
|
}
|
|
989
|
-
|
|
1135
|
+
throw new Error(
|
|
1136
|
+
`Railway Postgres service ${existing.name} (${existing.id}) failed proof; refusing to delete and recreate an existing service. Repair the existing database service in place and rerun reconciliation.`
|
|
1137
|
+
);
|
|
990
1138
|
}
|
|
991
1139
|
const template = await getRailwayTemplateByCode({ code: "postgres", env, fetchImpl });
|
|
992
1140
|
await deployRailwayTemplate({
|
|
@@ -1157,6 +1305,7 @@ query TreeseedRailwayServiceDeploymentHealth($serviceId: String!, $environmentId
|
|
|
1157
1305
|
latestDeployment {
|
|
1158
1306
|
status
|
|
1159
1307
|
deploymentStopped
|
|
1308
|
+
meta
|
|
1160
1309
|
instances {
|
|
1161
1310
|
status
|
|
1162
1311
|
}
|
|
@@ -1176,6 +1325,12 @@ query TreeseedRailwayServiceDeploymentHealth($serviceId: String!, $environmentId
|
|
|
1176
1325
|
return {
|
|
1177
1326
|
ok,
|
|
1178
1327
|
status,
|
|
1328
|
+
branch: railwayConnectionLabel(deployment?.meta?.branch) || null,
|
|
1329
|
+
repo: railwayConnectionLabel(deployment?.meta?.repo) || null,
|
|
1330
|
+
rootDirectory: railwayConnectionLabel(deployment?.meta?.rootDirectory) || null,
|
|
1331
|
+
commitHash: railwayConnectionLabel(deployment?.meta?.commitHash) || null,
|
|
1332
|
+
requiredMountPath: railwayConnectionLabel(deployment?.meta?.serviceManifest?.deploy?.requiredMountPath) || null,
|
|
1333
|
+
volumeMounts: Array.isArray(deployment?.meta?.volumeMounts) ? deployment.meta.volumeMounts.map((entry) => railwayConnectionLabel(entry)).filter(Boolean) : [],
|
|
1179
1334
|
message: ok ? "Deployment is healthy." : `Latest deployment status is ${status ?? "unknown"}${stopped ? " and stopped" : ""}${instanceStatuses.length ? `; instances=${instanceStatuses.join(",")}` : ""}.`
|
|
1180
1335
|
};
|
|
1181
1336
|
}
|
|
@@ -1215,6 +1370,8 @@ async function getRailwayServiceInstance({
|
|
|
1215
1370
|
const legacySummary = {
|
|
1216
1371
|
id: null,
|
|
1217
1372
|
buildCommand: null,
|
|
1373
|
+
dockerfilePath: null,
|
|
1374
|
+
railwayConfigFile: null,
|
|
1218
1375
|
startCommand: null,
|
|
1219
1376
|
cronSchedule: null,
|
|
1220
1377
|
rootDirectory: null,
|
|
@@ -1233,6 +1390,8 @@ query TreeseedRailwayServiceInstance($serviceId: String!, $environmentId: String
|
|
|
1233
1390
|
serviceInstance(serviceId: $serviceId, environmentId: $environmentId) {
|
|
1234
1391
|
id
|
|
1235
1392
|
buildCommand
|
|
1393
|
+
dockerfilePath
|
|
1394
|
+
railwayConfigFile
|
|
1236
1395
|
startCommand
|
|
1237
1396
|
cronSchedule
|
|
1238
1397
|
rootDirectory
|
|
@@ -1250,6 +1409,8 @@ query TreeseedRailwayServiceInstance($serviceId: String!, $environmentId: String
|
|
|
1250
1409
|
return {
|
|
1251
1410
|
id: railwayConnectionLabel(instance?.id) || null,
|
|
1252
1411
|
buildCommand: railwayConnectionLabel(instance?.buildCommand) || null,
|
|
1412
|
+
dockerfilePath: railwayConnectionLabel(instance?.dockerfilePath) || null,
|
|
1413
|
+
railwayConfigFile: railwayConnectionLabel(instance?.railwayConfigFile) || null,
|
|
1253
1414
|
startCommand: railwayConnectionLabel(instance?.startCommand) || null,
|
|
1254
1415
|
cronSchedule: railwayConnectionLabel(instance?.cronSchedule) || null,
|
|
1255
1416
|
rootDirectory: railwayConnectionLabel(instance?.rootDirectory) || null,
|
|
@@ -1270,6 +1431,8 @@ query TreeseedRailwayServiceInstanceLegacy($serviceId: String!, $environmentId:
|
|
|
1270
1431
|
serviceInstance(serviceId: $serviceId, environmentId: $environmentId) {
|
|
1271
1432
|
id
|
|
1272
1433
|
buildCommand
|
|
1434
|
+
dockerfilePath
|
|
1435
|
+
railwayConfigFile
|
|
1273
1436
|
startCommand
|
|
1274
1437
|
cronSchedule
|
|
1275
1438
|
rootDirectory
|
|
@@ -1285,6 +1448,8 @@ query TreeseedRailwayServiceInstanceLegacy($serviceId: String!, $environmentId:
|
|
|
1285
1448
|
...legacySummary,
|
|
1286
1449
|
id: railwayConnectionLabel(instance?.id) || null,
|
|
1287
1450
|
buildCommand: railwayConnectionLabel(instance?.buildCommand) || null,
|
|
1451
|
+
dockerfilePath: railwayConnectionLabel(instance?.dockerfilePath) || null,
|
|
1452
|
+
railwayConfigFile: railwayConnectionLabel(instance?.railwayConfigFile) || null,
|
|
1288
1453
|
startCommand: railwayConnectionLabel(instance?.startCommand) || null,
|
|
1289
1454
|
cronSchedule: railwayConnectionLabel(instance?.cronSchedule) || null,
|
|
1290
1455
|
rootDirectory: railwayConnectionLabel(instance?.rootDirectory) || null
|
|
@@ -1300,6 +1465,8 @@ async function ensureRailwayServiceInstanceConfiguration({
|
|
|
1300
1465
|
serviceId,
|
|
1301
1466
|
environmentId,
|
|
1302
1467
|
buildCommand,
|
|
1468
|
+
dockerfilePath,
|
|
1469
|
+
railwayConfigFile,
|
|
1303
1470
|
startCommand,
|
|
1304
1471
|
cronSchedule,
|
|
1305
1472
|
rootDirectory,
|
|
@@ -1328,6 +1495,8 @@ async function ensureRailwayServiceInstanceConfiguration({
|
|
|
1328
1495
|
const desiredDeploymentRegion = railwayConnectionLabel(deploymentRegion) || null;
|
|
1329
1496
|
const desired = {
|
|
1330
1497
|
buildCommand: railwayConnectionLabel(buildCommand) || null,
|
|
1498
|
+
dockerfilePath: railwayConnectionLabel(dockerfilePath) || null,
|
|
1499
|
+
railwayConfigFile: railwayConnectionLabel(railwayConfigFile) || null,
|
|
1331
1500
|
startCommand: railwayConnectionLabel(startCommand) || null,
|
|
1332
1501
|
cronSchedule: railwayConnectionLabel(cronSchedule) || null,
|
|
1333
1502
|
rootDirectory: railwayConnectionLabel(rootDirectory) || null,
|
|
@@ -1349,7 +1518,7 @@ async function ensureRailwayServiceInstanceConfiguration({
|
|
|
1349
1518
|
if (desired.restartPolicy !== null) {
|
|
1350
1519
|
throw new Error("Railway service instance restart policies are unsupported by the current Railway API schema.");
|
|
1351
1520
|
}
|
|
1352
|
-
const drifted = desired.buildCommand !== null && desired.buildCommand !== current.buildCommand || desired.startCommand !== null && desired.startCommand !== current.startCommand || desired.cronSchedule !== null && desired.cronSchedule !== current.cronSchedule || desired.rootDirectory !== null && desired.rootDirectory !== current.rootDirectory || desired.healthcheckPath !== null && desired.healthcheckPath !== current.healthcheckPath || desired.healthcheckTimeoutSeconds !== null && desired.healthcheckTimeoutSeconds !== current.healthcheckTimeoutSeconds || desired.runtimeMode !== null && desired.runtimeMode !== current.runtimeMode || desired.deploymentRegion !== null;
|
|
1521
|
+
const drifted = desired.buildCommand !== null && desired.buildCommand !== current.buildCommand || desired.dockerfilePath !== null && desired.dockerfilePath !== current.dockerfilePath || desired.railwayConfigFile !== null && desired.railwayConfigFile !== current.railwayConfigFile || desired.startCommand !== null && desired.startCommand !== current.startCommand || desired.cronSchedule !== null && desired.cronSchedule !== current.cronSchedule || desired.rootDirectory !== null && desired.rootDirectory !== current.rootDirectory || desired.healthcheckPath !== null && desired.healthcheckPath !== current.healthcheckPath || desired.healthcheckTimeoutSeconds !== null && desired.healthcheckTimeoutSeconds !== current.healthcheckTimeoutSeconds || desired.runtimeMode !== null && desired.runtimeMode !== current.runtimeMode || desired.deploymentRegion !== null;
|
|
1353
1522
|
if (!drifted) {
|
|
1354
1523
|
return { instance: current, updated: false };
|
|
1355
1524
|
}
|
|
@@ -1370,6 +1539,8 @@ mutation TreeseedRailwayServiceInstanceUpdateLegacy($serviceId: String!, $enviro
|
|
|
1370
1539
|
environmentId,
|
|
1371
1540
|
input: {
|
|
1372
1541
|
...desired.buildCommand !== null ? { buildCommand: desired.buildCommand } : {},
|
|
1542
|
+
...desired.dockerfilePath !== null ? { dockerfilePath: desired.dockerfilePath } : {},
|
|
1543
|
+
...desired.railwayConfigFile !== null ? { railwayConfigFile: desired.railwayConfigFile } : {},
|
|
1373
1544
|
...desired.startCommand !== null ? { startCommand: desired.startCommand } : {},
|
|
1374
1545
|
...desired.cronSchedule !== null ? { cronSchedule: desired.cronSchedule } : {},
|
|
1375
1546
|
...desired.rootDirectory !== null ? { rootDirectory: desired.rootDirectory } : {},
|
|
@@ -1474,6 +1645,21 @@ mutation TreeseedRailwayVariableCollectionUpsert($input: VariableCollectionUpser
|
|
|
1474
1645
|
replace: false,
|
|
1475
1646
|
skipDeploys: true
|
|
1476
1647
|
};
|
|
1648
|
+
const upsertOne = (key, value) => railwayGraphqlRequest({
|
|
1649
|
+
query,
|
|
1650
|
+
variables: {
|
|
1651
|
+
input: {
|
|
1652
|
+
projectId,
|
|
1653
|
+
environmentId,
|
|
1654
|
+
serviceId: serviceId || null,
|
|
1655
|
+
variables: { [key]: value },
|
|
1656
|
+
replace: false,
|
|
1657
|
+
skipDeploys: true
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
env,
|
|
1661
|
+
fetchImpl
|
|
1662
|
+
});
|
|
1477
1663
|
try {
|
|
1478
1664
|
await railwayGraphqlRequest({
|
|
1479
1665
|
query,
|
|
@@ -1487,23 +1673,29 @@ mutation TreeseedRailwayVariableCollectionUpsert($input: VariableCollectionUpser
|
|
|
1487
1673
|
throw error;
|
|
1488
1674
|
}
|
|
1489
1675
|
for (const [key, value] of Object.entries(variables)) {
|
|
1490
|
-
await
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1676
|
+
await upsertOne(key, value);
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
const observed = await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({}));
|
|
1680
|
+
const missing = Object.keys(variables).filter((key) => observed[key] == null);
|
|
1681
|
+
for (const key of missing) {
|
|
1682
|
+
await upsertOne(key, variables[key]);
|
|
1683
|
+
}
|
|
1684
|
+
let retried = missing.length > 0 ? await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({})) : observed;
|
|
1685
|
+
let stillMissing = Object.keys(variables).filter((key) => retried[key] == null);
|
|
1686
|
+
for (let attempt = 0; stillMissing.length > 0 && attempt < 12; attempt += 1) {
|
|
1687
|
+
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
1688
|
+
retried = await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({}));
|
|
1689
|
+
stillMissing = Object.keys(variables).filter((key) => retried[key] == null);
|
|
1690
|
+
if (stillMissing.length > 0 && attempt === 5) {
|
|
1691
|
+
for (const key of stillMissing) {
|
|
1692
|
+
await upsertOne(key, variables[key]);
|
|
1693
|
+
}
|
|
1505
1694
|
}
|
|
1506
1695
|
}
|
|
1696
|
+
if (stillMissing.length > 0) {
|
|
1697
|
+
throw new Error(`Railway variable upsert did not persist: ${stillMissing.join(", ")}.`);
|
|
1698
|
+
}
|
|
1507
1699
|
}
|
|
1508
1700
|
async function listRailwayVolumes({
|
|
1509
1701
|
projectId,
|
|
@@ -1528,6 +1720,8 @@ query TreeseedRailwayVolumeList($projectId: String!) {
|
|
|
1528
1720
|
environmentId
|
|
1529
1721
|
mountPath
|
|
1530
1722
|
state
|
|
1723
|
+
isPendingDeletion
|
|
1724
|
+
deletedAt
|
|
1531
1725
|
}
|
|
1532
1726
|
}
|
|
1533
1727
|
}
|
|
@@ -1562,15 +1756,17 @@ mutation TreeseedRailwayVolumeCreate($input: VolumeCreateInput!) {
|
|
|
1562
1756
|
projectId
|
|
1563
1757
|
volumeInstances {
|
|
1564
1758
|
edges {
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1759
|
+
node {
|
|
1760
|
+
id
|
|
1761
|
+
serviceId
|
|
1762
|
+
environmentId
|
|
1763
|
+
mountPath
|
|
1764
|
+
state
|
|
1765
|
+
isPendingDeletion
|
|
1766
|
+
deletedAt
|
|
1767
|
+
}
|
|
1571
1768
|
}
|
|
1572
1769
|
}
|
|
1573
|
-
}
|
|
1574
1770
|
}
|
|
1575
1771
|
}
|
|
1576
1772
|
`.trim();
|
|
@@ -1626,15 +1822,17 @@ mutation TreeseedRailwayVolumeUpdate($volumeId: String!, $input: VolumeUpdateInp
|
|
|
1626
1822
|
projectId
|
|
1627
1823
|
volumeInstances {
|
|
1628
1824
|
edges {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1825
|
+
node {
|
|
1826
|
+
id
|
|
1827
|
+
serviceId
|
|
1828
|
+
environmentId
|
|
1829
|
+
mountPath
|
|
1830
|
+
state
|
|
1831
|
+
isPendingDeletion
|
|
1832
|
+
deletedAt
|
|
1833
|
+
}
|
|
1635
1834
|
}
|
|
1636
1835
|
}
|
|
1637
|
-
}
|
|
1638
1836
|
}
|
|
1639
1837
|
}
|
|
1640
1838
|
`.trim();
|
|
@@ -1666,7 +1864,7 @@ mutation TreeseedRailwayVolumeInstanceUpdate($volumeId: String!, $input: VolumeI
|
|
|
1666
1864
|
variables: {
|
|
1667
1865
|
volumeId,
|
|
1668
1866
|
input: {
|
|
1669
|
-
...serviceId ? { serviceId } : {},
|
|
1867
|
+
...serviceId !== void 0 ? { serviceId } : {},
|
|
1670
1868
|
mountPath
|
|
1671
1869
|
}
|
|
1672
1870
|
},
|
|
@@ -1710,6 +1908,8 @@ async function ensureRailwayServiceVolume({
|
|
|
1710
1908
|
}
|
|
1711
1909
|
let volume = findRailwayVolumeForService(volumes, serviceId, environmentId) ?? findRailwayVolumeForService(volumes, serviceId) ?? activeVolumes.find(
|
|
1712
1910
|
(candidate) => candidate.name === name && candidate.instances.some((instance2) => instance2.environmentId === environmentId)
|
|
1911
|
+
) ?? activeVolumes.find(
|
|
1912
|
+
(candidate) => candidate.name === name && (candidate.instances.length === 0 || candidate.instances.some((instance2) => instance2.environmentId === environmentId))
|
|
1713
1913
|
) ?? null;
|
|
1714
1914
|
let created = false;
|
|
1715
1915
|
let updated = false;
|
|
@@ -1732,7 +1932,13 @@ async function ensureRailwayServiceVolume({
|
|
|
1732
1932
|
for (let attempt = 0; attempt < 8; attempt += 1) {
|
|
1733
1933
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
1734
1934
|
const refreshed = await listRailwayVolumes({ projectId, env, fetchImpl });
|
|
1735
|
-
const
|
|
1935
|
+
const activeRefreshed = refreshed.map((candidate) => ({
|
|
1936
|
+
...candidate,
|
|
1937
|
+
instances: candidate.instances.filter(isActiveRailwayVolumeInstance)
|
|
1938
|
+
})).filter((candidate) => candidate.instances.length > 0);
|
|
1939
|
+
const existing = findRailwayVolumeForService(refreshed, serviceId, environmentId) ?? findRailwayVolumeForService(refreshed, serviceId) ?? activeRefreshed.find(
|
|
1940
|
+
(candidate) => candidate.name === name && (candidate.instances.length === 0 || candidate.instances.some((instance2) => instance2.environmentId === environmentId))
|
|
1941
|
+
) ?? findSoleActiveRailwayVolumeForEnvironment(refreshed, environmentId);
|
|
1736
1942
|
if (existing) {
|
|
1737
1943
|
return existing;
|
|
1738
1944
|
}
|
|
@@ -1745,7 +1951,9 @@ async function ensureRailwayServiceVolume({
|
|
|
1745
1951
|
if (!volume) {
|
|
1746
1952
|
volume = await createReplacementVolume();
|
|
1747
1953
|
}
|
|
1748
|
-
const desiredNameInUse = volumes.some(
|
|
1954
|
+
const desiredNameInUse = volumes.some(
|
|
1955
|
+
(candidate) => candidate.id !== volume?.id && candidate.name === name && candidate.instances.some(isActiveRailwayVolumeInstance)
|
|
1956
|
+
);
|
|
1749
1957
|
if (volume.name && volume.name !== name && !desiredNameInUse) {
|
|
1750
1958
|
try {
|
|
1751
1959
|
volume = await updateRailwayVolumeName({ volumeId: volume.id, name, env, fetchImpl }) ?? { ...volume, name };
|
|
@@ -1869,6 +2077,15 @@ function findRailwayVolumeForService(volumes, serviceId, environmentId) {
|
|
|
1869
2077
|
)
|
|
1870
2078
|
) ?? null;
|
|
1871
2079
|
}
|
|
2080
|
+
function findSoleActiveRailwayVolumeForEnvironment(volumes, environmentId) {
|
|
2081
|
+
const active = volumes.map((candidate) => ({
|
|
2082
|
+
...candidate,
|
|
2083
|
+
instances: candidate.instances.filter(
|
|
2084
|
+
(instance) => instance.environmentId === environmentId && isActiveRailwayVolumeInstance(instance)
|
|
2085
|
+
)
|
|
2086
|
+
})).filter((candidate) => candidate.instances.length > 0);
|
|
2087
|
+
return active.length === 1 ? active[0] : null;
|
|
2088
|
+
}
|
|
1872
2089
|
function looksLikeRailwayVolumeCreateRace(error) {
|
|
1873
2090
|
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
1874
2091
|
return /already has a volume attached|would have \d+ volumes attached|can only have one volume|volume named .* already exists|already exists in this project|not authorized/iu.test(message);
|
|
@@ -1986,6 +2203,10 @@ function looksLikeRailwayMissingResource(error) {
|
|
|
1986
2203
|
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
1987
2204
|
return /not found|does not exist|could not find|unknown|invalid .*id/iu.test(message);
|
|
1988
2205
|
}
|
|
2206
|
+
function looksLikeRailwayOperationInProgress(error) {
|
|
2207
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
2208
|
+
return /operation is already in progress/iu.test(message);
|
|
2209
|
+
}
|
|
1989
2210
|
async function railwayDeleteMutation({
|
|
1990
2211
|
query,
|
|
1991
2212
|
variables,
|
|
@@ -1993,24 +2214,32 @@ async function railwayDeleteMutation({
|
|
|
1993
2214
|
fetchImpl,
|
|
1994
2215
|
missingResult
|
|
1995
2216
|
}) {
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2217
|
+
let lastError = null;
|
|
2218
|
+
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
2219
|
+
try {
|
|
2220
|
+
const payload = await railwayGraphqlRequest({
|
|
2221
|
+
query,
|
|
2222
|
+
variables,
|
|
2223
|
+
env,
|
|
2224
|
+
fetchImpl
|
|
2225
|
+
});
|
|
2226
|
+
const mutationResult = Object.values(payload.data ?? {})[0];
|
|
2227
|
+
if (mutationResult === false || mutationResult == null) {
|
|
2228
|
+
throw new Error("Railway delete mutation returned no successful deletion result.");
|
|
2229
|
+
}
|
|
2230
|
+
return { status: "deleted" };
|
|
2231
|
+
} catch (error) {
|
|
2232
|
+
if (looksLikeRailwayMissingResource(error)) {
|
|
2233
|
+
return missingResult;
|
|
2234
|
+
}
|
|
2235
|
+
if (!looksLikeRailwayOperationInProgress(error) || attempt >= 5) {
|
|
2236
|
+
throw error;
|
|
2237
|
+
}
|
|
2238
|
+
lastError = error;
|
|
2239
|
+
await new Promise((resolve) => setTimeout(resolve, 2500 * (attempt + 1)));
|
|
2011
2240
|
}
|
|
2012
|
-
throw error;
|
|
2013
2241
|
}
|
|
2242
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError ?? "Railway delete mutation did not complete."));
|
|
2014
2243
|
}
|
|
2015
2244
|
async function deleteRailwayCustomDomain({
|
|
2016
2245
|
domainId,
|
|
@@ -2175,6 +2404,7 @@ export {
|
|
|
2175
2404
|
inspectRailwayServiceDeploymentHealth,
|
|
2176
2405
|
isUsableRailwayToken,
|
|
2177
2406
|
listRailwayCustomDomains,
|
|
2407
|
+
listRailwayEnvironmentServices,
|
|
2178
2408
|
listRailwayEnvironments,
|
|
2179
2409
|
listRailwayProjects,
|
|
2180
2410
|
listRailwayServiceDomains,
|
|
@@ -2187,6 +2417,7 @@ export {
|
|
|
2187
2417
|
resolveRailwayApiUrl,
|
|
2188
2418
|
resolveRailwayWorkspace,
|
|
2189
2419
|
resolveRailwayWorkspaceContext,
|
|
2420
|
+
updateRailwayServiceGitSource,
|
|
2190
2421
|
updateRailwayServiceImageSource,
|
|
2191
2422
|
updateRailwayServiceName,
|
|
2192
2423
|
upsertRailwayVariables
|