@supatype/cli 0.9.0 → 0.9.2
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 +640 -68
- package/bin/node-version.js +28 -0
- package/bin/supatype.js +8 -4
- package/dist/app/port-holder.d.ts +33 -0
- package/dist/app/port-holder.d.ts.map +1 -0
- package/dist/app/port-holder.js +66 -0
- package/dist/app/port-holder.js.map +1 -0
- package/dist/app/proxy-dev-app.d.ts +32 -4
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +111 -77
- package/dist/app/proxy-dev-app.js.map +1 -1
- package/dist/app/vite-dev-args.d.ts +20 -0
- package/dist/app/vite-dev-args.d.ts.map +1 -0
- package/dist/app/vite-dev-args.js +65 -0
- package/dist/app/vite-dev-args.js.map +1 -0
- package/dist/app-config.d.ts +2 -0
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +27 -8
- package/dist/app-config.js.map +1 -1
- package/dist/augmentation-generator.d.ts +2 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +7 -3
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/auth-providers.d.ts +5 -4
- package/dist/auth-providers.d.ts.map +1 -1
- package/dist/auth-providers.js +3 -12
- package/dist/auth-providers.js.map +1 -1
- package/dist/binary-download-lock.d.ts.map +1 -1
- package/dist/binary-download-lock.js +2 -10
- package/dist/binary-download-lock.js.map +1 -1
- package/dist/build-spawn.d.ts +35 -0
- package/dist/build-spawn.d.ts.map +1 -0
- package/dist/build-spawn.js +75 -0
- package/dist/build-spawn.js.map +1 -0
- package/dist/cache-provider.d.ts +17 -2
- package/dist/cache-provider.d.ts.map +1 -1
- package/dist/cache-provider.js +28 -3
- package/dist/cache-provider.js.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -1
- package/dist/cli.js.map +1 -1
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +3 -1
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +11 -15
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/adopt.js +1 -1
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +22 -2
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/build.d.ts +29 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +69 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +5 -0
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +46 -23
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +14 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +67 -52
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +21 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +244 -86
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diff.d.ts +3 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +28 -34
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +21 -16
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +3 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +15 -10
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +312 -163
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts.map +1 -1
- package/dist/commands/internal.js +27 -7
- package/dist/commands/internal.js.map +1 -1
- package/dist/commands/introspect.d.ts.map +1 -1
- package/dist/commands/introspect.js +3 -0
- package/dist/commands/introspect.js.map +1 -1
- package/dist/commands/keys-print.d.ts +20 -0
- package/dist/commands/keys-print.d.ts.map +1 -0
- package/dist/commands/keys-print.js +47 -0
- package/dist/commands/keys-print.js.map +1 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +16 -12
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +28 -6
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/migrate.d.ts +5 -2
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +34 -36
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +6 -5
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +30 -19
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/rename.js +1 -1
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/seed.d.ts +2 -11
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +11 -38
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts +3 -3
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +133 -272
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/sso.d.ts +26 -0
- package/dist/commands/sso.d.ts.map +1 -0
- package/dist/commands/sso.js +362 -0
- package/dist/commands/sso.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +25 -8
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +156 -63
- package/dist/commands/update.js.map +1 -1
- package/dist/component-launch.d.ts.map +1 -1
- package/dist/component-launch.js +2 -1
- package/dist/component-launch.js.map +1 -1
- package/dist/compose-db-roles.d.ts +4 -4
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +14 -10
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-engine-run.d.ts +9 -2
- package/dist/compose-engine-run.d.ts.map +1 -1
- package/dist/compose-engine-run.js +30 -13
- package/dist/compose-engine-run.js.map +1 -1
- package/dist/compose-rename.d.ts.map +1 -1
- package/dist/compose-rename.js +5 -0
- package/dist/compose-rename.js.map +1 -1
- package/dist/compose-render-mode.d.ts +8 -3
- package/dist/compose-render-mode.d.ts.map +1 -1
- package/dist/compose-render-mode.js +13 -5
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts +18 -0
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +49 -23
- package/dist/compose-services.js.map +1 -1
- package/dist/config-mailer-env.d.ts +31 -0
- package/dist/config-mailer-env.d.ts.map +1 -0
- package/dist/config-mailer-env.js +45 -0
- package/dist/config-mailer-env.js.map +1 -0
- package/dist/config-version-pin.d.ts +42 -0
- package/dist/config-version-pin.d.ts.map +1 -0
- package/dist/config-version-pin.js +64 -0
- package/dist/config-version-pin.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -2
- package/dist/config.js.map +1 -1
- package/dist/db-rows.d.ts +3 -2
- package/dist/db-rows.d.ts.map +1 -1
- package/dist/db-rows.js +19 -4
- package/dist/db-rows.js.map +1 -1
- package/dist/dev-compose.d.ts +69 -9
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +272 -187
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-initial-push.d.ts.map +1 -1
- package/dist/dev-initial-push.js +6 -0
- package/dist/dev-initial-push.js.map +1 -1
- package/dist/dev-ports.d.ts +13 -6
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +124 -68
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-ready-panel.d.ts +26 -3
- package/dist/dev-ready-panel.d.ts.map +1 -1
- package/dist/dev-ready-panel.js +37 -5
- package/dist/dev-ready-panel.js.map +1 -1
- package/dist/dev-schema-watch.d.ts +8 -2
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +24 -13
- package/dist/dev-schema-watch.js.map +1 -1
- package/dist/dev-self-start.d.ts +16 -0
- package/dist/dev-self-start.d.ts.map +1 -0
- package/dist/dev-self-start.js +31 -0
- package/dist/dev-self-start.js.map +1 -0
- package/dist/dev-session-lock.d.ts +66 -2
- package/dist/dev-session-lock.d.ts.map +1 -1
- package/dist/dev-session-lock.js +104 -5
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +19 -3
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +31 -8
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +11 -2
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +27 -10
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-access.d.ts +10 -0
- package/dist/diff-access.d.ts.map +1 -0
- package/dist/diff-access.js +69 -0
- package/dist/diff-access.js.map +1 -0
- package/dist/diff-output.d.ts.map +1 -1
- package/dist/diff-output.js +2 -1
- package/dist/diff-output.js.map +1 -1
- package/dist/docker-exec.d.ts.map +1 -1
- package/dist/docker-exec.js +4 -4
- package/dist/docker-exec.js.map +1 -1
- package/dist/docker-runtime.d.ts +34 -4
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +155 -46
- package/dist/docker-runtime.js.map +1 -1
- package/dist/engine-answers.d.ts +2 -1
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +11 -0
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts +20 -0
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +9 -8
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-columns.d.ts +26 -0
- package/dist/engine-columns.d.ts.map +1 -0
- package/dist/engine-columns.js +67 -0
- package/dist/engine-columns.js.map +1 -0
- package/dist/engine-floor.d.ts +3 -2
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +2 -2
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-push-output.d.ts +8 -1
- package/dist/engine-push-output.d.ts.map +1 -1
- package/dist/engine-push-output.js +8 -1
- package/dist/engine-push-output.js.map +1 -1
- package/dist/env-file.d.ts +23 -3
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +74 -40
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +3 -2
- package/dist/env-lines.d.ts.map +1 -1
- package/dist/env-lines.js +5 -2
- package/dist/env-lines.js.map +1 -1
- package/dist/env-value.d.ts +15 -0
- package/dist/env-value.d.ts.map +1 -0
- package/dist/env-value.js +34 -0
- package/dist/env-value.js.map +1 -0
- package/dist/error-message.d.ts +20 -0
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +42 -0
- package/dist/error-message.js.map +1 -1
- package/dist/frontend-env.d.ts +13 -4
- package/dist/frontend-env.d.ts.map +1 -1
- package/dist/frontend-env.js +25 -5
- package/dist/frontend-env.js.map +1 -1
- package/dist/frontend-values-linked.d.ts +22 -0
- package/dist/frontend-values-linked.d.ts.map +1 -0
- package/dist/frontend-values-linked.js +143 -0
- package/dist/frontend-values-linked.js.map +1 -0
- package/dist/frontend-values.d.ts +90 -0
- package/dist/frontend-values.d.ts.map +1 -0
- package/dist/frontend-values.js +208 -0
- package/dist/frontend-values.js.map +1 -0
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +5 -5
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/functions-env-local.d.ts +13 -0
- package/dist/functions-env-local.d.ts.map +1 -0
- package/dist/functions-env-local.js +20 -0
- package/dist/functions-env-local.js.map +1 -0
- package/dist/functions-worker-files.d.ts.map +1 -1
- package/dist/functions-worker-files.js +2 -13
- package/dist/functions-worker-files.js.map +1 -1
- package/dist/generated/release-images.d.ts +6 -6
- package/dist/generated/release-images.js +3 -3
- package/dist/generated/release-images.js.map +1 -1
- package/dist/generated/typescript-libs.d.ts +4 -0
- package/dist/generated/typescript-libs.d.ts.map +1 -0
- package/dist/generated/typescript-libs.js +64 -0
- package/dist/generated/typescript-libs.js.map +1 -0
- package/dist/gitignore.d.ts +29 -2
- package/dist/gitignore.d.ts.map +1 -1
- package/dist/gitignore.js +86 -21
- package/dist/gitignore.js.map +1 -1
- package/dist/hooks-generator.d.ts.map +1 -1
- package/dist/hooks-generator.js +4 -2
- package/dist/hooks-generator.js.map +1 -1
- package/dist/host-database.d.ts +16 -12
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +28 -17
- package/dist/host-database.js.map +1 -1
- package/dist/init-answers.d.ts +18 -0
- package/dist/init-answers.d.ts.map +1 -0
- package/dist/init-answers.js +46 -0
- package/dist/init-answers.js.map +1 -0
- package/dist/init-dependency-versions.d.ts +2 -3
- package/dist/init-dependency-versions.d.ts.map +1 -1
- package/dist/init-dependency-versions.js +12 -9
- package/dist/init-dependency-versions.js.map +1 -1
- package/dist/init-example.d.ts.map +1 -1
- package/dist/init-example.js +13 -1
- package/dist/init-example.js.map +1 -1
- package/dist/init-expo-runtime-env.d.ts +25 -0
- package/dist/init-expo-runtime-env.d.ts.map +1 -0
- package/dist/init-expo-runtime-env.js +112 -0
- package/dist/init-expo-runtime-env.js.map +1 -0
- package/dist/init-next-runtime-env.d.ts +43 -0
- package/dist/init-next-runtime-env.d.ts.map +1 -0
- package/dist/init-next-runtime-env.js +261 -0
- package/dist/init-next-runtime-env.js.map +1 -0
- package/dist/init-package-json.d.ts +11 -3
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +20 -13
- package/dist/init-package-json.js.map +1 -1
- package/dist/init-port-registry.d.ts +19 -0
- package/dist/init-port-registry.d.ts.map +1 -0
- package/dist/init-port-registry.js +57 -0
- package/dist/init-port-registry.js.map +1 -0
- package/dist/init-project-detect.d.ts +20 -0
- package/dist/init-project-detect.d.ts.map +1 -1
- package/dist/init-project-detect.js +41 -8
- package/dist/init-project-detect.js.map +1 -1
- package/dist/init-vite-node.d.ts +21 -0
- package/dist/init-vite-node.d.ts.map +1 -0
- package/dist/init-vite-node.js +75 -0
- package/dist/init-vite-node.js.map +1 -0
- package/dist/jsx-first-child.d.ts +18 -0
- package/dist/jsx-first-child.d.ts.map +1 -0
- package/dist/jsx-first-child.js +53 -0
- package/dist/jsx-first-child.js.map +1 -0
- package/dist/jwt.d.ts +5 -0
- package/dist/jwt.d.ts.map +1 -1
- package/dist/jwt.js +16 -0
- package/dist/jwt.js.map +1 -1
- package/dist/keyspace-password-file.d.ts +46 -0
- package/dist/keyspace-password-file.d.ts.map +1 -0
- package/dist/keyspace-password-file.js +128 -0
- package/dist/keyspace-password-file.js.map +1 -0
- package/dist/kong-config.d.ts +1 -0
- package/dist/kong-config.d.ts.map +1 -1
- package/dist/kong-config.js +64 -20
- package/dist/kong-config.js.map +1 -1
- package/dist/local-gateway.d.ts +11 -3
- package/dist/local-gateway.d.ts.map +1 -1
- package/dist/local-gateway.js +16 -7
- package/dist/local-gateway.js.map +1 -1
- package/dist/local-secrets.d.ts +32 -0
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +49 -0
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack-guard.d.ts +37 -0
- package/dist/local-stack-guard.d.ts.map +1 -0
- package/dist/local-stack-guard.js +85 -0
- package/dist/local-stack-guard.js.map +1 -0
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +7 -6
- package/dist/local-stack.js.map +1 -1
- package/dist/local-storage.d.ts +3 -5
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/local-storage.js +10 -10
- package/dist/local-storage.js.map +1 -1
- package/dist/mailer-autoconfirm.d.ts +29 -24
- package/dist/mailer-autoconfirm.d.ts.map +1 -1
- package/dist/mailer-autoconfirm.js +47 -43
- package/dist/mailer-autoconfirm.js.map +1 -1
- package/dist/mailer-env.d.ts +4 -0
- package/dist/mailer-env.d.ts.map +1 -1
- package/dist/mailer-env.js +12 -1
- package/dist/mailer-env.js.map +1 -1
- package/dist/model-hooks.d.ts +4 -4
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +13 -7
- package/dist/model-hooks.js.map +1 -1
- package/dist/native-dev-env.d.ts +25 -2
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +39 -4
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-keyspace.d.ts +21 -6
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +48 -14
- package/dist/native-keyspace.js.map +1 -1
- package/dist/native-leftover-postgres.d.ts +23 -0
- package/dist/native-leftover-postgres.d.ts.map +1 -0
- package/dist/native-leftover-postgres.js +55 -0
- package/dist/native-leftover-postgres.js.map +1 -0
- package/dist/native-leftover-services.d.ts +17 -0
- package/dist/native-leftover-services.d.ts.map +1 -0
- package/dist/native-leftover-services.js +93 -0
- package/dist/native-leftover-services.js.map +1 -0
- package/dist/native-pg-auth.d.ts.map +1 -1
- package/dist/native-pg-auth.js +2 -1
- package/dist/native-pg-auth.js.map +1 -1
- package/dist/native-port-lock.d.ts +37 -0
- package/dist/native-port-lock.d.ts.map +1 -0
- package/dist/native-port-lock.js +78 -0
- package/dist/native-port-lock.js.map +1 -0
- package/dist/native-realtime.d.ts +6 -3
- package/dist/native-realtime.d.ts.map +1 -1
- package/dist/native-realtime.js +65 -24
- package/dist/native-realtime.js.map +1 -1
- package/dist/native-roles-sql.d.ts.map +1 -1
- package/dist/native-roles-sql.js +2 -1
- package/dist/native-roles-sql.js.map +1 -1
- package/dist/native-storage-import.d.ts.map +1 -1
- package/dist/native-storage-import.js +6 -5
- package/dist/native-storage-import.js.map +1 -1
- package/dist/native-storage.d.ts +42 -7
- package/dist/native-storage.d.ts.map +1 -1
- package/dist/native-storage.js +196 -50
- package/dist/native-storage.js.map +1 -1
- package/dist/node-executable.d.ts +6 -0
- package/dist/node-executable.d.ts.map +1 -0
- package/dist/node-executable.js +43 -0
- package/dist/node-executable.js.map +1 -0
- package/dist/parent-watch.d.ts +8 -3
- package/dist/parent-watch.d.ts.map +1 -1
- package/dist/parent-watch.js +12 -11
- package/dist/parent-watch.js.map +1 -1
- package/dist/postgres-ctl.d.ts +33 -5
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +60 -16
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +16 -0
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +34 -11
- package/dist/postgres-image.js.map +1 -1
- package/dist/process-info.d.ts +14 -0
- package/dist/process-info.d.ts.map +1 -0
- package/dist/process-info.js +41 -0
- package/dist/process-info.js.map +1 -0
- package/dist/process-manager.d.ts +110 -9
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +242 -104
- package/dist/process-manager.js.map +1 -1
- package/dist/process-tree.d.ts +48 -0
- package/dist/process-tree.d.ts.map +1 -0
- package/dist/process-tree.js +141 -0
- package/dist/process-tree.js.map +1 -0
- package/dist/project-config.d.ts +60 -4
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +23 -1
- package/dist/project-config.js.map +1 -1
- package/dist/push-audit.d.ts +4 -1
- package/dist/push-audit.d.ts.map +1 -1
- package/dist/push-audit.js +33 -4
- package/dist/push-audit.js.map +1 -1
- package/dist/recorded-field-masking-tier.d.ts +2 -2
- package/dist/recorded-field-masking-tier.d.ts.map +1 -1
- package/dist/recorded-field-masking-tier.js +6 -6
- package/dist/recorded-field-masking-tier.js.map +1 -1
- package/dist/rename-journal.d.ts +1 -1
- package/dist/rename-journal.d.ts.map +1 -1
- package/dist/required-host-components.d.ts.map +1 -1
- package/dist/required-host-components.js +3 -5
- package/dist/required-host-components.js.map +1 -1
- package/dist/resolve-api-url.d.ts +2 -0
- package/dist/resolve-api-url.d.ts.map +1 -1
- package/dist/resolve-api-url.js +5 -1
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +16 -1
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +20 -11
- package/dist/resolve-target.js.map +1 -1
- package/dist/route-manifest.d.ts +24 -0
- package/dist/route-manifest.d.ts.map +1 -1
- package/dist/route-manifest.js +60 -2
- package/dist/route-manifest.js.map +1 -1
- package/dist/run-captured.d.ts +33 -0
- package/dist/run-captured.d.ts.map +1 -0
- package/dist/run-captured.js +36 -0
- package/dist/run-captured.js.map +1 -0
- package/dist/run-until-stopped.d.ts +3 -0
- package/dist/run-until-stopped.d.ts.map +1 -1
- package/dist/run-until-stopped.js +25 -11
- package/dist/run-until-stopped.js.map +1 -1
- package/dist/runtime-routes.d.ts +5 -0
- package/dist/runtime-routes.d.ts.map +1 -1
- package/dist/runtime-routes.js +5 -1
- package/dist/runtime-routes.js.map +1 -1
- package/dist/saml-config.d.ts +53 -0
- package/dist/saml-config.d.ts.map +1 -0
- package/dist/saml-config.js +177 -0
- package/dist/saml-config.js.map +1 -0
- package/dist/saml-key-rotation.d.ts +5 -0
- package/dist/saml-key-rotation.d.ts.map +1 -0
- package/dist/saml-key-rotation.js +26 -0
- package/dist/saml-key-rotation.js.map +1 -0
- package/dist/saml-sp-certificate.d.ts +15 -0
- package/dist/saml-sp-certificate.d.ts.map +1 -0
- package/dist/saml-sp-certificate.js +34 -0
- package/dist/saml-sp-certificate.js.map +1 -0
- package/dist/schema-reset.d.ts +41 -0
- package/dist/schema-reset.d.ts.map +1 -0
- package/dist/schema-reset.js +98 -0
- package/dist/schema-reset.js.map +1 -0
- package/dist/secret-sql.d.ts +13 -0
- package/dist/secret-sql.d.ts.map +1 -0
- package/dist/secret-sql.js +13 -0
- package/dist/secret-sql.js.map +1 -0
- package/dist/seed-child.d.ts +25 -0
- package/dist/seed-child.d.ts.map +1 -0
- package/dist/seed-child.js +61 -0
- package/dist/seed-child.js.map +1 -0
- package/dist/seed-ir.d.ts +8 -1
- package/dist/seed-ir.d.ts.map +1 -1
- package/dist/seed-ir.js +92 -6
- package/dist/seed-ir.js.map +1 -1
- package/dist/seed-runner.d.ts +3 -5
- package/dist/seed-runner.d.ts.map +1 -1
- package/dist/seed-runner.js +20 -42
- package/dist/seed-runner.js.map +1 -1
- package/dist/seed.d.ts +15 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +24 -2
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +261 -63
- package/dist/self-host-compose.js.map +1 -1
- package/dist/serial-runs.d.ts +7 -0
- package/dist/serial-runs.d.ts.map +1 -0
- package/dist/serial-runs.js +29 -0
- package/dist/serial-runs.js.map +1 -0
- package/dist/sso-admin.d.ts +114 -0
- package/dist/sso-admin.d.ts.map +1 -0
- package/dist/sso-admin.js +256 -0
- package/dist/sso-admin.js.map +1 -0
- package/dist/stack-engine.d.ts +28 -0
- package/dist/stack-engine.d.ts.map +1 -0
- package/dist/stack-engine.js +59 -0
- package/dist/stack-engine.js.map +1 -0
- package/dist/stack-exit-watch.d.ts +52 -0
- package/dist/stack-exit-watch.d.ts.map +1 -0
- package/dist/stack-exit-watch.js +98 -0
- package/dist/stack-exit-watch.js.map +1 -0
- package/dist/stack-folder.d.ts +28 -0
- package/dist/stack-folder.d.ts.map +1 -0
- package/dist/stack-folder.js +123 -0
- package/dist/stack-folder.js.map +1 -0
- package/dist/stack-setting-warnings.d.ts +9 -0
- package/dist/stack-setting-warnings.d.ts.map +1 -0
- package/dist/stack-setting-warnings.js +19 -0
- package/dist/stack-setting-warnings.js.map +1 -0
- package/dist/storage-provision.d.ts +12 -2
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +36 -11
- package/dist/storage-provision.js.map +1 -1
- package/dist/studio-dev-server.d.ts.map +1 -1
- package/dist/studio-dev-server.js +2 -1
- package/dist/studio-dev-server.js.map +1 -1
- package/dist/target-client.d.ts +12 -2
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +14 -1
- package/dist/target-client.js.map +1 -1
- package/dist/tsx-runner.d.ts +5 -0
- package/dist/tsx-runner.d.ts.map +1 -1
- package/dist/tsx-runner.js +16 -16
- package/dist/tsx-runner.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +27 -3
- package/dist/type-extractor.js.map +1 -1
- package/dist/type-generation.d.ts +1 -1
- package/dist/type-generation.d.ts.map +1 -1
- package/dist/type-generation.js +2 -4
- package/dist/type-generation.js.map +1 -1
- package/dist/type-resolver.d.ts.map +1 -1
- package/dist/type-resolver.js +31 -12
- package/dist/type-resolver.js.map +1 -1
- package/dist/ui/clack-api.d.ts.map +1 -1
- package/dist/ui/clack-api.js +45 -23
- package/dist/ui/clack-api.js.map +1 -1
- package/dist/ui/components/LineInput.d.ts +26 -0
- package/dist/ui/components/LineInput.d.ts.map +1 -0
- package/dist/ui/components/LineInput.js +60 -0
- package/dist/ui/components/LineInput.js.map +1 -0
- package/dist/ui/dev/DevReadyPanelView.js +1 -1
- package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
- package/dist/ui/flows/FlowApp.d.ts +3 -1
- package/dist/ui/flows/FlowApp.d.ts.map +1 -1
- package/dist/ui/flows/FlowApp.js +14 -5
- package/dist/ui/flows/FlowApp.js.map +1 -1
- package/dist/ui/flows/prompt-fields.d.ts +3 -1
- package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
- package/dist/ui/flows/prompt-fields.js +10 -5
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/flows/types.d.ts +5 -1
- package/dist/ui/flows/types.d.ts.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/flow-transcript.d.ts +17 -0
- package/dist/ui/runtime/flow-transcript.d.ts.map +1 -0
- package/dist/ui/runtime/flow-transcript.js +38 -0
- package/dist/ui/runtime/flow-transcript.js.map +1 -0
- package/dist/ui/runtime/run-clack-flow.d.ts +7 -0
- package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +131 -17
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/valkey-sidecar.d.ts +24 -11
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +45 -25
- package/dist/valkey-sidecar.js.map +1 -1
- package/dist/windows-processes.d.ts +7 -0
- package/dist/windows-processes.d.ts.map +1 -0
- package/dist/windows-processes.js +31 -0
- package/dist/windows-processes.js.map +1 -0
- package/dist/write-if-changed.d.ts +12 -0
- package/dist/write-if-changed.d.ts.map +1 -0
- package/dist/write-if-changed.js +32 -0
- package/dist/write-if-changed.js.map +1 -0
- package/package.json +7 -6
- package/dist/systemd.d.ts +0 -26
- package/dist/systemd.d.ts.map +0 -1
- package/dist/systemd.js +0 -117
- package/dist/systemd.js.map +0 -1
package/dist/dev-compose.js
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
5
5
|
import { projectOutputPaths, writeAstDerivedOutputs, writeSeedBuilder } from "./type-generation.js";
|
|
6
6
|
import { errorMessage } from "./error-message.js";
|
|
7
|
-
import {
|
|
7
|
+
import { printRoleAccess } from "./diff-access.js";
|
|
8
|
+
import { postApplyFailed } from "./post-apply.js";
|
|
8
9
|
import { FRONTEND_URL_KEYS, frontendEnv, writeFrontendEnv } from "./frontend-env.js";
|
|
9
10
|
import { withPublishing } from "./model-versioning.js";
|
|
10
11
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { homedir } from "node:os";
|
|
12
12
|
import { dirname, join } from "node:path";
|
|
13
13
|
import { askDocker, askDockerSync, DOCKER_EXEC_TIMEOUT_MS, DOCKER_QUERY_TIMEOUT_MS } from "./docker-exec.js";
|
|
14
|
-
import {
|
|
14
|
+
import { appPanelLinks, startProxyDevApp } from "./app/proxy-dev-app.js";
|
|
15
15
|
import { loadSchemaAst, projectNameInFile } from "./config.js";
|
|
16
16
|
import { withComposeSchemaPushLock } from "./schema-push-lock.js";
|
|
17
17
|
import { recordDatabaseTier, sameApiSurface } from "./recorded-field-masking-tier.js";
|
|
18
|
-
import { connectionString, pgSchema, projectRootFromConfig, resolveRuntimeProvider, schemaPathFromProject, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
|
|
18
|
+
import { connectionString, nativeStateRoot, pgSchema, projectRootFromConfig, resolveRuntimeProvider, schemaPathFromProject, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
|
|
19
19
|
import { rowCacheChangeNote } from "./model-cache.js";
|
|
20
20
|
import { writeAppliedAstArtifacts } from "./applied-ast-artifacts.js";
|
|
21
21
|
import { anonKeyEnvUpdates } from "./commands/keys.js";
|
|
@@ -25,8 +25,9 @@ import { astRelatesToAuthUsers } from "./byo-preflight.js";
|
|
|
25
25
|
import { ensureDevDbPort, ensureKongPort } from "./dev-ports.js";
|
|
26
26
|
import { applyForThisRun, splitShellPortUpdates } from "./shell-ports.js";
|
|
27
27
|
import { handleComposeProjectRename } from "./compose-rename.js";
|
|
28
|
-
import { devSessionLockFor, recoverStaleDevSession, writeDevSessionLock } from "./dev-session-lock.js";
|
|
29
|
-
import {
|
|
28
|
+
import { devSessionLockFor, enterLocalStack, recoverStaleDevSession, writeDevSessionLock } from "./dev-session-lock.js";
|
|
29
|
+
import { recordStackFolder, refuseOtherFoldersStack } from "./stack-folder.js";
|
|
30
|
+
import { endDevSession, showDevStep, startDevSession, withSavePushOutput } from "./dev-session.js";
|
|
30
31
|
import { ensureDevApiConfig } from "./ensure-dev-api-config.js";
|
|
31
32
|
import { cacheSeedingNotes } from "./api-config-cache.js";
|
|
32
33
|
import { restartComposeFunctionsWorker, watchFunctionSources } from "./dev-functions-watch.js";
|
|
@@ -41,6 +42,7 @@ import { auditFlags, auditWhenSupported } from "./push-audit.js";
|
|
|
41
42
|
import { consentRefusal, reportDevPushFailure } from "./push-refusal.js";
|
|
42
43
|
import { COMPOSE_PINNED_IMAGE_ENV_KEYS, composeDockerImageEnv, composeProjectName, exitComposeFailed, noteUnpinnedImages, publishesDbToHost, runDockerCompose, runDockerComposeQuietly, settleComposeRuns, schemaEngineImageForPush, writeSelfHostCompose, composeFieldMaskingTier, selfHostComposePaths, } from "./self-host-compose.js";
|
|
43
44
|
import { composeServiceIsRunning } from "./compose-kong.js";
|
|
45
|
+
import { requireStackDatabase } from "./local-stack-guard.js";
|
|
44
46
|
import { hasEngineOverride } from "./binary-cache.js";
|
|
45
47
|
import { STUDIO_DEV_PORT, startStudioViteDevServer } from "./studio-dev-server.js";
|
|
46
48
|
import { ensureLocalServerDockerImage, usesLocalServerImage, LOCAL_SERVER_DOCKER_IMAGE, } from "./compose-local-server-image.js";
|
|
@@ -48,14 +50,14 @@ import { ensureEngine, enginePush, engineRequest } from "./engine-client.js";
|
|
|
48
50
|
import { isAdoptOutcome, isAnyAnswer, isDiffResult, isEnginePushResult, isGenerateAnswer, } from "./engine-answers.js";
|
|
49
51
|
import { writeSchemaSourcePushArtifacts } from "./schema-sources.js";
|
|
50
52
|
import { readEnvFile, readEnvValue, upsertEnvFile } from "./env-file.js";
|
|
51
|
-
import {
|
|
53
|
+
import { warnMissingStackSettings } from "./stack-setting-warnings.js";
|
|
52
54
|
import { devDatabaseIdentity, devDatabaseUrl, seedMissingDatabaseIdentity, seedMissingLocalSecrets, } from "./local-secrets.js";
|
|
53
55
|
import { writeLocalEnvironment } from "./link.js";
|
|
54
56
|
import { registerDevShutdown, waitForDevShutdown } from "./dev-shutdown.js";
|
|
55
57
|
import { filterComposeNoise, parseEngineJsonOutput, parseEnginePushOutput, reportAppliedPush, } from "./engine-push-output.js";
|
|
56
58
|
import { withAdminRoles } from "./studio-admin-roles.js";
|
|
57
59
|
import { restoreSystemRelationTargets } from "./restore-system-relation-targets.js";
|
|
58
|
-
import { provisionBucketsFromAst, unprovisionedBuckets } from "./storage-provision.js";
|
|
60
|
+
import { provisionBucketsFromAst, unprovisionedBuckets, warnBucketsLeft } from "./storage-provision.js";
|
|
59
61
|
import { ensureFirstAdminUserForProject } from "./commands/admin.js";
|
|
60
62
|
import { demoDataHint, publishDevReady } from "./dev-ready-panel.js";
|
|
61
63
|
import { pushInitialSchema, settleInitialPush } from "./dev-initial-push.js";
|
|
@@ -65,15 +67,16 @@ import { adoptKeysNeed, assertSupported, engineCapabilities, identityColumnsNeed
|
|
|
65
67
|
import { devPushConsentingToDrift } from "./drift-consent.js";
|
|
66
68
|
import { capabilitiesCache, rememberCapabilitiesSync } from "@supatype/shared";
|
|
67
69
|
import { waitForDatabaseAfterUp } from "./dev-db-ready.js";
|
|
68
|
-
import { DERIVED_DSN_SOURCE, hostComposeDbUrl, requireRunningStack, resolveHostDatabaseUrl, stackHostDbUrl, } from "./host-database.js";
|
|
70
|
+
import { DERIVED_DSN_SOURCE, hostComposeDbUrl, NoStackRunning, requireRunningStack, resolveHostDatabaseUrl, stackHostDbUrl, } from "./host-database.js";
|
|
69
71
|
import { studioUrlAt } from "./local-stack.js";
|
|
70
72
|
import { grantAuthSchemaAccess, privatizeTableDefaults, reconcileAuthenticatorPassword, reconcileSqlEditorPassword, } from "./compose-db-roles.js";
|
|
71
|
-
import { spawnComposeEngine } from "./compose-engine-run.js";
|
|
73
|
+
import { spawnComposeEngine, spawnComposeEngineSync } from "./compose-engine-run.js";
|
|
72
74
|
import { waitForRestReady } from "./rest-ready.js";
|
|
73
|
-
import { claimDevRenderMode, composeRenderMode, composeRenderOptions } from "./compose-render-mode.js";
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
75
|
+
import { claimDevRenderMode, composeRenderMode, composeRenderOptions, runningStackMode } from "./compose-render-mode.js";
|
|
76
|
+
import { configMailerEnv } from "./config-mailer-env.js";
|
|
77
|
+
import { retireCliMailerAutoconfirm } from "./mailer-autoconfirm.js";
|
|
76
78
|
import { fetchWithin } from "./fetch-within.js";
|
|
79
|
+
import { composeStackWatch, exitedServiceFailure } from "./stack-exit-watch.js";
|
|
77
80
|
import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
|
|
78
81
|
/**
|
|
79
82
|
* The image pins config asks for, once the engine's is known not to be older than this CLI needs.
|
|
@@ -116,10 +119,14 @@ function projectDatabaseUrl(cwd, config, inNetwork = false) {
|
|
|
116
119
|
return inNetwork ? composeDbUrl(cwd) : stackHostDbUrl(cwd, config.project.name);
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
119
|
-
* When `provider: docker` and `overrides.engine` is set
|
|
120
|
-
* on the host
|
|
122
|
+
* When `provider: docker` and `overrides.engine` is set: the stack's Postgres, which the local
|
|
123
|
+
* engine binary reaches on the host port the compose file publishes. Every layout publishes `db`
|
|
124
|
+
* ({@link publishesDbToHost}), dev on SUPATYPE_DEV_DB_PORT and standalone on SUPATYPE_DB_PORT, so
|
|
125
|
+
* on a running stack it is already there. Nothing is started (issue 46): this ran `up -d db`, and
|
|
126
|
+
* on a dev stack moved the dev port first, under a database that was already up. A stack that is
|
|
127
|
+
* not running, or whose `db` container is not, is refused instead.
|
|
121
128
|
*/
|
|
122
|
-
export
|
|
129
|
+
export function ensureDockerDbPublishedForHostEngine(cwd, config, command) {
|
|
123
130
|
if (resolveRuntimeProvider(config) !== "docker") {
|
|
124
131
|
throw new Error("ensureDockerDbPublishedForHostEngine requires provider: docker");
|
|
125
132
|
}
|
|
@@ -127,15 +134,9 @@ export async function ensureDockerDbPublishedForHostEngine(cwd, config, brand) {
|
|
|
127
134
|
throw new Error("This project uses an external database, so there is no Docker Postgres to publish. " +
|
|
128
135
|
"Point DATABASE_URL at it, or pass --connection.");
|
|
129
136
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// the URL the engine is handed cannot be derived, so refuse before starting anything (M1b).
|
|
134
|
-
const mode = requireRunningStack(cwd, config.project.name);
|
|
135
|
-
if (mode === "dev")
|
|
136
|
-
await prepareDevComposeEnv(cwd, config, project, await resolveKongPort(cwd, project));
|
|
137
|
-
const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
|
|
138
|
-
await startComposeDatabase(config, paths, cwd, project, brand);
|
|
137
|
+
// With no stack running the URL the engine is handed cannot be derived (M1b).
|
|
138
|
+
requireRunningStack(cwd, config.project.name);
|
|
139
|
+
requireStackDatabase(cwd, config, command);
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
142
|
* True when CLI should publish local Compose Postgres for the host-side engine
|
|
@@ -161,10 +162,10 @@ export async function resolveHostEngineDatabaseUrl(cwd, config, explicit) {
|
|
|
161
162
|
// The URL comes from the one resolver every host-side command uses. It is resolved first so a
|
|
162
163
|
// derived URL with no stack running refuses before anything starts (M1b), and a DATABASE_URL
|
|
163
164
|
// someone set is used without one. Then, when it is this project's local docker Postgres, the
|
|
164
|
-
// database is
|
|
165
|
+
// stack's database is checked to be running, which is what the URL reaches.
|
|
165
166
|
const resolved = resolveHostDatabaseUrl(cwd, config, { connection: explicit, allowDerived: true });
|
|
166
167
|
if (resolved.source === DERIVED_DSN_SOURCE && usesLocalDockerEngineDb(config, explicit)) {
|
|
167
|
-
|
|
168
|
+
ensureDockerDbPublishedForHostEngine(cwd, config);
|
|
168
169
|
}
|
|
169
170
|
return resolved.dsn;
|
|
170
171
|
}
|
|
@@ -182,8 +183,8 @@ export async function projectComposeEngine(cwd, config) {
|
|
|
182
183
|
return undefined;
|
|
183
184
|
if (config.connection?.trim())
|
|
184
185
|
return undefined;
|
|
186
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
185
187
|
const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
|
|
186
|
-
const project = composeProjectName(config.project.name);
|
|
187
188
|
const engineImage = await schemaEngineImageForPush(config, cwd);
|
|
188
189
|
return {
|
|
189
190
|
target: { cwd, project, composePath: paths.composePath, engineImage },
|
|
@@ -219,9 +220,14 @@ async function startComposeDatabase(config, paths, cwd, project, brand, timeoutM
|
|
|
219
220
|
}
|
|
220
221
|
await waitComposeHealthy(paths, cwd, timeoutMs, project);
|
|
221
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Write dev's values into `.env`, and return those held for this run only (DR9): built from a port
|
|
225
|
+
* only the shell gave, and set in this process's environment instead. The dev session records them.
|
|
226
|
+
*/
|
|
222
227
|
export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort) {
|
|
223
228
|
const apiUrl = `http://localhost:${kongPort}`;
|
|
224
229
|
const imagePins = checkedImagePins(config);
|
|
230
|
+
const mailer = configMailerEnv(config);
|
|
225
231
|
// `POSTGRES_PASSWORD` and `JWT_SECRET` are deliberately absent.
|
|
226
232
|
//
|
|
227
233
|
// They used to be pinned here to published constants on every `dev` run, against the same
|
|
@@ -247,12 +253,10 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
|
|
|
247
253
|
SUPATYPE_KONG_PORT: String(kongPort),
|
|
248
254
|
API_EXTERNAL_URL: apiUrl,
|
|
249
255
|
SITE_URL: apiUrl,
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
// service's noop client and no message at all.
|
|
255
|
-
...mailerProviderEnv(config.email),
|
|
256
|
+
// email.provider and its settings, which the compose file passes to the server. The compose path
|
|
257
|
+
// used to carry none of them, so a project that asked for smtp, Resend or SES got the noop
|
|
258
|
+
// mailer. Email confirmation is not written here: the compose file falls back to the config.
|
|
259
|
+
...mailer.updates,
|
|
256
260
|
...imagePins,
|
|
257
261
|
};
|
|
258
262
|
// Never for an external database: this URL describes the `db` container, which that project does
|
|
@@ -284,16 +288,16 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
|
|
|
284
288
|
applyForThisRun(runOnly);
|
|
285
289
|
const { urlsKept, rest } = takeFrontendUrls(persist);
|
|
286
290
|
upsertEnvFile(cwd, rest, {
|
|
287
|
-
removeManaged: removeImageKeys,
|
|
288
|
-
managed: [...managedImageKeys,
|
|
291
|
+
removeManaged: [...removeImageKeys, ...mailer.removeManaged],
|
|
292
|
+
managed: [...managedImageKeys, ...mailer.managed],
|
|
289
293
|
remove: [...retiredKeys, ...staleLocalServerImage(dotEnv["SUPATYPE_SERVER_IMAGE"], wantsLocalServer, imagePins)],
|
|
290
294
|
});
|
|
291
295
|
// The front end's copies go where a development build reads them, not .env, which a production
|
|
292
296
|
// build reads (frontend-env.ts). The URL only when it is the project's port, not the shell's.
|
|
293
297
|
writeFrontendEnv(cwd, { anonKey, ...(urlsKept && { apiUrl }) }, { local: true });
|
|
294
|
-
if (devDbPort
|
|
295
|
-
|
|
296
|
-
}
|
|
298
|
+
if (devDbPort === undefined || usesExternalDatabase(config))
|
|
299
|
+
return runOnly;
|
|
300
|
+
return { ...runOnly, ...writeDevStackDatabaseUrl(cwd, devDbPort, runOnly.SUPATYPE_DEV_DB_PORT !== undefined) };
|
|
297
301
|
}
|
|
298
302
|
/** `persist` less the front-end URL names, and whether they were among what is kept. */
|
|
299
303
|
function takeFrontendUrls(persist) {
|
|
@@ -316,18 +320,22 @@ function staleLocalServerImage(current, wantsLocalServer, imagePins) {
|
|
|
316
320
|
* Docker dev's DATABASE_URL: the stack's database at `devDbPort`, with the project's own user and
|
|
317
321
|
* database, not hardcoded ones, which on a project not named "supatype" named a database that does
|
|
318
322
|
* not exist. Written over a URL the CLI owns, for this run only when the port is the shell's; one
|
|
319
|
-
* that is yours always wins (database-url-owner.ts).
|
|
323
|
+
* that is yours always wins (database-url-owner.ts). The URL when it was set for this run only.
|
|
320
324
|
*/
|
|
321
325
|
function writeDevStackDatabaseUrl(cwd, devDbPort, runOnly) {
|
|
322
326
|
const url = hostComposeDbUrl(cwd, devDbPort);
|
|
323
|
-
if (runOnly)
|
|
324
|
-
setCliDatabaseUrlForRun(databaseUrlState(cwd), url);
|
|
325
|
-
else
|
|
327
|
+
if (!runOnly) {
|
|
326
328
|
writeCliDatabaseUrl(cwd, url);
|
|
329
|
+
return {};
|
|
330
|
+
}
|
|
331
|
+
return setCliDatabaseUrlForRun(databaseUrlState(cwd), url) ? { DATABASE_URL: url } : {};
|
|
327
332
|
}
|
|
328
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* Keep compose + Studio on the same freshly signed dev JWTs; sync optional image pins from config.
|
|
335
|
+
* The values held for this run only, as {@link upsertDevComposeEnv} returns them.
|
|
336
|
+
*/
|
|
329
337
|
function ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort) {
|
|
330
|
-
upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort);
|
|
338
|
+
return upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort);
|
|
331
339
|
}
|
|
332
340
|
/**
|
|
333
341
|
* The dev `.env` a push to a dev stack keeps current: the dev database port and the dev values.
|
|
@@ -446,34 +454,49 @@ async function reportUnhealthyStack(composePath, cwd, project) {
|
|
|
446
454
|
}
|
|
447
455
|
console.error("");
|
|
448
456
|
}
|
|
449
|
-
|
|
457
|
+
/** One look at the gateway's two health routes: whether both answer OK, and what each said. */
|
|
458
|
+
async function gatewayHealth(base) {
|
|
459
|
+
try {
|
|
460
|
+
const [auth, realtime] = await Promise.all([
|
|
461
|
+
fetchWithin(`${base}/auth/v1/health`, 2000),
|
|
462
|
+
fetchWithin(`${base}/realtime/v1/health`, 2000),
|
|
463
|
+
]);
|
|
464
|
+
return { ready: auth.ok && realtime.ok, auth: `HTTP ${auth.status}`, realtime: `HTTP ${realtime.status}` };
|
|
465
|
+
}
|
|
466
|
+
catch (err) {
|
|
467
|
+
return { ready: false, auth: errorMessage(err), realtime: errorMessage(err) };
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Wait for the gateway at `kongPort`, watching `stack`'s essential services as it goes: one that
|
|
472
|
+
* has exited will not come back, so the wait stops there and prints its exit code and last log
|
|
473
|
+
* lines before the caller's cleanup removes them (issue 38). Either failure ends dev's dashboard
|
|
474
|
+
* first, so what it prints reaches the terminal rather than a screen that is about to close.
|
|
475
|
+
*/
|
|
476
|
+
export async function waitKongReady(kongPort, maxSec, stack) {
|
|
450
477
|
const base = loopbackBase(kongPort);
|
|
478
|
+
const watched = stack === undefined ? undefined : { watch: stack.watch ?? composeStackWatch(stack), cwd: stack.cwd };
|
|
451
479
|
// Remembered so the failure can name the unhealthy upstream. Blaming "the
|
|
452
480
|
// Kong gateway" sent more than one investigation after Kong when Kong was
|
|
453
481
|
// fine and a service behind it was not.
|
|
454
|
-
let
|
|
455
|
-
let lastRealtime = "no response";
|
|
482
|
+
let last = { auth: "no response", realtime: "no response" };
|
|
456
483
|
for (let i = 0; i < maxSec; i++) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
if (auth.ok && realtime.ok)
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
catch (err) {
|
|
468
|
-
lastAuth = lastRealtime = errorMessage(err);
|
|
484
|
+
const [health, exited] = await Promise.all([gatewayHealth(base), watched?.watch.exited().catch(() => undefined)]);
|
|
485
|
+
if (health.ready)
|
|
486
|
+
return;
|
|
487
|
+
last = health;
|
|
488
|
+
if (exited !== undefined && watched !== undefined) {
|
|
489
|
+
endDevSession();
|
|
490
|
+
throw await exitedServiceFailure(exited, watched);
|
|
469
491
|
}
|
|
470
492
|
await sleep(1000);
|
|
471
493
|
}
|
|
472
494
|
if (stack !== undefined) {
|
|
495
|
+
endDevSession();
|
|
473
496
|
await reportUnhealthyStack(stack.composePath, stack.cwd, stack.project);
|
|
474
497
|
}
|
|
475
498
|
throw new Error(`Gateway at ${base} did not become ready within ${maxSec}s ` +
|
|
476
|
-
`(auth/v1/health: ${
|
|
499
|
+
`(auth/v1/health: ${last.auth}, realtime/v1/health: ${last.realtime})`);
|
|
477
500
|
}
|
|
478
501
|
/** Kong may be up while server → storage is still starting (503 or upstream errors). */
|
|
479
502
|
async function waitStorageApiReady(kongPort, serviceRoleKey, maxSec) {
|
|
@@ -499,15 +522,16 @@ async function waitStorageApiReady(kongPort, serviceRoleKey, maxSec) {
|
|
|
499
522
|
console.warn(`[supatype] Storage API at ${url} did not become ready within ${maxSec}s, bucket provisioning may fail.`);
|
|
500
523
|
}
|
|
501
524
|
/**
|
|
502
|
-
* The schema's buckets on the
|
|
503
|
-
*
|
|
504
|
-
*
|
|
525
|
+
* The schema's buckets on the stack: the line naming those the service did not take, or null when it
|
|
526
|
+
* took them all. Each caller decides what that means: dev and `compose up` carry on and warn
|
|
527
|
+
* ({@link warnBucketsLeft}), a push ends non-zero (0.9.1 release test FF2).
|
|
505
528
|
*/
|
|
506
529
|
async function provisionDockerStorageBuckets(ast, kongPort, serviceRoleKey) {
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
console.warn(`[supatype] ⚠ ${left}; uploads to them fail until a later push takes them.`);
|
|
530
|
+
const storageApi = `${loopbackBase(kongPort)}/storage/v1`;
|
|
531
|
+
return unprovisionedBuckets(await provisionBucketsFromAst(ast, storageApi, serviceRoleKey, { storageLogs: STORAGE_LOGS }));
|
|
510
532
|
}
|
|
533
|
+
/** The command that shows the storage container's log, named when it is not answering (N-FF11). */
|
|
534
|
+
const STORAGE_LOGS = "supatype self-host compose logs --service storage";
|
|
511
535
|
let _lastPushedAst = null;
|
|
512
536
|
let _lastFailedAst = null;
|
|
513
537
|
/** The schema the last push read, whether it applied, was refused or failed. */
|
|
@@ -680,6 +704,8 @@ export async function runComposeSchemaPush(cwd, config, paths, schemaPath, compo
|
|
|
680
704
|
// asked by `engineRequest`).
|
|
681
705
|
if (!hasEngineOverride(config))
|
|
682
706
|
await requireDockerFeatures(cwd, config, identityColumnsNeed(ast));
|
|
707
|
+
if (opts.access === "plan")
|
|
708
|
+
await printPlannedAccess(cwd, config);
|
|
683
709
|
try {
|
|
684
710
|
if (hasEngineOverride(config))
|
|
685
711
|
await applyViaHostEngine(cwd, config, ast, opts);
|
|
@@ -693,9 +719,27 @@ export async function runComposeSchemaPush(cwd, config, paths, schemaPath, compo
|
|
|
693
719
|
_lastPushedAst = astJson;
|
|
694
720
|
_lastFailedAst = null;
|
|
695
721
|
if (astRelatesToAuthUsers(ast))
|
|
696
|
-
grantAuthSchemaAccess(paths, cwd, composeProject);
|
|
722
|
+
await grantAuthSchemaAccess(paths, cwd, composeProject);
|
|
697
723
|
await refreshSchemaArtifacts(cwd, config, ast);
|
|
698
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* Each API role's access as the push about to apply leaves it, from a diff of the AST just written.
|
|
727
|
+
* Only a preview: a diff that fails says so and the push goes on, to report what is wrong itself.
|
|
728
|
+
*/
|
|
729
|
+
async function printPlannedAccess(cwd, config) {
|
|
730
|
+
try {
|
|
731
|
+
const diff = await dockerDiff(cwd, config);
|
|
732
|
+
if (diff !== undefined)
|
|
733
|
+
printRoleAccess(diff);
|
|
734
|
+
}
|
|
735
|
+
catch (err) {
|
|
736
|
+
console.log(`[supatype] Could not read each role's access before the push: ${errorMessage(err)}`);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
/** What a push reports of each role's access once applied: only `changes` prints anything. */
|
|
740
|
+
function appliedAccess(opts) {
|
|
741
|
+
return opts.access === undefined || opts.access === "changes" ? "changes" : "quiet";
|
|
742
|
+
}
|
|
699
743
|
/** The schema on disk as a push sends it, and that AST serialized for comparing pushes. */
|
|
700
744
|
function readSchemaToPush(schemaPath, cwd, config) {
|
|
701
745
|
const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
|
|
@@ -738,7 +782,7 @@ async function applyViaHostEngine(cwd, config, ast, opts) {
|
|
|
738
782
|
schema_sources_manifest: sources.payload.manifest,
|
|
739
783
|
}),
|
|
740
784
|
};
|
|
741
|
-
reportAppliedPush(await enginePush(cwd, body, isEnginePushResult));
|
|
785
|
+
reportAppliedPush(await enginePush(cwd, body, isEnginePushResult), appliedAccess(opts));
|
|
742
786
|
}
|
|
743
787
|
/** Apply the AST on disk with the stack's schema-engine container. Throws when it is not applied. */
|
|
744
788
|
async function applyViaComposeEngine(cwd, config, stack, opts) {
|
|
@@ -777,7 +821,7 @@ async function runComposeSchemaPushQueued(cwd, config, paths, schemaPath, compos
|
|
|
777
821
|
_composePushQueued = false;
|
|
778
822
|
await runDevSchemaPush(cwd, config, paths, schemaPath, composeProject, opts);
|
|
779
823
|
} while (_composePushQueued);
|
|
780
|
-
followRecordedTier(cwd, config, { recreate: true });
|
|
824
|
+
await followRecordedTier(cwd, config, { recreate: true });
|
|
781
825
|
}
|
|
782
826
|
finally {
|
|
783
827
|
_composePushInFlight = false;
|
|
@@ -791,13 +835,13 @@ async function runComposeSchemaPushQueued(cwd, config, paths, schemaPath, compos
|
|
|
791
835
|
* recreated so a running stack serves the new search path now; a caller about to run
|
|
792
836
|
* `compose up -d` leaves that to it.
|
|
793
837
|
*/
|
|
794
|
-
export function followRecordedTier(cwd, config, opts) {
|
|
838
|
+
export async function followRecordedTier(cwd, config, opts) {
|
|
795
839
|
if (usesExternalDatabase(config))
|
|
796
840
|
return;
|
|
797
|
-
const project =
|
|
841
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
798
842
|
const paths = selfHostComposePaths(cwd);
|
|
799
843
|
const served = composeFieldMaskingTier(cwd, config);
|
|
800
|
-
const recorded = recordDatabaseTier(cwd, { project, composePath: paths.composePath });
|
|
844
|
+
const recorded = await recordDatabaseTier(cwd, { project, composePath: paths.composePath });
|
|
801
845
|
if (recorded === undefined || sameApiSurface(config, served, recorded))
|
|
802
846
|
return;
|
|
803
847
|
writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
|
|
@@ -835,11 +879,11 @@ async function runDevSchemaPush(cwd, config, paths, schemaPath, composeProject,
|
|
|
835
879
|
* may be renames. Reads the AST the push wrote, so it is the schema that was refused.
|
|
836
880
|
*/
|
|
837
881
|
export async function dockerDiff(cwd, config) {
|
|
882
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
838
883
|
if (hasEngineOverride(config)) {
|
|
839
884
|
const ast = JSON.parse(readFileSync(join(cwd, ".supatype", "schema.ast.json"), "utf8"));
|
|
840
885
|
return engineRequest("/diff", { ast, database_url: projectDatabaseUrl(cwd, config), schema: pgSchema(config) }, isDiffResult);
|
|
841
886
|
}
|
|
842
|
-
const project = composeProjectName(config.project.name);
|
|
843
887
|
const result = await runComposeEngineDiff(selfHostComposePaths(cwd), cwd, project, config);
|
|
844
888
|
return result.diff ?? undefined;
|
|
845
889
|
}
|
|
@@ -858,7 +902,7 @@ async function runComposeEnginePush(paths, cwd, composeProject, config, sources,
|
|
|
858
902
|
const pushResult = parseEnginePushOutput(output);
|
|
859
903
|
if (exitStatus === 0) {
|
|
860
904
|
if (pushResult) {
|
|
861
|
-
reportAppliedPush(pushResult);
|
|
905
|
+
reportAppliedPush(pushResult, appliedAccess(opts));
|
|
862
906
|
}
|
|
863
907
|
else {
|
|
864
908
|
console.log("[supatype] Schema applied.");
|
|
@@ -873,13 +917,14 @@ async function runComposeEnginePush(paths, cwd, composeProject, config, sources,
|
|
|
873
917
|
export async function dockerEngineCapabilities(cwd, config) {
|
|
874
918
|
if (hasEngineOverride(config))
|
|
875
919
|
return engineCapabilities();
|
|
920
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
876
921
|
const engineImage = await schemaEngineImageForPush(config, cwd);
|
|
877
922
|
// An image Docker could not pull throws with the daemon's sentence, and is asked again next time.
|
|
878
923
|
const probe = () => {
|
|
879
924
|
const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
|
|
880
|
-
const target = { cwd, project
|
|
925
|
+
const target = { cwd, project, composePath: paths.composePath, engineImage };
|
|
881
926
|
return checkedCapabilities((args) => {
|
|
882
|
-
const run =
|
|
927
|
+
const run = spawnComposeEngineSync(target, args, { runFlags: ["--no-deps"] });
|
|
883
928
|
return { status: run.status, stdout: run.stdout, stderr: run.error ?? run.stderr };
|
|
884
929
|
});
|
|
885
930
|
};
|
|
@@ -959,7 +1004,7 @@ async function runComposeEngineCommand(paths, cwd, composeProject, config, comma
|
|
|
959
1004
|
async function runComposeEngine(paths, cwd, composeProject, config, engineArgs) {
|
|
960
1005
|
const engineImage = await schemaEngineImageForPush(config, cwd);
|
|
961
1006
|
const target = { cwd, project: composeProject, composePath: paths.composePath, engineImage };
|
|
962
|
-
const result = spawnComposeEngine(target, engineArgs, {
|
|
1007
|
+
const result = await spawnComposeEngine(target, engineArgs, {
|
|
963
1008
|
secrets: { DATABASE_URL: projectDatabaseUrl(cwd, config, true) },
|
|
964
1009
|
});
|
|
965
1010
|
return {
|
|
@@ -998,13 +1043,13 @@ export function dockerAdoptionSteps(cwd, config) {
|
|
|
998
1043
|
* which it is whenever a push has just been refused by it.
|
|
999
1044
|
*/
|
|
1000
1045
|
export async function adoptSchemaDocker(cwd, config, yes, keys) {
|
|
1001
|
-
const project =
|
|
1046
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
1002
1047
|
// Only these conflicts, or none for an empty list: never sent to an engine that would read
|
|
1003
1048
|
// either as "every conflict".
|
|
1004
1049
|
if (keys !== undefined)
|
|
1005
1050
|
await requireDockerFeatures(cwd, config, [adoptKeysNeed(keys)]);
|
|
1006
1051
|
if (hasEngineOverride(config)) {
|
|
1007
|
-
|
|
1052
|
+
ensureDockerDbPublishedForHostEngine(cwd, config, "adopt");
|
|
1008
1053
|
await ensureEngine();
|
|
1009
1054
|
return engineRequest("/adopt", {
|
|
1010
1055
|
ast: withPublishing(loadSchemaAst(schemaPathFromProject(config, cwd), cwd), config),
|
|
@@ -1029,60 +1074,30 @@ export async function adoptSchemaDocker(cwd, config, yes, keys) {
|
|
|
1029
1074
|
* `overrides.engine` is set: then Postgres is published to the host and diff runs
|
|
1030
1075
|
* through the local engine binary.
|
|
1031
1076
|
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1077
|
+
* Only against a stack that is running (issue 41): a stopped one is refused, not started. The diff
|
|
1078
|
+
* used to start Postgres itself, and stop it again afterwards.
|
|
1034
1079
|
*/
|
|
1035
1080
|
export async function diffSchemaDocker(cwd, config) {
|
|
1036
1081
|
if (resolveRuntimeProvider(config) !== "docker") {
|
|
1037
1082
|
throw new Error("diffSchemaDocker requires provider: docker");
|
|
1038
1083
|
}
|
|
1039
|
-
const project =
|
|
1040
|
-
const brand = { intro: "Schema diff" };
|
|
1084
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
1041
1085
|
if (hasEngineOverride(config)) {
|
|
1042
|
-
|
|
1086
|
+
ensureDockerDbPublishedForHostEngine(cwd, config, "diff");
|
|
1087
|
+
return diffWithHostEngine(cwd, config);
|
|
1043
1088
|
}
|
|
1089
|
+
const running = runningStackMode(cwd, config.project.name);
|
|
1090
|
+
if (running === undefined && !usesExternalDatabase(config))
|
|
1091
|
+
throw new NoStackRunning("diff");
|
|
1044
1092
|
// A diff of a standalone stack must not write dev values over the operator's .env (SH1). A dev
|
|
1045
|
-
// stack's is brought up to date as push does: compose interpolates the whole file
|
|
1046
|
-
|
|
1047
|
-
const mode = composeRenderMode(cwd, config.project.name);
|
|
1093
|
+
// stack's is brought up to date as push does: compose interpolates the whole file.
|
|
1094
|
+
const mode = running ?? "standalone";
|
|
1048
1095
|
if (mode === "dev") {
|
|
1049
1096
|
const { anonKey, serviceRoleKey } = devApiKeys(cwd);
|
|
1050
1097
|
ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, await resolveKongPort(cwd, project), undefined);
|
|
1051
1098
|
}
|
|
1052
1099
|
const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
|
|
1053
|
-
return
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* `run` with the stack's database up, `start` bringing it up, then stopped again when it was not
|
|
1057
|
-
* running before. One that a `supatype dev` session or a running stack is using is left as it was.
|
|
1058
|
-
*/
|
|
1059
|
-
async function withComposeDatabaseStarted(cwd, config, project, start, run) {
|
|
1060
|
-
const stack = { project, composePath: selfHostComposePaths(cwd).composePath };
|
|
1061
|
-
// An external database is not the stack's to start or stop.
|
|
1062
|
-
const wasStopped = !usesExternalDatabase(config) && !composeServiceIsRunning(cwd, stack, "db");
|
|
1063
|
-
let started = false;
|
|
1064
|
-
try {
|
|
1065
|
-
await start();
|
|
1066
|
-
started = true;
|
|
1067
|
-
return await run();
|
|
1068
|
-
}
|
|
1069
|
-
finally {
|
|
1070
|
-
// A start that failed after `up -d db` (its health wait, the host publish) has still brought
|
|
1071
|
-
// the container up; one refused before it (no stack running) has started nothing to stop.
|
|
1072
|
-
if (wasStopped && (started || composeServiceIsRunning(cwd, stack, "db")))
|
|
1073
|
-
stopComposeDatabase(cwd, stack);
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
/** Stop the stack's database, saying so rather than failing the command whose result is already in hand. */
|
|
1077
|
-
function stopComposeDatabase(cwd, stack) {
|
|
1078
|
-
try {
|
|
1079
|
-
const status = runDockerCompose(stack.composePath, ["stop", "db"], cwd, stack.project, { quiet: true });
|
|
1080
|
-
if (status !== 0)
|
|
1081
|
-
warn("Could not stop the Postgres container this command started. Stop it with `supatype self-host compose stop db`.");
|
|
1082
|
-
}
|
|
1083
|
-
catch (err) {
|
|
1084
|
-
warn(`Could not stop the Postgres container this command started: ${errorMessage(err)}`);
|
|
1085
|
-
}
|
|
1100
|
+
return diffWithComposeEngine(cwd, config, paths, project);
|
|
1086
1101
|
}
|
|
1087
1102
|
/** The diff from the host engine binary, against the database published to the host. */
|
|
1088
1103
|
async function diffWithHostEngine(cwd, config) {
|
|
@@ -1125,40 +1140,65 @@ function unparsedDiffError(rawOutput) {
|
|
|
1125
1140
|
* `supatype push` when `provider: docker`. Uses in-compose schema-engine unless
|
|
1126
1141
|
* `overrides.engine` is set: then Postgres is published to the host and push runs
|
|
1127
1142
|
* through the local engine binary (AST v2, contributor builds).
|
|
1143
|
+
*
|
|
1144
|
+
* Only to a stack that is running (issue 41): a stopped one is refused, not started. The push used
|
|
1145
|
+
* to start Postgres, apply, then start the rest of the stack, and exited 1 with the schema applied
|
|
1146
|
+
* when that start failed. An external database is applied to with no stack running, and then no
|
|
1147
|
+
* stack is started.
|
|
1128
1148
|
*/
|
|
1129
1149
|
export async function pushSchemaDocker(cwd, config, opts = {}) {
|
|
1130
1150
|
if (resolveRuntimeProvider(config) !== "docker") {
|
|
1131
1151
|
throw new Error("pushSchemaDocker requires provider: docker");
|
|
1132
1152
|
}
|
|
1133
|
-
const project =
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
// engine is handed the database derived from the running stack, so with none running it refuses
|
|
1137
|
-
// before anything starts (M1b).
|
|
1138
|
-
const hostEngineDerivesDb = hasEngineOverride(config) && !usesExternalDatabase(config);
|
|
1139
|
-
const mode = hostEngineDerivesDb
|
|
1140
|
-
? requireRunningStack(cwd, config.project.name)
|
|
1141
|
-
: composeRenderMode(cwd, config.project.name);
|
|
1153
|
+
const project = enterLocalStack(cwd, config.project.name);
|
|
1154
|
+
const running = pushStackMode(cwd, config);
|
|
1155
|
+
const mode = running ?? "standalone";
|
|
1142
1156
|
const kongPort = await resolveKongPort(cwd, project);
|
|
1143
1157
|
if (mode === "dev")
|
|
1144
1158
|
await prepareDevComposeEnv(cwd, config, project, kongPort);
|
|
1145
|
-
const gatewayPort = composeGatewayHostPort(config, mode, kongPort);
|
|
1146
|
-
const { anonKey, serviceRoleKey } = devApiKeys(cwd);
|
|
1147
1159
|
const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
|
|
1148
|
-
const
|
|
1149
|
-
await startComposeDatabase(config, paths, cwd, project, pushBrand);
|
|
1160
|
+
const stack = { paths, project, gatewayPort: composeGatewayHostPort(config, mode, kongPort), brand: { intro: "Push schema" } };
|
|
1150
1161
|
if (!usesExternalDatabase(config))
|
|
1151
|
-
privatizeTableDefaults(paths, cwd, project);
|
|
1162
|
+
await privatizeTableDefaults(paths, cwd, project);
|
|
1152
1163
|
const schemaPath = schemaPathFromProject(config, cwd);
|
|
1153
1164
|
const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
|
|
1154
1165
|
await runComposeSchemaPush(cwd, config, paths, schemaPath, project, opts);
|
|
1155
1166
|
// `up -d` below recreates PostgREST when the tier changed its environment.
|
|
1156
|
-
followRecordedTier(cwd, config, { recreate: false });
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1167
|
+
await followRecordedTier(cwd, config, { recreate: false });
|
|
1168
|
+
if (running === undefined) {
|
|
1169
|
+
console.log("[supatype] Schema pushed. The local stack isn't running, so nothing else was started.");
|
|
1170
|
+
return false;
|
|
1171
|
+
}
|
|
1172
|
+
return bringUpAfterApply(() => bringPushedStackUp(cwd, config, stack, ast, devApiKeys(cwd)));
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* The mode of the stack a push goes to, or undefined for an external database with no stack
|
|
1176
|
+
* running. A stopped stack with its own database is refused ({@link NoStackRunning}). The stack's
|
|
1177
|
+
* own mode, never dev by default: a push to a production stack used to render it as dev and
|
|
1178
|
+
* recreate it that way, and write dev values over the operator's .env (SH1).
|
|
1179
|
+
*/
|
|
1180
|
+
function pushStackMode(cwd, config) {
|
|
1181
|
+
const running = runningStackMode(cwd, config.project.name);
|
|
1182
|
+
if (running === undefined && !usesExternalDatabase(config))
|
|
1183
|
+
throw new NoStackRunning("push");
|
|
1184
|
+
return running;
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* What a push does on a running stack after it applied: `up -d` for what the schema changed, then
|
|
1188
|
+
* the buckets, the first admin and the REST wait. `bringUp` answers with the buckets the stack did
|
|
1189
|
+
* not take, or null. The schema is in by then and stays in (issue 41), but a step that failed ends
|
|
1190
|
+
* the push non-zero with no success line, as a push to a linked server does: it was warned about
|
|
1191
|
+
* and exited 0, so a pipeline passed with buckets missing (0.9.1 release test FF2, issue 301).
|
|
1192
|
+
* True when a step failed.
|
|
1193
|
+
*/
|
|
1194
|
+
async function bringUpAfterApply(bringUp) {
|
|
1195
|
+
const failure = await bringUp().catch((err) => `a step after it failed: ${errorMessage(err)}`);
|
|
1196
|
+
if (failure === null) {
|
|
1197
|
+
console.log("[supatype] Schema pushed.");
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
postApplyFailed(failure);
|
|
1201
|
+
return true;
|
|
1162
1202
|
}
|
|
1163
1203
|
/**
|
|
1164
1204
|
* The host port the stack's gateway answers plain HTTP on. A standalone stack with TLS publishes
|
|
@@ -1168,25 +1208,46 @@ export async function pushSchemaDocker(cwd, config, opts = {}) {
|
|
|
1168
1208
|
export function composeGatewayHostPort(config, mode, kongPort) {
|
|
1169
1209
|
return selfHostTlsEnabled(config, mode === "dev") ? 80 : kongPort;
|
|
1170
1210
|
}
|
|
1211
|
+
/** A stack `up` started that never answered through its gateway: not up, whatever `up` said (issue 57). */
|
|
1212
|
+
export class StackNotServing extends Error {
|
|
1213
|
+
name = "StackNotServing";
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* What a started stack needs once it answers: the gateway and storage waited for, then the schema's
|
|
1217
|
+
* declared buckets and the first admin user. A push to a running stack runs it after its `up -d`,
|
|
1218
|
+
* and `self-host compose up` after its own, so no command depends on a push to start the stack and
|
|
1219
|
+
* create them (issue 41). Answers with the buckets the stack did not take, or null, for the caller
|
|
1220
|
+
* to warn about or fail on.
|
|
1221
|
+
*/
|
|
1222
|
+
export async function provisionStartedStack(cwd, config, stack, ast, serviceRoleKey) {
|
|
1223
|
+
const { composePath, project, gatewayPort } = stack;
|
|
1224
|
+
try {
|
|
1225
|
+
await waitKongReady(gatewayPort, 120, { composePath, cwd, project });
|
|
1226
|
+
}
|
|
1227
|
+
catch (err) {
|
|
1228
|
+
throw new StackNotServing(errorMessage(err), { cause: err });
|
|
1229
|
+
}
|
|
1230
|
+
await waitStorageApiReady(gatewayPort, serviceRoleKey, 90);
|
|
1231
|
+
const left = await provisionDockerStorageBuckets(ast, gatewayPort, serviceRoleKey);
|
|
1232
|
+
await ensureFirstAdminUserForProject(cwd, config, { compose: { project, composePath } });
|
|
1233
|
+
return left;
|
|
1234
|
+
}
|
|
1171
1235
|
/**
|
|
1172
1236
|
* After a compose push: the rest of the stack up, then what the schema asks of it once it answers
|
|
1173
|
-
* (buckets, the first admin), then REST, which is the last to catch up with the new schema.
|
|
1237
|
+
* (buckets, the first admin), then REST, which is the last to catch up with the new schema. Answers
|
|
1238
|
+
* with the buckets the stack did not take, or null.
|
|
1174
1239
|
*/
|
|
1175
1240
|
async function bringPushedStackUp(cwd, config, stack, ast, keys) {
|
|
1176
1241
|
const { paths, project, gatewayPort, brand } = stack;
|
|
1177
1242
|
const upGateway = runDockerCompose(paths.composePath, ["up", "-d"], cwd, project, { quiet: true, brand });
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
await
|
|
1182
|
-
await waitStorageApiReady(gatewayPort, keys.serviceRoleKey, 90);
|
|
1183
|
-
await provisionDockerStorageBuckets(ast, gatewayPort, keys.serviceRoleKey);
|
|
1184
|
-
await ensureFirstAdminUserForProject(cwd, config, {
|
|
1185
|
-
compose: { project, composePath: paths.composePath },
|
|
1186
|
-
});
|
|
1243
|
+
// Thrown, not exited: the schema is applied by now (bringUpAfterApply).
|
|
1244
|
+
if (upGateway !== 0)
|
|
1245
|
+
throw new Error(`docker compose up exited with status ${upGateway}`);
|
|
1246
|
+
const left = await provisionStartedStack(cwd, config, { composePath: paths.composePath, project, gatewayPort }, ast, keys.serviceRoleKey);
|
|
1187
1247
|
// Last, so the admin user and the buckets are not held up by it. `supatype dev` never comes
|
|
1188
1248
|
// through here: it pushes before PostgREST starts, so PostgREST finds the schemas on its first try.
|
|
1189
1249
|
await waitForRestReady(loopbackBase(gatewayPort), keys.anonKey);
|
|
1250
|
+
return left;
|
|
1190
1251
|
}
|
|
1191
1252
|
/**
|
|
1192
1253
|
* The first push of a `dev` session. A retry only ever brings Postgres back up: it never removes
|
|
@@ -1230,6 +1291,26 @@ async function devStackDbPort(cwd, config, project) {
|
|
|
1230
1291
|
await offerToSaveShellDbPort(cwd);
|
|
1231
1292
|
return port;
|
|
1232
1293
|
}
|
|
1294
|
+
/** Stop the watchers and processes dev started, then bring the compose stack down. */
|
|
1295
|
+
export async function stopDevComposeStack(state, stack, cwd) {
|
|
1296
|
+
state.schemaWatcher?.close();
|
|
1297
|
+
state.schemaWatcher = null;
|
|
1298
|
+
state.functionsWatcher?.close();
|
|
1299
|
+
state.functionsWatcher = null;
|
|
1300
|
+
console.log("[supatype] Shutting down compose...");
|
|
1301
|
+
await state.studioProc?.stop();
|
|
1302
|
+
await state.appProc?.stop();
|
|
1303
|
+
await settleComposeRuns();
|
|
1304
|
+
// Docker was answering a moment ago, so the daemon probe is skipped: a slow `docker info` made it
|
|
1305
|
+
// report the daemon down and exit before `down` ran (issue 33).
|
|
1306
|
+
const downStatus = runDockerCompose(stack.composePath, ["down"], cwd, stack.project, { quiet: true, skipDaemonProbe: true });
|
|
1307
|
+
if (downStatus === 0) {
|
|
1308
|
+
console.log("[supatype] Compose stack stopped.");
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
console.warn(`[supatype] Compose down exited with status ${downStatus}.`);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1233
1314
|
export async function runDevCompose(cwd, config, opts) {
|
|
1234
1315
|
if (resolveRuntimeProvider(config) !== "docker") {
|
|
1235
1316
|
throw new Error("runDevCompose requires provider: docker");
|
|
@@ -1240,6 +1321,9 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1240
1321
|
// Per-project compose name + port isolate this project from any other Supatype
|
|
1241
1322
|
// stack on the machine (own containers, volumes, network, and gateway port).
|
|
1242
1323
|
const project = composeProjectName(config.project.name);
|
|
1324
|
+
// Before anything is rendered or started: the stack of that name may be another folder's (RB-2).
|
|
1325
|
+
refuseOtherFoldersStack(cwd, project);
|
|
1326
|
+
recordStackFolder(cwd, project);
|
|
1243
1327
|
const kongPort = await resolveKongPort(cwd, project);
|
|
1244
1328
|
// No dev db port for an external database: `ensureDevDbPort` allocates a host port for the `db`
|
|
1245
1329
|
// container *and persists a matching DATABASE_URL*, which overwrote the operator's own URL, the
|
|
@@ -1249,11 +1333,15 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1249
1333
|
// with a database on 54329 and a URL still saying 5432.
|
|
1250
1334
|
// Only dev moves the port off something else that holds it.
|
|
1251
1335
|
const devDbPort = await devStackDbPort(cwd, config, project);
|
|
1336
|
+
// Before .env is written and handed to compose: a SUPATYPE_MAILER_AUTOCONFIRM an earlier CLI wrote
|
|
1337
|
+
// there would otherwise win over the config as if the developer had set it (FF7).
|
|
1338
|
+
retireCliMailerAutoconfirm(cwd);
|
|
1252
1339
|
const { anonKey, serviceRoleKey } = devApiKeys(cwd);
|
|
1253
1340
|
const devBrand = { intro: "Local development" };
|
|
1254
1341
|
const localServerImage = await ensureLocalServerDockerImage(cwd, config, devBrand);
|
|
1255
|
-
|
|
1256
|
-
|
|
1342
|
+
// Recorded in the session's lock, so a later command from another shell runs this stack as it runs.
|
|
1343
|
+
const runEnv = ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort);
|
|
1344
|
+
warnMissingStackSettings(cwd, config);
|
|
1257
1345
|
console.log(`[supatype] provider docker, starting self-host Compose stack (project ${project}, gateway :${kongPort})...`);
|
|
1258
1346
|
await showDevStep("Preparing the Docker stack");
|
|
1259
1347
|
noteUnpinnedImages(cwd);
|
|
@@ -1267,25 +1355,12 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1267
1355
|
schemaWatcher: null,
|
|
1268
1356
|
functionsWatcher: null,
|
|
1269
1357
|
};
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
shutdownState.functionsWatcher?.close();
|
|
1274
|
-
shutdownState.functionsWatcher = null;
|
|
1275
|
-
console.log("[supatype] Shutting down compose...");
|
|
1276
|
-
await shutdownState.studioProc?.stop();
|
|
1277
|
-
await shutdownState.appProc?.stop();
|
|
1278
|
-
await settleComposeRuns();
|
|
1279
|
-
const downStatus = runDockerCompose(paths.composePath, ["down"], cwd, project, { quiet: true });
|
|
1280
|
-
if (downStatus === 0) {
|
|
1281
|
-
console.log("[supatype] Compose stack stopped.");
|
|
1282
|
-
}
|
|
1283
|
-
else {
|
|
1284
|
-
console.warn(`[supatype] Compose down exited with status ${downStatus}.`);
|
|
1285
|
-
}
|
|
1286
|
-
}, {
|
|
1358
|
+
// As the start begins, so the stack comes down however dev ends. Until the start is done a Ctrl+C
|
|
1359
|
+
// is a stopped start, as on native dev (FF11).
|
|
1360
|
+
registerDevShutdown(() => stopDevComposeStack(shutdownState, { project, composePath: paths.composePath }, cwd), {
|
|
1287
1361
|
cwd,
|
|
1288
1362
|
compose: { cwd, composePath: paths.composePath, composeProject: project },
|
|
1363
|
+
duringStart: true,
|
|
1289
1364
|
});
|
|
1290
1365
|
await recoverStaleDevSession(cwd);
|
|
1291
1366
|
await handleComposeProjectRename(cwd, projectNameInFile(config), paths);
|
|
@@ -1310,9 +1385,9 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1310
1385
|
// With the stack's database up, so a hand-written URL naming it is not reported as silent.
|
|
1311
1386
|
await warnIfHandWrittenUrlSilent(cwd);
|
|
1312
1387
|
if (!usesExternalDatabase(config)) {
|
|
1313
|
-
reconcileAuthenticatorPassword(paths, cwd, project);
|
|
1314
|
-
reconcileSqlEditorPassword(paths, cwd, project);
|
|
1315
|
-
privatizeTableDefaults(paths, cwd, project);
|
|
1388
|
+
await reconcileAuthenticatorPassword(paths, cwd, project);
|
|
1389
|
+
await reconcileSqlEditorPassword(paths, cwd, project);
|
|
1390
|
+
await privatizeTableDefaults(paths, cwd, project);
|
|
1316
1391
|
}
|
|
1317
1392
|
// A: apply schema before realtime (and the rest of the stack) starts decoding WAL.
|
|
1318
1393
|
const schemaPath = schemaPathFromProject(config, cwd);
|
|
@@ -1321,7 +1396,7 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1321
1396
|
await showDevStep("Applying the schema");
|
|
1322
1397
|
const schemaApplied = await applyInitialSchema(cwd, config, paths, schemaPath, project, devBrand, pushOptions);
|
|
1323
1398
|
// Before the stack starts, so PostgREST comes up on the tier the push actually produced.
|
|
1324
|
-
followRecordedTier(cwd, config, { recreate: false });
|
|
1399
|
+
await followRecordedTier(cwd, config, { recreate: false });
|
|
1325
1400
|
console.log("[supatype] Bringing up Docker Compose services...");
|
|
1326
1401
|
await showDevStep("Starting services (the first start downloads their images)");
|
|
1327
1402
|
const upStatus = await runDockerComposeQuietly(paths.composePath, ["up", "-d"], cwd, project, devBrand);
|
|
@@ -1388,14 +1463,21 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1388
1463
|
kongPort,
|
|
1389
1464
|
provider: "docker",
|
|
1390
1465
|
});
|
|
1391
|
-
writeDevSessionLock(cwd, devSessionLockFor(config, {
|
|
1466
|
+
writeDevSessionLock(cwd, devSessionLockFor(config, {
|
|
1467
|
+
provider: "docker",
|
|
1468
|
+
composeProject: project,
|
|
1469
|
+
composePath: paths.composePath,
|
|
1470
|
+
kongPort,
|
|
1471
|
+
...(devDbPort !== undefined && { dbPort: devDbPort }),
|
|
1472
|
+
runEnv,
|
|
1473
|
+
}));
|
|
1392
1474
|
// Only for a schema the database took, as a save does: a refused one may not even load, and its
|
|
1393
1475
|
// buckets belong to fields that do not exist yet. The save that applies it provisions them.
|
|
1394
1476
|
if (schemaApplied) {
|
|
1395
1477
|
const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
|
|
1396
|
-
await provisionDockerStorageBuckets(ast, kongPort, serviceRoleKey);
|
|
1478
|
+
warnBucketsLeft(await provisionDockerStorageBuckets(ast, kongPort, serviceRoleKey));
|
|
1397
1479
|
}
|
|
1398
|
-
const pidDir = join(
|
|
1480
|
+
const pidDir = join(nativeStateRoot(config), "pid");
|
|
1399
1481
|
mkdirSync(pidDir, { recursive: true });
|
|
1400
1482
|
startDevSession();
|
|
1401
1483
|
let studioProc = null;
|
|
@@ -1423,15 +1505,14 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1423
1505
|
{ label: "Storage", url: `http://localhost:${kongPort}/storage/v1/` },
|
|
1424
1506
|
{ label: "Realtime", url: `ws://localhost:${kongPort}/realtime/v1/` },
|
|
1425
1507
|
];
|
|
1426
|
-
|
|
1427
|
-
links.push({ label: "App", url: `http://localhost:${kongPort}/` });
|
|
1428
|
-
}
|
|
1508
|
+
links.push(...appPanelLinks(config, `http://localhost:${kongPort}`));
|
|
1429
1509
|
links.push({ label: "Studio", url: studioUrlAt(`http://localhost:${kongPort}`) });
|
|
1430
1510
|
const hints = [];
|
|
1431
1511
|
const demoData = demoDataHint(cwd);
|
|
1432
1512
|
if (demoData !== undefined)
|
|
1433
1513
|
hints.push(demoData);
|
|
1434
1514
|
publishDevReady({
|
|
1515
|
+
cwd,
|
|
1435
1516
|
title: `Services running (Docker · ${project})`,
|
|
1436
1517
|
links,
|
|
1437
1518
|
anonKey,
|
|
@@ -1446,14 +1527,18 @@ export async function runDevCompose(cwd, config, opts) {
|
|
|
1446
1527
|
shutdownState.schemaWatcher = watchDevSchema({
|
|
1447
1528
|
dir: schemaDir,
|
|
1448
1529
|
changedSinceLastPush: () => schemaChangedSinceLastPush(schemaPath, cwd, config),
|
|
1530
|
+
// The failure is reported inside the scope too, so its hints reach the dashboard.
|
|
1449
1531
|
push: (why) => {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1532
|
+
void withSavePushOutput(async () => {
|
|
1533
|
+
console.log(`\n[supatype] ${why}, pushing schema...`);
|
|
1534
|
+
try {
|
|
1535
|
+
await runComposeSchemaPushQueued(cwd, config, paths, schemaPath, project, pushOptions);
|
|
1536
|
+
warnBucketsLeft(await provisionDockerStorageBuckets(loadSchemaAst(schemaPath, cwd), kongPort, serviceRoleKey));
|
|
1537
|
+
}
|
|
1538
|
+
catch (err) {
|
|
1539
|
+
reportDevPushFailure(err);
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1457
1542
|
},
|
|
1458
1543
|
});
|
|
1459
1544
|
// The worker imports its handlers once; without this an edited function kept its old code.
|