@supatype/cli 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +499 -91
- package/bin/node-version.js +28 -0
- package/bin/supatype.js +8 -4
- package/dist/api-config-cache.d.ts +22 -8
- package/dist/api-config-cache.d.ts.map +1 -1
- package/dist/api-config-cache.js +82 -19
- package/dist/api-config-cache.js.map +1 -1
- package/dist/api-config-stack.d.ts +23 -0
- package/dist/api-config-stack.d.ts.map +1 -0
- package/dist/api-config-stack.js +63 -0
- package/dist/api-config-stack.js.map +1 -0
- package/dist/api-url.d.ts +12 -0
- package/dist/api-url.d.ts.map +1 -0
- package/dist/api-url.js +17 -0
- package/dist/api-url.js.map +1 -0
- package/dist/app/framework.d.ts +18 -2
- package/dist/app/framework.d.ts.map +1 -1
- package/dist/app/framework.js +26 -3
- package/dist/app/framework.js.map +1 -1
- 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 +27 -3
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +100 -46
- package/dist/app/proxy-dev-app.js.map +1 -1
- package/dist/app/vite-dev-args.d.ts +33 -0
- package/dist/app/vite-dev-args.d.ts.map +1 -0
- package/dist/app/vite-dev-args.js +90 -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/applied-ast-artifacts.d.ts +7 -2
- package/dist/applied-ast-artifacts.d.ts.map +1 -1
- package/dist/applied-ast-artifacts.js +8 -3
- package/dist/applied-ast-artifacts.js.map +1 -1
- package/dist/archive-extract.d.ts +21 -2
- package/dist/archive-extract.d.ts.map +1 -1
- package/dist/archive-extract.js +30 -11
- package/dist/archive-extract.js.map +1 -1
- package/dist/augmentation-generator.d.ts +9 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +75 -8
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/auth-answer.d.ts +1 -1
- package/dist/auth-answer.js +1 -1
- package/dist/auth-config-validate.d.ts +3 -0
- package/dist/auth-config-validate.d.ts.map +1 -0
- package/dist/auth-config-validate.js +85 -0
- package/dist/auth-config-validate.js.map +1 -0
- package/dist/auth-groups-env.d.ts +14 -0
- package/dist/auth-groups-env.d.ts.map +1 -0
- package/dist/auth-groups-env.js +53 -0
- package/dist/auth-groups-env.js.map +1 -0
- package/dist/auth-providers.d.ts +6 -14
- package/dist/auth-providers.d.ts.map +1 -1
- package/dist/auth-providers.js +6 -36
- package/dist/auth-providers.js.map +1 -1
- package/dist/auth-settings-push.d.ts +29 -0
- package/dist/auth-settings-push.d.ts.map +1 -0
- package/dist/auth-settings-push.js +176 -0
- package/dist/auth-settings-push.js.map +1 -0
- package/dist/binary-cache.d.ts +4 -1
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +33 -63
- package/dist/binary-cache.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/browser-login.d.ts +42 -0
- package/dist/browser-login.d.ts.map +1 -0
- package/dist/browser-login.js +111 -0
- package/dist/browser-login.js.map +1 -0
- package/dist/build-public-env.d.ts +29 -0
- package/dist/build-public-env.d.ts.map +1 -0
- package/dist/build-public-env.js +97 -0
- package/dist/build-public-env.js.map +1 -0
- package/dist/build-refused.d.ts +9 -0
- package/dist/build-refused.d.ts.map +1 -0
- package/dist/build-refused.js +9 -0
- package/dist/build-refused.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/cdn-fetch.d.ts +36 -0
- package/dist/cdn-fetch.d.ts.map +1 -0
- package/dist/cdn-fetch.js +175 -0
- package/dist/cdn-fetch.js.map +1 -0
- package/dist/channel-extractor.d.ts +51 -0
- package/dist/channel-extractor.d.ts.map +1 -0
- package/dist/channel-extractor.js +485 -0
- package/dist/channel-extractor.js.map +1 -0
- package/dist/cli-launcher.d.ts.map +1 -1
- package/dist/cli-launcher.js +3 -2
- package/dist/cli-launcher.js.map +1 -1
- package/dist/cli-release-check.d.ts +34 -0
- package/dist/cli-release-check.d.ts.map +1 -0
- package/dist/cli-release-check.js +79 -0
- package/dist/cli-release-check.js.map +1 -0
- package/dist/cli-standalone.d.ts +16 -0
- package/dist/cli-standalone.d.ts.map +1 -1
- package/dist/cli-standalone.js +92 -47
- package/dist/cli-standalone.js.map +1 -1
- package/dist/cli-version-embedded.d.ts.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cli-version-embedded.js.map +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-generator.d.ts.map +1 -1
- package/dist/client-generator.js +9 -3
- package/dist/client-generator.js.map +1 -1
- package/dist/cloud-admin.d.ts +55 -0
- package/dist/cloud-admin.d.ts.map +1 -0
- package/dist/cloud-admin.js +99 -0
- package/dist/cloud-admin.js.map +1 -0
- package/dist/cloud-credentials.d.ts +24 -9
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +57 -47
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/cloud-saml-key.d.ts +9 -0
- package/dist/cloud-saml-key.d.ts.map +1 -0
- package/dist/cloud-saml-key.js +44 -0
- package/dist/cloud-saml-key.js.map +1 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +79 -24
- package/dist/commands/admin.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 +3 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +10 -13
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +16 -5
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.d.ts +2 -0
- package/dist/commands/cloud.d.ts.map +1 -1
- package/dist/commands/cloud.js +96 -23
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +2 -1
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +21 -2
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +97 -97
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +31 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +261 -77
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +16 -4
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +163 -54
- 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/hooks.d.ts.map +1 -1
- package/dist/commands/hooks.js +40 -9
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +20 -8
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +358 -137
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts +6 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +17 -10
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts +4 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +64 -12
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/login.d.ts +3 -2
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +99 -57
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/migrate.d.ts +17 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +22 -4
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/push.d.ts +35 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +117 -21
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts +31 -45
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +93 -215
- 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 +88 -270
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/site.d.ts +42 -0
- package/dist/commands/site.d.ts.map +1 -0
- package/dist/commands/site.js +100 -0
- package/dist/commands/site.js.map +1 -0
- package/dist/commands/sso.d.ts +13 -3
- package/dist/commands/sso.d.ts.map +1 -1
- package/dist/commands/sso.js +58 -16
- package/dist/commands/sso.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +161 -68
- package/dist/commands/update.js.map +1 -1
- package/dist/compose-auth-settings.d.ts +12 -0
- package/dist/compose-auth-settings.d.ts.map +1 -0
- package/dist/compose-auth-settings.js +39 -0
- package/dist/compose-auth-settings.js.map +1 -0
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +6 -0
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-kong.d.ts +5 -1
- package/dist/compose-kong.d.ts.map +1 -1
- package/dist/compose-kong.js +8 -4
- package/dist/compose-kong.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 +22 -13
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +3 -2
- package/dist/compose-services.js.map +1 -1
- package/dist/config-mailer-env.d.ts +6 -2
- package/dist/config-mailer-env.d.ts.map +1 -1
- package/dist/config-mailer-env.js +11 -13
- package/dist/config-mailer-env.js.map +1 -1
- 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 +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -2
- package/dist/config.js.map +1 -1
- package/dist/cors-origins-push.d.ts +16 -0
- package/dist/cors-origins-push.d.ts.map +1 -0
- package/dist/cors-origins-push.js +37 -0
- package/dist/cors-origins-push.js.map +1 -0
- package/dist/database-url-owner.d.ts.map +1 -1
- package/dist/database-url-owner.js +2 -1
- package/dist/database-url-owner.js.map +1 -1
- package/dist/db-port.d.ts +3 -1
- package/dist/db-port.d.ts.map +1 -1
- package/dist/db-port.js +1 -1
- package/dist/db-port.js.map +1 -1
- package/dist/destructive-consent.d.ts.map +1 -1
- package/dist/destructive-consent.js +23 -1
- package/dist/destructive-consent.js.map +1 -1
- package/dist/dev-compose.d.ts +9 -4
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +112 -71
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-functions-watch.d.ts +25 -4
- package/dist/dev-functions-watch.d.ts.map +1 -1
- package/dist/dev-functions-watch.js +78 -13
- package/dist/dev-functions-watch.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 +7 -2
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +44 -22
- 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 +6 -0
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +9 -0
- 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 +71 -2
- package/dist/dev-session-lock.d.ts.map +1 -1
- package/dist/dev-session-lock.js +105 -5
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +6 -1
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +9 -3
- 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 +23 -9
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-access.d.ts.map +1 -1
- package/dist/diff-access.js +17 -1
- package/dist/diff-access.js.map +1 -1
- package/dist/diff-channels.d.ts +14 -0
- package/dist/diff-channels.d.ts.map +1 -0
- package/dist/diff-channels.js +38 -0
- package/dist/diff-channels.js.map +1 -0
- package/dist/docker-exec.d.ts +25 -4
- package/dist/docker-exec.d.ts.map +1 -1
- package/dist/docker-exec.js +88 -8
- package/dist/docker-exec.js.map +1 -1
- package/dist/docker-postgres.d.ts +11 -0
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +9 -1
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +31 -7
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +104 -36
- package/dist/docker-runtime.js.map +1 -1
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +2 -1
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts +28 -0
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +4 -4
- 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 +35 -0
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +67 -0
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-ownership-gate.d.ts +11 -1
- package/dist/engine-ownership-gate.d.ts.map +1 -1
- package/dist/engine-ownership-gate.js +32 -0
- package/dist/engine-ownership-gate.js.map +1 -1
- package/dist/engine-push-output.d.ts +12 -4
- package/dist/engine-push-output.d.ts.map +1 -1
- package/dist/engine-push-output.js.map +1 -1
- package/dist/env-file.d.ts +36 -3
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +82 -11
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +5 -2
- package/dist/env-lines.d.ts.map +1 -1
- package/dist/env-lines.js +18 -3
- package/dist/env-lines.js.map +1 -1
- package/dist/env-managed-record.d.ts +20 -0
- package/dist/env-managed-record.d.ts.map +1 -0
- package/dist/env-managed-record.js +56 -0
- package/dist/env-managed-record.js.map +1 -0
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +7 -3
- package/dist/error-message.js.map +1 -1
- package/dist/frontend-env.d.ts +3 -2
- package/dist/frontend-env.d.ts.map +1 -1
- package/dist/frontend-env.js +4 -5
- package/dist/frontend-env.js.map +1 -1
- package/dist/frontend-values-linked.d.ts +3 -0
- package/dist/frontend-values-linked.d.ts.map +1 -1
- package/dist/frontend-values-linked.js +3 -2
- package/dist/frontend-values-linked.js.map +1 -1
- package/dist/frontend-values.d.ts +2 -1
- package/dist/frontend-values.d.ts.map +1 -1
- package/dist/frontend-values.js +2 -1
- package/dist/frontend-values.js.map +1 -1
- package/dist/functions-context-refresh.d.ts.map +1 -1
- package/dist/functions-context-refresh.js +5 -2
- package/dist/functions-context-refresh.js.map +1 -1
- package/dist/functions-deno-types.d.ts +6 -0
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +43 -35
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/functions-env-local.d.ts +7 -2
- package/dist/functions-env-local.d.ts.map +1 -1
- package/dist/functions-env-local.js +8 -3
- package/dist/functions-env-local.js.map +1 -1
- 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/functions-worker-source.d.ts.map +1 -1
- package/dist/generated/functions-worker-source.js +6 -3
- package/dist/generated/functions-worker-source.js.map +1 -1
- package/dist/generated/release-images.d.ts +6 -6
- package/dist/generated/release-images.js +3 -3
- package/dist/generated-files-engine.d.ts +9 -0
- package/dist/generated-files-engine.d.ts.map +1 -1
- package/dist/generated-files-engine.js +23 -0
- package/dist/generated-files-engine.js.map +1 -1
- 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 +32 -10
- package/dist/hooks-generator.js.map +1 -1
- package/dist/hooks-worker-reload.d.ts +18 -0
- package/dist/hooks-worker-reload.d.ts.map +1 -0
- package/dist/hooks-worker-reload.js +19 -0
- package/dist/hooks-worker-reload.js.map +1 -0
- package/dist/host-database.d.ts +6 -2
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +10 -2
- package/dist/host-database.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- 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 +14 -1
- package/dist/init-next-runtime-env.d.ts.map +1 -1
- package/dist/init-next-runtime-env.js +116 -35
- package/dist/init-next-runtime-env.js.map +1 -1
- package/dist/init-package-json.d.ts +12 -3
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +35 -15
- 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-setup-steps.d.ts +32 -4
- package/dist/init-setup-steps.d.ts.map +1 -1
- package/dist/init-setup-steps.js +114 -18
- package/dist/init-setup-steps.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/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/keyspace-port.d.ts +14 -0
- package/dist/keyspace-port.d.ts.map +1 -0
- package/dist/keyspace-port.js +35 -0
- package/dist/keyspace-port.js.map +1 -0
- package/dist/kong-config.d.ts +6 -0
- package/dist/kong-config.d.ts.map +1 -1
- package/dist/kong-config.js +119 -20
- package/dist/kong-config.js.map +1 -1
- package/dist/link.d.ts +30 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +70 -16
- package/dist/link.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 +22 -0
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +29 -0
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack-guard.d.ts +8 -0
- package/dist/local-stack-guard.d.ts.map +1 -1
- package/dist/local-stack-guard.js +44 -3
- package/dist/local-stack-guard.js.map +1 -1
- package/dist/local-stack.d.ts +2 -0
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +14 -8
- 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 +8 -1
- package/dist/mailer-env.d.ts.map +1 -1
- package/dist/mailer-env.js +52 -8
- package/dist/mailer-env.js.map +1 -1
- package/dist/model-hooks.d.ts +6 -4
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +14 -8
- package/dist/model-hooks.js.map +1 -1
- package/dist/model-versioning.d.ts +6 -0
- package/dist/model-versioning.d.ts.map +1 -1
- package/dist/model-versioning.js +12 -0
- package/dist/model-versioning.js.map +1 -1
- package/dist/native-dev-env.d.ts +38 -3
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +98 -7
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-keyspace.d.ts +31 -6
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +70 -20
- 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-stale-session.d.ts +17 -0
- package/dist/native-stale-session.d.ts.map +1 -0
- package/dist/native-stale-session.js +42 -0
- package/dist/native-stale-session.js.map +1 -0
- 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/native-worker.d.ts +15 -0
- package/dist/native-worker.d.ts.map +1 -1
- package/dist/native-worker.js +26 -0
- package/dist/native-worker.js.map +1 -1
- package/dist/open-browser.d.ts +7 -0
- package/dist/open-browser.d.ts.map +1 -0
- package/dist/open-browser.js +26 -0
- package/dist/open-browser.js.map +1 -0
- package/dist/parent-watch.d.ts.map +1 -1
- package/dist/parent-watch.js +4 -8
- package/dist/parent-watch.js.map +1 -1
- package/dist/personal-access-token.d.ts +7 -0
- package/dist/personal-access-token.d.ts.map +1 -0
- package/dist/personal-access-token.js +11 -0
- package/dist/personal-access-token.js.map +1 -0
- package/dist/plan-sql.d.ts +30 -0
- package/dist/plan-sql.d.ts.map +1 -0
- package/dist/plan-sql.js +65 -0
- package/dist/plan-sql.js.map +1 -0
- package/dist/platform-settings-push.d.ts +15 -0
- package/dist/platform-settings-push.d.ts.map +1 -0
- package/dist/platform-settings-push.js +100 -0
- package/dist/platform-settings-push.js.map +1 -0
- package/dist/platform-settings.d.ts +81 -0
- package/dist/platform-settings.d.ts.map +1 -0
- package/dist/platform-settings.js +164 -0
- package/dist/platform-settings.js.map +1 -0
- package/dist/postgres-ctl.d.ts +45 -5
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +59 -21
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +27 -2
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +58 -13
- package/dist/postgres-image.js.map +1 -1
- package/dist/postgrest-release.d.ts +1 -1
- package/dist/postgrest-release.d.ts.map +1 -1
- package/dist/postgrest-release.js +3 -1
- package/dist/postgrest-release.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 +78 -4
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +128 -46
- 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 +121 -10
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +62 -1
- package/dist/project-config.js.map +1 -1
- package/dist/release-images.d.ts +21 -0
- package/dist/release-images.d.ts.map +1 -1
- package/dist/release-images.js +24 -0
- package/dist/release-images.js.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-target.d.ts +42 -2
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +115 -21
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-cache-admin.d.ts +13 -0
- package/dist/rest-cache-admin.d.ts.map +1 -1
- package/dist/rest-cache-admin.js +36 -1
- package/dist/rest-cache-admin.js.map +1 -1
- package/dist/rest-ready.d.ts +6 -0
- package/dist/rest-ready.d.ts.map +1 -1
- package/dist/rest-ready.js +18 -2
- package/dist/rest-ready.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 +3 -1
- package/dist/run-captured.d.ts.map +1 -1
- package/dist/run-captured.js.map +1 -1
- 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 +10 -5
- package/dist/runtime-routes.js.map +1 -1
- package/dist/schema-ast-v2.d.ts +38 -0
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js +2 -0
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-reset.d.ts.map +1 -1
- package/dist/schema-reset.js +2 -0
- package/dist/schema-reset.js.map +1 -1
- 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-default-export.d.ts +12 -0
- package/dist/seed-default-export.d.ts.map +1 -0
- package/dist/seed-default-export.js +44 -0
- package/dist/seed-default-export.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-prepare.d.ts +60 -0
- package/dist/seed-prepare.d.ts.map +1 -0
- package/dist/seed-prepare.js +115 -0
- package/dist/seed-prepare.js.map +1 -0
- package/dist/seed-remote.d.ts +22 -0
- package/dist/seed-remote.d.ts.map +1 -0
- package/dist/seed-remote.js +203 -0
- package/dist/seed-remote.js.map +1 -0
- package/dist/seed-report.d.ts +65 -0
- package/dist/seed-report.d.ts.map +1 -0
- package/dist/seed-report.js +98 -0
- package/dist/seed-report.js.map +1 -0
- package/dist/seed.d.ts +15 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +21 -1
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +349 -78
- package/dist/self-host-compose.js.map +1 -1
- package/dist/site-build-env.d.ts +31 -0
- package/dist/site-build-env.d.ts.map +1 -0
- package/dist/site-build-env.js +29 -0
- package/dist/site-build-env.js.map +1 -0
- package/dist/site-deploy.d.ts +52 -0
- package/dist/site-deploy.d.ts.map +1 -0
- package/dist/site-deploy.js +230 -0
- package/dist/site-deploy.js.map +1 -0
- package/dist/site-public-env.d.ts +67 -0
- package/dist/site-public-env.d.ts.map +1 -0
- package/dist/site-public-env.js +124 -0
- package/dist/site-public-env.js.map +1 -0
- package/dist/sso-admin.d.ts +15 -0
- package/dist/sso-admin.d.ts.map +1 -1
- package/dist/sso-admin.js +32 -9
- package/dist/sso-admin.js.map +1 -1
- package/dist/stack-exit-watch.d.ts +15 -0
- package/dist/stack-exit-watch.d.ts.map +1 -1
- package/dist/stack-exit-watch.js +41 -13
- package/dist/stack-exit-watch.js.map +1 -1
- 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-running.d.ts +13 -0
- package/dist/stack-running.d.ts.map +1 -0
- package/dist/stack-running.js +44 -0
- package/dist/stack-running.js.map +1 -0
- package/dist/stack-setting-warnings.d.ts +8 -1
- package/dist/stack-setting-warnings.d.ts.map +1 -1
- package/dist/stack-setting-warnings.js +21 -1
- package/dist/stack-setting-warnings.js.map +1 -1
- 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-admin-roles.d.ts +4 -4
- package/dist/studio-admin-roles.d.ts.map +1 -1
- package/dist/studio-admin-roles.js +6 -4
- package/dist/studio-admin-roles.js.map +1 -1
- package/dist/target-client.d.ts +13 -1
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +83 -17
- package/dist/target-client.js.map +1 -1
- package/dist/target-request.d.ts +5 -0
- package/dist/target-request.d.ts.map +1 -1
- package/dist/target-request.js +11 -2
- package/dist/target-request.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +102 -10
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/clack-api.d.ts +2 -1
- package/dist/ui/clack-api.d.ts.map +1 -1
- package/dist/ui/clack-api.js +4 -4
- package/dist/ui/clack-api.js.map +1 -1
- package/dist/ui/clack.d.ts.map +1 -1
- package/dist/ui/clack.js +5 -2
- package/dist/ui/clack.js.map +1 -1
- package/dist/ui/dev/DevReadyPanelView.js +1 -1
- package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
- package/dist/valkey-sidecar.d.ts +34 -13
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +65 -39
- 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 -5
- package/releases/deno/VERSION +1 -1
- package/dist/commands/deploy-types.d.ts +0 -14
- package/dist/commands/deploy-types.d.ts.map +0 -1
- package/dist/commands/deploy-types.js +0 -38
- package/dist/commands/deploy-types.js.map +0 -1
- 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
|
@@ -19,21 +19,26 @@ import { serialRuns } from "../serial-runs.js";
|
|
|
19
19
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
20
20
|
import { join, resolve } from "node:path";
|
|
21
21
|
import { hasEnvValue, readDotEnvFiles } from "../env-file.js";
|
|
22
|
+
import { retireCliMailerAutoconfirm } from "../mailer-autoconfirm.js";
|
|
22
23
|
import { requireUrlSafeComposePasswords } from "../url-safe-passwords.js";
|
|
23
24
|
import { loadConfig, PROJECT_CONFIG_FILES } from "../config.js";
|
|
24
|
-
import { bucketSpecsFromAst, isParsedBuckets, nativeBucketRow, provisionBuckets, withPublicFromMode, } from "../storage-provision.js";
|
|
25
|
+
import { bucketSpecsFromAst, isParsedBuckets, nativeBucketRow, provisionBuckets, unprovisionedBuckets, warnBucketsLeft, withPublicFromMode, } from "../storage-provision.js";
|
|
25
26
|
import { readJsonFile } from "../json-file.js";
|
|
26
27
|
import { isArrayOf, isJsonObject } from "@supatype/shared";
|
|
27
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";
|
|
28
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";
|
|
29
32
|
import { devServiceRoleRoutesPath, functionsWorkerEnv, writeServiceRoleRoutesFile } from "../functions-worker-files.js";
|
|
30
33
|
import { devServiceRoleKeyPath } from "../service-role-key-file.js";
|
|
31
34
|
import { requireUsableJwtSecret } from "../jwt-secret-length.js";
|
|
32
|
-
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, givenJwtSecret, ignoredJwtSecretWarning, secretFingerprint, } from "../local-secrets.js";
|
|
33
|
-
import {
|
|
35
|
+
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, givenJwtSecret, ignoredJwtSecretWarning, KEYSPACE_USERNAME, secretFingerprint, } from "../local-secrets.js";
|
|
36
|
+
import { keyspacePasswordOrigin, projectKeyspacePassword } from "../keyspace-password-file.js";
|
|
37
|
+
import { normalisePlatformPath, cachePath, currentPlatform, hasMeaningfulOverrides, describeActiveOverrides, postgresArchiveTag, pinnedVersion, download, } from "../binary-cache.js";
|
|
38
|
+
import { assertEngineSupportsSchema, assertRealtimeSupportsSchema } from "../engine-floor.js";
|
|
34
39
|
import { ensureBinary } from "../ensure-binary.js";
|
|
35
40
|
import { assertSupported, binaryCapabilities, EngineProbeFailed, OVERWRITE_DRIFT_NEED, OwnershipUnsupportedError, requireEngineFeatures, } from "../engine-ownership-gate.js";
|
|
36
|
-
import { startProxyDevApp } from "../app/proxy-dev-app.js";
|
|
41
|
+
import { appPanelLinks, startProxyDevApp } from "../app/proxy-dev-app.js";
|
|
37
42
|
import { ProcessManager } from "../process-manager.js";
|
|
38
43
|
import { markPostgrestUnpacked, POSTGREST_VERSION, postgrestArchiveName, postgrestArchiveUrl, postgrestRuntimeRepairDue, } from "../postgrest-release.js";
|
|
39
44
|
import { STUDIO_DEV_PORT, startStudioViteDevServer } from "../studio-dev-server.js";
|
|
@@ -45,23 +50,30 @@ import { probeDockerDaemon, reportDockerUnavailable } from "../docker-runtime.js
|
|
|
45
50
|
import { fatalError } from "../ui/fatal.js";
|
|
46
51
|
import { haltIfStopping, pushStartUndo, pushStartUndoLast, registerDevShutdown, reportUnlessStopping, stopQuietlyDuringStart, waitForDevShutdown, } from "../dev-shutdown.js";
|
|
47
52
|
import { startNativeRealtime } from "../native-realtime.js";
|
|
48
|
-
import { nativeWorkerDenoEnv, prepareNativeWorker } from "../native-worker.js";
|
|
53
|
+
import { denoPreflightWarning, nativeWorkerDenoEnv, prepareNativeWorker } from "../native-worker.js";
|
|
49
54
|
import { configSnapshot } from "../config-snapshot.js";
|
|
55
|
+
import { refuseInsideDevApp } from "../dev-self-start.js";
|
|
50
56
|
import { patchRouteManifest, recordNativeRoutes } from "../route-manifest.js";
|
|
51
57
|
import { reconcileNativeDevDatabaseUrl } from "../db-port-offer.js";
|
|
52
58
|
import { extractArchive } from "../archive-extract.js";
|
|
53
|
-
import { serverStorageEnv, startNativeStorage } from "../native-storage.js";
|
|
59
|
+
import { nativeS3StorageEnv, serverStorageEnv, startNativeS3Storage, startNativeStorage, startsStorageService, } from "../native-storage.js";
|
|
54
60
|
import { keepsObjectsLocally, serverStoreRoot } from "../local-storage.js";
|
|
55
61
|
import { writeAppliedAstArtifacts } from "../applied-ast-artifacts.js";
|
|
62
|
+
import { cacheSeedingNotes } from "../api-config-cache.js";
|
|
56
63
|
import { writeAppViteEnv } from "../app-vite-env.js";
|
|
57
64
|
import { nativeAuthProviderEnv, warnMissingAuthProviderSecrets } from "../auth-providers.js";
|
|
65
|
+
import { nativeAuthGroupsEnv } from "../auth-groups-env.js";
|
|
58
66
|
import { warnSmtpWithoutHost } from "../config-mailer-env.js";
|
|
59
67
|
import { nativeSamlEnv } from "../saml-config.js";
|
|
60
68
|
import { AUTHENTICATOR_PASSWORD_ENV } from "../native-roles-sql.js";
|
|
61
|
-
import { nativeAuthMailerEnv, nativeDevApiKeys, nativeDevRolesSql, nativePostgrestSchemaEnv, nativeServerCoreEnv, nativeServerDotEnvLayer, } from "../native-dev-env.js";
|
|
69
|
+
import { nativeAuthMailerEnv, nativeDevApiKeys, nativeDevRolesSql, nativePostgrestSchemaEnv, nativeKeyspaceServerEnv, nativeServerCoreEnv, nativeServerDotEnvLayer, nativeServerInheritsEnv, } from "../native-dev-env.js";
|
|
62
70
|
import { ensureValkeySidecar, externalValkey } from "../valkey-sidecar.js";
|
|
63
|
-
import { nativeKeyspaceAddr
|
|
64
|
-
import { ensureCluster, createdbArgs, databaseEncoding, nonUtf8DatabaseWarning, pgBuild, start as pgStart, stop as pgStop, waitReady as pgWaitReady, isPortInUse, portCheckCommand, } from "../postgres-ctl.js";
|
|
71
|
+
import { nativeKeyspaceAddr, machineKeyspaceChecks, nativeKeyspacePort, writeKeyspacePasswordFile, } from "../native-keyspace.js";
|
|
72
|
+
import { ensureCluster, createdbArgs, databaseEncoding, nonUtf8DatabaseWarning, pgBuild, start as pgStart, stop as pgStop, waitReady as pgWaitReady, connectSucceeds, isPortInUse, portCheckCommand, } from "../postgres-ctl.js";
|
|
73
|
+
import { claimPortLock, isPortLock } from "../native-port-lock.js";
|
|
74
|
+
import { leftoverOwnPostgres, recordNativeDevPid } from "../native-leftover-postgres.js";
|
|
75
|
+
import { stopLeftoverServices } from "../native-leftover-services.js";
|
|
76
|
+
import { cleanStaleNativeSession } from "../native-stale-session.js";
|
|
65
77
|
import { isPasswordRejected, pgClientEnv, requirePasswordAuth, requireSuperuserPassword, superuserPasswordMissingMessage, } from "../native-pg-auth.js";
|
|
66
78
|
const NATIVE_SERVICES = ["postgres", "server", "postgrest", "realtime", "deno", "storage"];
|
|
67
79
|
export const NATIVE_PORT_HINTS = {
|
|
@@ -74,7 +86,7 @@ export const NATIVE_PORT_HINTS = {
|
|
|
74
86
|
move: "Move this project's API server port with server.port in supatype.config.ts, or `supatype dev --port`.",
|
|
75
87
|
},
|
|
76
88
|
postgrest: {
|
|
77
|
-
holder: "Another service may be running.",
|
|
89
|
+
holder: "Another service, or another project's native dev, may be running.",
|
|
78
90
|
move: "Move this project's PostgREST port with server.postgrestPort in supatype.config.ts.",
|
|
79
91
|
},
|
|
80
92
|
realtime: {
|
|
@@ -90,17 +102,70 @@ export const NATIVE_PORT_HINTS = {
|
|
|
90
102
|
move: `Move this project's storage port with ${STORAGE_PORT_ENV} in .env.`,
|
|
91
103
|
},
|
|
92
104
|
};
|
|
93
|
-
/**
|
|
94
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Stop before anything starts when a port native dev binds is taken, then claim PostgREST's for the
|
|
107
|
+
* session, refused to every other native dev's start (N-FF12, native-port-lock.ts). Exported for tests.
|
|
108
|
+
*
|
|
109
|
+
* Postgres's port held by this project's own Postgres, which a dev that did not stop cleanly left
|
|
110
|
+
* running, is not a refusal (FF12 remainder): the start restarts it (native-leftover-postgres.ts).
|
|
111
|
+
* Its services, left by a dev that was killed, are stopped first (native-leftover-services.ts).
|
|
112
|
+
*/
|
|
113
|
+
export async function claimNativeDevPorts(ports, state) {
|
|
114
|
+
await stopLeftoverServices(state);
|
|
115
|
+
// Beside the checks below rather than after them: a refused connect on Windows takes its full wait.
|
|
116
|
+
const ipv6Checked = warnIfServerIpv6Held(ports.server);
|
|
117
|
+
const leftoverPostgres = leftoverOwnPostgres(state, ports.postgres);
|
|
95
118
|
for (const service of NATIVE_SERVICES) {
|
|
96
119
|
const port = ports[service];
|
|
97
|
-
if (port === undefined ||
|
|
120
|
+
if (port === undefined || (service === "postgres" && leftoverPostgres !== null))
|
|
98
121
|
continue;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
brand: { intro: "Local development" },
|
|
102
|
-
});
|
|
122
|
+
if (await isPortInUse(port))
|
|
123
|
+
refuseNativePort(service, port);
|
|
103
124
|
}
|
|
125
|
+
await ipv6Checked;
|
|
126
|
+
const postgrest = claimPortLock(ports.postgrest);
|
|
127
|
+
if (!isPortLock(postgrest))
|
|
128
|
+
refuseClaimedPort(ports.postgrest, postgrest);
|
|
129
|
+
return { postgrest, leftoverPostgres };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Says so when something else listens on [::1] at the API server's port. The server then serves on
|
|
133
|
+
* 127.0.0.1 alone, and a client resolving `localhost` to ::1 first (a browser on Windows) reaches
|
|
134
|
+
* the other listener. Dev started, and no pane said so (0.9.2 round 2, R2-S22).
|
|
135
|
+
*/
|
|
136
|
+
async function warnIfServerIpv6Held(port) {
|
|
137
|
+
if (!(await connectSucceeds(port, 400, "::1")))
|
|
138
|
+
return;
|
|
139
|
+
console.warn(`[supatype] ⚠ Something else listens on [::1]:${port}, so the API server answers on IPv4 only: ` +
|
|
140
|
+
`use http://127.0.0.1:${port}, as http://localhost:${port} can reach the other listener.`);
|
|
141
|
+
}
|
|
142
|
+
/** Refuse to start for a port another running native dev has claimed, naming it and its claim. */
|
|
143
|
+
function refuseClaimedPort(port, claim) {
|
|
144
|
+
fatalError(`Port ${port} is claimed by another native dev (pid ${claim.holder}).`, [
|
|
145
|
+
`Its claim is ${claim.path}. If no native dev is running, delete that file.`,
|
|
146
|
+
NATIVE_PORT_HINTS.postgrest.move,
|
|
147
|
+
], { brand: { intro: "Local development" } });
|
|
148
|
+
}
|
|
149
|
+
/** What native dev says of a port it binds that something else holds: what usually does, and how to move it. */
|
|
150
|
+
function portRefusalText(service, port) {
|
|
151
|
+
return { headline: `Port ${port} is already in use.`, ...NATIVE_PORT_HINTS[service] };
|
|
152
|
+
}
|
|
153
|
+
/** Refuse to start for a port native dev binds that something else holds. */
|
|
154
|
+
function refuseNativePort(service, port) {
|
|
155
|
+
const { headline, holder, move } = portRefusalText(service, port);
|
|
156
|
+
fatalError(headline, [holder, `Check: ${portCheckCommand(port)}`, move], {
|
|
157
|
+
brand: { intro: "Local development" },
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Refuses PostgREST's port when something other than a native dev took it since the check, as the
|
|
162
|
+
* check would have (N-FF12). A throw rather than a fatal exit, so the start undoes what it began.
|
|
163
|
+
*/
|
|
164
|
+
async function requirePostgrestPortFree(port) {
|
|
165
|
+
if (!(await isPortInUse(port)))
|
|
166
|
+
return;
|
|
167
|
+
const { headline, holder, move } = portRefusalText("postgrest", port);
|
|
168
|
+
throw new Error(`${headline} ${holder} ${move}`);
|
|
104
169
|
}
|
|
105
170
|
/**
|
|
106
171
|
* `dev --overwrite-drift` only where the engine that will push can honour it: the compose
|
|
@@ -126,6 +191,8 @@ async function requireDevEngineSupports(cwd, config, docker) {
|
|
|
126
191
|
export function registerDev(program) {
|
|
127
192
|
program
|
|
128
193
|
.command("dev")
|
|
194
|
+
// `dev stop` is not a command; a stray word must not start the stack it was meant to stop.
|
|
195
|
+
.allowExcessArguments(false)
|
|
129
196
|
.description("Start local Postgres, apply schema, and run supatype-server")
|
|
130
197
|
.option("--no-watch", "Start services but do not watch for schema changes, or (Docker) for function changes")
|
|
131
198
|
.option("--stream", "Print interleaved logs instead of the interactive TUI")
|
|
@@ -135,6 +202,7 @@ export function registerDev(program) {
|
|
|
135
202
|
.option("--overwrite-drift", "Every push of this session puts back policies, grants, labels and RLS changed outside Supatype")
|
|
136
203
|
// Ctrl+C during the start reaches its children too: it ends with one line, not their failure.
|
|
137
204
|
.action(stopQuietlyDuringStart(async (opts) => {
|
|
205
|
+
refuseInsideDevApp();
|
|
138
206
|
const cwd = process.cwd();
|
|
139
207
|
// ── 1. Load project config (before TUI, fatal errors must hit real stderr) ──
|
|
140
208
|
// Its bytes first: the functions.serviceRole watch, started much later, applies any edit since.
|
|
@@ -162,19 +230,29 @@ export function registerDev(program) {
|
|
|
162
230
|
const realtimePort = String(nativeRealtimePort(config, cwd));
|
|
163
231
|
const denoPort = nativeDenoPort(cwd);
|
|
164
232
|
const storagePort = nativeStoragePort(cwd);
|
|
233
|
+
// A native project on S3: the storage service on the project's own bucket, unless .env names a
|
|
234
|
+
// service of its own. Read before anything starts, so a blank S3_BUCKET is the first thing said.
|
|
235
|
+
const s3StorageEnv = provider !== "docker" && !keepsObjectsLocally(config) ? s3StorageEnvOrExit(cwd) : null;
|
|
236
|
+
const nativeState = { dataDir: nativeDataDir(config), pidDir: join(nativeStateRoot(config), "pid") };
|
|
237
|
+
let portClaim = null;
|
|
165
238
|
if (provider !== "docker") {
|
|
239
|
+
// A dev that was force-quit leaves its Valkey container and session file; say what is removed.
|
|
240
|
+
const cleaned = await cleanStaleNativeSession(cwd);
|
|
241
|
+
if (cleaned !== null)
|
|
242
|
+
console.log(`[supatype] ${cleaned}`);
|
|
166
243
|
// The functions worker runs on every native dev (native-worker.ts), so Deno's port is checked too.
|
|
167
|
-
await
|
|
244
|
+
portClaim = await claimNativeDevPorts({
|
|
168
245
|
postgres: pgPort,
|
|
169
246
|
server: Number(serverPort),
|
|
170
247
|
postgrest: Number(postgrestPort),
|
|
171
248
|
realtime: Number(realtimePort),
|
|
172
249
|
deno: denoPort,
|
|
173
|
-
...(
|
|
174
|
-
});
|
|
250
|
+
...(startsStorageService(config, s3StorageEnv) && { storage: storagePort }),
|
|
251
|
+
}, nativeState);
|
|
252
|
+
pushStartUndoLast(portClaim.postgrest.release);
|
|
175
253
|
// Before anything is generated: a missing password would otherwise be replaced in .env
|
|
176
254
|
// with a new one the existing cluster has never heard of.
|
|
177
|
-
requireSuperuserPassword(cwd,
|
|
255
|
+
requireSuperuserPassword(cwd, nativeState.dataDir);
|
|
178
256
|
}
|
|
179
257
|
// Before the session takes the terminal, so a refusal reaches it.
|
|
180
258
|
const overwriteDrift = opts.overwriteDrift === true;
|
|
@@ -226,12 +304,14 @@ export function registerDev(program) {
|
|
|
226
304
|
]);
|
|
227
305
|
// ── 3. Per-project state directories ─────────────────────────────────
|
|
228
306
|
const stateRoot = nativeStateRoot(config);
|
|
229
|
-
const pidDir =
|
|
307
|
+
const { pidDir } = nativeState;
|
|
230
308
|
const logsDir = join(stateRoot, "logs");
|
|
231
309
|
const tmpDir = join(stateRoot, "tmp");
|
|
232
310
|
for (const d of [pidDir, logsDir, tmpDir]) {
|
|
233
311
|
mkdirSync(d, { recursive: true });
|
|
234
312
|
}
|
|
313
|
+
// Before Postgres starts, so a dev started meanwhile never takes this one's Postgres for a leftover.
|
|
314
|
+
pushStartUndoLast(recordNativeDevPid(pidDir));
|
|
235
315
|
// ── 5–7. Start Postgres ───────────────────────────────────────────────
|
|
236
316
|
let dbURL;
|
|
237
317
|
/** What PostgREST connects as, deliberately not `dbURL`, which is a superuser. */
|
|
@@ -245,35 +325,41 @@ export function registerDev(program) {
|
|
|
245
325
|
// pgBinDir is set on the native path and used to add DLL search path for
|
|
246
326
|
// PostgREST on Windows (PostgREST links against libpq + SSL from MinGW).
|
|
247
327
|
let pgBinDir = null;
|
|
248
|
-
// The
|
|
249
|
-
//
|
|
250
|
-
let
|
|
328
|
+
// The keyspace this Postgres serves and its login, or null when the Valkey sidecar is what
|
|
329
|
+
// the cache talks to (native-keyspace.ts).
|
|
330
|
+
let keyspace = null;
|
|
251
331
|
{
|
|
252
332
|
// native: resolve pg bin dir and manage with pg_ctl
|
|
253
|
-
|
|
254
|
-
|
|
333
|
+
const pgInstall = await resolvePgInstall(config);
|
|
334
|
+
pgBinDir = pgInstall.binDir;
|
|
335
|
+
const { dataDir } = nativeState;
|
|
255
336
|
mkdirSync(dataDir, { recursive: true });
|
|
256
|
-
// The RESP keyspace, when this archive carries it: one process
|
|
257
|
-
// of a Postgres and a Valkey container. The port is chosen rather than
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
//
|
|
261
|
-
|
|
337
|
+
// The RESP keyspace, when this archive carries it and can require a password: one process
|
|
338
|
+
// instead of a Postgres and a Valkey container. The port is chosen rather than fixed
|
|
339
|
+
// because 6379 is the first thing a developer's own Redis or a leftover sidecar takes.
|
|
340
|
+
const keyspacePort = await nativeKeyspacePort(config, pgBinDir, pgInstall.version, machineKeyspaceChecks(cwd));
|
|
341
|
+
// The project's password, from .env or the file SUPATYPE_KEYSPACE_PASSWORD_FILE names
|
|
342
|
+
// (R2-S16), which the keyspace reads itself from a file only this user can read, and
|
|
343
|
+
// requires from its first client (N-RB2).
|
|
344
|
+
keyspace = keyspacePort === null ? null : { port: keyspacePort, login: { username: KEYSPACE_USERNAME, password: projectKeyspacePassword(cwd) } };
|
|
262
345
|
const pgOpts = {
|
|
263
346
|
pgBinDir,
|
|
264
347
|
dataDir,
|
|
265
348
|
port: pgPort,
|
|
266
349
|
logPath: join(logsDir, "postgres.log"),
|
|
267
350
|
database: projectName,
|
|
268
|
-
...(
|
|
269
|
-
|
|
270
|
-
:
|
|
351
|
+
...(keyspace !== null && {
|
|
352
|
+
keyspacePort: keyspace.port,
|
|
353
|
+
keyspaceDatabase: projectName,
|
|
354
|
+
keyspacePasswordFile: writeKeyspacePasswordFile(stateRoot, keyspace.login.password),
|
|
355
|
+
}),
|
|
271
356
|
};
|
|
272
357
|
// initdb, and createdb on a first start, need the archive's version and ICU support; asked once.
|
|
273
358
|
let build;
|
|
274
359
|
const buildOnce = () => (build ??= pgBuild(pgBinDir));
|
|
275
360
|
// Before initdb, which a first start runs here and which takes the longest.
|
|
276
361
|
await showDevStep("Starting Postgres");
|
|
362
|
+
restartLeftoverPostgres(portClaim, pgOpts);
|
|
277
363
|
ensureCluster(pgOpts, pgPassword, buildOnce);
|
|
278
364
|
console.log("[supatype] Starting Postgres...");
|
|
279
365
|
pgStart(pgOpts);
|
|
@@ -358,6 +444,9 @@ export function registerDev(program) {
|
|
|
358
444
|
// The functions worker the image runs, from the CLI's copy, on every start (native-worker.ts).
|
|
359
445
|
await showDevStep("Starting services");
|
|
360
446
|
const worker = await prepareNativeWorker(cwd, config);
|
|
447
|
+
const denoWarning = denoPreflightWarning(worker.denoBin, cwd);
|
|
448
|
+
if (denoWarning !== null)
|
|
449
|
+
console.warn(denoWarning);
|
|
361
450
|
// The server passes its environment, the key included, on to Deno, but the functions worker
|
|
362
451
|
// reads the key from a file: a --watch reload evaluates it again in an environment an
|
|
363
452
|
// earlier evaluation already took the key out of.
|
|
@@ -366,21 +455,35 @@ export function registerDev(program) {
|
|
|
366
455
|
writeAppViteEnv(cwd, config, `http://localhost:${serverPort}`, anonKey);
|
|
367
456
|
// After the push, failed or not: init's manifest names the compose stack's services.
|
|
368
457
|
recordNativeRoutes(manifestPath, worker.denoBin !== undefined);
|
|
369
|
-
//
|
|
370
|
-
const
|
|
458
|
+
// The cache, the keyspace or Valkey, alongside realtime and storage: none needs another.
|
|
459
|
+
const cacheStart = nativeCache(keyspace, projectName, cwd);
|
|
371
460
|
const realtimeProc = await startNativeRealtime({
|
|
372
461
|
config, cwd, manifestPath, pidDir, url: realtimeUrl, port: realtimePort,
|
|
373
462
|
databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
374
463
|
});
|
|
375
|
-
const nativeStorage = keepsObjectsLocally(config)
|
|
376
|
-
? await startNativeStorage({
|
|
377
|
-
config, cwd, manifestPath, pidDir, stateRoot, port: storagePort, databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
378
|
-
})
|
|
379
|
-
: null;
|
|
380
464
|
// Later pushes create the buckets a schema declares in the service as well as in buckets.json.
|
|
465
|
+
// A project on S3 has no buckets.json for the service to import, so the buckets the first push
|
|
466
|
+
// declared, before the service ran, are created in it now. The same for a service switched on
|
|
467
|
+
// only once it answered, after its start deadline (N-FF2).
|
|
468
|
+
const useStorage = async (storage) => {
|
|
469
|
+
const storageApi = { url: storage.url, serviceRoleKey };
|
|
470
|
+
schemaPush.storageApi = storageApi;
|
|
471
|
+
if (s3StorageEnv !== null)
|
|
472
|
+
await provisionDeclaredBuckets(engineBin, cwd, join(supatypeDir, "schema.ast.json"), { storageApi });
|
|
473
|
+
};
|
|
474
|
+
const storageOptions = {
|
|
475
|
+
config, cwd, manifestPath, pidDir, stateRoot, port: storagePort, databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
476
|
+
onLateStart: useStorage,
|
|
477
|
+
};
|
|
478
|
+
const nativeStorage = keepsObjectsLocally(config)
|
|
479
|
+
? await startNativeStorage(storageOptions)
|
|
480
|
+
: s3StorageEnv === null ? null : await startNativeS3Storage(storageOptions, s3StorageEnv);
|
|
381
481
|
if (nativeStorage !== null)
|
|
382
|
-
|
|
383
|
-
const
|
|
482
|
+
await useStorage(nativeStorage);
|
|
483
|
+
const cache = await cacheStart;
|
|
484
|
+
// Before .env is read: a SUPATYPE_MAILER_AUTOCONFIRM an earlier CLI wrote there would otherwise
|
|
485
|
+
// win over the config as if the developer had set it (FF7).
|
|
486
|
+
retireCliMailerAutoconfirm(cwd);
|
|
384
487
|
// `.env` and `.env.local`, read once for everything the server's environment takes from them.
|
|
385
488
|
const dotEnv = readDotEnvFiles(cwd);
|
|
386
489
|
// What an env("NAME") in auth.providers resolves against: the shell over .env, as for the config.
|
|
@@ -393,7 +496,7 @@ export function registerDev(program) {
|
|
|
393
496
|
const serverEnv = {
|
|
394
497
|
...nativeServerCoreEnv({
|
|
395
498
|
mode: config.server.mode ?? "dev",
|
|
396
|
-
valkeyAddr:
|
|
499
|
+
valkeyAddr: cache.sidecar.addr,
|
|
397
500
|
projectRef: projectName,
|
|
398
501
|
manifestPath,
|
|
399
502
|
adminConfigPath,
|
|
@@ -444,15 +547,20 @@ export function registerDev(program) {
|
|
|
444
547
|
SUPATYPE_API_HOST: "localhost",
|
|
445
548
|
SUPATYPE_SITE_URL: `http://localhost:${serverPort}`,
|
|
446
549
|
// External URL, mailer provider, emailed-link paths and the send-email hook.
|
|
447
|
-
...nativeAuthMailerEnv(config.email, serverPort),
|
|
550
|
+
...nativeAuthMailerEnv(config.email, serverPort, providerEnvironment),
|
|
448
551
|
SUPATYPE_LOG_LEVEL: "info",
|
|
449
552
|
SUPATYPE_DISABLE_SIGNUP: "false",
|
|
450
|
-
...serverStorageEnv(nativeStorage, config
|
|
553
|
+
...serverStorageEnv(nativeStorage, config),
|
|
451
554
|
// .env last, so a SUPATYPE_EXTERNAL_* value there wins over auth.providers in the config.
|
|
452
555
|
...nativeAuthProviderEnv(config, `http://localhost:${serverPort}`, providerEnvironment),
|
|
556
|
+
// auth hooks, captcha, password, sessions, MFA, phone and rate limits. After the mailer, so
|
|
557
|
+
// auth.hooks.sendEmail wins over email.send_email_hook.
|
|
558
|
+
...nativeAuthGroupsEnv(config, providerEnvironment),
|
|
453
559
|
// auth.sso.saml, with the signing key from .env (generated there the first time SAML is on).
|
|
454
560
|
...nativeSamlEnv(cwd, config),
|
|
455
|
-
...nativeServerDotEnvLayer({ dotEnv, config,
|
|
561
|
+
...nativeServerDotEnvLayer({ dotEnv, config, denoPort, environment: providerEnvironment }),
|
|
562
|
+
// After .env, which can hold a keyspace password for a Docker phase of the project (N-RB2).
|
|
563
|
+
...nativeKeyspaceServerEnv(cache, providerEnvironment),
|
|
456
564
|
};
|
|
457
565
|
await haltIfStopping();
|
|
458
566
|
const serverProc = new ProcessManager(serverBin, [], {
|
|
@@ -460,6 +568,8 @@ export function registerDev(program) {
|
|
|
460
568
|
pidDir,
|
|
461
569
|
colour: "\x1b[32m",
|
|
462
570
|
env: serverEnv,
|
|
571
|
+
// Not the whole shell: an older server passes all it has on to the Deno that runs functions.
|
|
572
|
+
inheritEnv: nativeServerInheritsEnv,
|
|
463
573
|
});
|
|
464
574
|
serverProc.start();
|
|
465
575
|
pushStartUndo(() => serverProc.stop());
|
|
@@ -468,6 +578,7 @@ export function registerDev(program) {
|
|
|
468
578
|
await haltIfStopping();
|
|
469
579
|
const postgrestBin = await resolvePostgrestBin(config.overrides?.postgrest);
|
|
470
580
|
if (postgrestBin) {
|
|
581
|
+
await requirePostgrestPortFree(Number(postgrestPort));
|
|
471
582
|
// Windows PostgREST builds are dynamically linked and require libpq/OpenSSL
|
|
472
583
|
// DLLs from a Postgres bin directory, even when the database runs in Docker.
|
|
473
584
|
let postgrestRuntimeBinDir = pgBinDir;
|
|
@@ -544,11 +655,16 @@ export function registerDev(program) {
|
|
|
544
655
|
const appProc = startProxyDevApp(cwd, config, pidDir);
|
|
545
656
|
if (appProc)
|
|
546
657
|
pushStartUndo(() => appProc.stop());
|
|
658
|
+
// No built-in store stands in for a service that did not start (native-storage.ts), so the
|
|
659
|
+
// panel lists no storage URL and repeats that storage is off, in case the warning scrolled by.
|
|
660
|
+
// A project on S3 too: its panel listed Storage while a refused S3_BUCKET kept it off (R2-S2).
|
|
661
|
+
const storageOff = nativeStorage === null && startsStorageService(config, s3StorageEnv);
|
|
547
662
|
const links = [
|
|
548
663
|
{ label: "API", url: `http://localhost:${serverPort}` },
|
|
549
664
|
{ label: "REST", url: `http://localhost:${serverPort}/rest/v1/` },
|
|
550
665
|
{ label: "Auth", url: `http://localhost:${serverPort}/auth/v1/` },
|
|
551
|
-
{ label: "Storage", url: `http://localhost:${serverPort}/storage/v1/` },
|
|
666
|
+
...(storageOff ? [] : [{ label: "Storage", url: `http://localhost:${serverPort}/storage/v1/` }]),
|
|
667
|
+
...appPanelLinks(config, `http://localhost:${serverPort}`),
|
|
552
668
|
];
|
|
553
669
|
if (realtimeProc) {
|
|
554
670
|
links.push({ label: "Realtime", url: `ws://localhost:${serverPort}/realtime/v1/` });
|
|
@@ -557,16 +673,33 @@ export function registerDev(program) {
|
|
|
557
673
|
links.push({ label: "Studio", url: `http://localhost:${studioPort}` });
|
|
558
674
|
}
|
|
559
675
|
publishDevReady({
|
|
676
|
+
cwd,
|
|
560
677
|
title: "Services running",
|
|
561
678
|
links,
|
|
562
679
|
anonKey,
|
|
563
680
|
serviceRoleKey,
|
|
564
|
-
|
|
681
|
+
databaseUrl: dbURL,
|
|
682
|
+
hints: [
|
|
683
|
+
`JWT secret: #${secretFingerprint(LOCAL_JWT_SECRET)} (in .env)`,
|
|
684
|
+
...(storageOff ? ["Storage is off: the storage service did not start (the reason is above)"] : []),
|
|
685
|
+
],
|
|
565
686
|
});
|
|
566
687
|
// ── Shutdown handler ──────────────────────────────────────────────────
|
|
567
688
|
// Everything the start began is undone after it, the services together and then Postgres
|
|
568
|
-
// (pushStartUndo, pushStartUndoLast), so the shutdown has nothing of its own to stop.
|
|
569
|
-
|
|
689
|
+
// (pushStartUndo, pushStartUndoLast), so the shutdown has nothing of its own to stop. Its
|
|
690
|
+
// `cwd` clears the session record below when dev ends.
|
|
691
|
+
registerDevShutdown(async () => undefined, { cwd });
|
|
692
|
+
// The session's database port, for host commands run from another shell: they took that
|
|
693
|
+
// shell's SUPATYPE_DEV_DB_PORT, and a push applied its migration to another Postgres there
|
|
694
|
+
// (0.9.2 round 5, FF-7 on native). Written once ready, as Docker dev writes its own.
|
|
695
|
+
writeDevSessionLock(cwd, devSessionLockFor(config, {
|
|
696
|
+
provider: "native",
|
|
697
|
+
composeProject: composeProjectName(projectName),
|
|
698
|
+
composePath: selfHostComposePaths(cwd).composePath,
|
|
699
|
+
dbPort: pgPort,
|
|
700
|
+
runEnv: { [DEV_DB_PORT_ENV]: String(pgPort) },
|
|
701
|
+
...(cache.sidecar.containerName !== null && { valkeyContainer: cache.sidecar.containerName }),
|
|
702
|
+
}));
|
|
570
703
|
// ── 10. Schema watch ──────────────────────────────────────────────────
|
|
571
704
|
if (opts.watch) {
|
|
572
705
|
const schemaDir = resolve(cwd, schemaPath, "..");
|
|
@@ -717,6 +850,12 @@ export async function runSchemaPush(push) {
|
|
|
717
850
|
/** The schema on disk as native dev pushes it, saying which fields were stood in for by JSONB. */
|
|
718
851
|
async function readNativeSchema(cwd, schemaPath, config, skipFieldKinds) {
|
|
719
852
|
const built = await buildNativeAst(cwd, schemaPath, config, skipFieldKinds);
|
|
853
|
+
// The check `supatype push` makes: a pinned engine too old to read part of the schema drops it silently.
|
|
854
|
+
if (config) {
|
|
855
|
+
assertEngineSupportsSchema(built.ast, pinnedVersion("engine", config));
|
|
856
|
+
// Native dev runs the realtime it resolves, and one that predates channels enforces none (FF-34).
|
|
857
|
+
assertRealtimeSupportsSchema(built.ast, pinnedVersion("realtime", config));
|
|
858
|
+
}
|
|
720
859
|
if (built.adapted.length > 0) {
|
|
721
860
|
console.warn(`[supatype] ${built.adapted.length} field(s) replaced with JSONB, required extensions not available:\n` +
|
|
722
861
|
built.adapted.map((s) => ` ${s}`).join("\n"));
|
|
@@ -747,14 +886,26 @@ async function applyNativeSchema(cwd, schema, target) {
|
|
|
747
886
|
*/
|
|
748
887
|
async function writeNativeSchemaArtifacts(paths, ast, config) {
|
|
749
888
|
const { cwd, engineBin, astPath } = paths;
|
|
750
|
-
if (paths.storagePath)
|
|
889
|
+
if (paths.storagePath || paths.storageApi)
|
|
751
890
|
await provisionDeclaredBuckets(engineBin, cwd, astPath, paths);
|
|
752
891
|
if (paths.adminConfigPath)
|
|
753
892
|
await writeNativeAdminConfig(paths, paths.adminConfigPath, ast, config);
|
|
754
893
|
if (config)
|
|
755
|
-
writeNativeAppliedAst(cwd, config, ast);
|
|
894
|
+
await writeNativeAppliedAst(cwd, config, ast);
|
|
756
895
|
await writeNativeTypes(cwd, ast, config);
|
|
757
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* {@link nativeS3StorageEnv} from the shell over .env, as compose reads them. A blank S3_BUCKET ends
|
|
899
|
+
* dev here, before anything has started, saying what to set.
|
|
900
|
+
*/
|
|
901
|
+
function s3StorageEnvOrExit(cwd) {
|
|
902
|
+
try {
|
|
903
|
+
return nativeS3StorageEnv({ ...readDotEnvFiles(cwd), ...process.env });
|
|
904
|
+
}
|
|
905
|
+
catch (err) {
|
|
906
|
+
fatalError(errorMessage(err));
|
|
907
|
+
}
|
|
908
|
+
}
|
|
758
909
|
/** The storage buckets the schema declares, as the engine resolves them; none when it cannot say. */
|
|
759
910
|
async function declaredBuckets(engineBin, cwd, astPath) {
|
|
760
911
|
const parseResult = await runCaptured(engineBin, ["parse", "-i", astPath], { cwd });
|
|
@@ -769,24 +920,30 @@ async function declaredBuckets(engineBin, cwd, astPath) {
|
|
|
769
920
|
}
|
|
770
921
|
}
|
|
771
922
|
/**
|
|
772
|
-
* Create the storage buckets the schema declares: in buckets.json, which the
|
|
773
|
-
*
|
|
923
|
+
* Create the storage buckets the schema declares: in buckets.json, which the storage service
|
|
924
|
+
* imports when it starts, and in the service itself once it runs. A project on S3 has the service
|
|
925
|
+
* alone.
|
|
774
926
|
*/
|
|
775
927
|
async function provisionDeclaredBuckets(engineBin, cwd, astPath, paths) {
|
|
776
928
|
const buckets = await declaredBuckets(engineBin, cwd, astPath);
|
|
777
|
-
if (buckets.length === 0
|
|
929
|
+
if (buckets.length === 0)
|
|
778
930
|
return;
|
|
779
|
-
await provisionNativeBuckets(buckets,
|
|
931
|
+
await provisionNativeBuckets(buckets, paths);
|
|
780
932
|
}
|
|
781
933
|
/**
|
|
782
934
|
* `buckets` in buckets.json, and in the storage service while it runs, saying how many new ones
|
|
783
|
-
* are ready: a bucket the service did not take is not, though buckets.json has it.
|
|
935
|
+
* are ready: a bucket the service did not take is not, though buckets.json has it. A project on S3
|
|
936
|
+
* has no buckets.json, only the service, and is told which buckets it did not take. Exported for tests.
|
|
784
937
|
*/
|
|
785
938
|
export async function provisionNativeBuckets(buckets, paths) {
|
|
786
|
-
const added = provisionStorageBuckets(buckets, paths.storagePath);
|
|
939
|
+
const added = paths.storagePath === undefined ? null : provisionStorageBuckets(buckets, paths.storagePath);
|
|
787
940
|
const failed = paths.storageApi
|
|
788
941
|
? await provisionBuckets(paths.storageApi.url, paths.storageApi.serviceRoleKey, bucketSpecsFromAst({ storageBuckets: buckets }))
|
|
789
942
|
: [];
|
|
943
|
+
if (added === null) {
|
|
944
|
+
warnBucketsLeft(unprovisionedBuckets({ total: buckets.length, failed }));
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
790
947
|
const ready = added.filter((id) => !failed.includes(id)).length;
|
|
791
948
|
if (ready > 0)
|
|
792
949
|
console.log(`[supatype] Storage: provisioned ${ready} bucket(s).`);
|
|
@@ -850,6 +1007,14 @@ function provisionStorageBuckets(declared, storagePath) {
|
|
|
850
1007
|
// Resolve Postgres bin dir
|
|
851
1008
|
// ---------------------------------------------------------------------------
|
|
852
1009
|
export async function resolvePgBinDir(config) {
|
|
1010
|
+
return (await resolvePgInstall(config)).binDir;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Native Postgres's bin directory, and the version of the archive it came from: null for
|
|
1014
|
+
* `overrides.postgres_dir`, a local build whose version nothing records. The version is resolved
|
|
1015
|
+
* here once, since on a build that is not a release resolving it asks the CDN.
|
|
1016
|
+
*/
|
|
1017
|
+
async function resolvePgInstall(config) {
|
|
853
1018
|
const override = config.overrides?.postgres_dir;
|
|
854
1019
|
if (override) {
|
|
855
1020
|
// Normalize Git Bash (/c/Users/...) paths to Win32 form (C:\Users\...) on Windows.
|
|
@@ -860,7 +1025,7 @@ export async function resolvePgBinDir(config) {
|
|
|
860
1025
|
throw new Error(`[overrides] postgres_dir does not contain a bin/ directory: ${resolved}`);
|
|
861
1026
|
}
|
|
862
1027
|
console.warn(`\u26a0 Using local Postgres build: ${resolved}`);
|
|
863
|
-
return binDir;
|
|
1028
|
+
return { binDir, version: null };
|
|
864
1029
|
}
|
|
865
1030
|
// Locate cached Postgres archive.
|
|
866
1031
|
const { cachePath, currentPlatform, resolveVersionFor } = await import("../binary-cache.js");
|
|
@@ -873,15 +1038,16 @@ export async function resolvePgBinDir(config) {
|
|
|
873
1038
|
// Try to extract the cached archive.
|
|
874
1039
|
await extractPostgresArchive(pgCacheDir, version, platform, extractedDir);
|
|
875
1040
|
}
|
|
876
|
-
return join(extractedDir, "bin");
|
|
1041
|
+
return { binDir: join(extractedDir, "bin"), version };
|
|
877
1042
|
}
|
|
878
|
-
|
|
1043
|
+
/** Unpacks the cached Postgres archive for `version`, fetching it first when this machine has none. */
|
|
1044
|
+
export async function extractPostgresArchive(pgCacheDir, version, platform, extractDir) {
|
|
879
1045
|
const ext = platform.os === "windows" ? ".zip" : ".tar.gz";
|
|
880
1046
|
const archiveName = `supatype-pg-${postgresArchiveTag(version)}-${platform.os}-${platform.arch}${ext}`;
|
|
881
1047
|
const archivePath = join(pgCacheDir, archiveName);
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1048
|
+
// Fetched like the engine, server and PostgREST are: a first `dev` on a clean home needs no `update`.
|
|
1049
|
+
if (!existsSync(archivePath))
|
|
1050
|
+
await download("postgres", version, platform);
|
|
885
1051
|
extractArchive(archivePath, extractDir);
|
|
886
1052
|
}
|
|
887
1053
|
// ---------------------------------------------------------------------------
|
|
@@ -1058,15 +1224,29 @@ function runAuthMigrations(serverBin, migrateEnv) {
|
|
|
1058
1224
|
}
|
|
1059
1225
|
}
|
|
1060
1226
|
/**
|
|
1061
|
-
*
|
|
1062
|
-
* the sidecar container
|
|
1227
|
+
* Native dev's REST cache: the keyspace native Postgres serves, on loopback and requiring its
|
|
1228
|
+
* password, when it answers a client that logs in; else Valkey, the project's own sidecar container
|
|
1229
|
+
* or the one SUPATYPE_VALKEY_ADDR names (valkey-sidecar.ts, N-S28). Windows archives carry no
|
|
1230
|
+
* pg_keyspace, so Windows is always Valkey.
|
|
1063
1231
|
*/
|
|
1064
|
-
async function
|
|
1065
|
-
const
|
|
1066
|
-
if (keyspace === null)
|
|
1067
|
-
return ensureValkeySidecar(projectName);
|
|
1068
|
-
console.log(`[supatype] Keyspace served by Postgres (${
|
|
1069
|
-
return externalValkey(keyspace
|
|
1232
|
+
async function nativeCache(keyspace, projectName, cwd) {
|
|
1233
|
+
const addr = keyspace === null ? null : await nativeKeyspaceAddr(keyspace.port, keyspace.login);
|
|
1234
|
+
if (addr === null || keyspace === null)
|
|
1235
|
+
return { sidecar: await ensureValkeySidecar(projectName, cwd), login: null };
|
|
1236
|
+
console.log(`[supatype] Keyspace served by Postgres (${addr}, loopback only, password ${keyspacePasswordOrigin(cwd)}).`);
|
|
1237
|
+
return { sidecar: externalValkey(addr), login: keyspace.login };
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Stops this project's own Postgres, left running by a dev that did not stop cleanly, so this run
|
|
1241
|
+
* starts it with its own settings and stops it when it ends (FF12 remainder,
|
|
1242
|
+
* native-leftover-postgres.ts).
|
|
1243
|
+
*/
|
|
1244
|
+
function restartLeftoverPostgres(claim, pgOpts) {
|
|
1245
|
+
const pid = claim?.leftoverPostgres ?? null;
|
|
1246
|
+
if (pid === null)
|
|
1247
|
+
return;
|
|
1248
|
+
console.log(`[supatype] This project's Postgres (pid ${pid}) was still running from a dev that did not stop cleanly; restarting it.`);
|
|
1249
|
+
pgStop(pgOpts);
|
|
1070
1250
|
}
|
|
1071
1251
|
/**
|
|
1072
1252
|
* The project database: left as it is when psql can report its encoding (with a warning when an
|
|
@@ -1101,13 +1281,17 @@ function ensureProjectDatabase(db) {
|
|
|
1101
1281
|
* What push and Docker dev write from an applied AST (applied-ast-artifacts.ts), for native dev,
|
|
1102
1282
|
* which has no row-cache container. The manifest is made first when there is none: the hook maps
|
|
1103
1283
|
* only go into one that exists, and the first push runs before native dev records its functions,
|
|
1104
|
-
* which
|
|
1284
|
+
* which switches functions (`services.functions`) before the server reads it.
|
|
1105
1285
|
*/
|
|
1106
|
-
function writeNativeAppliedAst(cwd, config, ast) {
|
|
1286
|
+
export async function writeNativeAppliedAst(cwd, config, ast) {
|
|
1107
1287
|
const manifestPath = join(cwd, ".supatype", "manifest.json");
|
|
1108
1288
|
if (!existsSync(manifestPath))
|
|
1109
1289
|
patchRouteManifest(manifestPath, {});
|
|
1110
1290
|
for (const line of writeAppliedAstArtifacts(cwd, config, ast, { rowCacheEnv: false }).lines)
|
|
1111
1291
|
console.log(`[supatype] ${line}`);
|
|
1292
|
+
// The declaration is a ceiling and the allowlist is what is on: only a push seeded the allowlist, so
|
|
1293
|
+
// a declared `.cache({ server: true })` answered BYPASS under native dev (S-24).
|
|
1294
|
+
for (const note of await cacheSeedingNotes(cwd, ast))
|
|
1295
|
+
console.log(`[supatype] ${note}`);
|
|
1112
1296
|
}
|
|
1113
1297
|
//# sourceMappingURL=dev.js.map
|