@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/commands/dev.js
CHANGED
|
@@ -14,30 +14,36 @@ import { errorMessage } from "../error-message.js";
|
|
|
14
14
|
import { isDiffResult, isEnginePushResult } from "../engine-answers.js";
|
|
15
15
|
import { reportDevPushFailure } from "../push-refusal.js";
|
|
16
16
|
import { spawnSync } from "node:child_process";
|
|
17
|
+
import { runCaptured } from "../run-captured.js";
|
|
18
|
+
import { serialRuns } from "../serial-runs.js";
|
|
17
19
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
18
20
|
import { join, resolve } from "node:path";
|
|
19
21
|
import { hasEnvValue, readDotEnvFiles } from "../env-file.js";
|
|
22
|
+
import { retireCliMailerAutoconfirm } from "../mailer-autoconfirm.js";
|
|
20
23
|
import { requireUrlSafeComposePasswords } from "../url-safe-passwords.js";
|
|
21
24
|
import { loadConfig, PROJECT_CONFIG_FILES } from "../config.js";
|
|
22
|
-
import { bucketSpecsFromAst, isParsedBuckets, nativeBucketRow, provisionBuckets, withPublicFromMode, } from "../storage-provision.js";
|
|
25
|
+
import { bucketSpecsFromAst, isParsedBuckets, nativeBucketRow, provisionBuckets, unprovisionedBuckets, warnBucketsLeft, withPublicFromMode, } from "../storage-provision.js";
|
|
23
26
|
import { readJsonFile } from "../json-file.js";
|
|
24
27
|
import { isArrayOf, isJsonObject } from "@supatype/shared";
|
|
25
|
-
import { pgSchema, localDSN, nativeDataDir, nativeDbPort, nativeRealtimePort, nativeDenoPort, nativeStoragePort, STORAGE_PORT_ENV, DENO_PORT_ENV, nativeStateRoot, nativeServerPort, REALTIME_PORT_ENV, resolveRuntimeProvider, schemaPathFromProject, serviceRoleRoutes, } from "../project-config.js";
|
|
28
|
+
import { pgSchema, localDSN, nativeDataDir, nativeDbPort, nativeRealtimePort, nativeDenoPort, nativeStoragePort, STORAGE_PORT_ENV, DENO_PORT_ENV, nativeStateRoot, nativeServerPort, REALTIME_PORT_ENV, publicEnvServerEnv, resolveRuntimeProvider, schemaPathFromProject, serviceRoleRoutes, } from "../project-config.js";
|
|
26
29
|
import { DEV_DB_PORT_ENV } from "../db-port.js";
|
|
30
|
+
import { devSessionLockFor, writeDevSessionLock } from "../dev-session-lock.js";
|
|
31
|
+
import { composeProjectName, selfHostComposePaths } from "../self-host-compose.js";
|
|
27
32
|
import { devServiceRoleRoutesPath, functionsWorkerEnv, writeServiceRoleRoutesFile } from "../functions-worker-files.js";
|
|
28
33
|
import { devServiceRoleKeyPath } from "../service-role-key-file.js";
|
|
29
34
|
import { requireUsableJwtSecret } from "../jwt-secret-length.js";
|
|
30
|
-
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, givenJwtSecret, ignoredJwtSecretWarning, secretFingerprint, } from "../local-secrets.js";
|
|
35
|
+
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, givenJwtSecret, ignoredJwtSecretWarning, KEYSPACE_USERNAME, secretFingerprint, } from "../local-secrets.js";
|
|
36
|
+
import { keyspacePasswordOrigin, projectKeyspacePassword } from "../keyspace-password-file.js";
|
|
31
37
|
import { normalisePlatformPath, cachePath, currentPlatform, hasMeaningfulOverrides, describeActiveOverrides, postgresArchiveTag, } from "../binary-cache.js";
|
|
32
38
|
import { ensureBinary } from "../ensure-binary.js";
|
|
33
39
|
import { assertSupported, binaryCapabilities, EngineProbeFailed, OVERWRITE_DRIFT_NEED, OwnershipUnsupportedError, requireEngineFeatures, } from "../engine-ownership-gate.js";
|
|
34
|
-
import { startProxyDevApp } from "../app/proxy-dev-app.js";
|
|
40
|
+
import { appPanelLinks, startProxyDevApp } from "../app/proxy-dev-app.js";
|
|
35
41
|
import { ProcessManager } from "../process-manager.js";
|
|
36
42
|
import { markPostgrestUnpacked, POSTGREST_VERSION, postgrestArchiveName, postgrestArchiveUrl, postgrestRuntimeRepairDue, } from "../postgrest-release.js";
|
|
37
43
|
import { STUDIO_DEV_PORT, startStudioViteDevServer } from "../studio-dev-server.js";
|
|
38
44
|
import { postgrestHookActorEnv } from "../hook-actor.js";
|
|
39
45
|
import { restoreSystemRelationTargets } from "../restore-system-relation-targets.js";
|
|
40
|
-
import { beginDevSession, resolveDevUiMode, showDevStep } from "../dev-session.js";
|
|
46
|
+
import { beginDevSession, resolveDevUiMode, showDevStep, withSavePushOutput } from "../dev-session.js";
|
|
41
47
|
import { publishDevReady } from "../dev-ready-panel.js";
|
|
42
48
|
import { probeDockerDaemon, reportDockerUnavailable } from "../docker-runtime.js";
|
|
43
49
|
import { fatalError } from "../ui/fatal.js";
|
|
@@ -45,25 +51,26 @@ import { haltIfStopping, pushStartUndo, pushStartUndoLast, registerDevShutdown,
|
|
|
45
51
|
import { startNativeRealtime } from "../native-realtime.js";
|
|
46
52
|
import { nativeWorkerDenoEnv, prepareNativeWorker } from "../native-worker.js";
|
|
47
53
|
import { configSnapshot } from "../config-snapshot.js";
|
|
54
|
+
import { refuseInsideDevApp } from "../dev-self-start.js";
|
|
48
55
|
import { patchRouteManifest, recordNativeRoutes } from "../route-manifest.js";
|
|
49
56
|
import { reconcileNativeDevDatabaseUrl } from "../db-port-offer.js";
|
|
50
57
|
import { extractArchive } from "../archive-extract.js";
|
|
51
|
-
import { serverStorageEnv, startNativeStorage } from "../native-storage.js";
|
|
58
|
+
import { nativeS3StorageEnv, serverStorageEnv, startNativeS3Storage, startNativeStorage, startsStorageService, } from "../native-storage.js";
|
|
52
59
|
import { keepsObjectsLocally, serverStoreRoot } from "../local-storage.js";
|
|
53
60
|
import { writeAppliedAstArtifacts } from "../applied-ast-artifacts.js";
|
|
54
61
|
import { writeAppViteEnv } from "../app-vite-env.js";
|
|
55
62
|
import { nativeAuthProviderEnv, warnMissingAuthProviderSecrets } from "../auth-providers.js";
|
|
63
|
+
import { warnSmtpWithoutHost } from "../config-mailer-env.js";
|
|
64
|
+
import { nativeSamlEnv } from "../saml-config.js";
|
|
56
65
|
import { AUTHENTICATOR_PASSWORD_ENV } from "../native-roles-sql.js";
|
|
57
|
-
import { nativeAuthMailerEnv, nativeDevApiKeys, nativeDevRolesSql, nativePostgrestSchemaEnv, nativeServerCoreEnv, nativeServerDotEnvLayer, } from "../native-dev-env.js";
|
|
66
|
+
import { nativeAuthMailerEnv, nativeDevApiKeys, nativeDevRolesSql, nativePostgrestSchemaEnv, nativeKeyspaceServerEnv, nativeServerCoreEnv, nativeServerDotEnvLayer, } from "../native-dev-env.js";
|
|
58
67
|
import { ensureValkeySidecar, externalValkey } from "../valkey-sidecar.js";
|
|
59
|
-
import { nativeKeyspaceAddr
|
|
60
|
-
import { ensureCluster, createdbArgs, databaseEncoding, nonUtf8DatabaseWarning, pgBuild, start as pgStart, stop as pgStop, waitReady as pgWaitReady, isPortInUse, } from "../postgres-ctl.js";
|
|
68
|
+
import { nativeKeyspaceAddr, nativeKeyspacePort, writeKeyspacePasswordFile, } from "../native-keyspace.js";
|
|
69
|
+
import { ensureCluster, createdbArgs, databaseEncoding, nonUtf8DatabaseWarning, pgBuild, start as pgStart, stop as pgStop, waitReady as pgWaitReady, connectSucceeds, isPortInUse, portCheckCommand, } from "../postgres-ctl.js";
|
|
70
|
+
import { claimPortLock, isPortLock } from "../native-port-lock.js";
|
|
71
|
+
import { leftoverOwnPostgres, recordNativeDevPid } from "../native-leftover-postgres.js";
|
|
72
|
+
import { stopLeftoverServices } from "../native-leftover-services.js";
|
|
61
73
|
import { isPasswordRejected, pgClientEnv, requirePasswordAuth, requireSuperuserPassword, superuserPasswordMissingMessage, } from "../native-pg-auth.js";
|
|
62
|
-
function portCheckCommand(port) {
|
|
63
|
-
return process.platform === "win32"
|
|
64
|
-
? `netstat -ano | findstr :${port}`
|
|
65
|
-
: `lsof -i :${port}`;
|
|
66
|
-
}
|
|
67
74
|
const NATIVE_SERVICES = ["postgres", "server", "postgrest", "realtime", "deno", "storage"];
|
|
68
75
|
export const NATIVE_PORT_HINTS = {
|
|
69
76
|
postgres: {
|
|
@@ -75,7 +82,7 @@ export const NATIVE_PORT_HINTS = {
|
|
|
75
82
|
move: "Move this project's API server port with server.port in supatype.config.ts, or `supatype dev --port`.",
|
|
76
83
|
},
|
|
77
84
|
postgrest: {
|
|
78
|
-
holder: "Another service may be running.",
|
|
85
|
+
holder: "Another service, or another project's native dev, may be running.",
|
|
79
86
|
move: "Move this project's PostgREST port with server.postgrestPort in supatype.config.ts.",
|
|
80
87
|
},
|
|
81
88
|
realtime: {
|
|
@@ -91,17 +98,70 @@ export const NATIVE_PORT_HINTS = {
|
|
|
91
98
|
move: `Move this project's storage port with ${STORAGE_PORT_ENV} in .env.`,
|
|
92
99
|
},
|
|
93
100
|
};
|
|
94
|
-
/**
|
|
95
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Stop before anything starts when a port native dev binds is taken, then claim PostgREST's for the
|
|
103
|
+
* session, refused to every other native dev's start (N-FF12, native-port-lock.ts). Exported for tests.
|
|
104
|
+
*
|
|
105
|
+
* Postgres's port held by this project's own Postgres, which a dev that did not stop cleanly left
|
|
106
|
+
* running, is not a refusal (FF12 remainder): the start restarts it (native-leftover-postgres.ts).
|
|
107
|
+
* Its services, left by a dev that was killed, are stopped first (native-leftover-services.ts).
|
|
108
|
+
*/
|
|
109
|
+
export async function claimNativeDevPorts(ports, state) {
|
|
110
|
+
await stopLeftoverServices(state);
|
|
111
|
+
// Beside the checks below rather than after them: a refused connect on Windows takes its full wait.
|
|
112
|
+
const ipv6Checked = warnIfServerIpv6Held(ports.server);
|
|
113
|
+
const leftoverPostgres = leftoverOwnPostgres(state, ports.postgres);
|
|
96
114
|
for (const service of NATIVE_SERVICES) {
|
|
97
115
|
const port = ports[service];
|
|
98
|
-
if (port === undefined ||
|
|
116
|
+
if (port === undefined || (service === "postgres" && leftoverPostgres !== null))
|
|
99
117
|
continue;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
brand: { intro: "Local development" },
|
|
103
|
-
});
|
|
118
|
+
if (await isPortInUse(port))
|
|
119
|
+
refuseNativePort(service, port);
|
|
104
120
|
}
|
|
121
|
+
await ipv6Checked;
|
|
122
|
+
const postgrest = claimPortLock(ports.postgrest);
|
|
123
|
+
if (!isPortLock(postgrest))
|
|
124
|
+
refuseClaimedPort(ports.postgrest, postgrest);
|
|
125
|
+
return { postgrest, leftoverPostgres };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Says so when something else listens on [::1] at the API server's port. The server then serves on
|
|
129
|
+
* 127.0.0.1 alone, and a client resolving `localhost` to ::1 first (a browser on Windows) reaches
|
|
130
|
+
* the other listener. Dev started, and no pane said so (0.9.2 round 2, R2-S22).
|
|
131
|
+
*/
|
|
132
|
+
async function warnIfServerIpv6Held(port) {
|
|
133
|
+
if (!(await connectSucceeds(port, 400, "::1")))
|
|
134
|
+
return;
|
|
135
|
+
console.warn(`[supatype] ⚠ Something else listens on [::1]:${port}, so the API server answers on IPv4 only: ` +
|
|
136
|
+
`use http://127.0.0.1:${port}, as http://localhost:${port} can reach the other listener.`);
|
|
137
|
+
}
|
|
138
|
+
/** Refuse to start for a port another running native dev has claimed, naming it and its claim. */
|
|
139
|
+
function refuseClaimedPort(port, claim) {
|
|
140
|
+
fatalError(`Port ${port} is claimed by another native dev (pid ${claim.holder}).`, [
|
|
141
|
+
`Its claim is ${claim.path}. If no native dev is running, delete that file.`,
|
|
142
|
+
NATIVE_PORT_HINTS.postgrest.move,
|
|
143
|
+
], { brand: { intro: "Local development" } });
|
|
144
|
+
}
|
|
145
|
+
/** What native dev says of a port it binds that something else holds: what usually does, and how to move it. */
|
|
146
|
+
function portRefusalText(service, port) {
|
|
147
|
+
return { headline: `Port ${port} is already in use.`, ...NATIVE_PORT_HINTS[service] };
|
|
148
|
+
}
|
|
149
|
+
/** Refuse to start for a port native dev binds that something else holds. */
|
|
150
|
+
function refuseNativePort(service, port) {
|
|
151
|
+
const { headline, holder, move } = portRefusalText(service, port);
|
|
152
|
+
fatalError(headline, [holder, `Check: ${portCheckCommand(port)}`, move], {
|
|
153
|
+
brand: { intro: "Local development" },
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Refuses PostgREST's port when something other than a native dev took it since the check, as the
|
|
158
|
+
* check would have (N-FF12). A throw rather than a fatal exit, so the start undoes what it began.
|
|
159
|
+
*/
|
|
160
|
+
async function requirePostgrestPortFree(port) {
|
|
161
|
+
if (!(await isPortInUse(port)))
|
|
162
|
+
return;
|
|
163
|
+
const { headline, holder, move } = portRefusalText("postgrest", port);
|
|
164
|
+
throw new Error(`${headline} ${holder} ${move}`);
|
|
105
165
|
}
|
|
106
166
|
/**
|
|
107
167
|
* `dev --overwrite-drift` only where the engine that will push can honour it: the compose
|
|
@@ -136,6 +196,7 @@ export function registerDev(program) {
|
|
|
136
196
|
.option("--overwrite-drift", "Every push of this session puts back policies, grants, labels and RLS changed outside Supatype")
|
|
137
197
|
// Ctrl+C during the start reaches its children too: it ends with one line, not their failure.
|
|
138
198
|
.action(stopQuietlyDuringStart(async (opts) => {
|
|
199
|
+
refuseInsideDevApp();
|
|
139
200
|
const cwd = process.cwd();
|
|
140
201
|
// ── 1. Load project config (before TUI, fatal errors must hit real stderr) ──
|
|
141
202
|
// Its bytes first: the functions.serviceRole watch, started much later, applies any edit since.
|
|
@@ -163,19 +224,25 @@ export function registerDev(program) {
|
|
|
163
224
|
const realtimePort = String(nativeRealtimePort(config, cwd));
|
|
164
225
|
const denoPort = nativeDenoPort(cwd);
|
|
165
226
|
const storagePort = nativeStoragePort(cwd);
|
|
227
|
+
// A native project on S3: the storage service on the project's own bucket, unless .env names a
|
|
228
|
+
// service of its own. Read before anything starts, so a blank S3_BUCKET is the first thing said.
|
|
229
|
+
const s3StorageEnv = provider !== "docker" && !keepsObjectsLocally(config) ? s3StorageEnvOrExit(cwd) : null;
|
|
230
|
+
const nativeState = { dataDir: nativeDataDir(config), pidDir: join(nativeStateRoot(config), "pid") };
|
|
231
|
+
let portClaim = null;
|
|
166
232
|
if (provider !== "docker") {
|
|
167
233
|
// The functions worker runs on every native dev (native-worker.ts), so Deno's port is checked too.
|
|
168
|
-
await
|
|
234
|
+
portClaim = await claimNativeDevPorts({
|
|
169
235
|
postgres: pgPort,
|
|
170
236
|
server: Number(serverPort),
|
|
171
237
|
postgrest: Number(postgrestPort),
|
|
172
238
|
realtime: Number(realtimePort),
|
|
173
239
|
deno: denoPort,
|
|
174
|
-
...(
|
|
175
|
-
});
|
|
240
|
+
...(startsStorageService(config, s3StorageEnv) && { storage: storagePort }),
|
|
241
|
+
}, nativeState);
|
|
242
|
+
pushStartUndoLast(portClaim.postgrest.release);
|
|
176
243
|
// Before anything is generated: a missing password would otherwise be replaced in .env
|
|
177
244
|
// with a new one the existing cluster has never heard of.
|
|
178
|
-
requireSuperuserPassword(cwd,
|
|
245
|
+
requireSuperuserPassword(cwd, nativeState.dataDir);
|
|
179
246
|
}
|
|
180
247
|
// Before the session takes the terminal, so a refusal reaches it.
|
|
181
248
|
const overwriteDrift = opts.overwriteDrift === true;
|
|
@@ -227,12 +294,14 @@ export function registerDev(program) {
|
|
|
227
294
|
]);
|
|
228
295
|
// ── 3. Per-project state directories ─────────────────────────────────
|
|
229
296
|
const stateRoot = nativeStateRoot(config);
|
|
230
|
-
const pidDir =
|
|
297
|
+
const { pidDir } = nativeState;
|
|
231
298
|
const logsDir = join(stateRoot, "logs");
|
|
232
299
|
const tmpDir = join(stateRoot, "tmp");
|
|
233
300
|
for (const d of [pidDir, logsDir, tmpDir]) {
|
|
234
301
|
mkdirSync(d, { recursive: true });
|
|
235
302
|
}
|
|
303
|
+
// Before Postgres starts, so a dev started meanwhile never takes this one's Postgres for a leftover.
|
|
304
|
+
pushStartUndoLast(recordNativeDevPid(pidDir));
|
|
236
305
|
// ── 5–7. Start Postgres ───────────────────────────────────────────────
|
|
237
306
|
let dbURL;
|
|
238
307
|
/** What PostgREST connects as, deliberately not `dbURL`, which is a superuser. */
|
|
@@ -246,35 +315,41 @@ export function registerDev(program) {
|
|
|
246
315
|
// pgBinDir is set on the native path and used to add DLL search path for
|
|
247
316
|
// PostgREST on Windows (PostgREST links against libpq + SSL from MinGW).
|
|
248
317
|
let pgBinDir = null;
|
|
249
|
-
// The
|
|
250
|
-
//
|
|
251
|
-
let
|
|
318
|
+
// The keyspace this Postgres serves and its login, or null when the Valkey sidecar is what
|
|
319
|
+
// the cache talks to (native-keyspace.ts).
|
|
320
|
+
let keyspace = null;
|
|
252
321
|
{
|
|
253
322
|
// native: resolve pg bin dir and manage with pg_ctl
|
|
254
|
-
|
|
255
|
-
|
|
323
|
+
const pgInstall = await resolvePgInstall(config);
|
|
324
|
+
pgBinDir = pgInstall.binDir;
|
|
325
|
+
const { dataDir } = nativeState;
|
|
256
326
|
mkdirSync(dataDir, { recursive: true });
|
|
257
|
-
// The RESP keyspace, when this archive carries it: one process
|
|
258
|
-
// of a Postgres and a Valkey container. The port is chosen rather than
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
|
|
327
|
+
// The RESP keyspace, when this archive carries it and can require a password: one process
|
|
328
|
+
// instead of a Postgres and a Valkey container. The port is chosen rather than fixed
|
|
329
|
+
// because 6379 is the first thing a developer's own Redis or a leftover sidecar takes.
|
|
330
|
+
const keyspacePort = await nativeKeyspacePort(config, pgBinDir, pgInstall.version);
|
|
331
|
+
// The project's password, from .env or the file SUPATYPE_KEYSPACE_PASSWORD_FILE names
|
|
332
|
+
// (R2-S16), which the keyspace reads itself from a file only this user can read, and
|
|
333
|
+
// requires from its first client (N-RB2).
|
|
334
|
+
keyspace = keyspacePort === null ? null : { port: keyspacePort, login: { username: KEYSPACE_USERNAME, password: projectKeyspacePassword(cwd) } };
|
|
263
335
|
const pgOpts = {
|
|
264
336
|
pgBinDir,
|
|
265
337
|
dataDir,
|
|
266
338
|
port: pgPort,
|
|
267
339
|
logPath: join(logsDir, "postgres.log"),
|
|
268
340
|
database: projectName,
|
|
269
|
-
...(
|
|
270
|
-
|
|
271
|
-
:
|
|
341
|
+
...(keyspace !== null && {
|
|
342
|
+
keyspacePort: keyspace.port,
|
|
343
|
+
keyspaceDatabase: projectName,
|
|
344
|
+
keyspacePasswordFile: writeKeyspacePasswordFile(stateRoot, keyspace.login.password),
|
|
345
|
+
}),
|
|
272
346
|
};
|
|
273
347
|
// initdb, and createdb on a first start, need the archive's version and ICU support; asked once.
|
|
274
348
|
let build;
|
|
275
349
|
const buildOnce = () => (build ??= pgBuild(pgBinDir));
|
|
276
350
|
// Before initdb, which a first start runs here and which takes the longest.
|
|
277
351
|
await showDevStep("Starting Postgres");
|
|
352
|
+
restartLeftoverPostgres(portClaim, pgOpts);
|
|
278
353
|
ensureCluster(pgOpts, pgPassword, buildOnce);
|
|
279
354
|
console.log("[supatype] Starting Postgres...");
|
|
280
355
|
pgStart(pgOpts);
|
|
@@ -367,33 +442,48 @@ export function registerDev(program) {
|
|
|
367
442
|
writeAppViteEnv(cwd, config, `http://localhost:${serverPort}`, anonKey);
|
|
368
443
|
// After the push, failed or not: init's manifest names the compose stack's services.
|
|
369
444
|
recordNativeRoutes(manifestPath, worker.denoBin !== undefined);
|
|
370
|
-
//
|
|
371
|
-
const
|
|
445
|
+
// The cache, the keyspace or Valkey, alongside realtime and storage: none needs another.
|
|
446
|
+
const cacheStart = nativeCache(keyspace, projectName, cwd);
|
|
372
447
|
const realtimeProc = await startNativeRealtime({
|
|
373
448
|
config, cwd, manifestPath, pidDir, url: realtimeUrl, port: realtimePort,
|
|
374
449
|
databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
375
450
|
});
|
|
376
|
-
const nativeStorage = keepsObjectsLocally(config)
|
|
377
|
-
? await startNativeStorage({
|
|
378
|
-
config, cwd, manifestPath, pidDir, stateRoot, port: storagePort, databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
379
|
-
})
|
|
380
|
-
: null;
|
|
381
451
|
// Later pushes create the buckets a schema declares in the service as well as in buckets.json.
|
|
452
|
+
// A project on S3 has no buckets.json for the service to import, so the buckets the first push
|
|
453
|
+
// declared, before the service ran, are created in it now. The same for a service switched on
|
|
454
|
+
// only once it answered, after its start deadline (N-FF2).
|
|
455
|
+
const useStorage = async (storage) => {
|
|
456
|
+
const storageApi = { url: storage.url, serviceRoleKey };
|
|
457
|
+
schemaPush.storageApi = storageApi;
|
|
458
|
+
if (s3StorageEnv !== null)
|
|
459
|
+
await provisionDeclaredBuckets(engineBin, cwd, join(supatypeDir, "schema.ast.json"), { storageApi });
|
|
460
|
+
};
|
|
461
|
+
const storageOptions = {
|
|
462
|
+
config, cwd, manifestPath, pidDir, stateRoot, port: storagePort, databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
463
|
+
onLateStart: useStorage,
|
|
464
|
+
};
|
|
465
|
+
const nativeStorage = keepsObjectsLocally(config)
|
|
466
|
+
? await startNativeStorage(storageOptions)
|
|
467
|
+
: s3StorageEnv === null ? null : await startNativeS3Storage(storageOptions, s3StorageEnv);
|
|
382
468
|
if (nativeStorage !== null)
|
|
383
|
-
|
|
384
|
-
const
|
|
469
|
+
await useStorage(nativeStorage);
|
|
470
|
+
const cache = await cacheStart;
|
|
471
|
+
// Before .env is read: a SUPATYPE_MAILER_AUTOCONFIRM an earlier CLI wrote there would otherwise
|
|
472
|
+
// win over the config as if the developer had set it (FF7).
|
|
473
|
+
retireCliMailerAutoconfirm(cwd);
|
|
385
474
|
// `.env` and `.env.local`, read once for everything the server's environment takes from them.
|
|
386
475
|
const dotEnv = readDotEnvFiles(cwd);
|
|
387
476
|
// What an env("NAME") in auth.providers resolves against: the shell over .env, as for the config.
|
|
388
477
|
const providerEnvironment = { ...dotEnv, ...process.env };
|
|
389
478
|
warnMissingAuthProviderSecrets(config, providerEnvironment);
|
|
479
|
+
warnSmtpWithoutHost(config, providerEnvironment);
|
|
390
480
|
// functions.serviceRole as the worker starts with it; the config watch below keeps it current.
|
|
391
481
|
const serviceRole = { routesPath: devServiceRoleRoutesPath(cwd), initial: serviceRoleRoutes(config) };
|
|
392
482
|
writeServiceRoleRoutesFile(serviceRole.routesPath, serviceRole.initial);
|
|
393
483
|
const serverEnv = {
|
|
394
484
|
...nativeServerCoreEnv({
|
|
395
485
|
mode: config.server.mode ?? "dev",
|
|
396
|
-
valkeyAddr:
|
|
486
|
+
valkeyAddr: cache.sidecar.addr,
|
|
397
487
|
projectRef: projectName,
|
|
398
488
|
manifestPath,
|
|
399
489
|
adminConfigPath,
|
|
@@ -417,6 +507,7 @@ export function registerDev(program) {
|
|
|
417
507
|
SUPATYPE_PUBLIC_URL: `http://localhost:${serverPort}`,
|
|
418
508
|
SUPATYPE_REALTIME_URL: realtimeUrl,
|
|
419
509
|
SUPATYPE_ANON_KEY: anonKey,
|
|
510
|
+
...publicEnvServerEnv(config),
|
|
420
511
|
SUPATYPE_SERVICE_ROLE_KEY: serviceRoleKey,
|
|
421
512
|
PORT: serverPort,
|
|
422
513
|
SUPATYPE_APP_MODE: config.app.mode ?? "none",
|
|
@@ -446,10 +537,14 @@ export function registerDev(program) {
|
|
|
446
537
|
...nativeAuthMailerEnv(config.email, serverPort),
|
|
447
538
|
SUPATYPE_LOG_LEVEL: "info",
|
|
448
539
|
SUPATYPE_DISABLE_SIGNUP: "false",
|
|
449
|
-
...serverStorageEnv(nativeStorage, config
|
|
540
|
+
...serverStorageEnv(nativeStorage, config),
|
|
450
541
|
// .env last, so a SUPATYPE_EXTERNAL_* value there wins over auth.providers in the config.
|
|
451
542
|
...nativeAuthProviderEnv(config, `http://localhost:${serverPort}`, providerEnvironment),
|
|
452
|
-
|
|
543
|
+
// auth.sso.saml, with the signing key from .env (generated there the first time SAML is on).
|
|
544
|
+
...nativeSamlEnv(cwd, config),
|
|
545
|
+
...nativeServerDotEnvLayer({ dotEnv, config, denoPort }),
|
|
546
|
+
// After .env, which can hold a keyspace password for a Docker phase of the project (N-RB2).
|
|
547
|
+
...nativeKeyspaceServerEnv(cache),
|
|
453
548
|
};
|
|
454
549
|
await haltIfStopping();
|
|
455
550
|
const serverProc = new ProcessManager(serverBin, [], {
|
|
@@ -465,6 +560,7 @@ export function registerDev(program) {
|
|
|
465
560
|
await haltIfStopping();
|
|
466
561
|
const postgrestBin = await resolvePostgrestBin(config.overrides?.postgrest);
|
|
467
562
|
if (postgrestBin) {
|
|
563
|
+
await requirePostgrestPortFree(Number(postgrestPort));
|
|
468
564
|
// Windows PostgREST builds are dynamically linked and require libpq/OpenSSL
|
|
469
565
|
// DLLs from a Postgres bin directory, even when the database runs in Docker.
|
|
470
566
|
let postgrestRuntimeBinDir = pgBinDir;
|
|
@@ -541,11 +637,16 @@ export function registerDev(program) {
|
|
|
541
637
|
const appProc = startProxyDevApp(cwd, config, pidDir);
|
|
542
638
|
if (appProc)
|
|
543
639
|
pushStartUndo(() => appProc.stop());
|
|
640
|
+
// No built-in store stands in for a service that did not start (native-storage.ts), so the
|
|
641
|
+
// panel lists no storage URL and repeats that storage is off, in case the warning scrolled by.
|
|
642
|
+
// A project on S3 too: its panel listed Storage while a refused S3_BUCKET kept it off (R2-S2).
|
|
643
|
+
const storageOff = nativeStorage === null && startsStorageService(config, s3StorageEnv);
|
|
544
644
|
const links = [
|
|
545
645
|
{ label: "API", url: `http://localhost:${serverPort}` },
|
|
546
646
|
{ label: "REST", url: `http://localhost:${serverPort}/rest/v1/` },
|
|
547
647
|
{ label: "Auth", url: `http://localhost:${serverPort}/auth/v1/` },
|
|
548
|
-
{ label: "Storage", url: `http://localhost:${serverPort}/storage/v1/` },
|
|
648
|
+
...(storageOff ? [] : [{ label: "Storage", url: `http://localhost:${serverPort}/storage/v1/` }]),
|
|
649
|
+
...appPanelLinks(config, `http://localhost:${serverPort}`),
|
|
549
650
|
];
|
|
550
651
|
if (realtimeProc) {
|
|
551
652
|
links.push({ label: "Realtime", url: `ws://localhost:${serverPort}/realtime/v1/` });
|
|
@@ -554,16 +655,32 @@ export function registerDev(program) {
|
|
|
554
655
|
links.push({ label: "Studio", url: `http://localhost:${studioPort}` });
|
|
555
656
|
}
|
|
556
657
|
publishDevReady({
|
|
658
|
+
cwd,
|
|
557
659
|
title: "Services running",
|
|
558
660
|
links,
|
|
559
661
|
anonKey,
|
|
560
662
|
serviceRoleKey,
|
|
561
|
-
|
|
663
|
+
databaseUrl: dbURL,
|
|
664
|
+
hints: [
|
|
665
|
+
`JWT secret: #${secretFingerprint(LOCAL_JWT_SECRET)} (in .env)`,
|
|
666
|
+
...(storageOff ? ["Storage is off: the storage service did not start (the reason is above)"] : []),
|
|
667
|
+
],
|
|
562
668
|
});
|
|
563
669
|
// ── Shutdown handler ──────────────────────────────────────────────────
|
|
564
670
|
// Everything the start began is undone after it, the services together and then Postgres
|
|
565
|
-
// (pushStartUndo, pushStartUndoLast), so the shutdown has nothing of its own to stop.
|
|
566
|
-
|
|
671
|
+
// (pushStartUndo, pushStartUndoLast), so the shutdown has nothing of its own to stop. Its
|
|
672
|
+
// `cwd` clears the session record below when dev ends.
|
|
673
|
+
registerDevShutdown(async () => undefined, { cwd });
|
|
674
|
+
// The session's database port, for host commands run from another shell: they took that
|
|
675
|
+
// shell's SUPATYPE_DEV_DB_PORT, and a push applied its migration to another Postgres there
|
|
676
|
+
// (0.9.2 round 5, FF-7 on native). Written once ready, as Docker dev writes its own.
|
|
677
|
+
writeDevSessionLock(cwd, devSessionLockFor(config, {
|
|
678
|
+
provider: "native",
|
|
679
|
+
composeProject: composeProjectName(projectName),
|
|
680
|
+
composePath: selfHostComposePaths(cwd).composePath,
|
|
681
|
+
dbPort: pgPort,
|
|
682
|
+
runEnv: { [DEV_DB_PORT_ENV]: String(pgPort) },
|
|
683
|
+
}));
|
|
567
684
|
// ── 10. Schema watch ──────────────────────────────────────────────────
|
|
568
685
|
if (opts.watch) {
|
|
569
686
|
const schemaDir = resolve(cwd, schemaPath, "..");
|
|
@@ -581,13 +698,18 @@ export function registerDev(program) {
|
|
|
581
698
|
reload: functionsWatch.reload,
|
|
582
699
|
});
|
|
583
700
|
const { watchDevSchema } = await import("../dev-schema-watch.js");
|
|
701
|
+
// One push at a time: a save during a push is pushed once it is done, as docker dev queues it.
|
|
702
|
+
// A hook the push declares is served once the worker's routes name it.
|
|
703
|
+
const pushSaved = serialRuns(() => runSchemaPush(schemaPush).then(() => functionsWatch.refresh()), reportUnlessStopping(reportDevPushFailure));
|
|
584
704
|
watchDevSchema({
|
|
585
705
|
dir: schemaDir,
|
|
586
706
|
changedSinceLastPush: async () => JSON.stringify((await buildNativeAst(cwd, schemaPath, config, skipFieldKinds)).ast) !== _lastReadAst,
|
|
707
|
+
// pushSaved reports its own failure, inside the scope, so its hints reach the dashboard.
|
|
587
708
|
push: (why) => {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
709
|
+
void withSavePushOutput(async () => {
|
|
710
|
+
console.log(`\n[supatype] ${why}, checking schema...`);
|
|
711
|
+
await pushSaved();
|
|
712
|
+
});
|
|
591
713
|
},
|
|
592
714
|
});
|
|
593
715
|
}
|
|
@@ -739,7 +861,7 @@ async function applyNativeSchema(cwd, schema, target) {
|
|
|
739
861
|
*/
|
|
740
862
|
async function writeNativeSchemaArtifacts(paths, ast, config) {
|
|
741
863
|
const { cwd, engineBin, astPath } = paths;
|
|
742
|
-
if (paths.storagePath)
|
|
864
|
+
if (paths.storagePath || paths.storageApi)
|
|
743
865
|
await provisionDeclaredBuckets(engineBin, cwd, astPath, paths);
|
|
744
866
|
if (paths.adminConfigPath)
|
|
745
867
|
await writeNativeAdminConfig(paths, paths.adminConfigPath, ast, config);
|
|
@@ -747,9 +869,21 @@ async function writeNativeSchemaArtifacts(paths, ast, config) {
|
|
|
747
869
|
writeNativeAppliedAst(cwd, config, ast);
|
|
748
870
|
await writeNativeTypes(cwd, ast, config);
|
|
749
871
|
}
|
|
872
|
+
/**
|
|
873
|
+
* {@link nativeS3StorageEnv} from the shell over .env, as compose reads them. A blank S3_BUCKET ends
|
|
874
|
+
* dev here, before anything has started, saying what to set.
|
|
875
|
+
*/
|
|
876
|
+
function s3StorageEnvOrExit(cwd) {
|
|
877
|
+
try {
|
|
878
|
+
return nativeS3StorageEnv({ ...readDotEnvFiles(cwd), ...process.env });
|
|
879
|
+
}
|
|
880
|
+
catch (err) {
|
|
881
|
+
fatalError(errorMessage(err));
|
|
882
|
+
}
|
|
883
|
+
}
|
|
750
884
|
/** The storage buckets the schema declares, as the engine resolves them; none when it cannot say. */
|
|
751
|
-
function declaredBuckets(engineBin, cwd, astPath) {
|
|
752
|
-
const parseResult =
|
|
885
|
+
async function declaredBuckets(engineBin, cwd, astPath) {
|
|
886
|
+
const parseResult = await runCaptured(engineBin, ["parse", "-i", astPath], { cwd });
|
|
753
887
|
if (parseResult.status !== 0 || !parseResult.stdout)
|
|
754
888
|
return [];
|
|
755
889
|
try {
|
|
@@ -761,35 +895,37 @@ function declaredBuckets(engineBin, cwd, astPath) {
|
|
|
761
895
|
}
|
|
762
896
|
}
|
|
763
897
|
/**
|
|
764
|
-
* Create the storage buckets the schema declares: in buckets.json, which the
|
|
765
|
-
*
|
|
898
|
+
* Create the storage buckets the schema declares: in buckets.json, which the storage service
|
|
899
|
+
* imports when it starts, and in the service itself once it runs. A project on S3 has the service
|
|
900
|
+
* alone.
|
|
766
901
|
*/
|
|
767
902
|
async function provisionDeclaredBuckets(engineBin, cwd, astPath, paths) {
|
|
768
|
-
const buckets = declaredBuckets(engineBin, cwd, astPath);
|
|
769
|
-
if (buckets.length === 0
|
|
903
|
+
const buckets = await declaredBuckets(engineBin, cwd, astPath);
|
|
904
|
+
if (buckets.length === 0)
|
|
770
905
|
return;
|
|
771
|
-
await provisionNativeBuckets(buckets,
|
|
906
|
+
await provisionNativeBuckets(buckets, paths);
|
|
772
907
|
}
|
|
773
908
|
/**
|
|
774
909
|
* `buckets` in buckets.json, and in the storage service while it runs, saying how many new ones
|
|
775
|
-
* are ready: a bucket the service did not take is not, though buckets.json has it.
|
|
910
|
+
* are ready: a bucket the service did not take is not, though buckets.json has it. A project on S3
|
|
911
|
+
* has no buckets.json, only the service, and is told which buckets it did not take. Exported for tests.
|
|
776
912
|
*/
|
|
777
913
|
export async function provisionNativeBuckets(buckets, paths) {
|
|
778
|
-
const added = provisionStorageBuckets(buckets, paths.storagePath);
|
|
914
|
+
const added = paths.storagePath === undefined ? null : provisionStorageBuckets(buckets, paths.storagePath);
|
|
779
915
|
const failed = paths.storageApi
|
|
780
916
|
? await provisionBuckets(paths.storageApi.url, paths.storageApi.serviceRoleKey, bucketSpecsFromAst({ storageBuckets: buckets }))
|
|
781
917
|
: [];
|
|
918
|
+
if (added === null) {
|
|
919
|
+
warnBucketsLeft(unprovisionedBuckets({ total: buckets.length, failed }));
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
782
922
|
const ready = added.filter((id) => !failed.includes(id)).length;
|
|
783
923
|
if (ready > 0)
|
|
784
924
|
console.log(`[supatype] Storage: provisioned ${ready} bucket(s).`);
|
|
785
925
|
}
|
|
786
926
|
/** Studio's admin config, which the engine writes to stdout, with the project's roles merged in. */
|
|
787
927
|
async function writeNativeAdminConfig(paths, adminConfigPath, ast, config) {
|
|
788
|
-
const adminResult =
|
|
789
|
-
cwd: paths.cwd,
|
|
790
|
-
stdio: "pipe",
|
|
791
|
-
encoding: "utf8",
|
|
792
|
-
});
|
|
928
|
+
const adminResult = await runCaptured(paths.engineBin, ["admin", "-i", paths.astPath], { cwd: paths.cwd });
|
|
793
929
|
if (adminResult.status !== 0 || !adminResult.stdout)
|
|
794
930
|
return;
|
|
795
931
|
const { withAdminRoles } = await import("../studio-admin-roles.js");
|
|
@@ -846,6 +982,14 @@ function provisionStorageBuckets(declared, storagePath) {
|
|
|
846
982
|
// Resolve Postgres bin dir
|
|
847
983
|
// ---------------------------------------------------------------------------
|
|
848
984
|
export async function resolvePgBinDir(config) {
|
|
985
|
+
return (await resolvePgInstall(config)).binDir;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Native Postgres's bin directory, and the version of the archive it came from: null for
|
|
989
|
+
* `overrides.postgres_dir`, a local build whose version nothing records. The version is resolved
|
|
990
|
+
* here once, since on a build that is not a release resolving it asks the CDN.
|
|
991
|
+
*/
|
|
992
|
+
async function resolvePgInstall(config) {
|
|
849
993
|
const override = config.overrides?.postgres_dir;
|
|
850
994
|
if (override) {
|
|
851
995
|
// Normalize Git Bash (/c/Users/...) paths to Win32 form (C:\Users\...) on Windows.
|
|
@@ -856,7 +1000,7 @@ export async function resolvePgBinDir(config) {
|
|
|
856
1000
|
throw new Error(`[overrides] postgres_dir does not contain a bin/ directory: ${resolved}`);
|
|
857
1001
|
}
|
|
858
1002
|
console.warn(`\u26a0 Using local Postgres build: ${resolved}`);
|
|
859
|
-
return binDir;
|
|
1003
|
+
return { binDir, version: null };
|
|
860
1004
|
}
|
|
861
1005
|
// Locate cached Postgres archive.
|
|
862
1006
|
const { cachePath, currentPlatform, resolveVersionFor } = await import("../binary-cache.js");
|
|
@@ -869,7 +1013,7 @@ export async function resolvePgBinDir(config) {
|
|
|
869
1013
|
// Try to extract the cached archive.
|
|
870
1014
|
await extractPostgresArchive(pgCacheDir, version, platform, extractedDir);
|
|
871
1015
|
}
|
|
872
|
-
return join(extractedDir, "bin");
|
|
1016
|
+
return { binDir: join(extractedDir, "bin"), version };
|
|
873
1017
|
}
|
|
874
1018
|
async function extractPostgresArchive(pgCacheDir, version, platform, extractDir) {
|
|
875
1019
|
const ext = platform.os === "windows" ? ".zip" : ".tar.gz";
|
|
@@ -1054,15 +1198,29 @@ function runAuthMigrations(serverBin, migrateEnv) {
|
|
|
1054
1198
|
}
|
|
1055
1199
|
}
|
|
1056
1200
|
/**
|
|
1057
|
-
*
|
|
1058
|
-
* the sidecar container
|
|
1201
|
+
* Native dev's REST cache: the keyspace native Postgres serves, on loopback and requiring its
|
|
1202
|
+
* password, when it answers a client that logs in; else Valkey, the project's own sidecar container
|
|
1203
|
+
* or the one SUPATYPE_VALKEY_ADDR names (valkey-sidecar.ts, N-S28). Windows archives carry no
|
|
1204
|
+
* pg_keyspace, so Windows is always Valkey.
|
|
1059
1205
|
*/
|
|
1060
|
-
async function
|
|
1061
|
-
const
|
|
1062
|
-
if (keyspace === null)
|
|
1063
|
-
return ensureValkeySidecar(projectName);
|
|
1064
|
-
console.log(`[supatype] Keyspace served by Postgres (${
|
|
1065
|
-
return externalValkey(keyspace
|
|
1206
|
+
async function nativeCache(keyspace, projectName, cwd) {
|
|
1207
|
+
const addr = keyspace === null ? null : await nativeKeyspaceAddr(keyspace.port, keyspace.login);
|
|
1208
|
+
if (addr === null || keyspace === null)
|
|
1209
|
+
return { sidecar: await ensureValkeySidecar(projectName, cwd), login: null };
|
|
1210
|
+
console.log(`[supatype] Keyspace served by Postgres (${addr}, loopback only, password ${keyspacePasswordOrigin(cwd)}).`);
|
|
1211
|
+
return { sidecar: externalValkey(addr), login: keyspace.login };
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Stops this project's own Postgres, left running by a dev that did not stop cleanly, so this run
|
|
1215
|
+
* starts it with its own settings and stops it when it ends (FF12 remainder,
|
|
1216
|
+
* native-leftover-postgres.ts).
|
|
1217
|
+
*/
|
|
1218
|
+
function restartLeftoverPostgres(claim, pgOpts) {
|
|
1219
|
+
const pid = claim?.leftoverPostgres ?? null;
|
|
1220
|
+
if (pid === null)
|
|
1221
|
+
return;
|
|
1222
|
+
console.log(`[supatype] This project's Postgres (pid ${pid}) was still running from a dev that did not stop cleanly; restarting it.`);
|
|
1223
|
+
pgStop(pgOpts);
|
|
1066
1224
|
}
|
|
1067
1225
|
/**
|
|
1068
1226
|
* The project database: left as it is when psql can report its encoding (with a warning when an
|
|
@@ -1097,7 +1255,7 @@ function ensureProjectDatabase(db) {
|
|
|
1097
1255
|
* What push and Docker dev write from an applied AST (applied-ast-artifacts.ts), for native dev,
|
|
1098
1256
|
* which has no row-cache container. The manifest is made first when there is none: the hook maps
|
|
1099
1257
|
* only go into one that exists, and the first push runs before native dev records its functions,
|
|
1100
|
-
* which
|
|
1258
|
+
* which switches functions (`services.functions`) before the server reads it.
|
|
1101
1259
|
*/
|
|
1102
1260
|
function writeNativeAppliedAst(cwd, config, ast) {
|
|
1103
1261
|
const manifestPath = join(cwd, ".supatype", "manifest.json");
|