@supatype/cli 0.7.0 → 0.8.0
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 +259 -0
- package/bin/supatype.js +25 -4
- package/deno.d.ts +1 -1
- package/dist/admin-prompt-state.d.ts +13 -0
- package/dist/admin-prompt-state.d.ts.map +1 -0
- package/dist/admin-prompt-state.js +30 -0
- package/dist/admin-prompt-state.js.map +1 -0
- package/dist/adopt-columns.d.ts.map +1 -1
- package/dist/adopt-columns.js +13 -17
- package/dist/adopt-columns.js.map +1 -1
- package/dist/app-config.d.ts +1 -1
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +103 -144
- package/dist/app-config.js.map +1 -1
- package/dist/applied-ast-artifacts.d.ts +16 -0
- package/dist/applied-ast-artifacts.d.ts.map +1 -0
- package/dist/applied-ast-artifacts.js +37 -0
- package/dist/applied-ast-artifacts.js.map +1 -0
- package/dist/archive-extract.d.ts +3 -0
- package/dist/archive-extract.d.ts.map +1 -0
- package/dist/archive-extract.js +19 -0
- package/dist/archive-extract.js.map +1 -0
- package/dist/binary-cache.d.ts +25 -2
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +115 -81
- package/dist/binary-cache.js.map +1 -1
- package/dist/binary-download-lock.d.ts.map +1 -1
- package/dist/binary-download-lock.js +1 -3
- package/dist/binary-download-lock.js.map +1 -1
- package/dist/byo-preflight.d.ts.map +1 -1
- package/dist/byo-preflight.js +2 -10
- package/dist/byo-preflight.js.map +1 -1
- package/dist/cache-pins.d.ts.map +1 -1
- package/dist/cache-pins.js +2 -2
- package/dist/cache-pins.js.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cloud-credentials.d.ts +6 -0
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +13 -0
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +18 -18
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +27 -8
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +5 -4
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.js +2 -4
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +116 -106
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +50 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +262 -266
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/functions.d.ts +30 -0
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +503 -507
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +11 -8
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/hooks.js +26 -11
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +16 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +237 -143
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts.map +1 -1
- package/dist/commands/internal.js +2 -1
- package/dist/commands/internal.js.map +1 -1
- package/dist/commands/keys.d.ts +36 -10
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +168 -128
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +30 -9
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +5 -4
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pg.js +2 -0
- package/dist/commands/pg.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +17 -7
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/push.d.ts +37 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +188 -73
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts +35 -0
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +72 -38
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +61 -29
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/status.js +5 -5
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/types.js +2 -5
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +212 -101
- package/dist/commands/update.js.map +1 -1
- package/dist/component-launch.d.ts +11 -0
- package/dist/component-launch.d.ts.map +1 -0
- package/dist/component-launch.js +35 -0
- package/dist/component-launch.js.map +1 -0
- package/dist/components.d.ts +7 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +7 -2
- package/dist/components.js.map +1 -1
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +5 -14
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-engine-run.d.ts +6 -5
- package/dist/compose-engine-run.d.ts.map +1 -1
- package/dist/compose-engine-run.js +44 -37
- package/dist/compose-engine-run.js.map +1 -1
- package/dist/compose-engine-service.d.ts +10 -0
- package/dist/compose-engine-service.d.ts.map +1 -0
- package/dist/compose-engine-service.js +16 -0
- package/dist/compose-engine-service.js.map +1 -0
- package/dist/compose-host-path.d.ts +14 -0
- package/dist/compose-host-path.d.ts.map +1 -0
- package/dist/compose-host-path.js +18 -0
- package/dist/compose-host-path.js.map +1 -0
- package/dist/compose-image-pull.d.ts +43 -0
- package/dist/compose-image-pull.d.ts.map +1 -0
- package/dist/compose-image-pull.js +27 -0
- package/dist/compose-image-pull.js.map +1 -0
- package/dist/compose-kong.d.ts.map +1 -1
- package/dist/compose-kong.js +10 -6
- package/dist/compose-kong.js.map +1 -1
- package/dist/compose-local-server-image.d.ts.map +1 -1
- package/dist/compose-local-server-image.js +7 -3
- package/dist/compose-local-server-image.js.map +1 -1
- package/dist/compose-render-mode.d.ts.map +1 -1
- package/dist/compose-render-mode.js +7 -4
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts +12 -2
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +27 -12
- package/dist/compose-services.js.map +1 -1
- package/dist/config-snapshot.d.ts +6 -0
- package/dist/config-snapshot.d.ts.map +1 -0
- package/dist/config-snapshot.js +23 -0
- package/dist/config-snapshot.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/database-url-owner.d.ts +57 -0
- package/dist/database-url-owner.d.ts.map +1 -0
- package/dist/database-url-owner.js +130 -0
- package/dist/database-url-owner.js.map +1 -0
- package/dist/db-port-offer.d.ts +18 -0
- package/dist/db-port-offer.d.ts.map +1 -0
- package/dist/db-port-offer.js +68 -0
- package/dist/db-port-offer.js.map +1 -0
- package/dist/db-port.d.ts +40 -18
- package/dist/db-port.d.ts.map +1 -1
- package/dist/db-port.js +33 -31
- package/dist/db-port.js.map +1 -1
- package/dist/db-preflight.d.ts +8 -0
- package/dist/db-preflight.d.ts.map +1 -1
- package/dist/db-preflight.js +18 -1
- package/dist/db-preflight.js.map +1 -1
- package/dist/db-rows.d.ts +11 -0
- package/dist/db-rows.d.ts.map +1 -1
- package/dist/db-rows.js +27 -0
- package/dist/db-rows.js.map +1 -1
- package/dist/debounce.d.ts +11 -0
- package/dist/debounce.d.ts.map +1 -0
- package/dist/debounce.js +23 -0
- package/dist/debounce.js.map +1 -0
- package/dist/dev-api-keys.d.ts +12 -2
- package/dist/dev-api-keys.d.ts.map +1 -1
- package/dist/dev-api-keys.js +33 -17
- package/dist/dev-api-keys.js.map +1 -1
- package/dist/dev-compose.d.ts +5 -12
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +153 -245
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-db-ready.d.ts.map +1 -1
- package/dist/dev-db-ready.js +2 -1
- package/dist/dev-db-ready.js.map +1 -1
- package/dist/dev-db-reset.d.ts.map +1 -1
- package/dist/dev-db-reset.js +5 -4
- package/dist/dev-db-reset.js.map +1 -1
- package/dist/dev-functions-watch.d.ts.map +1 -1
- package/dist/dev-functions-watch.js +5 -16
- package/dist/dev-functions-watch.js.map +1 -1
- package/dist/dev-ports.d.ts +22 -7
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +61 -38
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +7 -12
- package/dist/dev-schema-watch.js.map +1 -1
- package/dist/dev-session-lock.js +4 -3
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +3 -0
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +45 -0
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +206 -31
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/docker-address-pool.d.ts +23 -0
- package/dist/docker-address-pool.d.ts.map +1 -0
- package/dist/docker-address-pool.js +56 -0
- package/dist/docker-address-pool.js.map +1 -0
- package/dist/docker-exec.d.ts +92 -0
- package/dist/docker-exec.d.ts.map +1 -0
- package/dist/docker-exec.js +139 -0
- package/dist/docker-exec.js.map +1 -0
- package/dist/docker-postgres.d.ts +1 -6
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +67 -85
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +12 -1
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +48 -23
- package/dist/docker-runtime.js.map +1 -1
- package/dist/dotenv-parse.d.ts +22 -0
- package/dist/dotenv-parse.d.ts.map +1 -0
- package/dist/dotenv-parse.js +63 -0
- package/dist/dotenv-parse.js.map +1 -0
- package/dist/engine-answers.d.ts +0 -2
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +4 -3
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +10 -12
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-floor.d.ts +29 -0
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +56 -0
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-ownership-gate.d.ts +10 -0
- package/dist/engine-ownership-gate.d.ts.map +1 -1
- package/dist/engine-ownership-gate.js +31 -6
- package/dist/engine-ownership-gate.js.map +1 -1
- package/dist/ensure-binary.d.ts +9 -0
- package/dist/ensure-binary.d.ts.map +1 -1
- package/dist/ensure-binary.js +38 -5
- package/dist/ensure-binary.js.map +1 -1
- package/dist/ensure-component-binaries.d.ts.map +1 -1
- package/dist/ensure-component-binaries.js +2 -1
- package/dist/ensure-component-binaries.js.map +1 -1
- package/dist/env-file.d.ts +28 -8
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +80 -53
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +11 -0
- package/dist/env-lines.d.ts.map +1 -0
- package/dist/env-lines.js +36 -0
- package/dist/env-lines.js.map +1 -0
- package/dist/error-message.d.ts +34 -1
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +102 -2
- package/dist/error-message.js.map +1 -1
- package/dist/fetch-within.d.ts +10 -0
- package/dist/fetch-within.d.ts.map +1 -0
- package/dist/fetch-within.js +12 -0
- package/dist/fetch-within.js.map +1 -0
- package/dist/field-masking-tier.d.ts.map +1 -1
- package/dist/field-masking-tier.js +7 -5
- package/dist/field-masking-tier.js.map +1 -1
- package/dist/functions-context-refresh.d.ts +6 -2
- package/dist/functions-context-refresh.d.ts.map +1 -1
- package/dist/functions-context-refresh.js +11 -3
- package/dist/functions-context-refresh.js.map +1 -1
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +9 -2
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/{functions-router-gen.d.ts → functions-discovery.d.ts} +8 -10
- package/dist/functions-discovery.d.ts.map +1 -0
- package/dist/functions-discovery.js +87 -0
- package/dist/functions-discovery.js.map +1 -0
- package/dist/functions-template.d.ts.map +1 -1
- package/dist/functions-template.js +20 -12
- package/dist/functions-template.js.map +1 -1
- package/dist/functions-worker-files.d.ts +55 -0
- package/dist/functions-worker-files.d.ts.map +1 -0
- package/dist/functions-worker-files.js +149 -0
- package/dist/functions-worker-files.js.map +1 -0
- package/dist/generated/functions-worker-source.d.ts +2 -0
- package/dist/generated/functions-worker-source.d.ts.map +1 -0
- package/dist/generated/functions-worker-source.js +12 -0
- package/dist/generated/functions-worker-source.js.map +1 -0
- package/dist/generated/release-images.d.ts +18 -0
- package/dist/generated/release-images.d.ts.map +1 -0
- package/dist/generated/release-images.js +8 -0
- package/dist/generated/release-images.js.map +1 -0
- package/dist/generated-files-engine.d.ts +33 -0
- package/dist/generated-files-engine.d.ts.map +1 -0
- package/dist/generated-files-engine.js +45 -0
- package/dist/generated-files-engine.js.map +1 -0
- package/dist/hook-upload.d.ts +29 -15
- package/dist/hook-upload.d.ts.map +1 -1
- package/dist/hook-upload.js +88 -59
- package/dist/hook-upload.js.map +1 -1
- package/dist/hooks-generator.d.ts +5 -0
- package/dist/hooks-generator.d.ts.map +1 -1
- package/dist/hooks-generator.js +7 -2
- package/dist/hooks-generator.js.map +1 -1
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +31 -4
- package/dist/host-database.js.map +1 -1
- package/dist/init-dependency-versions.d.ts +3 -1
- package/dist/init-dependency-versions.d.ts.map +1 -1
- package/dist/init-dependency-versions.js +22 -6
- package/dist/init-dependency-versions.js.map +1 -1
- package/dist/init-example.d.ts +48 -0
- package/dist/init-example.d.ts.map +1 -0
- package/dist/init-example.js +110 -0
- package/dist/init-example.js.map +1 -0
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +2 -0
- package/dist/init-package-json.js.map +1 -1
- package/dist/init-setup-steps.d.ts +37 -0
- package/dist/init-setup-steps.d.ts.map +1 -0
- package/dist/init-setup-steps.js +118 -0
- package/dist/init-setup-steps.js.map +1 -0
- package/dist/jwt-secret-length.d.ts +5 -13
- package/dist/jwt-secret-length.d.ts.map +1 -1
- package/dist/jwt-secret-length.js +7 -22
- package/dist/jwt-secret-length.js.map +1 -1
- package/dist/jwt-secret-rules.d.ts +24 -0
- package/dist/jwt-secret-rules.d.ts.map +1 -0
- package/dist/jwt-secret-rules.js +46 -0
- package/dist/jwt-secret-rules.js.map +1 -0
- package/dist/local-gateway.d.ts +3 -6
- package/dist/local-gateway.d.ts.map +1 -1
- package/dist/local-gateway.js +7 -9
- package/dist/local-gateway.js.map +1 -1
- package/dist/local-secrets.d.ts +95 -11
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +153 -18
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +2 -7
- package/dist/local-stack.js.map +1 -1
- package/dist/local-storage.d.ts +7 -2
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/local-storage.js +11 -3
- package/dist/local-storage.js.map +1 -1
- package/dist/mailer-env.d.ts +37 -0
- package/dist/mailer-env.d.ts.map +1 -0
- package/dist/mailer-env.js +98 -0
- package/dist/mailer-env.js.map +1 -0
- package/dist/model-cache.d.ts +4 -8
- package/dist/model-cache.d.ts.map +1 -1
- package/dist/model-cache.js.map +1 -1
- package/dist/model-hooks.d.ts +17 -7
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +52 -39
- package/dist/model-hooks.js.map +1 -1
- package/dist/native-dev-env.d.ts +37 -1
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +64 -2
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-functions-watch.d.ts +56 -5
- package/dist/native-functions-watch.d.ts.map +1 -1
- package/dist/native-functions-watch.js +119 -38
- package/dist/native-functions-watch.js.map +1 -1
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +2 -2
- package/dist/native-keyspace.js.map +1 -1
- package/dist/native-realtime.d.ts +11 -3
- package/dist/native-realtime.d.ts.map +1 -1
- package/dist/native-realtime.js +162 -10
- package/dist/native-realtime.js.map +1 -1
- package/dist/native-roles-sql.d.ts +14 -0
- package/dist/native-roles-sql.d.ts.map +1 -1
- package/dist/native-roles-sql.js +82 -1
- package/dist/native-roles-sql.js.map +1 -1
- package/dist/native-storage-import.d.ts +19 -0
- package/dist/native-storage-import.d.ts.map +1 -0
- package/dist/native-storage-import.js +327 -0
- package/dist/native-storage-import.js.map +1 -0
- package/dist/native-storage.d.ts +45 -0
- package/dist/native-storage.d.ts.map +1 -0
- package/dist/native-storage.js +140 -0
- package/dist/native-storage.js.map +1 -0
- package/dist/native-worker.d.ts +26 -0
- package/dist/native-worker.d.ts.map +1 -0
- package/dist/native-worker.js +63 -0
- package/dist/native-worker.js.map +1 -0
- package/dist/owner-default.d.ts +9 -1
- package/dist/owner-default.d.ts.map +1 -1
- package/dist/owner-default.js +17 -4
- package/dist/owner-default.js.map +1 -1
- package/dist/post-apply.d.ts +3 -0
- package/dist/post-apply.d.ts.map +1 -0
- package/dist/post-apply.js +17 -0
- package/dist/post-apply.js.map +1 -0
- package/dist/postgres-ctl.d.ts +98 -7
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +273 -40
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +15 -3
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +18 -15
- package/dist/postgres-image.js.map +1 -1
- package/dist/postgrest-release.d.ts +9 -0
- package/dist/postgrest-release.d.ts.map +1 -1
- package/dist/postgrest-release.js +23 -0
- package/dist/postgrest-release.js.map +1 -1
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +3 -1
- package/dist/process-manager.js.map +1 -1
- package/dist/project-config.d.ts +40 -7
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +42 -4
- package/dist/project-config.js.map +1 -1
- package/dist/pull-utils.d.ts +15 -0
- package/dist/pull-utils.d.ts.map +1 -1
- package/dist/pull-utils.js +149 -23
- package/dist/pull-utils.js.map +1 -1
- package/dist/push-refusal.d.ts.map +1 -1
- package/dist/push-refusal.js +3 -2
- package/dist/push-refusal.js.map +1 -1
- package/dist/realtime-launch.d.ts +2 -5
- package/dist/realtime-launch.d.ts.map +1 -1
- package/dist/realtime-launch.js +6 -23
- package/dist/realtime-launch.js.map +1 -1
- package/dist/recorded-field-masking-tier.d.ts.map +1 -1
- package/dist/recorded-field-masking-tier.js +4 -3
- package/dist/recorded-field-masking-tier.js.map +1 -1
- package/dist/release-images.d.ts +31 -0
- package/dist/release-images.d.ts.map +1 -0
- package/dist/release-images.js +90 -0
- package/dist/release-images.js.map +1 -0
- package/dist/required-host-components.d.ts.map +1 -1
- package/dist/required-host-components.js +4 -0
- package/dist/required-host-components.js.map +1 -1
- package/dist/resolve-api-url.d.ts +17 -3
- package/dist/resolve-api-url.d.ts.map +1 -1
- package/dist/resolve-api-url.js +71 -30
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +62 -0
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +68 -23
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-ready.d.ts.map +1 -1
- package/dist/rest-ready.js +2 -1
- package/dist/rest-ready.js.map +1 -1
- package/dist/route-manifest.d.ts +25 -2
- package/dist/route-manifest.d.ts.map +1 -1
- package/dist/route-manifest.js +48 -4
- package/dist/route-manifest.js.map +1 -1
- package/dist/run-until-stopped.d.ts +12 -0
- package/dist/run-until-stopped.d.ts.map +1 -0
- package/dist/run-until-stopped.js +42 -0
- package/dist/run-until-stopped.js.map +1 -0
- package/dist/schema-ast-v2.d.ts +2 -1
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-push-lock.d.ts.map +1 -1
- package/dist/schema-push-lock.js +59 -46
- package/dist/schema-push-lock.js.map +1 -1
- package/dist/schema-sources.d.ts +19 -4
- package/dist/schema-sources.d.ts.map +1 -1
- package/dist/schema-sources.js +56 -35
- package/dist/schema-sources.js.map +1 -1
- package/dist/seed-auth-connect.d.ts +14 -0
- package/dist/seed-auth-connect.d.ts.map +1 -0
- package/dist/seed-auth-connect.js +97 -0
- package/dist/seed-auth-connect.js.map +1 -0
- package/dist/seed-runner.d.ts.map +1 -1
- package/dist/seed-runner.js +22 -1
- package/dist/seed-runner.js.map +1 -1
- package/dist/seed.d.ts +6 -3
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +32 -30
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +252 -152
- package/dist/self-host-compose.js.map +1 -1
- package/dist/service-role-key-file.d.ts +32 -0
- package/dist/service-role-key-file.d.ts.map +1 -0
- package/dist/service-role-key-file.js +90 -0
- package/dist/service-role-key-file.js.map +1 -0
- package/dist/shell-ports.d.ts +13 -2
- package/dist/shell-ports.d.ts.map +1 -1
- package/dist/shell-ports.js +18 -7
- package/dist/shell-ports.js.map +1 -1
- package/dist/stop-signals.d.ts +7 -0
- package/dist/stop-signals.d.ts.map +1 -0
- package/dist/stop-signals.js +12 -0
- package/dist/stop-signals.js.map +1 -0
- package/dist/storage-launch.d.ts +11 -0
- package/dist/storage-launch.d.ts.map +1 -0
- package/dist/storage-launch.js +41 -0
- package/dist/storage-launch.js.map +1 -0
- package/dist/storage-provision.d.ts +50 -5
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +101 -33
- package/dist/storage-provision.js.map +1 -1
- package/dist/systemd.d.ts +1 -1
- package/dist/systemd.d.ts.map +1 -1
- package/dist/systemd.js +26 -11
- package/dist/systemd.js.map +1 -1
- package/dist/tar-reader.d.ts +29 -0
- package/dist/tar-reader.d.ts.map +1 -0
- package/dist/tar-reader.js +99 -0
- package/dist/tar-reader.js.map +1 -0
- package/dist/target-client.d.ts +14 -1
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +134 -23
- package/dist/target-client.js.map +1 -1
- package/dist/target-request.d.ts +25 -0
- package/dist/target-request.d.ts.map +1 -0
- package/dist/target-request.js +33 -0
- package/dist/target-request.js.map +1 -0
- package/dist/target-warning.d.ts +7 -0
- package/dist/target-warning.d.ts.map +1 -0
- package/dist/target-warning.js +12 -0
- package/dist/target-warning.js.map +1 -0
- package/dist/type-extractor.d.ts +6 -0
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +118 -59
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/clack.d.ts.map +1 -1
- package/dist/ui/clack.js +11 -1
- package/dist/ui/clack.js.map +1 -1
- package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
- package/dist/ui/dev/DevDashboard.js +4 -2
- package/dist/ui/dev/DevDashboard.js.map +1 -1
- package/dist/ui/fatal.d.ts.map +1 -1
- package/dist/ui/fatal.js +6 -7
- package/dist/ui/fatal.js.map +1 -1
- package/dist/ui/flows/FlowApp.d.ts.map +1 -1
- package/dist/ui/flows/FlowApp.js +16 -1
- package/dist/ui/flows/FlowApp.js.map +1 -1
- package/dist/ui/flows/prompt-fields.d.ts +5 -0
- package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
- package/dist/ui/flows/prompt-fields.js +8 -1
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/messages.d.ts +6 -0
- package/dist/ui/messages.d.ts.map +1 -1
- package/dist/ui/messages.js +17 -0
- package/dist/ui/messages.js.map +1 -1
- package/dist/ui/progress.d.ts +7 -0
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +22 -8
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
- package/dist/ui/runtime/command-chrome.js +2 -0
- package/dist/ui/runtime/command-chrome.js.map +1 -1
- package/dist/ui/runtime/prompt-interrupt.d.ts +10 -0
- package/dist/ui/runtime/prompt-interrupt.d.ts.map +1 -0
- package/dist/ui/runtime/prompt-interrupt.js +24 -0
- package/dist/ui/runtime/prompt-interrupt.js.map +1 -0
- package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +5 -2
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts +14 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.js +44 -3
- package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
- package/dist/url-safe-passwords.d.ts +25 -0
- package/dist/url-safe-passwords.d.ts.map +1 -0
- package/dist/url-safe-passwords.js +70 -0
- package/dist/url-safe-passwords.js.map +1 -0
- package/dist/valkey-sidecar.d.ts +33 -6
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +90 -61
- package/dist/valkey-sidecar.js.map +1 -1
- package/dist/worker-module-files.d.ts +3 -0
- package/dist/worker-module-files.d.ts.map +1 -0
- package/dist/worker-module-files.js +18 -0
- package/dist/worker-module-files.js.map +1 -0
- package/package.json +9 -6
- package/dist/functions-router-gen.d.ts.map +0 -1
- package/dist/functions-router-gen.js +0 -302
- package/dist/functions-router-gen.js.map +0 -1
package/dist/dev-compose.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `supatype dev` when `provider: docker`, full self-host Compose stack (Kong gateway).
|
|
3
3
|
*/
|
|
4
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
4
5
|
import { projectOutputPaths, writeAstDerivedOutputs, writeSeedBuilder } from "./type-generation.js";
|
|
5
6
|
import { errorMessage } from "./error-message.js";
|
|
6
7
|
import { withPublishing } from "./model-versioning.js";
|
|
7
8
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
9
|
import { homedir } from "node:os";
|
|
9
10
|
import { dirname, join } from "node:path";
|
|
10
|
-
import {
|
|
11
|
+
import { askDocker, askDockerSync, DOCKER_EXEC_TIMEOUT_MS, DOCKER_QUERY_TIMEOUT_MS } from "./docker-exec.js";
|
|
11
12
|
import { startProxyDevApp, resolveProxyDevScript } from "./app/proxy-dev-app.js";
|
|
12
13
|
import { loadSchemaAst, projectNameInFile } from "./config.js";
|
|
13
14
|
import { withComposeSchemaPushLock } from "./schema-push-lock.js";
|
|
14
15
|
import { recordDatabaseTier, sameApiSurface } from "./recorded-field-masking-tier.js";
|
|
15
|
-
import { connectionString, pgSchema, projectRootFromConfig, resolveRuntimeProvider,
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { connectionString, pgSchema, projectRootFromConfig, resolveRuntimeProvider, schemaPathFromProject, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
|
|
17
|
+
import { rowCacheChangeNote } from "./model-cache.js";
|
|
18
|
+
import { writeAppliedAstArtifacts } from "./applied-ast-artifacts.js";
|
|
18
19
|
import { anonKeyEnvUpdates } from "./commands/keys.js";
|
|
19
20
|
import { devApiKeys } from "./dev-api-keys.js";
|
|
21
|
+
import { warnUrlUnsafeComposePasswords } from "./url-safe-passwords.js";
|
|
20
22
|
import { astRelatesToAuthUsers } from "./byo-preflight.js";
|
|
21
23
|
import { ensureDevDbPort, ensureKongPort } from "./dev-ports.js";
|
|
22
24
|
import { applyForThisRun, splitShellPortUpdates } from "./shell-ports.js";
|
|
@@ -25,23 +27,25 @@ import { devSessionLockFor, recoverStaleDevSession, writeDevSessionLock } from "
|
|
|
25
27
|
import { endDevSession, startDevSession } from "./dev-session.js";
|
|
26
28
|
import { ensureDevApiConfig } from "./ensure-dev-api-config.js";
|
|
27
29
|
import { cacheSeedingNotes } from "./api-config-cache.js";
|
|
28
|
-
import { refreshFunctionsContext } from "./functions-context-refresh.js";
|
|
29
30
|
import { restartComposeFunctionsWorker, watchFunctionSources } from "./dev-functions-watch.js";
|
|
30
31
|
import { watchDevSchema } from "./dev-schema-watch.js";
|
|
31
|
-
import {
|
|
32
|
+
import { offerToSaveShellDbPort } from "./db-port-offer.js";
|
|
33
|
+
import { databaseUrlSyncMessage } from "./db-port.js";
|
|
34
|
+
import { databaseUrlState, setCliDatabaseUrlForRun, syncDatabaseUrlPort, warnIfHandWrittenUrlSilent, writeCliDatabaseUrl, } from "./database-url-owner.js";
|
|
32
35
|
import { degraded } from "./strict.js";
|
|
36
|
+
import { ENGINE_FALLBACK, generatedFilesEngine } from "./generated-files-engine.js";
|
|
33
37
|
import { DEV_DESTRUCTIVE_POLICY, consentDepsFromDiff, pushConsentingToDestructive } from "./destructive-consent.js";
|
|
34
38
|
import { auditFlags, auditWhenSupported } from "./push-audit.js";
|
|
35
39
|
import { consentRefusal, reportDevPushFailure } from "./push-refusal.js";
|
|
36
|
-
import { COMPOSE_PINNED_IMAGE_ENV_KEYS, composeDockerImageEnv, composeProjectName, exitComposeFailed, publishesDbToHost, runDockerCompose, schemaEngineImageForPush, writeSelfHostCompose, composeFieldMaskingTier, selfHostComposePaths, } from "./self-host-compose.js";
|
|
40
|
+
import { COMPOSE_PINNED_IMAGE_ENV_KEYS, composeDockerImageEnv, composeProjectName, exitComposeFailed, noteUnpinnedImages, publishesDbToHost, runDockerCompose, schemaEngineImageForPush, writeSelfHostCompose, composeFieldMaskingTier, selfHostComposePaths, } from "./self-host-compose.js";
|
|
37
41
|
import { composeServiceIsRunning } from "./compose-kong.js";
|
|
38
42
|
import { hasEngineOverride } from "./binary-cache.js";
|
|
39
43
|
import { STUDIO_DEV_PORT, startStudioViteDevServer } from "./studio-dev-server.js";
|
|
40
44
|
import { ensureLocalServerDockerImage, usesLocalServerImage, LOCAL_SERVER_DOCKER_IMAGE, } from "./compose-local-server-image.js";
|
|
41
45
|
import { ensureEngine, enginePush, engineRequest } from "./engine-client.js";
|
|
42
|
-
import { isAdoptOutcome, isAnyAnswer, isDiffResult, isEnginePushResult, isGenerateAnswer,
|
|
46
|
+
import { isAdoptOutcome, isAnyAnswer, isDiffResult, isEnginePushResult, isGenerateAnswer, } from "./engine-answers.js";
|
|
43
47
|
import { writeSchemaSourcePushArtifacts } from "./schema-sources.js";
|
|
44
|
-
import { readEnvValue, upsertEnvFile } from "./env-file.js";
|
|
48
|
+
import { readEnvFile, readEnvValue, upsertEnvFile } from "./env-file.js";
|
|
45
49
|
import { warnProjectAuthProviderSecrets } from "./auth-providers.js";
|
|
46
50
|
import { devDatabaseIdentity, devDatabaseUrl, seedMissingDatabaseIdentity, seedMissingLocalSecrets, } from "./local-secrets.js";
|
|
47
51
|
import { writeLocalEnvironment } from "./link.js";
|
|
@@ -49,13 +53,13 @@ import { registerDevShutdown, waitForDevShutdown } from "./dev-shutdown.js";
|
|
|
49
53
|
import { filterComposeNoise, parseEngineJsonOutput, parseEnginePushOutput, reportAppliedPush, } from "./engine-push-output.js";
|
|
50
54
|
import { withAdminRoles } from "./studio-admin-roles.js";
|
|
51
55
|
import { restoreSystemRelationTargets } from "./restore-system-relation-targets.js";
|
|
52
|
-
import { provisionBucketsFromAst } from "./storage-provision.js";
|
|
56
|
+
import { provisionBucketsFromAst, unprovisionedBuckets } from "./storage-provision.js";
|
|
53
57
|
import { ensureFirstAdminUserForProject } from "./commands/admin.js";
|
|
54
58
|
import { demoDataHint, publishDevReady } from "./dev-ready-panel.js";
|
|
55
59
|
import { pushInitialSchema, settleInitialPush } from "./dev-initial-push.js";
|
|
56
60
|
import { offerAdoption, targetAdoptionSteps } from "./adopt-walkthrough.js";
|
|
57
61
|
import { resetDevDatabase } from "./dev-db-reset.js";
|
|
58
|
-
import { adoptKeysNeed, assertSupported, engineCapabilities, identityColumnsNeed, OVERWRITE_DRIFT_NEED,
|
|
62
|
+
import { adoptKeysNeed, assertSupported, engineCapabilities, identityColumnsNeed, OVERWRITE_DRIFT_NEED, checkedCapabilities, } from "./engine-ownership-gate.js";
|
|
59
63
|
import { devPushConsentingToDrift } from "./drift-consent.js";
|
|
60
64
|
import { capabilitiesCache, rememberCapabilitiesSync } from "@supatype/shared";
|
|
61
65
|
import { waitForDatabaseAfterUp } from "./dev-db-ready.js";
|
|
@@ -66,9 +70,24 @@ import { spawnComposeEngine } from "./compose-engine-run.js";
|
|
|
66
70
|
import { waitForRestReady } from "./rest-ready.js";
|
|
67
71
|
import { claimDevRenderMode, composeRenderMode, composeRenderOptions } from "./compose-render-mode.js";
|
|
68
72
|
import { devMailerAutoconfirmUpdate, MAILER_AUTOCONFIRM_ENV } from "./mailer-autoconfirm.js";
|
|
73
|
+
import { mailerProviderEnv } from "./mailer-env.js";
|
|
74
|
+
import { fetchWithin } from "./fetch-within.js";
|
|
75
|
+
import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
|
|
76
|
+
/**
|
|
77
|
+
* The image pins config asks for, once the engine's is known not to be older than this CLI needs.
|
|
78
|
+
* Checked before `.env` is written: a push refused the engine after writing its pin there as a
|
|
79
|
+
* managed line, and `.env` stayed pinned to the refused engine (local test round 6).
|
|
80
|
+
*/
|
|
81
|
+
function checkedImagePins(config) {
|
|
82
|
+
const pins = composeDockerImageEnv(config);
|
|
83
|
+
const engine = pins["SUPATYPE_ENGINE_IMAGE"];
|
|
84
|
+
if (engine !== undefined)
|
|
85
|
+
assertEngineVersionSupported(engineImageVersion(engine), "versions.engine in supatype.config.ts", "image");
|
|
86
|
+
return pins;
|
|
87
|
+
}
|
|
69
88
|
/** Sync optional Docker image pins from config into `.env` (no JWT rotation). */
|
|
70
89
|
export function syncComposeImagePins(cwd, config) {
|
|
71
|
-
const imagePins =
|
|
90
|
+
const imagePins = checkedImagePins(config);
|
|
72
91
|
// Clean up only what a previous run wrote from config. A hand-written image tag in `.env` is the
|
|
73
92
|
// documented way to run a local build, and this used to delete it on every compose run.
|
|
74
93
|
const removeImageKeys = COMPOSE_PINNED_IMAGE_ENV_KEYS.filter((key) => !(key in imagePins));
|
|
@@ -170,39 +189,6 @@ export async function projectComposeEngine(cwd, config) {
|
|
|
170
189
|
capabilities: () => dockerEngineCapabilities(cwd, config),
|
|
171
190
|
};
|
|
172
191
|
}
|
|
173
|
-
/**
|
|
174
|
-
* `email.provider` and `email.smtp` for the compose server service.
|
|
175
|
-
*
|
|
176
|
-
* The native dev path has mapped these since it existed; the compose path never
|
|
177
|
-
* did, so a project that asked for smtp got the auth service's noop client and
|
|
178
|
-
* no message at all. Console is the documented default, and it at least says
|
|
179
|
-
* that a message would have been sent.
|
|
180
|
-
*/
|
|
181
|
-
function composeMailerEnv(config) {
|
|
182
|
-
const email = config.email;
|
|
183
|
-
const out = {
|
|
184
|
-
// Mailer.MailerProvider, so the doubled word is the real name.
|
|
185
|
-
SUPATYPE_MAILER_MAILER_PROVIDER: email?.provider ?? "console",
|
|
186
|
-
};
|
|
187
|
-
const smtp = email?.smtp;
|
|
188
|
-
if (email?.provider !== "smtp" || smtp === undefined)
|
|
189
|
-
return out;
|
|
190
|
-
if (smtp.host !== undefined && smtp.host !== "")
|
|
191
|
-
out.SUPATYPE_SMTP_HOST = smtp.host;
|
|
192
|
-
if (smtp.port !== undefined)
|
|
193
|
-
out.SUPATYPE_SMTP_PORT = String(smtp.port);
|
|
194
|
-
if (smtp.user !== undefined && smtp.user !== "")
|
|
195
|
-
out.SUPATYPE_SMTP_USER = smtp.user;
|
|
196
|
-
if (smtp.pass !== undefined && smtp.pass !== "")
|
|
197
|
-
out.SUPATYPE_SMTP_PASS = smtp.pass;
|
|
198
|
-
if (smtp.admin_email !== undefined && smtp.admin_email !== "") {
|
|
199
|
-
out.SUPATYPE_SMTP_ADMIN_EMAIL = smtp.admin_email;
|
|
200
|
-
}
|
|
201
|
-
if (smtp.sender_name !== undefined && smtp.sender_name !== "") {
|
|
202
|
-
out.SUPATYPE_SMTP_SENDER_NAME = smtp.sender_name;
|
|
203
|
-
}
|
|
204
|
-
return out;
|
|
205
|
-
}
|
|
206
192
|
async function resolveKongPort(cwd, composeProject) {
|
|
207
193
|
// The compose project is passed so an already-running stack of *this* project counts as
|
|
208
194
|
// available rather than as a collision.
|
|
@@ -215,10 +201,15 @@ async function resolveKongPort(cwd, composeProject) {
|
|
|
215
201
|
* already running, and its readiness is the operator's, `supatype db check` is what reports on it.
|
|
216
202
|
* Four call sites did this inline, so an external project hit `compose up -d db` against a compose
|
|
217
203
|
* file that deliberately has no `db`.
|
|
204
|
+
*
|
|
205
|
+
* Warns rather than refuses about a URL-unsafe password. dev has refused before it gets here, and
|
|
206
|
+
* push and diff are not stopped over a database that starts either way: the warning names the
|
|
207
|
+
* cause before any connection failure it leads to.
|
|
218
208
|
*/
|
|
219
209
|
async function startComposeDatabase(config, paths, cwd, project, brand, timeoutMs = 120_000, onFailure) {
|
|
220
210
|
if (usesExternalDatabase(config))
|
|
221
211
|
return;
|
|
212
|
+
warnUrlUnsafeComposePasswords(cwd, config);
|
|
222
213
|
const up = runDockerCompose(paths.composePath, ["up", "-d", "db"], cwd, project, {
|
|
223
214
|
quiet: true,
|
|
224
215
|
...(brand !== undefined && { brand }),
|
|
@@ -231,7 +222,7 @@ async function startComposeDatabase(config, paths, cwd, project, brand, timeoutM
|
|
|
231
222
|
}
|
|
232
223
|
export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort) {
|
|
233
224
|
const apiUrl = `http://localhost:${kongPort}`;
|
|
234
|
-
const imagePins =
|
|
225
|
+
const imagePins = checkedImagePins(config);
|
|
235
226
|
// `POSTGRES_PASSWORD` and `JWT_SECRET` are deliberately absent.
|
|
236
227
|
//
|
|
237
228
|
// They used to be pinned here to published constants on every `dev` run, against the same
|
|
@@ -263,7 +254,10 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
|
|
|
263
254
|
SITE_URL: apiUrl,
|
|
264
255
|
// From auth.email.enableConfirmations, unless the developer set their own in .env.
|
|
265
256
|
...devMailerAutoconfirmUpdate(cwd, config),
|
|
266
|
-
|
|
257
|
+
// email.provider and its settings, which the compose file passes to the server. The compose
|
|
258
|
+
// path used to carry none of them, so a project that asked for smtp, Resend or SES got the auth
|
|
259
|
+
// service's noop client and no message at all.
|
|
260
|
+
...mailerProviderEnv(config.email),
|
|
267
261
|
...imagePins,
|
|
268
262
|
};
|
|
269
263
|
// Never for an external database: this URL describes the `db` container, which that project does
|
|
@@ -271,13 +265,8 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
|
|
|
271
265
|
// every CLI command reads, with a DSN pointing at a database that does not exist. Found by
|
|
272
266
|
// rehearsing a push against a real external Postgres, where the compose guard then refused to
|
|
273
267
|
// proceed because .env and the config disagreed. They disagreed because of this line.
|
|
274
|
-
if (devDbPort !== undefined && !usesExternalDatabase(config))
|
|
268
|
+
if (devDbPort !== undefined && !usesExternalDatabase(config))
|
|
275
269
|
updates.SUPATYPE_DEV_DB_PORT = String(devDbPort);
|
|
276
|
-
// User and database from the project, not hardcoded, same reason as
|
|
277
|
-
// `seedMissingDatabaseIdentity`: a project not named "supatype" had this URL pointing at a
|
|
278
|
-
// database that does not exist.
|
|
279
|
-
updates.DATABASE_URL = hostComposeDbUrl(cwd, devDbPort);
|
|
280
|
-
}
|
|
281
270
|
// `SUPATYPE_SERVER_IMAGE` is written here, not passed in, and it is deliberately *not* marked
|
|
282
271
|
// managed. The managed marker means "this value came from `versions` in the config and is mine to
|
|
283
272
|
// clean up when the pin goes away". The locally built image comes from `overrides`, so removing
|
|
@@ -294,21 +283,42 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
|
|
|
294
283
|
// write is removed: an operator's own GOTRUE_ variable is theirs, and the server's error names it
|
|
295
284
|
// and its replacement precisely enough to fix by hand.
|
|
296
285
|
const retiredKeys = ["GOTRUE_MAILER_AUTOCONFIRM"];
|
|
297
|
-
// A port the shell gave for this run is the run's, not the project's (DR9).
|
|
298
|
-
const
|
|
286
|
+
// A port the shell gave for this run is the run's, not the project's (DR9), unless `.env` holds it too.
|
|
287
|
+
const dotEnv = readEnvFile(cwd);
|
|
288
|
+
const { persist, runOnly } = splitShellPortUpdates(updates, process.env, dotEnv);
|
|
299
289
|
applyForThisRun(runOnly);
|
|
300
290
|
upsertEnvFile(cwd, persist, {
|
|
301
291
|
removeManaged: removeImageKeys,
|
|
302
292
|
managed: [...managedImageKeys, MAILER_AUTOCONFIRM_ENV],
|
|
303
|
-
|
|
304
|
-
// compose at a stale build, and it carries no marker for `removeManaged` to act on.
|
|
305
|
-
remove: [
|
|
306
|
-
...retiredKeys,
|
|
307
|
-
...(!wantsLocalServer && !("SUPATYPE_SERVER_IMAGE" in imagePins)
|
|
308
|
-
? ["SUPATYPE_SERVER_IMAGE"]
|
|
309
|
-
: []),
|
|
310
|
-
],
|
|
293
|
+
remove: [...retiredKeys, ...staleLocalServerImage(dotEnv["SUPATYPE_SERVER_IMAGE"], wantsLocalServer, imagePins)],
|
|
311
294
|
});
|
|
295
|
+
if (devDbPort !== undefined && !usesExternalDatabase(config)) {
|
|
296
|
+
writeDevStackDatabaseUrl(cwd, devDbPort, runOnly.SUPATYPE_DEV_DB_PORT !== undefined);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* `SUPATYPE_SERVER_IMAGE` to remove from `.env`: the local-dev image this CLI wrote, once the project
|
|
301
|
+
* stops asking for a local build and pins no server. It carries no marker for `removeManaged` to act
|
|
302
|
+
* on, and left behind it would keep pointing compose at a stale build. Any other value was set by
|
|
303
|
+
* hand, `supatype/server:it-r3` for instance, and is kept (local test round 3, N1).
|
|
304
|
+
*/
|
|
305
|
+
function staleLocalServerImage(current, wantsLocalServer, imagePins) {
|
|
306
|
+
if (wantsLocalServer || "SUPATYPE_SERVER_IMAGE" in imagePins)
|
|
307
|
+
return [];
|
|
308
|
+
return current?.trim() === LOCAL_SERVER_DOCKER_IMAGE ? ["SUPATYPE_SERVER_IMAGE"] : [];
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Docker dev's DATABASE_URL: the stack's database at `devDbPort`, with the project's own user and
|
|
312
|
+
* database, not hardcoded ones, which on a project not named "supatype" named a database that does
|
|
313
|
+
* not exist. Written over a URL the CLI owns, for this run only when the port is the shell's; one
|
|
314
|
+
* that is yours always wins (database-url-owner.ts).
|
|
315
|
+
*/
|
|
316
|
+
function writeDevStackDatabaseUrl(cwd, devDbPort, runOnly) {
|
|
317
|
+
const url = hostComposeDbUrl(cwd, devDbPort);
|
|
318
|
+
if (runOnly)
|
|
319
|
+
setCliDatabaseUrlForRun(databaseUrlState(cwd), url);
|
|
320
|
+
else
|
|
321
|
+
writeCliDatabaseUrl(cwd, url);
|
|
312
322
|
}
|
|
313
323
|
/** Keep compose + Studio on the same freshly signed dev JWTs; sync optional image pins from config. */
|
|
314
324
|
function ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort) {
|
|
@@ -339,7 +349,7 @@ async function waitComposeHealthy(paths, cwd, maxMs, composeProject) {
|
|
|
339
349
|
baseArgs.push("--env-file", envFile);
|
|
340
350
|
const deadline = Date.now() + maxMs;
|
|
341
351
|
while (Date.now() < deadline) {
|
|
342
|
-
const ready =
|
|
352
|
+
const ready = await askDocker(
|
|
343
353
|
// Over TCP, deliberately, not the Unix socket.
|
|
344
354
|
//
|
|
345
355
|
// On a first run the Postgres entrypoint starts a temporary server with `listen_addresses=''`
|
|
@@ -352,10 +362,10 @@ async function waitComposeHealthy(paths, cwd, maxMs, composeProject) {
|
|
|
352
362
|
[
|
|
353
363
|
...baseArgs, "exec", "-T", "db",
|
|
354
364
|
"pg_isready", "-h", "127.0.0.1", "-U", devDatabaseIdentity(cwd).user,
|
|
355
|
-
], { cwd: composeDir,
|
|
365
|
+
], { cwd: composeDir, timeoutMs: DOCKER_EXEC_TIMEOUT_MS });
|
|
356
366
|
if (ready.status === 0)
|
|
357
367
|
return;
|
|
358
|
-
await
|
|
368
|
+
await sleep(2000);
|
|
359
369
|
}
|
|
360
370
|
throw new Error("Compose db service did not become healthy in time");
|
|
361
371
|
}
|
|
@@ -373,12 +383,9 @@ function dumpComposeDbLogs(paths, cwd, composeProject, reason) {
|
|
|
373
383
|
if (existsSync(envFile))
|
|
374
384
|
args.push("--env-file", envFile);
|
|
375
385
|
args.push("logs", "--no-color", "--timestamps", "--tail", "800", "db");
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
380
|
-
});
|
|
381
|
-
const body = `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
386
|
+
// Synchronous: called from the failure paths that then exit.
|
|
387
|
+
const result = askDockerSync(args, { cwd, timeoutMs: DOCKER_QUERY_TIMEOUT_MS });
|
|
388
|
+
const body = `${result.stdout}${result.stderr}`.trim();
|
|
382
389
|
const content = body || `(empty, docker compose logs db exit ${result.status ?? "?"})\n`;
|
|
383
390
|
try {
|
|
384
391
|
writeFileSync(logPath, content);
|
|
@@ -405,17 +412,6 @@ function dumpComposeDbLogs(paths, cwd, composeProject, reason) {
|
|
|
405
412
|
function loopbackBase(port) {
|
|
406
413
|
return `http://127.0.0.1:${port}`;
|
|
407
414
|
}
|
|
408
|
-
/**
|
|
409
|
-
* `fetch` with a deadline, because the built-in has none.
|
|
410
|
-
*
|
|
411
|
-
* A poll loop bounded by `maxSec` iterations is only bounded if each attempt can end. Against a
|
|
412
|
-
* socket that accepts and never responds, an un-timed `fetch` never settles, the loop never reaches
|
|
413
|
-
* its second iteration, and a wait advertised as 120 seconds runs until someone kills it. That is
|
|
414
|
-
* how `supatype push` came to hang indefinitely after reporting the schema applied.
|
|
415
|
-
*/
|
|
416
|
-
async function fetchWithin(url, ms, init) {
|
|
417
|
-
return await fetch(url, { ...init, signal: AbortSignal.timeout(ms) });
|
|
418
|
-
}
|
|
419
415
|
/**
|
|
420
416
|
* Print what the stack is doing when the gateway never comes up.
|
|
421
417
|
*
|
|
@@ -424,21 +420,19 @@ async function fetchWithin(url, ms, init) {
|
|
|
424
420
|
* That sends people to look at Kong, which is almost never the problem, and in
|
|
425
421
|
* CI the containers are gone by the time anything else can inspect them.
|
|
426
422
|
*/
|
|
427
|
-
function reportUnhealthyStack(composePath, cwd, project) {
|
|
428
|
-
const capture = (args) => {
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
});
|
|
433
|
-
return `${result.stdout ?? ""}${result.stderr ?? ""}`.trim();
|
|
423
|
+
async function reportUnhealthyStack(composePath, cwd, project) {
|
|
424
|
+
const capture = async (args) => {
|
|
425
|
+
const call = { cwd, timeoutMs: DOCKER_QUERY_TIMEOUT_MS };
|
|
426
|
+
const result = await askDocker(["compose", "-p", project, "--project-directory", cwd, "-f", composePath, ...args], call);
|
|
427
|
+
return `${result.stdout}${result.stderr}`.trim();
|
|
434
428
|
};
|
|
435
429
|
console.error("");
|
|
436
430
|
console.error("[supatype] The gateway is up but a service behind it is not. Container state:");
|
|
437
|
-
const state = capture(["ps", "-a"]);
|
|
431
|
+
const state = await capture(["ps", "-a"]);
|
|
438
432
|
console.error(state === "" ? " (no containers)" : state);
|
|
439
433
|
// The two the gateway health check depends on, and db because both need it.
|
|
440
434
|
for (const service of ["server", "realtime", "db"]) {
|
|
441
|
-
const logs = capture(["logs", "--no-color", "--tail", "40", service]);
|
|
435
|
+
const logs = await capture(["logs", "--no-color", "--tail", "40", service]);
|
|
442
436
|
if (logs === "")
|
|
443
437
|
continue;
|
|
444
438
|
console.error("");
|
|
@@ -466,12 +460,12 @@ async function waitKongReady(kongPort, maxSec, stack) {
|
|
|
466
460
|
return;
|
|
467
461
|
}
|
|
468
462
|
catch (err) {
|
|
469
|
-
lastAuth = lastRealtime =
|
|
463
|
+
lastAuth = lastRealtime = errorMessage(err);
|
|
470
464
|
}
|
|
471
|
-
await
|
|
465
|
+
await sleep(1000);
|
|
472
466
|
}
|
|
473
467
|
if (stack !== undefined) {
|
|
474
|
-
reportUnhealthyStack(stack.composePath, stack.cwd, stack.project);
|
|
468
|
+
await reportUnhealthyStack(stack.composePath, stack.cwd, stack.project);
|
|
475
469
|
}
|
|
476
470
|
throw new Error(`Gateway at ${base} did not become ready within ${maxSec}s ` +
|
|
477
471
|
`(auth/v1/health: ${lastAuth}, realtime/v1/health: ${lastRealtime})`);
|
|
@@ -495,12 +489,19 @@ async function waitStorageApiReady(kongPort, serviceRoleKey, maxSec) {
|
|
|
495
489
|
catch {
|
|
496
490
|
/* retry */
|
|
497
491
|
}
|
|
498
|
-
await
|
|
492
|
+
await sleep(1000);
|
|
499
493
|
}
|
|
500
494
|
console.warn(`[supatype] Storage API at ${url} did not become ready within ${maxSec}s, bucket provisioning may fail.`);
|
|
501
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* The schema's buckets on the dev stack. One the service did not take is said in one line, with what
|
|
498
|
+
* it means: dev carries on, and only uploads to that bucket fail. They were dropped without a word
|
|
499
|
+
* past each bucket's own warning.
|
|
500
|
+
*/
|
|
502
501
|
async function provisionDockerStorageBuckets(ast, kongPort, serviceRoleKey) {
|
|
503
|
-
await provisionBucketsFromAst(ast, `${loopbackBase(kongPort)}/storage/v1`, serviceRoleKey);
|
|
502
|
+
const left = unprovisionedBuckets(await provisionBucketsFromAst(ast, `${loopbackBase(kongPort)}/storage/v1`, serviceRoleKey));
|
|
503
|
+
if (left !== null)
|
|
504
|
+
console.warn(`[supatype] ⚠ ${left}; uploads to them fail until a later push takes them.`);
|
|
504
505
|
}
|
|
505
506
|
let _lastPushedAst = null;
|
|
506
507
|
let _lastFailedAst = null;
|
|
@@ -511,24 +512,25 @@ let _composePushQueued = false;
|
|
|
511
512
|
/**
|
|
512
513
|
* Regenerate everything derived from the schema once a push has applied it: the AST-derived files,
|
|
513
514
|
* then the types and admin config from the engine. Never called for a push that was refused or
|
|
514
|
-
* failed.
|
|
515
|
-
*
|
|
516
|
-
* fetched.
|
|
515
|
+
* failed. The engine is the one `supatype generate` uses, the host program, with the project's
|
|
516
|
+
* image only when that cannot be fetched (generated-files-engine.ts).
|
|
517
517
|
*/
|
|
518
518
|
async function refreshSchemaArtifacts(cwd, config, ast) {
|
|
519
519
|
writeAstDerivedArtifacts(cwd, config, ast);
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
// The client and augmentation need no engine, so no engine problem keeps them from being written.
|
|
521
|
+
writeDevAstOutputs(cwd, ast, config, "");
|
|
522
|
+
let choice;
|
|
522
523
|
try {
|
|
523
|
-
|
|
524
|
+
choice = await generatedFilesEngine(cwd, config);
|
|
524
525
|
}
|
|
525
526
|
catch (err) {
|
|
526
|
-
degraded("
|
|
527
|
+
degraded("No engine could write the admin config and types, so they were not refreshed", errorMessage(err));
|
|
527
528
|
return;
|
|
528
529
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
530
|
+
await writeEngineArtifacts(cwd, config, ast, join(cwd, ".supatype", "admin-config.json"), choice.engine);
|
|
531
|
+
// Said after writing, so SUPATYPE_STRICT fails the run with the files written and the true reason.
|
|
532
|
+
if (choice.fellBack !== undefined)
|
|
533
|
+
degraded(ENGINE_FALLBACK, choice.fellBack);
|
|
532
534
|
}
|
|
533
535
|
/** The files read straight off the applied AST, written whatever happens with the generator afterwards. */
|
|
534
536
|
function writeAstDerivedArtifacts(cwd, config, ast) {
|
|
@@ -540,21 +542,11 @@ function writeAstDerivedArtifacts(cwd, config, ast) {
|
|
|
540
542
|
// Every project running on Compose therefore had a manifest with no `hooks` and no `validators`
|
|
541
543
|
// key, and the server, having nothing to call, ran neither. A hook silently not firing is bad; a
|
|
542
544
|
// validator silently not firing means a write the schema says is checked is accepted with a 201.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
// received one: its handlers had no `FunctionContext` to import.
|
|
549
|
-
if (refreshFunctionsContext(cwd, config)) {
|
|
550
|
-
console.log("[supatype] Function context type written to functions/_shared/context.ts");
|
|
551
|
-
}
|
|
552
|
-
if (syncManifestHooks(cwd, ast)) {
|
|
553
|
-
console.log("[supatype] Hook and validator maps written to .supatype/manifest.json");
|
|
554
|
-
}
|
|
555
|
-
// Written before the stack comes up, so a first run with a row cache declared starts with it on
|
|
556
|
-
// rather than needing a second `supatype dev`.
|
|
557
|
-
const rowCache = syncRowCacheEnv(cwd, ast);
|
|
545
|
+
// The row cache is written before the stack comes up, so a first run with a row cache declared
|
|
546
|
+
// starts with it on rather than needing a second `supatype dev`.
|
|
547
|
+
const { lines, rowCache } = writeAppliedAstArtifacts(cwd, config, ast, { rowCacheEnv: true });
|
|
548
|
+
for (const line of lines)
|
|
549
|
+
console.log(`[supatype] ${line}`);
|
|
558
550
|
if (rowCache !== null) {
|
|
559
551
|
console.log(`[supatype] ${rowCacheChangeNote(rowCache)}`);
|
|
560
552
|
}
|
|
@@ -575,50 +567,14 @@ function writeAstDerivedArtifacts(cwd, config, ast) {
|
|
|
575
567
|
* on `npm run seed` with ECONNREFUSED against a port nothing was listening on. The layout is the
|
|
576
568
|
* stack's own (dev while a dev session holds it, otherwise self-host), so a self-host push in a
|
|
577
569
|
* project that once ran dev keeps the self-host port, and the message names the variable it read.
|
|
570
|
+
* Only a URL the CLI owns moves: one that is yours is left as it is, for this run too.
|
|
578
571
|
*/
|
|
579
572
|
function syncDatabaseUrlToStack(cwd, config) {
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
console.log(`[supatype] ${databaseUrlSyncMessage(dbPort)}`);
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* True when the host engine binary is ready. When it is not, the in-compose engine writes the
|
|
587
|
-
* admin config and types instead and this answers false, having said which happened.
|
|
588
|
-
*/
|
|
589
|
-
async function hostEngineOrComposeFallback(cwd, config, ast, adminConfigPath) {
|
|
590
|
-
try {
|
|
591
|
-
await ensureEngine();
|
|
592
|
-
return true;
|
|
593
|
-
}
|
|
594
|
-
catch (err) {
|
|
595
|
-
// A project that named its engine gets that engine or an error, never a stand-in.
|
|
596
|
-
if (hasEngineOverride(config)) {
|
|
597
|
-
degraded("overrides.engine could not be used, admin config and types not refreshed", errorMessage(err));
|
|
598
|
-
return false;
|
|
599
|
-
}
|
|
600
|
-
// The host engine is a CDN download and this machine could not complete it. The schema is
|
|
601
|
-
// already applied, so fall back to the engine in compose rather than giving up: without
|
|
602
|
-
// admin-config.json Studio reports "No schema has been pushed yet" on a stack whose schema is
|
|
603
|
-
// entirely live, which reads as a failed push rather than a missing binary.
|
|
604
|
-
const paths = selfHostComposePaths(cwd);
|
|
605
|
-
const composeProject = composeProjectName(config.project.name);
|
|
606
|
-
const wrote = await generateViaComposeEngine(paths, cwd, composeProject, config, ast, adminConfigPath)
|
|
607
|
-
.catch(() => false);
|
|
608
|
-
// Reported through `degraded` rather than warned, so a run that takes this path says so where
|
|
609
|
-
// CI looks, rather than in a line that scrolls past.
|
|
610
|
-
const message = errorMessage(err);
|
|
611
|
-
if (wrote) {
|
|
612
|
-
degraded("Host engine unavailable, used the in-compose engine instead", message);
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
degraded("Host engine unavailable, admin config and types not refreshed", `${message}\n[supatype] Studio will report no schema until this succeeds, even though the ` +
|
|
616
|
-
"schema is applied. Retry with the stack up, or run `supatype push`.");
|
|
617
|
-
}
|
|
618
|
-
return false;
|
|
619
|
-
}
|
|
573
|
+
const sync = syncDatabaseUrlPort(cwd, composeRenderMode(cwd, config.project.name) === "dev");
|
|
574
|
+
if (sync !== null)
|
|
575
|
+
console.log(`[supatype] ${databaseUrlSyncMessage(sync)}`);
|
|
620
576
|
}
|
|
621
|
-
/** The types, the
|
|
577
|
+
/** The types, the seed builder and the admin config, from `engine` (the host binary when undefined). */
|
|
622
578
|
async function writeEngineArtifacts(cwd, config, ast, adminConfigPath, engine) {
|
|
623
579
|
// At the default paths when `output` is not set, which is every project `init` made before it
|
|
624
580
|
// wrote one: gated on `output.types`, a renamed field left the typed client on the old name.
|
|
@@ -635,7 +591,6 @@ async function writeEngineArtifacts(cwd, config, ast, adminConfigPath, engine) {
|
|
|
635
591
|
catch (err) {
|
|
636
592
|
console.warn(`[supatype] Type generation failed: ${errorMessage(err)}`);
|
|
637
593
|
}
|
|
638
|
-
writeDevAstOutputs(cwd, ast, config, "");
|
|
639
594
|
await writeDevSeedBuilder(cwd, config, ast, engine);
|
|
640
595
|
try {
|
|
641
596
|
const admin = withAdminRoles(await engineRequest("/admin", { ast }, isAnyAnswer, engine), config);
|
|
@@ -765,7 +720,7 @@ function writeSchemaAstFile(cwd, astJson) {
|
|
|
765
720
|
*/
|
|
766
721
|
async function applyViaHostEngine(cwd, config, ast, opts) {
|
|
767
722
|
await ensureEngine();
|
|
768
|
-
const sources = writeSchemaSourcePushArtifacts(cwd);
|
|
723
|
+
const sources = writeSchemaSourcePushArtifacts(cwd, opts.snapshotOptional === true);
|
|
769
724
|
const body = {
|
|
770
725
|
ast,
|
|
771
726
|
database_url: projectDatabaseUrl(cwd, config),
|
|
@@ -782,7 +737,7 @@ async function applyViaHostEngine(cwd, config, ast, opts) {
|
|
|
782
737
|
/** Apply the AST on disk with the stack's schema-engine container. Throws when it is not applied. */
|
|
783
738
|
async function applyViaComposeEngine(cwd, config, stack, opts) {
|
|
784
739
|
const { paths, composeProject } = stack;
|
|
785
|
-
const sources = writeSchemaSourcePushArtifacts(cwd);
|
|
740
|
+
const sources = writeSchemaSourcePushArtifacts(cwd, opts.snapshotOptional === true);
|
|
786
741
|
const audit = opts.audit ?? (await composeAuditArgs(cwd, config));
|
|
787
742
|
const pushOnce = () => runComposeEnginePush(paths, cwd, composeProject, config, sources, { ...opts, audit });
|
|
788
743
|
const runPush = async () => {
|
|
@@ -791,7 +746,7 @@ async function applyViaComposeEngine(cwd, config, stack, opts) {
|
|
|
791
746
|
// engine's considered answer, not a lagging mount, and running it again only repeats it.
|
|
792
747
|
if (first.status === 0 || consentRefusal(first.output) !== null)
|
|
793
748
|
return first;
|
|
794
|
-
await
|
|
749
|
+
await sleep(250);
|
|
795
750
|
return pushOnce();
|
|
796
751
|
};
|
|
797
752
|
// B: only hold the advisory lock when realtime is already decoding, first-boot
|
|
@@ -857,7 +812,13 @@ export function followRecordedTier(cwd, config, opts) {
|
|
|
857
812
|
*/
|
|
858
813
|
async function runDevSchemaPush(cwd, config, paths, schemaPath, composeProject, opts) {
|
|
859
814
|
const audit = opts.audit ?? (hasEngineOverride(config) ? [] : await composeAuditArgs(cwd, config));
|
|
860
|
-
const once = (overwriteDrift) => pushConsentingToDestructive((force) => runComposeSchemaPush(cwd, config, paths, schemaPath, composeProject, {
|
|
815
|
+
const once = (overwriteDrift) => pushConsentingToDestructive((force) => runComposeSchemaPush(cwd, config, paths, schemaPath, composeProject, {
|
|
816
|
+
...opts,
|
|
817
|
+
audit,
|
|
818
|
+
overwriteDrift,
|
|
819
|
+
force,
|
|
820
|
+
snapshotOptional: true,
|
|
821
|
+
}), DEV_DESTRUCTIVE_POLICY, consentDepsFromDiff(cwd, () => dockerDiff(cwd, config)));
|
|
861
822
|
return devPushConsentingToDrift(once, opts.overwriteDrift === true, {
|
|
862
823
|
beforeOverwrite: () => requireDockerFeatures(cwd, config, [OVERWRITE_DRIFT_NEED]),
|
|
863
824
|
});
|
|
@@ -911,12 +872,12 @@ export async function dockerEngineCapabilities(cwd, config) {
|
|
|
911
872
|
const probe = () => {
|
|
912
873
|
const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
|
|
913
874
|
const target = { cwd, project: composeProjectName(config.project.name), composePath: paths.composePath, engineImage };
|
|
914
|
-
return
|
|
875
|
+
return checkedCapabilities((args) => {
|
|
915
876
|
const run = spawnComposeEngine(target, args, { runFlags: ["--no-deps"] });
|
|
916
|
-
return { status: run.status, stdout: run.stdout
|
|
877
|
+
return { status: run.status, stdout: run.stdout, stderr: run.error ?? run.stderr };
|
|
917
878
|
});
|
|
918
879
|
};
|
|
919
|
-
const imageId = engineImage === undefined ? "compose-default" : localImageId(engineImage);
|
|
880
|
+
const imageId = engineImage === undefined ? "compose-default" : await localImageId(engineImage);
|
|
920
881
|
// Not pulled yet: the probe pulls it, and the next call keys on the ID it then has.
|
|
921
882
|
if (imageId === undefined)
|
|
922
883
|
return probe();
|
|
@@ -926,8 +887,8 @@ export async function dockerEngineCapabilities(cwd, config) {
|
|
|
926
887
|
* The local image's ID, or undefined when Docker does not have it. The answer is keyed on it, so
|
|
927
888
|
* a tag that now names another image (a pull, a rebuild) is asked again, and nothing else is.
|
|
928
889
|
*/
|
|
929
|
-
function localImageId(image) {
|
|
930
|
-
const inspect =
|
|
890
|
+
async function localImageId(image) {
|
|
891
|
+
const inspect = await askDocker(["image", "inspect", "--format", "{{.Id}}", image], { timeoutMs: DOCKER_QUERY_TIMEOUT_MS });
|
|
931
892
|
const id = inspect.status === 0 ? inspect.stdout.trim() : "";
|
|
932
893
|
return id === "" ? undefined : id;
|
|
933
894
|
}
|
|
@@ -1092,7 +1053,7 @@ export async function diffSchemaDocker(cwd, config) {
|
|
|
1092
1053
|
let result = await runComposeEngineDiff(paths, cwd, project, config);
|
|
1093
1054
|
// Windows Docker bind mounts can lag briefly after the host write.
|
|
1094
1055
|
if (result.status !== 0) {
|
|
1095
|
-
await
|
|
1056
|
+
await sleep(250);
|
|
1096
1057
|
result = await runComposeEngineDiff(paths, cwd, project, config);
|
|
1097
1058
|
}
|
|
1098
1059
|
if (result.status !== 0) {
|
|
@@ -1187,7 +1148,7 @@ async function applyInitialSchema(cwd, config, paths, schemaPath, project, brand
|
|
|
1187
1148
|
push: () => runDevSchemaPush(cwd, config, paths, schemaPath, project, opts),
|
|
1188
1149
|
recoverDatabase: () => startComposeDatabase(config, paths, cwd, project, brand, undefined, endDevSession),
|
|
1189
1150
|
dumpLogs: (reason) => dumpComposeDbLogs(paths, cwd, project, reason),
|
|
1190
|
-
sleep: (ms) =>
|
|
1151
|
+
sleep: (ms) => sleep(ms),
|
|
1191
1152
|
};
|
|
1192
1153
|
const outcome = await adoptingOnRefusal(await pushInitialSchema(steps), steps, cwd, config);
|
|
1193
1154
|
// Ending the session before an exit, so its message reaches the real terminal rather than a TUI
|
|
@@ -1208,6 +1169,18 @@ async function adoptingOnRefusal(outcome, steps, cwd, config) {
|
|
|
1208
1169
|
});
|
|
1209
1170
|
return adopted === "adopted" ? pushInitialSchema(steps) : outcome;
|
|
1210
1171
|
}
|
|
1172
|
+
/**
|
|
1173
|
+
* The dev stack's database port, moved off one something else holds, or undefined for an external
|
|
1174
|
+
* database. A port only the shell gives is offered to `.env` before anything else reads the URL
|
|
1175
|
+
* (db-port-offer.ts), so a yes is what the rest of the run sees.
|
|
1176
|
+
*/
|
|
1177
|
+
async function devStackDbPort(cwd, config, project) {
|
|
1178
|
+
if (!publishesDbToHost(config))
|
|
1179
|
+
return undefined;
|
|
1180
|
+
const port = await ensureDevDbPort(cwd, { composeProject: project, mayMove: true });
|
|
1181
|
+
await offerToSaveShellDbPort(cwd);
|
|
1182
|
+
return port;
|
|
1183
|
+
}
|
|
1211
1184
|
export async function runDevCompose(cwd, config, opts) {
|
|
1212
1185
|
if (resolveRuntimeProvider(config) !== "docker") {
|
|
1213
1186
|
throw new Error("runDevCompose requires provider: docker");
|
|
@@ -1226,15 +1199,14 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1226
1199
|
// `overrides.engine` while the compose file published unconditionally is what left a project
|
|
1227
1200
|
// with a database on 54329 and a URL still saying 5432.
|
|
1228
1201
|
// Only dev moves the port off something else that holds it.
|
|
1229
|
-
const devDbPort =
|
|
1230
|
-
? await ensureDevDbPort(cwd, { composeProject: project, mayMove: true })
|
|
1231
|
-
: undefined;
|
|
1202
|
+
const devDbPort = await devStackDbPort(cwd, config, project);
|
|
1232
1203
|
const { anonKey, serviceRoleKey } = devApiKeys(cwd);
|
|
1233
1204
|
const devBrand = { intro: "Local development" };
|
|
1234
1205
|
const localServerImage = await ensureLocalServerDockerImage(cwd, config, devBrand);
|
|
1235
1206
|
ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort);
|
|
1236
1207
|
warnProjectAuthProviderSecrets(cwd, config);
|
|
1237
1208
|
console.log(`[supatype] provider docker, starting self-host Compose stack (project ${project}, gateway :${kongPort})...`);
|
|
1209
|
+
noteUnpinnedImages(cwd);
|
|
1238
1210
|
const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
|
|
1239
1211
|
if (ensureDevApiConfig(cwd)) {
|
|
1240
1212
|
console.log("[supatype] API config written to .supatype/api-config.json");
|
|
@@ -1282,7 +1254,9 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1282
1254
|
}
|
|
1283
1255
|
await startComposeDatabase(config, paths, cwd, project, devBrand, 180_000, endDevSession);
|
|
1284
1256
|
// Settle before DDL: pg_isready can pass slightly before the instance is stable.
|
|
1285
|
-
await
|
|
1257
|
+
await sleep(3000);
|
|
1258
|
+
// With the stack's database up, so a hand-written URL naming it is not reported as silent.
|
|
1259
|
+
await warnIfHandWrittenUrlSilent(cwd);
|
|
1286
1260
|
if (!usesExternalDatabase(config)) {
|
|
1287
1261
|
reconcileAuthenticatorPassword(paths, cwd, project);
|
|
1288
1262
|
reconcileSqlEditorPassword(paths, cwd, project);
|
|
@@ -1433,70 +1407,4 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1433
1407
|
// Until Ctrl+C or a signal: the shutdown hook takes the stack down and exits.
|
|
1434
1408
|
await waitForDevShutdown();
|
|
1435
1409
|
}
|
|
1436
|
-
/**
|
|
1437
|
-
* Run one read-only generator in the in-compose schema-engine and return its stdout.
|
|
1438
|
-
*
|
|
1439
|
-
* The same image and the same bind mount the push just used, so if the schema could be applied
|
|
1440
|
-
* this can run. It exists because the host engine is a separate binary fetched from a CDN, and a
|
|
1441
|
-
* machine that cannot fetch it is not a machine that cannot generate: the schema is already
|
|
1442
|
-
* applied, the AST is already on disk, and the container that did it is one `docker compose run`
|
|
1443
|
-
* away.
|
|
1444
|
-
*/
|
|
1445
|
-
async function runComposeEngineGenerator(paths, cwd, composeProject, config, args) {
|
|
1446
|
-
const engineImage = await schemaEngineImageForPush(config, cwd);
|
|
1447
|
-
const target = { cwd, project: composeProject, composePath: paths.composePath, engineImage };
|
|
1448
|
-
const result = spawnComposeEngine(target, [...args, "-i", COMPOSE_SCHEMA_AST], {
|
|
1449
|
-
runFlags: ["-T"],
|
|
1450
|
-
maxBuffer: 20 * 1024 * 1024,
|
|
1451
|
-
});
|
|
1452
|
-
if ((result.status ?? 1) !== 0)
|
|
1453
|
-
return null;
|
|
1454
|
-
return String(result.stdout ?? "");
|
|
1455
|
-
}
|
|
1456
|
-
/**
|
|
1457
|
-
* The in-compose engine as {@link engineRequest} takes it, for generating only. No database URL:
|
|
1458
|
-
* `/generate` reads the AST alone and runs without starting the database.
|
|
1459
|
-
*/
|
|
1460
|
-
async function composeGeneratorEngine(paths, cwd, composeProject, config) {
|
|
1461
|
-
const engineImage = await schemaEngineImageForPush(config, cwd);
|
|
1462
|
-
return {
|
|
1463
|
-
target: { cwd, project: composeProject, composePath: paths.composePath, engineImage },
|
|
1464
|
-
databaseUrl: "",
|
|
1465
|
-
capabilities: () => dockerEngineCapabilities(cwd, config),
|
|
1466
|
-
};
|
|
1467
|
-
}
|
|
1468
|
-
/**
|
|
1469
|
-
* Write `admin-config.json` and the generated types using the in-compose engine.
|
|
1470
|
-
*
|
|
1471
|
-
* The fallback for a host engine that could not be fetched. Without it, a `supatype dev` that
|
|
1472
|
-
* applied the schema perfectly well still left no `admin-config.json`, and Studio reads that file
|
|
1473
|
-
* to decide whether a schema exists: the stack came up, every table was live, the API served them,
|
|
1474
|
-
* and Studio said **"No schema has been pushed yet."** The warning that preceded it named the
|
|
1475
|
-
* download, not the consequence, so nothing connected the two.
|
|
1476
|
-
*
|
|
1477
|
-
* Returns true when the admin config was written, which is the file Studio actually needs.
|
|
1478
|
-
*/
|
|
1479
|
-
export async function generateViaComposeEngine(paths, cwd, composeProject, config, ast, adminConfigPath) {
|
|
1480
|
-
const { typesPath } = projectOutputPaths(config.output);
|
|
1481
|
-
const out = await runComposeEngineGenerator(paths, cwd, composeProject, config, ["generate"]);
|
|
1482
|
-
if (writeEngineTypes(cwd, typesPath, out ?? undefined)) {
|
|
1483
|
-
console.log(`[supatype] Types written to ${typesPath} (in-compose engine).`);
|
|
1484
|
-
}
|
|
1485
|
-
// The same AST-derived files as the host path. This is the fallback used when the host engine
|
|
1486
|
-
// could not be fetched, and these need no engine at all, so there is no reason for a project on
|
|
1487
|
-
// this path to end up with fewer generated files than one on the other.
|
|
1488
|
-
writeDevAstOutputs(cwd, ast, config, " (in-compose engine).");
|
|
1489
|
-
await writeDevSeedBuilder(cwd, config, ast, await composeGeneratorEngine(paths, cwd, composeProject, config));
|
|
1490
|
-
const adminOut = await runComposeEngineGenerator(paths, cwd, composeProject, config, ["admin"]);
|
|
1491
|
-
if (!adminOut)
|
|
1492
|
-
return false;
|
|
1493
|
-
const parsed = parseEngineJsonOutput(adminOut, isObjectAnswer);
|
|
1494
|
-
if (parsed === null)
|
|
1495
|
-
return false;
|
|
1496
|
-
const admin = withAdminRoles(parsed, config);
|
|
1497
|
-
restoreSystemRelationTargets(admin, ast);
|
|
1498
|
-
writeFileSync(adminConfigPath, `${JSON.stringify(admin, null, 2)}\n`);
|
|
1499
|
-
console.log("[supatype] Admin config written to .supatype/admin-config.json (in-compose engine).");
|
|
1500
|
-
return true;
|
|
1501
|
-
}
|
|
1502
1410
|
//# sourceMappingURL=dev-compose.js.map
|