@supatype/cli 0.7.0 → 0.9.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 +314 -0
- package/bin/supatype.js +40 -4
- package/deno.d.ts +1 -1
- package/dist/admin-prompt-state.d.ts +13 -0
- package/dist/admin-prompt-state.d.ts.map +1 -0
- package/dist/admin-prompt-state.js +30 -0
- package/dist/admin-prompt-state.js.map +1 -0
- package/dist/adopt-columns.d.ts.map +1 -1
- package/dist/adopt-columns.js +13 -17
- package/dist/adopt-columns.js.map +1 -1
- package/dist/after-hooks-health.d.ts +19 -0
- package/dist/after-hooks-health.d.ts.map +1 -0
- package/dist/after-hooks-health.js +69 -0
- package/dist/after-hooks-health.js.map +1 -0
- package/dist/app-config.d.ts +1 -1
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +103 -144
- package/dist/app-config.js.map +1 -1
- package/dist/app-vite-env.d.ts +5 -1
- package/dist/app-vite-env.d.ts.map +1 -1
- package/dist/app-vite-env.js +9 -15
- package/dist/app-vite-env.js.map +1 -1
- package/dist/applied-ast-artifacts.d.ts +16 -0
- package/dist/applied-ast-artifacts.d.ts.map +1 -0
- package/dist/applied-ast-artifacts.js +37 -0
- package/dist/applied-ast-artifacts.js.map +1 -0
- package/dist/archive-extract.d.ts +3 -0
- package/dist/archive-extract.d.ts.map +1 -0
- package/dist/archive-extract.js +19 -0
- package/dist/archive-extract.js.map +1 -0
- package/dist/augmentation-generator.d.ts +5 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +13 -4
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/binary-cache.d.ts +27 -3
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +117 -85
- package/dist/binary-cache.js.map +1 -1
- package/dist/binary-download-lock.d.ts.map +1 -1
- package/dist/binary-download-lock.js +1 -3
- package/dist/binary-download-lock.js.map +1 -1
- package/dist/byo-preflight.d.ts.map +1 -1
- package/dist/byo-preflight.js +2 -10
- package/dist/byo-preflight.js.map +1 -1
- package/dist/byte-size.d.ts +9 -0
- package/dist/byte-size.d.ts.map +1 -0
- package/dist/byte-size.js +36 -0
- package/dist/byte-size.js.map +1 -0
- package/dist/cache-clean.d.ts +0 -2
- package/dist/cache-clean.d.ts.map +1 -1
- package/dist/cache-clean.js +1 -27
- package/dist/cache-clean.js.map +1 -1
- package/dist/cache-pins.d.ts.map +1 -1
- package/dist/cache-pins.js +3 -20
- package/dist/cache-pins.js.map +1 -1
- package/dist/cache-root.d.ts +7 -0
- package/dist/cache-root.d.ts.map +1 -0
- package/dist/cache-root.js +11 -0
- package/dist/cache-root.js.map +1 -0
- package/dist/cli-artifacts.d.ts.map +1 -1
- package/dist/cli-artifacts.js +2 -1
- package/dist/cli-artifacts.js.map +1 -1
- package/dist/cli-install-method.d.ts.map +1 -1
- package/dist/cli-install-method.js +7 -1
- package/dist/cli-install-method.js.map +1 -1
- package/dist/cli-launcher.d.ts +21 -0
- package/dist/cli-launcher.d.ts.map +1 -0
- package/dist/cli-launcher.js +112 -0
- package/dist/cli-launcher.js.map +1 -0
- package/dist/cli-old-versions.d.ts +44 -0
- package/dist/cli-old-versions.d.ts.map +1 -0
- package/dist/cli-old-versions.js +83 -0
- package/dist/cli-old-versions.js.map +1 -0
- package/dist/cli-program-path.d.ts +20 -0
- package/dist/cli-program-path.d.ts.map +1 -0
- package/dist/cli-program-path.js +41 -0
- package/dist/cli-program-path.js.map +1 -0
- package/dist/cli-standalone.d.ts +2 -3
- package/dist/cli-standalone.d.ts.map +1 -1
- package/dist/cli-standalone.js +51 -24
- package/dist/cli-standalone.js.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cloud-credentials.d.ts +6 -0
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +13 -0
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +18 -18
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +27 -8
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +37 -11
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.js +2 -4
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +116 -106
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +3 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +50 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +276 -267
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +32 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +66 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts +30 -0
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +503 -507
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +11 -8
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/hooks.d.ts.map +1 -1
- package/dist/commands/hooks.js +46 -23
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +37 -4
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +509 -386
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts.map +1 -1
- package/dist/commands/internal.js +2 -1
- package/dist/commands/internal.js.map +1 -1
- package/dist/commands/keys.d.ts +46 -20
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +196 -156
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +30 -11
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +5 -4
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pg.js +2 -0
- package/dist/commands/pg.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +17 -7
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/push.d.ts +39 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +221 -77
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts +35 -0
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +72 -38
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +71 -42
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +9 -3
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/status.js +5 -5
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/types.js +2 -5
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +212 -101
- package/dist/commands/update.js.map +1 -1
- package/dist/component-launch.d.ts +11 -0
- package/dist/component-launch.d.ts.map +1 -0
- package/dist/component-launch.js +35 -0
- package/dist/component-launch.js.map +1 -0
- package/dist/components.d.ts +7 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +7 -2
- package/dist/components.js.map +1 -1
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +5 -14
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-engine-run.d.ts +6 -5
- package/dist/compose-engine-run.d.ts.map +1 -1
- package/dist/compose-engine-run.js +44 -37
- package/dist/compose-engine-run.js.map +1 -1
- package/dist/compose-engine-service.d.ts +10 -0
- package/dist/compose-engine-service.d.ts.map +1 -0
- package/dist/compose-engine-service.js +16 -0
- package/dist/compose-engine-service.js.map +1 -0
- package/dist/compose-host-path.d.ts +14 -0
- package/dist/compose-host-path.d.ts.map +1 -0
- package/dist/compose-host-path.js +18 -0
- package/dist/compose-host-path.js.map +1 -0
- package/dist/compose-image-pull.d.ts +43 -0
- package/dist/compose-image-pull.d.ts.map +1 -0
- package/dist/compose-image-pull.js +27 -0
- package/dist/compose-image-pull.js.map +1 -0
- package/dist/compose-kong.d.ts +4 -0
- package/dist/compose-kong.d.ts.map +1 -1
- package/dist/compose-kong.js +23 -9
- package/dist/compose-kong.js.map +1 -1
- package/dist/compose-local-server-image.d.ts.map +1 -1
- package/dist/compose-local-server-image.js +7 -3
- package/dist/compose-local-server-image.js.map +1 -1
- package/dist/compose-render-mode.d.ts.map +1 -1
- package/dist/compose-render-mode.js +7 -4
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts +12 -2
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +27 -12
- package/dist/compose-services.js.map +1 -1
- package/dist/config-snapshot.d.ts +6 -0
- package/dist/config-snapshot.d.ts.map +1 -0
- package/dist/config-snapshot.js +23 -0
- package/dist/config-snapshot.js.map +1 -0
- package/dist/config.d.ts +11 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -3
- package/dist/config.js.map +1 -1
- package/dist/database-url-owner.d.ts +59 -0
- package/dist/database-url-owner.d.ts.map +1 -0
- package/dist/database-url-owner.js +133 -0
- package/dist/database-url-owner.js.map +1 -0
- package/dist/db-port-offer.d.ts +18 -0
- package/dist/db-port-offer.d.ts.map +1 -0
- package/dist/db-port-offer.js +68 -0
- package/dist/db-port-offer.js.map +1 -0
- package/dist/db-port.d.ts +42 -18
- package/dist/db-port.d.ts.map +1 -1
- package/dist/db-port.js +34 -32
- package/dist/db-port.js.map +1 -1
- package/dist/db-preflight.d.ts +37 -0
- package/dist/db-preflight.d.ts.map +1 -1
- package/dist/db-preflight.js +219 -77
- package/dist/db-preflight.js.map +1 -1
- package/dist/db-rows.d.ts +11 -0
- package/dist/db-rows.d.ts.map +1 -1
- package/dist/db-rows.js +27 -0
- package/dist/db-rows.js.map +1 -1
- package/dist/debounce.d.ts +11 -0
- package/dist/debounce.d.ts.map +1 -0
- package/dist/debounce.js +23 -0
- package/dist/debounce.js.map +1 -0
- package/dist/dev-api-keys.d.ts +12 -2
- package/dist/dev-api-keys.d.ts.map +1 -1
- package/dist/dev-api-keys.js +33 -17
- package/dist/dev-api-keys.js.map +1 -1
- package/dist/dev-compose.d.ts +10 -12
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +252 -288
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-db-ready.d.ts.map +1 -1
- package/dist/dev-db-ready.js +2 -1
- package/dist/dev-db-ready.js.map +1 -1
- package/dist/dev-db-reset.d.ts.map +1 -1
- package/dist/dev-db-reset.js +5 -4
- package/dist/dev-db-reset.js.map +1 -1
- package/dist/dev-functions-watch.d.ts.map +1 -1
- package/dist/dev-functions-watch.js +5 -16
- package/dist/dev-functions-watch.js.map +1 -1
- package/dist/dev-log-bus.d.ts +8 -0
- package/dist/dev-log-bus.d.ts.map +1 -1
- package/dist/dev-log-bus.js +13 -0
- package/dist/dev-log-bus.js.map +1 -1
- package/dist/dev-ports.d.ts +27 -7
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +68 -41
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +7 -12
- package/dist/dev-schema-watch.js.map +1 -1
- package/dist/dev-session-lock.js +4 -3
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +15 -0
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +27 -1
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +45 -0
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +221 -33
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-output.d.ts +7 -1
- package/dist/diff-output.d.ts.map +1 -1
- package/dist/diff-output.js +91 -2
- package/dist/diff-output.js.map +1 -1
- package/dist/docker-address-pool.d.ts +23 -0
- package/dist/docker-address-pool.d.ts.map +1 -0
- package/dist/docker-address-pool.js +56 -0
- package/dist/docker-address-pool.js.map +1 -0
- package/dist/docker-exec.d.ts +92 -0
- package/dist/docker-exec.d.ts.map +1 -0
- package/dist/docker-exec.js +139 -0
- package/dist/docker-exec.js.map +1 -0
- package/dist/docker-postgres.d.ts +1 -6
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +67 -85
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +14 -1
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +55 -24
- package/dist/docker-runtime.js.map +1 -1
- package/dist/dotenv-parse.d.ts +22 -0
- package/dist/dotenv-parse.d.ts.map +1 -0
- package/dist/dotenv-parse.js +63 -0
- package/dist/dotenv-parse.js.map +1 -0
- package/dist/engine-answers.d.ts +0 -2
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +4 -3
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +13 -12
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-floor.d.ts +29 -0
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +56 -0
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-ownership-gate.d.ts +13 -1
- package/dist/engine-ownership-gate.d.ts.map +1 -1
- package/dist/engine-ownership-gate.js +36 -6
- package/dist/engine-ownership-gate.js.map +1 -1
- package/dist/ensure-binary.d.ts +9 -0
- package/dist/ensure-binary.d.ts.map +1 -1
- package/dist/ensure-binary.js +38 -5
- package/dist/ensure-binary.js.map +1 -1
- package/dist/ensure-component-binaries.d.ts.map +1 -1
- package/dist/ensure-component-binaries.js +2 -1
- package/dist/ensure-component-binaries.js.map +1 -1
- package/dist/env-file.d.ts +30 -8
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +84 -57
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +11 -0
- package/dist/env-lines.d.ts.map +1 -0
- package/dist/env-lines.js +36 -0
- package/dist/env-lines.js.map +1 -0
- package/dist/error-message.d.ts +34 -1
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +102 -2
- package/dist/error-message.js.map +1 -1
- package/dist/fetch-within.d.ts +10 -0
- package/dist/fetch-within.d.ts.map +1 -0
- package/dist/fetch-within.js +12 -0
- package/dist/fetch-within.js.map +1 -0
- package/dist/field-masking-tier.d.ts.map +1 -1
- package/dist/field-masking-tier.js +7 -5
- package/dist/field-masking-tier.js.map +1 -1
- package/dist/frontend-env.d.ts +43 -0
- package/dist/frontend-env.d.ts.map +1 -0
- package/dist/frontend-env.js +81 -0
- package/dist/frontend-env.js.map +1 -0
- package/dist/functions-context-refresh.d.ts +6 -2
- package/dist/functions-context-refresh.d.ts.map +1 -1
- package/dist/functions-context-refresh.js +11 -3
- package/dist/functions-context-refresh.js.map +1 -1
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +9 -2
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/{functions-router-gen.d.ts → functions-discovery.d.ts} +8 -10
- package/dist/functions-discovery.d.ts.map +1 -0
- package/dist/functions-discovery.js +87 -0
- package/dist/functions-discovery.js.map +1 -0
- package/dist/functions-template.d.ts.map +1 -1
- package/dist/functions-template.js +20 -12
- package/dist/functions-template.js.map +1 -1
- package/dist/functions-worker-files.d.ts +55 -0
- package/dist/functions-worker-files.d.ts.map +1 -0
- package/dist/functions-worker-files.js +149 -0
- package/dist/functions-worker-files.js.map +1 -0
- package/dist/generated/functions-worker-source.d.ts +2 -0
- package/dist/generated/functions-worker-source.d.ts.map +1 -0
- package/dist/generated/functions-worker-source.js +12 -0
- package/dist/generated/functions-worker-source.js.map +1 -0
- package/dist/generated/release-images.d.ts +18 -0
- package/dist/generated/release-images.d.ts.map +1 -0
- package/dist/generated/release-images.js +8 -0
- package/dist/generated/release-images.js.map +1 -0
- package/dist/generated-files-engine.d.ts +33 -0
- package/dist/generated-files-engine.d.ts.map +1 -0
- package/dist/generated-files-engine.js +45 -0
- package/dist/generated-files-engine.js.map +1 -0
- package/dist/hook-actor.d.ts +17 -0
- package/dist/hook-actor.d.ts.map +1 -0
- package/dist/hook-actor.js +37 -0
- package/dist/hook-actor.js.map +1 -0
- package/dist/hook-columns.d.ts +30 -0
- package/dist/hook-columns.d.ts.map +1 -0
- package/dist/hook-columns.js +77 -0
- package/dist/hook-columns.js.map +1 -0
- package/dist/hook-events.d.ts +11 -0
- package/dist/hook-events.d.ts.map +1 -0
- package/dist/hook-events.js +11 -0
- package/dist/hook-events.js.map +1 -0
- package/dist/hook-upload.d.ts +29 -15
- package/dist/hook-upload.d.ts.map +1 -1
- package/dist/hook-upload.js +88 -59
- package/dist/hook-upload.js.map +1 -1
- package/dist/hooks-generator.d.ts +5 -0
- package/dist/hooks-generator.d.ts.map +1 -1
- package/dist/hooks-generator.js +92 -21
- package/dist/hooks-generator.js.map +1 -1
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +31 -4
- package/dist/host-database.js.map +1 -1
- package/dist/init-dependency-versions.d.ts +3 -1
- package/dist/init-dependency-versions.d.ts.map +1 -1
- package/dist/init-dependency-versions.js +32 -6
- package/dist/init-dependency-versions.js.map +1 -1
- package/dist/init-example.d.ts +48 -0
- package/dist/init-example.d.ts.map +1 -0
- package/dist/init-example.js +110 -0
- package/dist/init-example.js.map +1 -0
- package/dist/init-package-json.d.ts +38 -1
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +150 -37
- package/dist/init-package-json.js.map +1 -1
- package/dist/init-setup-steps.d.ts +37 -0
- package/dist/init-setup-steps.d.ts.map +1 -0
- package/dist/init-setup-steps.js +118 -0
- package/dist/init-setup-steps.js.map +1 -0
- package/dist/jwt-secret-length.d.ts +5 -13
- package/dist/jwt-secret-length.d.ts.map +1 -1
- package/dist/jwt-secret-length.js +7 -22
- package/dist/jwt-secret-length.js.map +1 -1
- package/dist/jwt-secret-rules.d.ts +24 -0
- package/dist/jwt-secret-rules.d.ts.map +1 -0
- package/dist/jwt-secret-rules.js +46 -0
- package/dist/jwt-secret-rules.js.map +1 -0
- package/dist/local-gateway.d.ts +3 -6
- package/dist/local-gateway.d.ts.map +1 -1
- package/dist/local-gateway.js +7 -9
- package/dist/local-gateway.js.map +1 -1
- package/dist/local-secrets.d.ts +95 -11
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +153 -18
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +2 -7
- package/dist/local-stack.js.map +1 -1
- package/dist/local-storage.d.ts +7 -2
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/local-storage.js +11 -3
- package/dist/local-storage.js.map +1 -1
- package/dist/mailer-env.d.ts +37 -0
- package/dist/mailer-env.d.ts.map +1 -0
- package/dist/mailer-env.js +98 -0
- package/dist/mailer-env.js.map +1 -0
- package/dist/model-cache.d.ts +4 -8
- package/dist/model-cache.d.ts.map +1 -1
- package/dist/model-cache.js.map +1 -1
- package/dist/model-hooks.d.ts +21 -7
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +62 -39
- package/dist/model-hooks.js.map +1 -1
- package/dist/native-dev-env.d.ts +37 -1
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +64 -2
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-functions-watch.d.ts +56 -5
- package/dist/native-functions-watch.d.ts.map +1 -1
- package/dist/native-functions-watch.js +119 -38
- package/dist/native-functions-watch.js.map +1 -1
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +2 -2
- package/dist/native-keyspace.js.map +1 -1
- package/dist/native-realtime.d.ts +11 -3
- package/dist/native-realtime.d.ts.map +1 -1
- package/dist/native-realtime.js +162 -10
- package/dist/native-realtime.js.map +1 -1
- package/dist/native-roles-sql.d.ts +14 -0
- package/dist/native-roles-sql.d.ts.map +1 -1
- package/dist/native-roles-sql.js +82 -1
- package/dist/native-roles-sql.js.map +1 -1
- package/dist/native-storage-import.d.ts +19 -0
- package/dist/native-storage-import.d.ts.map +1 -0
- package/dist/native-storage-import.js +327 -0
- package/dist/native-storage-import.js.map +1 -0
- package/dist/native-storage.d.ts +45 -0
- package/dist/native-storage.d.ts.map +1 -0
- package/dist/native-storage.js +140 -0
- package/dist/native-storage.js.map +1 -0
- package/dist/native-worker.d.ts +26 -0
- package/dist/native-worker.d.ts.map +1 -0
- package/dist/native-worker.js +63 -0
- package/dist/native-worker.js.map +1 -0
- package/dist/owner-default.d.ts +9 -1
- package/dist/owner-default.d.ts.map +1 -1
- package/dist/owner-default.js +17 -4
- package/dist/owner-default.js.map +1 -1
- package/dist/post-apply.d.ts +3 -0
- package/dist/post-apply.d.ts.map +1 -0
- package/dist/post-apply.js +17 -0
- package/dist/post-apply.js.map +1 -0
- package/dist/postgres-ctl.d.ts +98 -7
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +273 -40
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +15 -3
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +18 -15
- package/dist/postgres-image.js.map +1 -1
- package/dist/postgrest-release.d.ts +9 -0
- package/dist/postgrest-release.d.ts.map +1 -1
- package/dist/postgrest-release.js +23 -0
- package/dist/postgrest-release.js.map +1 -1
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +3 -1
- package/dist/process-manager.js.map +1 -1
- package/dist/project-config.d.ts +44 -7
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +48 -4
- package/dist/project-config.js.map +1 -1
- package/dist/pull-utils.d.ts +15 -0
- package/dist/pull-utils.d.ts.map +1 -1
- package/dist/pull-utils.js +149 -23
- package/dist/pull-utils.js.map +1 -1
- package/dist/push-refusal.d.ts.map +1 -1
- package/dist/push-refusal.js +3 -2
- package/dist/push-refusal.js.map +1 -1
- package/dist/realtime-launch.d.ts +2 -5
- package/dist/realtime-launch.d.ts.map +1 -1
- package/dist/realtime-launch.js +6 -23
- package/dist/realtime-launch.js.map +1 -1
- package/dist/recorded-field-masking-tier.d.ts.map +1 -1
- package/dist/recorded-field-masking-tier.js +4 -3
- package/dist/recorded-field-masking-tier.js.map +1 -1
- package/dist/release-images.d.ts +31 -0
- package/dist/release-images.d.ts.map +1 -0
- package/dist/release-images.js +90 -0
- package/dist/release-images.js.map +1 -0
- package/dist/required-host-components.d.ts.map +1 -1
- package/dist/required-host-components.js +4 -0
- package/dist/required-host-components.js.map +1 -1
- package/dist/resolve-api-url.d.ts +17 -3
- package/dist/resolve-api-url.d.ts.map +1 -1
- package/dist/resolve-api-url.js +71 -30
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +64 -0
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +75 -27
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-ready.d.ts.map +1 -1
- package/dist/rest-ready.js +2 -1
- package/dist/rest-ready.js.map +1 -1
- package/dist/route-manifest.d.ts +25 -2
- package/dist/route-manifest.d.ts.map +1 -1
- package/dist/route-manifest.js +48 -4
- package/dist/route-manifest.js.map +1 -1
- package/dist/run-until-stopped.d.ts +12 -0
- package/dist/run-until-stopped.d.ts.map +1 -0
- package/dist/run-until-stopped.js +42 -0
- package/dist/run-until-stopped.js.map +1 -0
- package/dist/schema-ast-v2.d.ts +2 -1
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-push-lock.d.ts.map +1 -1
- package/dist/schema-push-lock.js +59 -46
- package/dist/schema-push-lock.js.map +1 -1
- package/dist/schema-sources.d.ts +19 -4
- package/dist/schema-sources.d.ts.map +1 -1
- package/dist/schema-sources.js +56 -35
- package/dist/schema-sources.js.map +1 -1
- package/dist/seed-auth-connect.d.ts +14 -0
- package/dist/seed-auth-connect.d.ts.map +1 -0
- package/dist/seed-auth-connect.js +97 -0
- package/dist/seed-auth-connect.js.map +1 -0
- package/dist/seed-runner.d.ts.map +1 -1
- package/dist/seed-runner.js +22 -1
- package/dist/seed-runner.js.map +1 -1
- package/dist/seed.d.ts +6 -3
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +44 -29
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +311 -159
- package/dist/self-host-compose.js.map +1 -1
- package/dist/service-role-key-file.d.ts +32 -0
- package/dist/service-role-key-file.d.ts.map +1 -0
- package/dist/service-role-key-file.js +90 -0
- package/dist/service-role-key-file.js.map +1 -0
- package/dist/shell-ports.d.ts +13 -2
- package/dist/shell-ports.d.ts.map +1 -1
- package/dist/shell-ports.js +20 -15
- package/dist/shell-ports.js.map +1 -1
- package/dist/stop-signals.d.ts +7 -0
- package/dist/stop-signals.d.ts.map +1 -0
- package/dist/stop-signals.js +12 -0
- package/dist/stop-signals.js.map +1 -0
- package/dist/storage-launch.d.ts +11 -0
- package/dist/storage-launch.d.ts.map +1 -0
- package/dist/storage-launch.js +41 -0
- package/dist/storage-launch.js.map +1 -0
- package/dist/storage-provision.d.ts +50 -5
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +101 -33
- package/dist/storage-provision.js.map +1 -1
- package/dist/systemd.d.ts +1 -1
- package/dist/systemd.d.ts.map +1 -1
- package/dist/systemd.js +26 -11
- package/dist/systemd.js.map +1 -1
- package/dist/tar-reader.d.ts +29 -0
- package/dist/tar-reader.d.ts.map +1 -0
- package/dist/tar-reader.js +99 -0
- package/dist/tar-reader.js.map +1 -0
- package/dist/target-client.d.ts +14 -1
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +134 -23
- package/dist/target-client.js.map +1 -1
- package/dist/target-request.d.ts +25 -0
- package/dist/target-request.d.ts.map +1 -0
- package/dist/target-request.js +33 -0
- package/dist/target-request.js.map +1 -0
- package/dist/target-warning.d.ts +7 -0
- package/dist/target-warning.d.ts.map +1 -0
- package/dist/target-warning.js +12 -0
- package/dist/target-warning.js.map +1 -0
- package/dist/tsx-runner.d.ts.map +1 -1
- package/dist/tsx-runner.js +2 -1
- package/dist/tsx-runner.js.map +1 -1
- package/dist/type-extractor.d.ts +6 -0
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +138 -70
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/clack.d.ts.map +1 -1
- package/dist/ui/clack.js +11 -1
- package/dist/ui/clack.js.map +1 -1
- package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
- package/dist/ui/dev/DevDashboard.js +13 -5
- package/dist/ui/dev/DevDashboard.js.map +1 -1
- package/dist/ui/fatal.d.ts.map +1 -1
- package/dist/ui/fatal.js +6 -7
- package/dist/ui/fatal.js.map +1 -1
- package/dist/ui/flows/FlowApp.d.ts.map +1 -1
- package/dist/ui/flows/FlowApp.js +16 -1
- package/dist/ui/flows/FlowApp.js.map +1 -1
- package/dist/ui/flows/prompt-fields.d.ts +16 -6
- package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
- package/dist/ui/flows/prompt-fields.js +19 -9
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/messages.d.ts +6 -0
- package/dist/ui/messages.d.ts.map +1 -1
- package/dist/ui/messages.js +17 -0
- package/dist/ui/messages.js.map +1 -1
- package/dist/ui/progress.d.ts +7 -0
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +22 -8
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
- package/dist/ui/runtime/command-chrome.js +2 -0
- package/dist/ui/runtime/command-chrome.js.map +1 -1
- package/dist/ui/runtime/prompt-interrupt.d.ts +10 -0
- package/dist/ui/runtime/prompt-interrupt.d.ts.map +1 -0
- package/dist/ui/runtime/prompt-interrupt.js +24 -0
- package/dist/ui/runtime/prompt-interrupt.js.map +1 -0
- package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +5 -2
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts +14 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.js +44 -3
- package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
- package/dist/url-safe-passwords.d.ts +25 -0
- package/dist/url-safe-passwords.d.ts.map +1 -0
- package/dist/url-safe-passwords.js +70 -0
- package/dist/url-safe-passwords.js.map +1 -0
- package/dist/valkey-sidecar.d.ts +33 -6
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +90 -61
- package/dist/valkey-sidecar.js.map +1 -1
- package/dist/worker-module-files.d.ts +3 -0
- package/dist/worker-module-files.d.ts.map +1 -0
- package/dist/worker-module-files.js +18 -0
- package/dist/worker-module-files.js.map +1 -0
- package/package.json +22 -16
- package/dist/functions-router-gen.d.ts.map +0 -1
- package/dist/functions-router-gen.js +0 -302
- package/dist/functions-router-gen.js.map +0 -1
package/dist/commands/dev.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* supatype dev: start local Postgres, apply schema, run supatype-server.
|
|
3
3
|
*
|
|
4
4
|
* Runtime provider (top-level `provider` or legacy `database.provider`):
|
|
5
|
-
* docker: full self-host Compose stack (Kong
|
|
5
|
+
* docker: full self-host Compose stack (Kong on SUPATYPE_KONG_PORT); see dev-compose.ts (default)
|
|
6
6
|
* native: host Postgres + host server + host engine
|
|
7
7
|
*
|
|
8
8
|
* Edge functions (when a functions/ dir exists): Deno is resolved from the CDN cache
|
|
@@ -14,94 +14,88 @@ 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 { existsSync, mkdirSync,
|
|
18
|
-
import { join,
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
17
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
18
|
+
import { join, resolve } from "node:path";
|
|
19
|
+
import { hasEnvValue, readDotEnvFiles } from "../env-file.js";
|
|
20
|
+
import { requireUrlSafeComposePasswords } from "../url-safe-passwords.js";
|
|
21
|
+
import { loadConfig, PROJECT_CONFIG_FILES } from "../config.js";
|
|
22
|
+
import { bucketSpecsFromAst, isParsedBuckets, nativeBucketRow, provisionBuckets, withPublicFromMode, } from "../storage-provision.js";
|
|
21
23
|
import { readJsonFile } from "../json-file.js";
|
|
22
24
|
import { isArrayOf, isJsonObject } from "@supatype/shared";
|
|
23
|
-
import { pgSchema,
|
|
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";
|
|
24
26
|
import { DEV_DB_PORT_ENV } from "../db-port.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
+
import { devServiceRoleRoutesPath, functionsWorkerEnv, writeServiceRoleRoutesFile } from "../functions-worker-files.js";
|
|
28
|
+
import { devServiceRoleKeyPath } from "../service-role-key-file.js";
|
|
27
29
|
import { requireUsableJwtSecret } from "../jwt-secret-length.js";
|
|
28
|
-
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, secretFingerprint, } from "../local-secrets.js";
|
|
30
|
+
import { ensureNativeAuthenticatorPassword, devJwtSecret, ensureNativeSuperuserPassword, givenJwtSecret, ignoredJwtSecretWarning, secretFingerprint, } from "../local-secrets.js";
|
|
29
31
|
import { normalisePlatformPath, cachePath, currentPlatform, hasMeaningfulOverrides, describeActiveOverrides, postgresArchiveTag, } from "../binary-cache.js";
|
|
30
32
|
import { ensureBinary } from "../ensure-binary.js";
|
|
31
33
|
import { assertSupported, binaryCapabilities, EngineProbeFailed, OVERWRITE_DRIFT_NEED, OwnershipUnsupportedError, requireEngineFeatures, } from "../engine-ownership-gate.js";
|
|
32
34
|
import { startProxyDevApp } from "../app/proxy-dev-app.js";
|
|
33
35
|
import { ProcessManager } from "../process-manager.js";
|
|
34
|
-
import { POSTGREST_VERSION, postgrestArchiveName, postgrestArchiveUrl } from "../postgrest-release.js";
|
|
36
|
+
import { markPostgrestUnpacked, POSTGREST_VERSION, postgrestArchiveName, postgrestArchiveUrl, postgrestRuntimeRepairDue, } from "../postgrest-release.js";
|
|
35
37
|
import { STUDIO_DEV_PORT, startStudioViteDevServer } from "../studio-dev-server.js";
|
|
38
|
+
import { postgrestHookActorEnv } from "../hook-actor.js";
|
|
36
39
|
import { restoreSystemRelationTargets } from "../restore-system-relation-targets.js";
|
|
37
|
-
import {
|
|
38
|
-
import { beginDevSession, resolveDevUiMode } from "../dev-session.js";
|
|
40
|
+
import { beginDevSession, resolveDevUiMode, showDevStep } from "../dev-session.js";
|
|
39
41
|
import { publishDevReady } from "../dev-ready-panel.js";
|
|
40
42
|
import { probeDockerDaemon, reportDockerUnavailable } from "../docker-runtime.js";
|
|
41
43
|
import { fatalError } from "../ui/fatal.js";
|
|
42
|
-
import { registerDevShutdown, waitForDevShutdown } from "../dev-shutdown.js";
|
|
44
|
+
import { haltIfStopping, pushStartUndo, pushStartUndoLast, registerDevShutdown, reportUnlessStopping, stopQuietlyDuringStart, waitForDevShutdown, } from "../dev-shutdown.js";
|
|
43
45
|
import { startNativeRealtime } from "../native-realtime.js";
|
|
46
|
+
import { nativeWorkerDenoEnv, prepareNativeWorker } from "../native-worker.js";
|
|
47
|
+
import { configSnapshot } from "../config-snapshot.js";
|
|
48
|
+
import { patchRouteManifest, recordNativeRoutes } from "../route-manifest.js";
|
|
49
|
+
import { reconcileNativeDevDatabaseUrl } from "../db-port-offer.js";
|
|
50
|
+
import { extractArchive } from "../archive-extract.js";
|
|
51
|
+
import { serverStorageEnv, startNativeStorage } from "../native-storage.js";
|
|
52
|
+
import { keepsObjectsLocally, serverStoreRoot } from "../local-storage.js";
|
|
53
|
+
import { writeAppliedAstArtifacts } from "../applied-ast-artifacts.js";
|
|
44
54
|
import { writeAppViteEnv } from "../app-vite-env.js";
|
|
45
55
|
import { nativeAuthProviderEnv, warnMissingAuthProviderSecrets } from "../auth-providers.js";
|
|
46
|
-
import { nativeMailerAutoconfirmEnv } from "../mailer-autoconfirm.js";
|
|
47
56
|
import { AUTHENTICATOR_PASSWORD_ENV } from "../native-roles-sql.js";
|
|
48
|
-
import { nativeDevRolesSql, nativePostgrestSchemaEnv, nativeServerCoreEnv } from "../native-dev-env.js";
|
|
49
|
-
import { ensureValkeySidecar,
|
|
57
|
+
import { nativeAuthMailerEnv, nativeDevApiKeys, nativeDevRolesSql, nativePostgrestSchemaEnv, nativeServerCoreEnv, nativeServerDotEnvLayer, } from "../native-dev-env.js";
|
|
58
|
+
import { ensureValkeySidecar, externalValkey } from "../valkey-sidecar.js";
|
|
50
59
|
import { nativeKeyspaceAddr as nativeKeyspaceAddrFor, nativeKeyspacePort } from "../native-keyspace.js";
|
|
51
|
-
import {
|
|
60
|
+
import { ensureCluster, createdbArgs, databaseEncoding, nonUtf8DatabaseWarning, pgBuild, start as pgStart, stop as pgStop, waitReady as pgWaitReady, isPortInUse, } from "../postgres-ctl.js";
|
|
52
61
|
import { isPasswordRejected, pgClientEnv, requirePasswordAuth, requireSuperuserPassword, superuserPasswordMissingMessage, } from "../native-pg-auth.js";
|
|
53
|
-
/** Map `email.smtp` from supatype.config.ts into SUPATYPE_SMTP_* for the embedded auth service. */
|
|
54
|
-
function authSMTPFromEmailConfig(email) {
|
|
55
|
-
const s = email?.smtp;
|
|
56
|
-
if (!s)
|
|
57
|
-
return {};
|
|
58
|
-
const out = {};
|
|
59
|
-
const host = s.host?.trim();
|
|
60
|
-
if (host)
|
|
61
|
-
out.SUPATYPE_SMTP_HOST = host;
|
|
62
|
-
if (s.port !== undefined)
|
|
63
|
-
out.SUPATYPE_SMTP_PORT = String(s.port);
|
|
64
|
-
const user = s.user?.trim();
|
|
65
|
-
if (user)
|
|
66
|
-
out.SUPATYPE_SMTP_USER = user;
|
|
67
|
-
if (s.pass !== undefined && s.pass !== "")
|
|
68
|
-
out.SUPATYPE_SMTP_PASS = s.pass;
|
|
69
|
-
const admin = s.admin_email?.trim();
|
|
70
|
-
if (admin)
|
|
71
|
-
out.SUPATYPE_SMTP_ADMIN_EMAIL = admin;
|
|
72
|
-
const sender = s.sender_name?.trim();
|
|
73
|
-
if (sender)
|
|
74
|
-
out.SUPATYPE_SMTP_SENDER_NAME = sender;
|
|
75
|
-
return out;
|
|
76
|
-
}
|
|
77
62
|
function portCheckCommand(port) {
|
|
78
63
|
return process.platform === "win32"
|
|
79
64
|
? `netstat -ano | findstr :${port}`
|
|
80
65
|
: `lsof -i :${port}`;
|
|
81
66
|
}
|
|
82
|
-
const NATIVE_SERVICES = ["postgres", "server", "postgrest", "realtime"];
|
|
83
|
-
const NATIVE_PORT_HINTS = {
|
|
67
|
+
const NATIVE_SERVICES = ["postgres", "server", "postgrest", "realtime", "deno", "storage"];
|
|
68
|
+
export const NATIVE_PORT_HINTS = {
|
|
84
69
|
postgres: {
|
|
85
70
|
holder: "Another Postgres instance may be running.",
|
|
86
|
-
move: `Move this project's with ${DEV_DB_PORT_ENV} in .env, or database.port in supatype.config.ts.`,
|
|
71
|
+
move: `Move this project's database port with ${DEV_DB_PORT_ENV} in .env, or database.port in supatype.config.ts.`,
|
|
87
72
|
},
|
|
88
73
|
server: {
|
|
89
74
|
holder: "Another supatype-server may be running.",
|
|
90
|
-
move: "Move this project's with server.port in supatype.config.ts, or `supatype dev --port`.",
|
|
75
|
+
move: "Move this project's API server port with server.port in supatype.config.ts, or `supatype dev --port`.",
|
|
91
76
|
},
|
|
92
77
|
postgrest: {
|
|
93
78
|
holder: "Another service may be running.",
|
|
94
|
-
move: "Move this project's with server.postgrestPort in supatype.config.ts.",
|
|
79
|
+
move: "Move this project's PostgREST port with server.postgrestPort in supatype.config.ts.",
|
|
95
80
|
},
|
|
96
81
|
realtime: {
|
|
97
82
|
holder: "Another realtime service, or any app on this port, may be running.",
|
|
98
|
-
move: `Move this project's with ${REALTIME_PORT_ENV} in .env, or server.realtimePort in supatype.config.ts.`,
|
|
83
|
+
move: `Move this project's realtime port with ${REALTIME_PORT_ENV} in .env, or server.realtimePort in supatype.config.ts.`,
|
|
84
|
+
},
|
|
85
|
+
deno: {
|
|
86
|
+
holder: "Another Deno process, or any app on this port, may be running.",
|
|
87
|
+
move: `Move this project's functions port with ${DENO_PORT_ENV} in .env.`,
|
|
88
|
+
},
|
|
89
|
+
storage: {
|
|
90
|
+
holder: "Another storage service, or any app on this port, may be running.",
|
|
91
|
+
move: `Move this project's storage port with ${STORAGE_PORT_ENV} in .env.`,
|
|
99
92
|
},
|
|
100
93
|
};
|
|
101
|
-
|
|
94
|
+
/** Stop before anything starts when a port native dev binds is taken. Exported for tests. */
|
|
95
|
+
export async function assertNativeDevPortsFree(ports) {
|
|
102
96
|
for (const service of NATIVE_SERVICES) {
|
|
103
97
|
const port = ports[service];
|
|
104
|
-
if (!(await isPortInUse(port)))
|
|
98
|
+
if (port === undefined || !(await isPortInUse(port)))
|
|
105
99
|
continue;
|
|
106
100
|
const { holder, move } = NATIVE_PORT_HINTS[service];
|
|
107
101
|
fatalError(`Port ${port} is already in use.`, [holder, `Check: ${portCheckCommand(port)}`, move], {
|
|
@@ -140,9 +134,12 @@ export function registerDev(program) {
|
|
|
140
134
|
.option("--reset-db", "Remove the local Postgres data volume before starting (asks first; storage is kept)")
|
|
141
135
|
.option("--yes", "Skip the --reset-db confirmation")
|
|
142
136
|
.option("--overwrite-drift", "Every push of this session puts back policies, grants, labels and RLS changed outside Supatype")
|
|
143
|
-
|
|
137
|
+
// Ctrl+C during the start reaches its children too: it ends with one line, not their failure.
|
|
138
|
+
.action(stopQuietlyDuringStart(async (opts) => {
|
|
144
139
|
const cwd = process.cwd();
|
|
145
140
|
// ── 1. Load project config (before TUI, fatal errors must hit real stderr) ──
|
|
141
|
+
// Its bytes first: the functions.serviceRole watch, started much later, applies any edit since.
|
|
142
|
+
const configBaseline = configSnapshot(cwd, PROJECT_CONFIG_FILES);
|
|
146
143
|
const config = loadConfig(cwd);
|
|
147
144
|
const provider = resolveRuntimeProvider(config);
|
|
148
145
|
// The native provider keeps Postgres in a data directory, not a compose volume, and has
|
|
@@ -160,16 +157,21 @@ export function registerDev(program) {
|
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
const projectName = config.project.name;
|
|
163
|
-
const serverPort = opts.port ?? String(config
|
|
160
|
+
const serverPort = opts.port ?? String(nativeServerPort(config));
|
|
164
161
|
const postgrestPort = String(config.server.postgrestPort ?? 3001);
|
|
165
162
|
const pgPort = nativeDbPort(config, cwd);
|
|
166
163
|
const realtimePort = String(nativeRealtimePort(config, cwd));
|
|
164
|
+
const denoPort = nativeDenoPort(cwd);
|
|
165
|
+
const storagePort = nativeStoragePort(cwd);
|
|
167
166
|
if (provider !== "docker") {
|
|
167
|
+
// The functions worker runs on every native dev (native-worker.ts), so Deno's port is checked too.
|
|
168
168
|
await assertNativeDevPortsFree({
|
|
169
169
|
postgres: pgPort,
|
|
170
170
|
server: Number(serverPort),
|
|
171
171
|
postgrest: Number(postgrestPort),
|
|
172
172
|
realtime: Number(realtimePort),
|
|
173
|
+
deno: denoPort,
|
|
174
|
+
...(keepsObjectsLocally(config) && { storage: storagePort }),
|
|
173
175
|
});
|
|
174
176
|
// Before anything is generated: a missing password would otherwise be replaced in .env
|
|
175
177
|
// with a new one the existing cluster has never heard of.
|
|
@@ -179,7 +181,15 @@ export function registerDev(program) {
|
|
|
179
181
|
const overwriteDrift = opts.overwriteDrift === true;
|
|
180
182
|
if (overwriteDrift)
|
|
181
183
|
await requireDevEngineSupports(cwd, config, provider === "docker");
|
|
184
|
+
// The compose file puts the database passwords into URLs as `${VAR}`, unencoded. Checked
|
|
185
|
+
// here, before the session takes the terminal, and only here: the watcher rewrites the compose
|
|
186
|
+
// file mid-session, where a refusal would end the session.
|
|
187
|
+
if (provider === "docker")
|
|
188
|
+
requireUrlSafeComposePasswords(cwd, config);
|
|
182
189
|
beginDevSession(resolveDevUiMode(opts.stream === true));
|
|
190
|
+
// From the first frame, so the dashboard never shows the logo over an empty log with nothing
|
|
191
|
+
// to say what it is doing. The provider's own steps follow.
|
|
192
|
+
await showDevStep("Getting ready");
|
|
183
193
|
if (hasMeaningfulOverrides(config)) {
|
|
184
194
|
console.warn("[supatype] Local binary overrides active:");
|
|
185
195
|
for (const line of describeActiveOverrides(config)) {
|
|
@@ -187,9 +197,17 @@ export function registerDev(program) {
|
|
|
187
197
|
}
|
|
188
198
|
console.warn("");
|
|
189
199
|
}
|
|
190
|
-
// Both providers, before anything starts
|
|
191
|
-
//
|
|
192
|
-
|
|
200
|
+
// Both providers, before anything starts. A project without one gets one in .env here (the
|
|
201
|
+
// shell's when usable, else generated), which every later step signs and validates with.
|
|
202
|
+
// Compose is run without a shell JWT_SECRET that differs from it (self-host-compose.ts), so
|
|
203
|
+
// that one is only warned about, and only when .env already had a secret: one written just
|
|
204
|
+
// now was the shell's, or devJwtSecret has already said why it was not.
|
|
205
|
+
const hadJwtSecret = hasEnvValue(cwd, "JWT_SECRET");
|
|
206
|
+
const jwtSecret = devJwtSecret(cwd);
|
|
207
|
+
requireUsableJwtSecret(jwtSecret);
|
|
208
|
+
const ignored = hadJwtSecret ? ignoredJwtSecretWarning(jwtSecret, givenJwtSecret()) : undefined;
|
|
209
|
+
if (ignored !== undefined)
|
|
210
|
+
console.warn(`[supatype] ${ignored}`);
|
|
193
211
|
if (provider === "docker") {
|
|
194
212
|
const { runDevCompose } = await import("../dev-compose.js");
|
|
195
213
|
await runDevCompose(cwd, config, {
|
|
@@ -202,6 +220,7 @@ export function registerDev(program) {
|
|
|
202
220
|
}
|
|
203
221
|
// ── 2. Resolve engine + server binaries ──────────────────────────────
|
|
204
222
|
console.log(`[supatype] Resolving component binaries for "${projectName}"...`);
|
|
223
|
+
await showDevStep("Getting components ready (the first start downloads them)");
|
|
205
224
|
const [engineBin, serverBin] = await Promise.all([
|
|
206
225
|
ensureBinary("engine", config),
|
|
207
226
|
ensureBinary("server", config),
|
|
@@ -218,7 +237,6 @@ export function registerDev(program) {
|
|
|
218
237
|
let dbURL;
|
|
219
238
|
/** What PostgREST connects as, deliberately not `dbURL`, which is a superuser. */
|
|
220
239
|
let postgrestDbURL;
|
|
221
|
-
let stopPostgres;
|
|
222
240
|
// Checked by the cluster (native-pg-auth.ts): .env's, or generated and written there.
|
|
223
241
|
const pgPassword = ensureNativeSuperuserPassword(cwd);
|
|
224
242
|
// Distinct from pgPassword even locally, so the split the other paths enforce is the
|
|
@@ -247,42 +265,36 @@ export function registerDev(program) {
|
|
|
247
265
|
dataDir,
|
|
248
266
|
port: pgPort,
|
|
249
267
|
logPath: join(logsDir, "postgres.log"),
|
|
268
|
+
database: projectName,
|
|
250
269
|
...(keyspacePort !== null
|
|
251
270
|
? { keyspacePort, keyspaceDatabase: projectName }
|
|
252
271
|
: {}),
|
|
253
272
|
};
|
|
254
|
-
|
|
255
|
-
|
|
273
|
+
// initdb, and createdb on a first start, need the archive's version and ICU support; asked once.
|
|
274
|
+
let build;
|
|
275
|
+
const buildOnce = () => (build ??= pgBuild(pgBinDir));
|
|
276
|
+
// Before initdb, which a first start runs here and which takes the longest.
|
|
277
|
+
await showDevStep("Starting Postgres");
|
|
278
|
+
ensureCluster(pgOpts, pgPassword, buildOnce);
|
|
256
279
|
console.log("[supatype] Starting Postgres...");
|
|
257
280
|
pgStart(pgOpts);
|
|
281
|
+
pushStartUndoLast(() => pgStop(pgOpts, { quiet: true }));
|
|
258
282
|
await pgWaitReady(pgOpts, 15_000);
|
|
259
283
|
console.log("[supatype] Postgres is ready.");
|
|
284
|
+
// Between start steps: once a Ctrl+C has begun the shutdown, nothing more is started.
|
|
285
|
+
await haltIfStopping();
|
|
260
286
|
if (requirePasswordAuth(pgOpts, pgPassword)) {
|
|
261
287
|
console.log("[supatype] This Postgres trusted every local connection; it now checks passwords.");
|
|
262
288
|
}
|
|
263
289
|
dbURL = localDSN(config, pgPassword, cwd);
|
|
290
|
+
// A port only the shell gives is offered to .env (B1), then a DATABASE_URL the CLI wrote,
|
|
291
|
+
// for Docker perhaps, names this database (N1).
|
|
292
|
+
await reconcileNativeDevDatabaseUrl(cwd, dbURL);
|
|
264
293
|
postgrestDbURL = `postgres://authenticator:${encodeURIComponent(authenticatorPassword)}@127.0.0.1:${pgPort}/${projectName}?sslmode=disable`;
|
|
265
|
-
stopPostgres = () => pgStop(pgOpts);
|
|
266
|
-
// Create project database if it doesn't exist (native only).
|
|
267
294
|
const psqlBin = join(pgBinDir, process.platform === "win32" ? "psql.exe" : "psql");
|
|
268
|
-
const createdbBin = join(pgBinDir, process.platform === "win32" ? "createdb.exe" : "createdb");
|
|
269
295
|
const pgConnArgs = ["-h", "127.0.0.1", "-p", String(pgPort), "-U", "postgres"];
|
|
270
296
|
const pgEnv = pgClientEnv(pgBinDir, pgPassword);
|
|
271
|
-
|
|
272
|
-
if (createDbResult.status !== 0) {
|
|
273
|
-
const stderr = createDbResult.stderr ?? "";
|
|
274
|
-
// A POSTGRES_PASSWORD changed by hand reaches here; a deleted one was stopped earlier.
|
|
275
|
-
if (isPasswordRejected(stderr)) {
|
|
276
|
-
const { title, hints } = superuserPasswordMissingMessage(dataDir);
|
|
277
|
-
throw new Error([title, ...hints].join("\n "));
|
|
278
|
-
}
|
|
279
|
-
if (!stderr.includes("already exists")) {
|
|
280
|
-
throw new Error(`Failed to create database "${projectName}": ${stderr}`);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
console.log(`[supatype] Created database "${projectName}".`);
|
|
285
|
-
}
|
|
297
|
+
ensureProjectDatabase({ binDir: pgBinDir, connArgs: pgConnArgs, env: pgEnv, dataDir, name: projectName, build: buildOnce });
|
|
286
298
|
// Create roles required by PostgREST and grant them to postgres so
|
|
287
299
|
// PostgREST can SET ROLE when processing requests.
|
|
288
300
|
// anon – unauthenticated requests (RLS enforced)
|
|
@@ -320,84 +332,64 @@ export function registerDev(program) {
|
|
|
320
332
|
: `${dbURL}?search_path=auth`;
|
|
321
333
|
// ── 8. auth migrations (auth.users before engine studio SQL) ─────────
|
|
322
334
|
console.log("[supatype] Running auth migrations...");
|
|
335
|
+
await showDevStep("Running auth migrations");
|
|
323
336
|
const migrateEnv = authMigrateEnv(serverPort, dbURL, LOCAL_JWT_SECRET);
|
|
324
337
|
runAuthMigrations(serverBin, migrateEnv);
|
|
338
|
+
await haltIfStopping();
|
|
325
339
|
// ── 9. Engine: apply schema ───────────────────────────────────────────
|
|
326
340
|
const schemaPath = schemaPathFromProject(config, cwd);
|
|
327
341
|
const supatypeDir = join(cwd, ".supatype");
|
|
328
342
|
const manifestPath = join(supatypeDir, "manifest.json");
|
|
329
343
|
const adminConfigPath = join(supatypeDir, "admin-config.json");
|
|
330
344
|
mkdirSync(supatypeDir, { recursive: true });
|
|
331
|
-
const localStoragePath = config
|
|
345
|
+
const localStoragePath = keepsObjectsLocally(config) ? serverStoreRoot(stateRoot) : undefined;
|
|
332
346
|
// Native Postgres builds don't include PostGIS, skip geo fields rather than failing.
|
|
333
347
|
const skipFieldKinds = new Set(["geo", "vector"]);
|
|
334
|
-
|
|
348
|
+
// The first push and every one the schema watch makes.
|
|
349
|
+
const schemaPush = {
|
|
350
|
+
cwd, engineBin, schemaPath, dbURL, adminConfigPath, storagePath: localStoragePath, skipFieldKinds, config, overwriteDrift,
|
|
351
|
+
};
|
|
352
|
+
await showDevStep("Applying the schema");
|
|
353
|
+
await runSchemaPush(schemaPush).catch(reportUnlessStopping(reportDevPushFailure));
|
|
354
|
+
await haltIfStopping();
|
|
335
355
|
const { ensureFirstAdminUser } = await import("./admin.js");
|
|
356
|
+
await showDevStep("Checking for an admin user");
|
|
336
357
|
await ensureFirstAdminUser(dbURL, { cwd });
|
|
337
358
|
// ── 10. Spawn supatype-server ─────────────────────────────────────────
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
: [];
|
|
346
|
-
const denoServeScriptAbs = hasFunctionsDir && functionsDir !== undefined
|
|
347
|
-
? (writeDevFunctionsRouter(cwd, functionsDir, functionRoutes) ?? "")
|
|
348
|
-
: "";
|
|
349
|
-
let denoBinPath;
|
|
350
|
-
if (hasFunctionsDir) {
|
|
351
|
-
console.log(`[supatype] Edge functions enabled (${functionsDir})`);
|
|
352
|
-
try {
|
|
353
|
-
denoBinPath = await ensureBinary("deno", config);
|
|
354
|
-
const denoVersion = await (await import("../binary-cache.js")).resolveVersionFor("deno", config);
|
|
355
|
-
console.log(`[supatype] Deno runtime: ${denoBinPath} (v${denoVersion})`);
|
|
356
|
-
if (functionRoutes.length > 0) {
|
|
357
|
-
console.log(`[supatype] Edge functions router: ${relative(cwd, denoServeScriptAbs) || ".supatype/functions-router.ts"} ` +
|
|
358
|
-
`(${functionRoutes.length} function(s): ${functionRoutes.map(fn => fn.name).join(", ")})`);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
console.log("[supatype] Edge functions router not generated (no handler files discovered yet)");
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
catch (err) {
|
|
365
|
-
console.warn(`[supatype] ⚠ Found ${functionsDir} but could not provision Deno, edge functions will not run.\n` +
|
|
366
|
-
` ${errorMessage(err)}\n` +
|
|
367
|
-
" (Functions still appear in Studio; invocations need Deno.)");
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
// Matches SUPATYPE_HOOK_SEND_EMAIL_SECRETS symmetric format (dev only). Override via .env.
|
|
371
|
-
const LOCAL_SEND_EMAIL_HOOK_SECRETS = "v1,whsec_abcdefghijklmnopqrstuvwxyz01234567";
|
|
372
|
-
const now = Math.floor(Date.now() / 1000);
|
|
373
|
-
const jwtBase = { iss: "supatype", iat: now, exp: now + 315_360_000 };
|
|
374
|
-
const anonKey = signJwt({ ...jwtBase, role: "anon" }, LOCAL_JWT_SECRET);
|
|
375
|
-
const serviceRoleKey = signJwt({ ...jwtBase, role: "service_role" }, LOCAL_JWT_SECRET);
|
|
359
|
+
// The functions worker the image runs, from the CLI's copy, on every start (native-worker.ts).
|
|
360
|
+
await showDevStep("Starting services");
|
|
361
|
+
const worker = await prepareNativeWorker(cwd, config);
|
|
362
|
+
// The server passes its environment, the key included, on to Deno, but the functions worker
|
|
363
|
+
// reads the key from a file: a --watch reload evaluates it again in an environment an
|
|
364
|
+
// earlier evaluation already took the key out of.
|
|
365
|
+
const { anonKey, serviceRoleKey } = nativeDevApiKeys(cwd);
|
|
376
366
|
const realtimeUrl = `http://127.0.0.1:${realtimePort}`;
|
|
377
367
|
writeAppViteEnv(cwd, config, `http://localhost:${serverPort}`, anonKey);
|
|
368
|
+
// After the push, failed or not: init's manifest names the compose stack's services.
|
|
369
|
+
recordNativeRoutes(manifestPath, worker.denoBin !== undefined);
|
|
370
|
+
// Valkey, or the keyspace Postgres serves, alongside realtime and storage: none needs another.
|
|
371
|
+
const valkeyStart = nativeValkey(keyspacePort, projectName);
|
|
378
372
|
const realtimeProc = await startNativeRealtime({
|
|
379
373
|
config, cwd, manifestPath, pidDir, url: realtimeUrl, port: realtimePort,
|
|
380
374
|
databaseUrl: dbURL, jwtSecret: LOCAL_JWT_SECRET,
|
|
381
375
|
});
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
console.log(`[supatype] Keyspace served by Postgres (${nativeKeyspaceAddr}).`);
|
|
394
|
-
}
|
|
395
|
-
const valkeySidecar = nativeKeyspaceAddr
|
|
396
|
-
? { addr: nativeKeyspaceAddr, containerName: null, started: false }
|
|
397
|
-
: ensureValkeySidecar(projectName);
|
|
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
|
+
// Later pushes create the buckets a schema declares in the service as well as in buckets.json.
|
|
382
|
+
if (nativeStorage !== null)
|
|
383
|
+
schemaPush.storageApi = { url: nativeStorage.url, serviceRoleKey };
|
|
384
|
+
const valkeySidecar = await valkeyStart;
|
|
385
|
+
// `.env` and `.env.local`, read once for everything the server's environment takes from them.
|
|
386
|
+
const dotEnv = readDotEnvFiles(cwd);
|
|
398
387
|
// What an env("NAME") in auth.providers resolves against: the shell over .env, as for the config.
|
|
399
|
-
const providerEnvironment = { ...
|
|
388
|
+
const providerEnvironment = { ...dotEnv, ...process.env };
|
|
400
389
|
warnMissingAuthProviderSecrets(config, providerEnvironment);
|
|
390
|
+
// functions.serviceRole as the worker starts with it; the config watch below keeps it current.
|
|
391
|
+
const serviceRole = { routesPath: devServiceRoleRoutesPath(cwd), initial: serviceRoleRoutes(config) };
|
|
392
|
+
writeServiceRoleRoutesFile(serviceRole.routesPath, serviceRole.initial);
|
|
401
393
|
const serverEnv = {
|
|
402
394
|
...nativeServerCoreEnv({
|
|
403
395
|
mode: config.server.mode ?? "dev",
|
|
@@ -409,12 +401,16 @@ export function registerDev(program) {
|
|
|
409
401
|
pgBinDir,
|
|
410
402
|
databaseUrl: dbURL,
|
|
411
403
|
}),
|
|
412
|
-
SUPATYPE_DENO_FUNCTIONS_DIR:
|
|
413
|
-
...(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
404
|
+
SUPATYPE_DENO_FUNCTIONS_DIR: worker.functionsDir,
|
|
405
|
+
...nativeWorkerDenoEnv(worker),
|
|
406
|
+
SUPATYPE_DENO_SERVE_SCRIPT: worker.entry,
|
|
407
|
+
// The server passes its environment on to Deno: the worker's, as compose gives the image,
|
|
408
|
+
// functions.serviceRole included, so a function relying on the key unlisted fails here first.
|
|
409
|
+
...functionsWorkerEnv({ cwd, config, functionsDir: worker.functionsDir, keyPath: devServiceRoleKeyPath(cwd) }),
|
|
410
|
+
// The server reaches the worker on 127.0.0.1; nothing else on the network should.
|
|
411
|
+
SUPATYPE_FUNCTIONS_HOST: "127.0.0.1",
|
|
412
|
+
// Read again on every reload, so a functions.serviceRole change applies without a restart.
|
|
413
|
+
SUPATYPE_SERVICE_ROLE_ROUTES_FILE: serviceRole.routesPath,
|
|
418
414
|
SUPATYPE_URL: `http://localhost:${serverPort}`,
|
|
419
415
|
// Natively the server is the gateway, so the address functions call is the one a browser
|
|
420
416
|
// opens. The server passes its environment on to the Deno child that runs them.
|
|
@@ -444,46 +440,18 @@ export function registerDev(program) {
|
|
|
444
440
|
SUPATYPE_JWT_EXP: "3600",
|
|
445
441
|
SUPATYPE_JWT_AUD: "authenticated",
|
|
446
442
|
SUPATYPE_JWT_ADMIN_ROLES: "supatype_admin,service_role",
|
|
447
|
-
SUPATYPE_API_EXTERNAL_URL: `http://localhost:${serverPort}/auth/v1`,
|
|
448
443
|
SUPATYPE_API_HOST: "localhost",
|
|
449
444
|
SUPATYPE_SITE_URL: `http://localhost:${serverPort}`,
|
|
450
|
-
|
|
445
|
+
// External URL, mailer provider, emailed-link paths and the send-email hook.
|
|
446
|
+
...nativeAuthMailerEnv(config.email, serverPort),
|
|
451
447
|
SUPATYPE_LOG_LEVEL: "info",
|
|
452
448
|
SUPATYPE_DISABLE_SIGNUP: "false",
|
|
453
|
-
...(
|
|
454
|
-
? { RESEND_API_KEY: config.email.resend_api_key }
|
|
455
|
-
: {}),
|
|
456
|
-
...(authMailerProvider === "resend" &&
|
|
457
|
-
config.email?.resend_from !== undefined &&
|
|
458
|
-
config.email.resend_from.trim() !== ""
|
|
459
|
-
? { RESEND_FROM: config.email.resend_from.trim() }
|
|
460
|
-
: {}),
|
|
461
|
-
...(authMailerProvider === "ses" &&
|
|
462
|
-
config.email?.ses_from !== undefined &&
|
|
463
|
-
config.email.ses_from.trim() !== ""
|
|
464
|
-
? { SES_FROM: config.email.ses_from.trim() }
|
|
465
|
-
: {}),
|
|
466
|
-
...(authMailerProvider === "smtp" ? authSMTPFromEmailConfig(config.email) : {}),
|
|
467
|
-
...(config.email?.send_email_hook === true
|
|
468
|
-
? {
|
|
469
|
-
SUPATYPE_HOOK_SEND_EMAIL_ENABLED: "true",
|
|
470
|
-
SUPATYPE_HOOK_SEND_EMAIL_URI: config.email?.send_email_hook_uri !== undefined &&
|
|
471
|
-
config.email.send_email_hook_uri.trim() !== ""
|
|
472
|
-
? config.email.send_email_hook_uri.trim()
|
|
473
|
-
: `http://127.0.0.1:${serverPort}/internal/v0hooks/send-email`,
|
|
474
|
-
SUPATYPE_HOOK_SEND_EMAIL_SECRETS: config.email?.send_email_hook_secrets !== undefined &&
|
|
475
|
-
config.email.send_email_hook_secrets.trim() !== ""
|
|
476
|
-
? config.email.send_email_hook_secrets.trim()
|
|
477
|
-
: LOCAL_SEND_EMAIL_HOOK_SECRETS,
|
|
478
|
-
}
|
|
479
|
-
: {}),
|
|
480
|
-
...(config.storage?.provider !== "s3" ? localStorageEnv(stateRoot) : {}),
|
|
449
|
+
...serverStorageEnv(nativeStorage, config, stateRoot),
|
|
481
450
|
// .env last, so a SUPATYPE_EXTERNAL_* value there wins over auth.providers in the config.
|
|
482
451
|
...nativeAuthProviderEnv(config, `http://localhost:${serverPort}`, providerEnvironment),
|
|
483
|
-
...
|
|
484
|
-
// After .env: auth.email.enableConfirmations, unless the developer set their own value.
|
|
485
|
-
...nativeMailerAutoconfirmEnv(cwd, config),
|
|
452
|
+
...nativeServerDotEnvLayer({ dotEnv, config, cwd, denoPort }),
|
|
486
453
|
};
|
|
454
|
+
await haltIfStopping();
|
|
487
455
|
const serverProc = new ProcessManager(serverBin, [], {
|
|
488
456
|
label: "server",
|
|
489
457
|
pidDir,
|
|
@@ -491,8 +459,10 @@ export function registerDev(program) {
|
|
|
491
459
|
env: serverEnv,
|
|
492
460
|
});
|
|
493
461
|
serverProc.start();
|
|
462
|
+
pushStartUndo(() => serverProc.stop());
|
|
494
463
|
// ── 9b. PostgREST ────────────────────────────────────────────────────
|
|
495
464
|
let postgrestProc = null;
|
|
465
|
+
await haltIfStopping();
|
|
496
466
|
const postgrestBin = await resolvePostgrestBin(config.overrides?.postgrest);
|
|
497
467
|
if (postgrestBin) {
|
|
498
468
|
// Windows PostgREST builds are dynamically linked and require libpq/OpenSSL
|
|
@@ -521,6 +491,8 @@ export function registerDev(program) {
|
|
|
521
491
|
PGRST_SERVER_HOST: "127.0.0.1",
|
|
522
492
|
PGRST_JWT_SECRET: serverEnv["SUPATYPE_JWT_SECRET"] ?? "",
|
|
523
493
|
PGRST_LOG_LEVEL: "warn",
|
|
494
|
+
// The caller marker after-hooks read from the change log, as on a compose stack.
|
|
495
|
+
...postgrestHookActorEnv(config),
|
|
524
496
|
// On Windows, PostgREST (MinGW/GHC binary) needs libpq.dll and
|
|
525
497
|
// OpenSSL DLLs. Prepend a Postgres bin dir which bundles these
|
|
526
498
|
// runtime dependencies.
|
|
@@ -545,11 +517,13 @@ export function registerDev(program) {
|
|
|
545
517
|
env: postgrestEnv,
|
|
546
518
|
});
|
|
547
519
|
postgrestProc.start();
|
|
520
|
+
pushStartUndo(() => postgrestProc?.stop());
|
|
548
521
|
}
|
|
549
522
|
}
|
|
550
523
|
// ── 9d. Studio (optional) ─────────────────────────────────────────────
|
|
551
524
|
const studioPort = STUDIO_DEV_PORT;
|
|
552
525
|
let studioProc = null;
|
|
526
|
+
await haltIfStopping();
|
|
553
527
|
const studioOverride = config.overrides?.studio;
|
|
554
528
|
if (studioOverride) {
|
|
555
529
|
studioProc = startStudioViteDevServer({
|
|
@@ -561,8 +535,12 @@ export function registerDev(program) {
|
|
|
561
535
|
viteSupatypeUrl: `http://localhost:${studioPort}`,
|
|
562
536
|
});
|
|
563
537
|
studioProc?.start();
|
|
538
|
+
pushStartUndo(() => studioProc?.stop());
|
|
564
539
|
}
|
|
540
|
+
await haltIfStopping();
|
|
565
541
|
const appProc = startProxyDevApp(cwd, config, pidDir);
|
|
542
|
+
if (appProc)
|
|
543
|
+
pushStartUndo(() => appProc.stop());
|
|
566
544
|
const links = [
|
|
567
545
|
{ label: "API", url: `http://localhost:${serverPort}` },
|
|
568
546
|
{ label: "REST", url: `http://localhost:${serverPort}/rest/v1/` },
|
|
@@ -583,40 +561,39 @@ export function registerDev(program) {
|
|
|
583
561
|
hints: [`Postgres ${dbURL}`, `JWT secret: #${secretFingerprint(LOCAL_JWT_SECRET)} (in .env)`],
|
|
584
562
|
});
|
|
585
563
|
// ── Shutdown handler ──────────────────────────────────────────────────
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
serverProc.stop(),
|
|
590
|
-
realtimeProc?.stop(),
|
|
591
|
-
postgrestProc?.stop(),
|
|
592
|
-
studioProc?.stop(),
|
|
593
|
-
appProc?.stop(),
|
|
594
|
-
]);
|
|
595
|
-
stopValkeySidecar(valkeySidecar.containerName);
|
|
596
|
-
await stopPostgres();
|
|
597
|
-
});
|
|
564
|
+
// 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
|
+
registerDevShutdown(async () => undefined);
|
|
598
567
|
// ── 10. Schema watch ──────────────────────────────────────────────────
|
|
599
568
|
if (opts.watch) {
|
|
600
569
|
const schemaDir = resolve(cwd, schemaPath, "..");
|
|
601
570
|
console.log(`[supatype] Watching ${schemaDir} for changes...`);
|
|
571
|
+
// Deno reloads the worker when a file it imported changes, but not for a function added later.
|
|
572
|
+
const { watchNativeFunctions, watchServiceRoleRoutes } = await import("../native-functions-watch.js");
|
|
573
|
+
const { functionsDir, hooksDir, workerMain, routes } = worker;
|
|
574
|
+
const functionsWatch = watchNativeFunctions({ cwd, functionsDir, hooksDir, workerMain }, routes);
|
|
575
|
+
watchServiceRoleRoutes({
|
|
576
|
+
...serviceRole,
|
|
577
|
+
dir: cwd,
|
|
578
|
+
configFiles: PROJECT_CONFIG_FILES,
|
|
579
|
+
baseline: configBaseline,
|
|
580
|
+
readRoutes: () => serviceRoleRoutes(loadConfig(cwd)),
|
|
581
|
+
reload: functionsWatch.reload,
|
|
582
|
+
});
|
|
602
583
|
const { watchDevSchema } = await import("../dev-schema-watch.js");
|
|
603
584
|
watchDevSchema({
|
|
604
585
|
dir: schemaDir,
|
|
605
586
|
changedSinceLastPush: async () => JSON.stringify((await buildNativeAst(cwd, schemaPath, config, skipFieldKinds)).ast) !== _lastReadAst,
|
|
606
587
|
push: (why) => {
|
|
607
588
|
console.log(`\n[supatype] ${why}, checking schema...`);
|
|
608
|
-
|
|
589
|
+
// A hook the push declares is served once the worker's routes name it.
|
|
590
|
+
runSchemaPush(schemaPush).then(() => functionsWatch.refresh()).catch(reportUnlessStopping(reportDevPushFailure));
|
|
609
591
|
},
|
|
610
592
|
});
|
|
611
|
-
// Deno reloads the router on change, but only lists the functions found at start.
|
|
612
|
-
if (functionsDir !== undefined && denoServeScriptAbs !== "") {
|
|
613
|
-
const { watchNativeFunctions } = await import("../native-functions-watch.js");
|
|
614
|
-
watchNativeFunctions(cwd, functionsDir, functionRoutes.map((route) => route.name));
|
|
615
|
-
}
|
|
616
593
|
}
|
|
617
594
|
// Block until killed.
|
|
618
595
|
await waitForDevShutdown();
|
|
619
|
-
});
|
|
596
|
+
}));
|
|
620
597
|
}
|
|
621
598
|
// ---------------------------------------------------------------------------
|
|
622
599
|
// Schema push (engine subprocess)
|
|
@@ -642,7 +619,7 @@ async function pushNativeSchema(cwd, schema, target) {
|
|
|
642
619
|
const { DEV_DESTRUCTIVE_POLICY, consentDepsFromDiff, pushConsentingToDestructive } = await import("../destructive-consent.js");
|
|
643
620
|
const { devPushConsentingToDrift } = await import("../drift-consent.js");
|
|
644
621
|
await ensureEngine();
|
|
645
|
-
const sources = writeSchemaSourcePushArtifacts(cwd);
|
|
622
|
+
const sources = writeSchemaSourcePushArtifacts(cwd, true);
|
|
646
623
|
let ast = schema.ast;
|
|
647
624
|
let stale = false;
|
|
648
625
|
const request = async () => {
|
|
@@ -706,9 +683,9 @@ async function buildNativeAst(cwd, schemaPath, config, skipFieldKinds) {
|
|
|
706
683
|
return { ast: filtered, adapted };
|
|
707
684
|
}
|
|
708
685
|
/** One push of native dev (provider `native`): the schema on disk, then what describes it. Exported for tests. */
|
|
709
|
-
export async function runSchemaPush(
|
|
710
|
-
|
|
711
|
-
overwriteDrift = false
|
|
686
|
+
export async function runSchemaPush(push) {
|
|
687
|
+
const { cwd, engineBin, schemaPath, dbURL, adminConfigPath, storagePath, skipFieldKinds, config, storageApi } = push;
|
|
688
|
+
const overwriteDrift = push.overwriteDrift ?? false;
|
|
712
689
|
const read = await readNativeSchema(cwd, schemaPath, config, skipFieldKinds);
|
|
713
690
|
const astJson = JSON.stringify(read);
|
|
714
691
|
_lastReadAst = astJson;
|
|
@@ -727,7 +704,7 @@ overwriteDrift = false) {
|
|
|
727
704
|
const pgSchemaName = config ? pgSchema(config) : "public";
|
|
728
705
|
const ast = await applyNativeSchema(cwd, { ast: read, rebuild }, { dbURL, pgSchema: pgSchemaName, overwriteDrift });
|
|
729
706
|
writeFileSync(astPath, JSON.stringify(ast));
|
|
730
|
-
await writeNativeSchemaArtifacts({ cwd, engineBin, astPath,
|
|
707
|
+
await writeNativeSchemaArtifacts({ cwd, engineBin, astPath, adminConfigPath, storagePath, storageApi }, ast, config);
|
|
731
708
|
}
|
|
732
709
|
/** The schema on disk as native dev pushes it, saying which fields were stood in for by JSONB. */
|
|
733
710
|
async function readNativeSchema(cwd, schemaPath, config, skipFieldKinds) {
|
|
@@ -755,35 +732,56 @@ async function applyNativeSchema(cwd, schema, target) {
|
|
|
755
732
|
throw err;
|
|
756
733
|
}
|
|
757
734
|
}
|
|
758
|
-
/**
|
|
735
|
+
/**
|
|
736
|
+
* The buckets, Studio's admin config, the types, and the hook maps and handler types, from the AST
|
|
737
|
+
* applied. The rest of the server's route manifest names where each service is, nothing from the
|
|
738
|
+
* schema, and native dev writes it as it starts them (native-realtime.ts, recordNativeRoutes).
|
|
739
|
+
*/
|
|
759
740
|
async function writeNativeSchemaArtifacts(paths, ast, config) {
|
|
760
741
|
const { cwd, engineBin, astPath } = paths;
|
|
761
742
|
if (paths.storagePath)
|
|
762
|
-
provisionDeclaredBuckets(engineBin, cwd, astPath, paths
|
|
763
|
-
const genResult = spawnSync(engineBin, ["generate", "-i", astPath, "-o", paths.manifestPath], {
|
|
764
|
-
cwd,
|
|
765
|
-
stdio: "pipe",
|
|
766
|
-
encoding: "utf8",
|
|
767
|
-
});
|
|
768
|
-
if (genResult.status !== 0) {
|
|
769
|
-
console.warn("[supatype] Manifest generation failed, server routing may be stale.");
|
|
770
|
-
}
|
|
743
|
+
await provisionDeclaredBuckets(engineBin, cwd, astPath, paths);
|
|
771
744
|
if (paths.adminConfigPath)
|
|
772
745
|
await writeNativeAdminConfig(paths, paths.adminConfigPath, ast, config);
|
|
746
|
+
if (config)
|
|
747
|
+
writeNativeAppliedAst(cwd, config, ast);
|
|
773
748
|
await writeNativeTypes(cwd, ast, config);
|
|
774
749
|
}
|
|
775
|
-
/**
|
|
776
|
-
function
|
|
750
|
+
/** The storage buckets the schema declares, as the engine resolves them; none when it cannot say. */
|
|
751
|
+
function declaredBuckets(engineBin, cwd, astPath) {
|
|
777
752
|
const parseResult = spawnSync(engineBin, ["parse", "-i", astPath], { cwd, stdio: "pipe", encoding: "utf8" });
|
|
778
753
|
if (parseResult.status !== 0 || !parseResult.stdout)
|
|
779
|
-
return;
|
|
754
|
+
return [];
|
|
780
755
|
try {
|
|
781
756
|
const resolvedAst = JSON.parse(parseResult.stdout);
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
757
|
+
return isParsedBuckets(resolvedAst) ? resolvedAst.storageBuckets ?? [] : [];
|
|
758
|
+
}
|
|
759
|
+
catch {
|
|
760
|
+
return [];
|
|
785
761
|
}
|
|
786
|
-
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Create the storage buckets the schema declares: in buckets.json, which the server's store reads
|
|
765
|
+
* and the storage service imports when it starts, and in the service itself once it runs.
|
|
766
|
+
*/
|
|
767
|
+
async function provisionDeclaredBuckets(engineBin, cwd, astPath, paths) {
|
|
768
|
+
const buckets = declaredBuckets(engineBin, cwd, astPath);
|
|
769
|
+
if (buckets.length === 0 || paths.storagePath === undefined)
|
|
770
|
+
return;
|
|
771
|
+
await provisionNativeBuckets(buckets, { storagePath: paths.storagePath, storageApi: paths.storageApi });
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* `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. Exported for tests.
|
|
776
|
+
*/
|
|
777
|
+
export async function provisionNativeBuckets(buckets, paths) {
|
|
778
|
+
const added = provisionStorageBuckets(buckets, paths.storagePath);
|
|
779
|
+
const failed = paths.storageApi
|
|
780
|
+
? await provisionBuckets(paths.storageApi.url, paths.storageApi.serviceRoleKey, bucketSpecsFromAst({ storageBuckets: buckets }))
|
|
781
|
+
: [];
|
|
782
|
+
const ready = added.filter((id) => !failed.includes(id)).length;
|
|
783
|
+
if (ready > 0)
|
|
784
|
+
console.log(`[supatype] Storage: provisioned ${ready} bucket(s).`);
|
|
787
785
|
}
|
|
788
786
|
/** Studio's admin config, which the engine writes to stdout, with the project's roles merged in. */
|
|
789
787
|
async function writeNativeAdminConfig(paths, adminConfigPath, ast, config) {
|
|
@@ -822,36 +820,27 @@ async function writeNativeTypes(cwd, ast, config) {
|
|
|
822
820
|
console.warn(`[supatype] Type generation failed: ${errorMessage(err)}`);
|
|
823
821
|
}
|
|
824
822
|
}
|
|
823
|
+
/** Writes the declared buckets buckets.json lacks to it, and returns their ids. */
|
|
825
824
|
function provisionStorageBuckets(declared, storagePath) {
|
|
826
825
|
const bucketsDir = join(storagePath, ".supatype");
|
|
827
826
|
const bucketsFile = join(bucketsDir, "buckets.json");
|
|
828
827
|
mkdirSync(bucketsDir, { recursive: true });
|
|
829
828
|
// Absent until the first bucket, and anything that is not a list of buckets reads as none.
|
|
830
|
-
const
|
|
829
|
+
const stored = readJsonFile(bucketsFile, isArrayOf(isJsonObject)) ?? [];
|
|
830
|
+
const existing = stored.map(withPublicFromMode);
|
|
831
|
+
const corrected = existing.filter((row, i) => row["public"] !== stored[i]?.["public"]).length;
|
|
831
832
|
const existingIds = new Set(existing.map((b) => b["id"]));
|
|
832
|
-
|
|
833
|
+
const added = [];
|
|
833
834
|
for (const bucket of declared) {
|
|
834
835
|
if (existingIds.has(bucket.id))
|
|
835
836
|
continue;
|
|
836
|
-
|
|
837
|
-
existing.push({
|
|
838
|
-
id: bucket.id,
|
|
839
|
-
name: bucket.id,
|
|
840
|
-
public: bucket.public,
|
|
841
|
-
file_size_limit: bucket.fileSizeLimit ?? null,
|
|
842
|
-
allowed_mime_types: bucket.allowedMimeTypes ?? null,
|
|
843
|
-
access_mode: bucket.accessMode ?? (bucket.public ? "public" : "private"),
|
|
844
|
-
s3_bucket_policy: bucket.s3BucketPolicy ?? null,
|
|
845
|
-
created_at: now,
|
|
846
|
-
updated_at: now,
|
|
847
|
-
});
|
|
837
|
+
existing.push(nativeBucketRow(bucket, new Date().toISOString()));
|
|
848
838
|
mkdirSync(join(storagePath, bucket.id), { recursive: true });
|
|
849
|
-
added
|
|
839
|
+
added.push(bucket.id);
|
|
850
840
|
}
|
|
851
|
-
if (added > 0)
|
|
841
|
+
if (added.length > 0 || corrected > 0)
|
|
852
842
|
writeFileSync(bucketsFile, JSON.stringify(existing, null, 2));
|
|
853
|
-
|
|
854
|
-
}
|
|
843
|
+
return added;
|
|
855
844
|
}
|
|
856
845
|
// ---------------------------------------------------------------------------
|
|
857
846
|
// Resolve Postgres bin dir
|
|
@@ -889,16 +878,7 @@ async function extractPostgresArchive(pgCacheDir, version, platform, extractDir)
|
|
|
889
878
|
if (!existsSync(archivePath)) {
|
|
890
879
|
throw new Error(`Postgres ${version} archive not found. Run: supatype update`);
|
|
891
880
|
}
|
|
892
|
-
|
|
893
|
-
// On Windows, Git Bash tar is typically first in PATH and chokes on drive-letter
|
|
894
|
-
// paths (C:\...). Use PowerShell's Expand-Archive instead, which handles Windows
|
|
895
|
-
// paths natively. On Linux/macOS, use tar as normal.
|
|
896
|
-
const result = platform.os === "windows"
|
|
897
|
-
? spawnSync("powershell.exe", ["-NoProfile", "-Command", `Expand-Archive -Path '${archivePath}' -DestinationPath '${extractDir}' -Force`], { stdio: "inherit" })
|
|
898
|
-
: spawnSync("tar", ["-xzf", archivePath, "-C", extractDir], { stdio: "inherit" });
|
|
899
|
-
if (result.status !== 0) {
|
|
900
|
-
throw new Error(`Failed to extract Postgres archive: ${archivePath}`);
|
|
901
|
-
}
|
|
881
|
+
extractArchive(archivePath, extractDir);
|
|
902
882
|
}
|
|
903
883
|
// ---------------------------------------------------------------------------
|
|
904
884
|
// PostgREST resolver: downloads from GitHub releases if not cached
|
|
@@ -926,11 +906,11 @@ async function resolvePostgrestBin(overridePath) {
|
|
|
926
906
|
if (existsSync(binPath)) {
|
|
927
907
|
// Backfill DLLs for older cached Windows installs where only postgrest.exe
|
|
928
908
|
// was copied from the release archive.
|
|
929
|
-
if (platform.os === "windows" &&
|
|
930
|
-
|
|
931
|
-
|
|
909
|
+
if (platform.os === "windows" && postgrestRuntimeRepairDue(cacheDir, archivePath)) {
|
|
910
|
+
if (repairWindowsPostgrestRuntime(cacheDir, archivePath, binPath))
|
|
911
|
+
markPostgrestUnpacked(cacheDir);
|
|
912
|
+
else
|
|
932
913
|
console.warn("[supatype] ⚠ PostgREST runtime DLL repair failed; REST API may be unavailable.");
|
|
933
|
-
}
|
|
934
914
|
}
|
|
935
915
|
return binPath;
|
|
936
916
|
}
|
|
@@ -987,16 +967,10 @@ async function resolvePostgrestBin(overridePath) {
|
|
|
987
967
|
const { chmod } = await import("node:fs/promises");
|
|
988
968
|
await chmod(binPath, 0o755);
|
|
989
969
|
}
|
|
970
|
+
markPostgrestUnpacked(cacheDir);
|
|
990
971
|
console.log(`[supatype] PostgREST v${version} ready.`);
|
|
991
972
|
return binPath;
|
|
992
973
|
}
|
|
993
|
-
function hasLikelyWindowsRuntimeDlls(dir) {
|
|
994
|
-
if (process.platform !== "win32")
|
|
995
|
-
return true;
|
|
996
|
-
return (existsSync(join(dir, "libpq.dll")) ||
|
|
997
|
-
existsSync(join(dir, "libpq-5.dll")) ||
|
|
998
|
-
existsSync(join(dir, "libssl-3-x64.dll")));
|
|
999
|
-
}
|
|
1000
974
|
function repairWindowsPostgrestRuntime(cacheDir, archivePath, binPath) {
|
|
1001
975
|
const r = spawnSync("powershell.exe", [
|
|
1002
976
|
"-NoProfile",
|
|
@@ -1079,22 +1053,57 @@ function runAuthMigrations(serverBin, migrateEnv) {
|
|
|
1079
1053
|
(detail ? `:\n${detail}` : ""));
|
|
1080
1054
|
}
|
|
1081
1055
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1056
|
+
/**
|
|
1057
|
+
* The keyspace native Postgres serves, when it answers RESP, else Valkey: one already running, or
|
|
1058
|
+
* the sidecar container.
|
|
1059
|
+
*/
|
|
1060
|
+
async function nativeValkey(keyspacePort, projectName) {
|
|
1061
|
+
const keyspace = await nativeKeyspaceAddrFor(keyspacePort);
|
|
1062
|
+
if (keyspace === null)
|
|
1063
|
+
return ensureValkeySidecar(projectName);
|
|
1064
|
+
console.log(`[supatype] Keyspace served by Postgres (${keyspace}).`);
|
|
1065
|
+
return externalValkey(keyspace);
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* The project database: left as it is when psql can report its encoding (with a warning when an
|
|
1069
|
+
* older CLI made it in another encoding than UTF8), else created, UTF8 as the cluster. One psql
|
|
1070
|
+
* call on every start after the first, where it took createdb, a psql and two version probes.
|
|
1071
|
+
*/
|
|
1072
|
+
function ensureProjectDatabase(db) {
|
|
1073
|
+
const psqlBin = join(db.binDir, process.platform === "win32" ? "psql.exe" : "psql");
|
|
1074
|
+
const encoding = databaseEncoding(psqlBin, [...db.connArgs, "-d", db.name], db.env);
|
|
1075
|
+
if (encoding !== null) {
|
|
1076
|
+
const warning = nonUtf8DatabaseWarning(encoding, db.name, db.dataDir);
|
|
1077
|
+
if (warning !== null)
|
|
1078
|
+
console.warn(warning);
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
const createdbBin = join(db.binDir, process.platform === "win32" ? "createdb.exe" : "createdb");
|
|
1082
|
+
const created = spawnSync(createdbBin, createdbArgs(db.connArgs, db.name, db.build()), { stdio: "pipe", encoding: "utf8", env: db.env });
|
|
1083
|
+
if (created.status === 0) {
|
|
1084
|
+
console.log(`[supatype] Created database "${db.name}".`);
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
const stderr = created.stderr ?? "";
|
|
1088
|
+
// A POSTGRES_PASSWORD changed by hand reaches here; a deleted one was stopped earlier.
|
|
1089
|
+
if (isPasswordRejected(stderr)) {
|
|
1090
|
+
const { title, hints } = superuserPasswordMissingMessage(db.dataDir);
|
|
1091
|
+
throw new Error([title, ...hints].join("\n "));
|
|
1097
1092
|
}
|
|
1098
|
-
|
|
1093
|
+
if (!stderr.includes("already exists"))
|
|
1094
|
+
throw new Error(`Failed to create database "${db.name}": ${stderr}`);
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* What push and Docker dev write from an applied AST (applied-ast-artifacts.ts), for native dev,
|
|
1098
|
+
* which has no row-cache container. The manifest is made first when there is none: the hook maps
|
|
1099
|
+
* only go into one that exists, and the first push runs before native dev records its functions,
|
|
1100
|
+
* which sets `functions_enabled` before the server reads it.
|
|
1101
|
+
*/
|
|
1102
|
+
function writeNativeAppliedAst(cwd, config, ast) {
|
|
1103
|
+
const manifestPath = join(cwd, ".supatype", "manifest.json");
|
|
1104
|
+
if (!existsSync(manifestPath))
|
|
1105
|
+
patchRouteManifest(manifestPath, {});
|
|
1106
|
+
for (const line of writeAppliedAstArtifacts(cwd, config, ast, { rowCacheEnv: false }).lines)
|
|
1107
|
+
console.log(`[supatype] ${line}`);
|
|
1099
1108
|
}
|
|
1100
1109
|
//# sourceMappingURL=dev.js.map
|