@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,319 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
* **schema:** a `?` on a model field (`due?: string`) is refused, naming `Model.field` and saying to
|
|
8
|
+
write `Optional<>`. It read as nullable but compiled to a `NOT NULL` column.
|
|
9
|
+
* **generate:** `supatype generate --connection` is refused as an unknown option. Generate writes the
|
|
10
|
+
types from the schema file and never opened a database, so the option was accepted and ignored.
|
|
11
|
+
* **seed:** a seed file's `export const config = { transaction: ... }` is refused, and `transaction`
|
|
12
|
+
is gone from `SeedConfig`. It was validated and never sent: every seed file runs in a transaction
|
|
13
|
+
of its own (all of them in one with `--atomic`), and the engine cannot run one outside it. Any
|
|
14
|
+
other key `config` does not have (a misspelt `runonce`, say) is refused too, rather than ignored.
|
|
15
|
+
* **realtime:** the service's process entry is `dist/main.js`; `dist/index.js` only exports and no
|
|
16
|
+
longer starts a server, so an `overrides.realtime` naming `packages/realtime/dist/index.js` exits
|
|
17
|
+
at once. Point it at `packages/realtime/dist/main.js`.
|
|
18
|
+
* **hooks:** `AfterDeleteContext` has no `filter`. After-hooks are fed from the database's change log,
|
|
19
|
+
which records the rows a write changed rather than the request that changed them, so there is no
|
|
20
|
+
filter to give. `ctx.old` replaces it: the deleted rows themselves, as they were. A handler reading
|
|
21
|
+
`ctx.filter` in an `afterDelete` no longer compiles; read `ctx.old` instead.
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **push:** `--run-hooks` fires after-hooks for the rows a push's own data migrations rewrite (column
|
|
26
|
+
conversions, block moves, kind changes). Without it they are skipped, as seeds are. Against an
|
|
27
|
+
engine whose capabilities do not list `run_hooks`, the push stops before anything is sent.
|
|
28
|
+
|
|
29
|
+
* **init:** `supatype init <dir> --example <name>` starts from `examples/<name>` of the release
|
|
30
|
+
matching the CLI (`v<version>` on GitHub), with every `workspace:` dependency pinned to
|
|
31
|
+
`^<version>`. An unknown name is refused with the list of examples in that release, and so is an
|
|
32
|
+
example holding a file named with `..`, a backslash, a NUL, a leading drive (`C:`) or an absolute
|
|
33
|
+
path, or one that resolves outside the directory; nothing is written then. A colon anywhere in a
|
|
34
|
+
name is refused too, since on Windows `docs/a:b.md` writes a hidden stream of a file `docs/a`.
|
|
35
|
+
Such a name elsewhere in the repository does not stop an example. Schema snapshots are restored
|
|
36
|
+
with the same checks, and `push` refuses a schema file named in a way restore would refuse.
|
|
37
|
+
`supatype dev` warns instead and pushes without a snapshot, so it does not stop on every save.
|
|
38
|
+
* **seed:** `authUser: { connect: { id } }` on a relation to the auth user (`RelatedTo<SupatypeAuthUser>`)
|
|
39
|
+
writes the relation's key column. It failed with "`supatype:user` is not a model in this schema".
|
|
40
|
+
The generated `...Create` type still offers the key column (`auth_user_id`) rather than `authUser`;
|
|
41
|
+
that comes from the engine.
|
|
42
|
+
* **schema:** `Geo<"polygon">` and `Geo<"linestring">` compile to `GEOGRAPHY(POLYGON, 4326)` and
|
|
43
|
+
`GEOGRAPHY(LINESTRING, 4326)`. Every `Geo` field was a point whatever it said; a bare `Geo` still is.
|
|
44
|
+
* **keys:** `supatype keys` writes into `.env` when there is one, filling only the blank keys, as
|
|
45
|
+
`--write` did. `--print` only prints. `--write` still works, so scripts and docs written for 0.7.0
|
|
46
|
+
keep running. With no `.env` the keys are printed, with a line saying how to have them written.
|
|
47
|
+
`--print` with no secret anywhere exits 1 rather than printing keys signed with one it made up and
|
|
48
|
+
kept nowhere. `--print` checks the secret as writing does, since printed keys end up in a `.env`
|
|
49
|
+
all the same: at least 32 characters, and for a given one, no whitespace, `#` or quotes.
|
|
50
|
+
* **keys, self-host, init, dev:** one rule for the `JWT_SECRET` keys are signed with. `.env`'s always
|
|
51
|
+
wins. A shell `JWT_SECRET` is used only when `.env` has none, and is then written into `.env`; one
|
|
52
|
+
that differs from `.env`'s gets a single warning line saying `.env`'s is used, and is never
|
|
53
|
+
refused. Only a `keys --secret` that differs from `.env`'s is refused. Docker Compose reads the
|
|
54
|
+
shell ahead of `.env`, so every compose command now runs without the shell's `JWT_SECRET`,
|
|
55
|
+
`ANON_KEY` and `SERVICE_ROLE_KEY` when `.env` defines that name, and without a shell key the stack
|
|
56
|
+
would not accept under `.env`'s `JWT_SECRET` (another secret, another role, or expired):
|
|
57
|
+
`supatype dev` on docker with a different shell `JWT_SECRET` started services that refused every
|
|
58
|
+
key with 401. A shell key the stack accepts still fills a blank one. `push`, `status` and the
|
|
59
|
+
other commands calling the local stack follow the same rule, and send `.env`'s `SERVICE_ROLE_KEY`,
|
|
60
|
+
the name the stack is started with, and never a `SUPATYPE_SERVICE_ROLE_KEY` there. When a
|
|
61
|
+
`JWT_SECRET` is newly written into `.env` (given or generated), `keys` and `self-host compose up`
|
|
62
|
+
sign both keys again and say so, since keys already there cannot verify against it. A secret is
|
|
63
|
+
checked before anything is written: at least 32 characters, and for one written into `.env`, no
|
|
64
|
+
whitespace, `#` or quotes. `compose up` used to write keys signed with a short secret and then
|
|
65
|
+
refuse it, leaving keys that were never re-signed once the secret was fixed. `init` warns and
|
|
66
|
+
generates a secret when the shell's is unusable, and never exits mid-wizard over the keys.
|
|
67
|
+
* **keys, dev:** `NEXT_PUBLIC_SUPATYPE_ANON_KEY` is written beside the `VITE_`, `PUBLIC_` and
|
|
68
|
+
`EXPO_PUBLIC_` copies, and `NEXT_PUBLIC_SUPATYPE_URL` wherever the other URL copies are.
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
* **npm:** the CLI works in an app that installs React 19. npm hoisted the CLI's `ink` into the
|
|
73
|
+
app's `node_modules`, where it loaded the app's React rather than the CLI's own React 18, and
|
|
74
|
+
every command failed with `Cannot read properties of undefined (reading 'ReactCurrentOwner')`.
|
|
75
|
+
So did `npm install`, through the scaffold's `prepare: supatype generate`. Installed from npm,
|
|
76
|
+
`supatype` now runs the same signed program the curl and Homebrew installs run, which carries its
|
|
77
|
+
own copy of everything it uses. The first run of each version downloads it from
|
|
78
|
+
releases.supatype.com into `~/.supatype/cache/cli/<version>/`, checked against the release's
|
|
79
|
+
signed checksums; set `SUPATYPE_CDN_BASE` to use a mirror. The package no longer installs `ink`,
|
|
80
|
+
`react`, `commander`, `ts-morph`, `tsx` or `bcryptjs` into the app. Linux, macOS (x64, arm64)
|
|
81
|
+
and Windows x64 are supported; anything else is refused with the list.
|
|
82
|
+
* **self-update:** run by the npm package, `self-update` says to update with npm instead of
|
|
83
|
+
replacing the program the package starts.
|
|
84
|
+
* **cache:** upgrading an npm install leaves the previous version's program in the cache, since
|
|
85
|
+
another project may still use it. Once those take more than 250 MB the CLI says so when it
|
|
86
|
+
starts, at most once a day, and `supatype cache clean` (or `cache clean cli`) removes them,
|
|
87
|
+
never the running version.
|
|
88
|
+
* **init:** new projects no longer install `tsx`. The CLI runs the project's TypeScript itself.
|
|
89
|
+
* **init:** a project installs for production. Its `prepare` ran `supatype generate`, which npm
|
|
90
|
+
runs on `npm ci --omit=dev` too, where the CLI (a development dependency) is not installed, so
|
|
91
|
+
every production install failed with `supatype: not found`. `prepare` is now
|
|
92
|
+
`supatype-prepare`, a command `@supatype/client` installs, which runs `generate` only where the
|
|
93
|
+
CLI is installed, as Prisma's client does with the Prisma CLI. A failing `generate` still fails
|
|
94
|
+
the install. Existing projects `init` is merged into get the same script, and their
|
|
95
|
+
`@supatype/client` is moved into `dependencies` and raised to a release that has the command.
|
|
96
|
+
`init` never picks a client older than itself, and replaces the `prepare` earlier releases
|
|
97
|
+
wrote. A project made before this release keeps that `prepare` until then: set it to
|
|
98
|
+
`supatype-prepare`, and upgrade `@supatype/client` to this release, the first with that command,
|
|
99
|
+
listed in `dependencies`.
|
|
100
|
+
* **dev:** a Ctrl+C sent to the npm package's process alone, as an IDE's stop button sends it, stops
|
|
101
|
+
dev on Linux and macOS, where the starter passes every stop signal on. dev counts the same signal
|
|
102
|
+
twice within half a second as one press, since a Ctrl+C typed in the terminal reaches it both
|
|
103
|
+
from the terminal and from the starter; pressing again to force quit still does.
|
|
104
|
+
* **dev:** one Ctrl+C stops `supatype dev`. Ink took the first one itself and closed the dashboard
|
|
105
|
+
and nothing else, so dev went on running with no screen until a second Ctrl+C.
|
|
106
|
+
* **dev:** the dashboard names what it is waiting on, with a spinner: starting Postgres, applying
|
|
107
|
+
the schema, starting the services (the first start downloads their images), waiting for the
|
|
108
|
+
gateway. It showed the logo over an idle log, sometimes for minutes. Starting the Compose stack
|
|
109
|
+
no longer blocks the screen, so the spinner keeps turning while images download.
|
|
110
|
+
* **init:** a Vite app gets `vite: ^8`, which current `@vitejs/plugin-react` requires (`^6` failed
|
|
111
|
+
the install with ERESOLVE), and a `build: vite build` script, without which nothing produced the
|
|
112
|
+
`./dist` that `app.static_dir` serves. A new project's package.json has `"version": "0.1.0"`.
|
|
113
|
+
* **init:** `.env`'s `SITE_URL`, where auth emails send people back to, is the address a static or
|
|
114
|
+
proxied app is served on (the gateway's port on Docker). It was `http://localhost:3000` for every
|
|
115
|
+
project, where nothing listened.
|
|
116
|
+
* **init:** in an existing package.json, `@supatype/cli` and `@supatype/types` go in
|
|
117
|
+
`devDependencies` as they do for a new project, and the `seed` script runs `supatype seed`. It ran
|
|
118
|
+
`tsx seed.ts`, which loads the seed module without calling it.
|
|
119
|
+
* **functions serve:** a project with `functions/.env.local` serves again. The file was handed to
|
|
120
|
+
Deno as `--env-file <path>`, two arguments, and Deno takes the value only after `=`, so it ran
|
|
121
|
+
`.env.local` as the script and served nothing. `functions new` creates that file, so every project
|
|
122
|
+
that had made a function with it was affected.
|
|
123
|
+
* **dev:** native dev's port-in-use message says which port to move ("Move this project's database
|
|
124
|
+
port with ..."). It read "Move this project's with ...".
|
|
125
|
+
* **dev, functions serve, functions worker:** a function that fails to load answers its own route
|
|
126
|
+
with a 500, `function_load_failed` and why, and every other function keeps serving. A module that
|
|
127
|
+
threw on import, did not parse, or exported no handler stopped the router (or the deployed
|
|
128
|
+
worker) starting, so every function answered 502.
|
|
129
|
+
* **dev:** native dev writes a bucket declared `custom` as not public in the object store's
|
|
130
|
+
`buckets.json`. It copied `public: true` from the declaration, so the store listed a custom
|
|
131
|
+
bucket as public, which the store and the storage service never do.
|
|
132
|
+
* **hooks:** the `beforeChange` scaffold from `supatype hooks new` no longer says the service role
|
|
133
|
+
bypasses hooks. The server fires them for every write through the API, service-role key included;
|
|
134
|
+
only direct SQL, seeds and migrations skip them.
|
|
135
|
+
* **dev:** a blank mailer setting in `.env` no longer erases the one `email` in `supatype.config.ts`
|
|
136
|
+
sets. `init` scaffolds `SUPATYPE_SMTP_HOST=`, `SUPATYPE_RESEND_API_KEY=` and the rest blank, and
|
|
137
|
+
native `dev` applied `.env` over the config, so a project with its SMTP host or Resend key in the
|
|
138
|
+
config got the noop mailer and sent nothing. A value in `.env` still wins over the config.
|
|
139
|
+
|
|
140
|
+
* **app, status, functions serve:** the local gateway address follows `.env`. `app add` printed the
|
|
141
|
+
app URL, `status` the API URL, and `functions serve` gave functions `SUPATYPE_URL`, all on the
|
|
142
|
+
default port 18473 whatever `SUPATYPE_KONG_PORT` said, so after `dev` moved Kong to another port
|
|
143
|
+
they pointed at whichever stack held 18473. They now use `.env`'s `API_EXTERNAL_URL`, else
|
|
144
|
+
`SUPATYPE_KONG_PORT`, as `ctx.publicUrl` already did.
|
|
145
|
+
|
|
146
|
+
* **pull:** a uuid `id` column is drafted as `UUID`. Every one was drafted as `SupatypeAuthUserId`,
|
|
147
|
+
which declares the key to be an auth user's id; telling the two apart needs the schema of a foreign
|
|
148
|
+
key's table, which the engine does not report yet. A drafted model also names its table
|
|
149
|
+
(`tableName`) when its model name would not map back to it, as `HTTPLog` or `Orders` do, so a push
|
|
150
|
+
of the draft does not create a second, empty table.
|
|
151
|
+
|
|
152
|
+
* **plugins:** `plugins add` and `plugins list` no longer claim a plugin is in use. `add` said
|
|
153
|
+
"installed and registered" and `list` showed every compatible plugin as "active", but nothing in
|
|
154
|
+
Supatype loads plugins yet. Both now say the plugin is installed and that it is not loaded.
|
|
155
|
+
|
|
156
|
+
* **functions:** the scaffolded `functions/_shared/context.ts` says where `ctx.env` comes from: the
|
|
157
|
+
functions directory's `.env.local` (or `SUPATYPE_SHARED_ENV_FILE`), then `.env.<function>.local`,
|
|
158
|
+
which wins. It said `.env`, which is never read for it.
|
|
159
|
+
|
|
160
|
+
* **dev, functions serve:** the local functions router loads and guards handlers as the deployed
|
|
161
|
+
worker does. It accepted only `export default`, so a function exporting a named `handler`, which the
|
|
162
|
+
worker serves, failed to load locally; a module with neither answers its own route with an error
|
|
163
|
+
naming it. It also gave every function the service-role key, in `ctx.serviceRoleKey` and in `Deno.env`, where the
|
|
164
|
+
worker takes the key out of the environment before importing any handler and grants it only to the
|
|
165
|
+
routes `functions.serviceRole` lists, and to hooks. The router now does the same, so a function that
|
|
166
|
+
relies on the key without being listed fails locally rather than once deployed. The key is still
|
|
167
|
+
granted after `--watch` reloads the router on a change, however the run before it ended: a function
|
|
168
|
+
that failed to load, an unhandled rejection or a crash no longer leaves every later reload without
|
|
169
|
+
the key until `dev` restarts. The router reads it from a file in `.supatype/`, readable by its owner
|
|
170
|
+
only, rather than from the environment it takes the key out of. The file is removed when `dev` or
|
|
171
|
+
`functions serve` stops, Ctrl+C included, and each `functions serve` has a file of its own.
|
|
172
|
+
|
|
173
|
+
* **dev, functions serve:** native `dev` and `functions serve` run the functions worker the deployed
|
|
174
|
+
image runs (packages/functions-worker), not a router the CLI generated to copy its rules, so the
|
|
175
|
+
two can no longer drift: the copy had already differed on which exports it took, who got the
|
|
176
|
+
service-role key and which env files it read. The CLI carries the worker's source and writes it to
|
|
177
|
+
`~/.supatype/cache/functions-worker/`. Native `dev` now also serves model hooks from `hooks/`, as
|
|
178
|
+
the compose stack does, including in a project with hooks and no functions, and picks up a hook
|
|
179
|
+
added while it runs; `functions serve` picks up a function added while it runs.
|
|
180
|
+
|
|
181
|
+
* **functions:** `ctx.env` reads `.env.local` and `.env.<function>.local` with the CLI's own dotenv
|
|
182
|
+
parser, so `KEY="value"` is `value`, an inline ` # comment` is dropped and `export KEY=` is read,
|
|
183
|
+
as the CLI and compose read a `.env`. The worker kept the quotes and the comment.
|
|
184
|
+
|
|
185
|
+
* **dev (native):** runs the storage service (packages/storage) on this machine instead of the
|
|
186
|
+
server's built-in object store, so bucket rules, `maxSize`, `accept`, `access_mode`, caller rules
|
|
187
|
+
and image transforms are the ones a deployment enforces. Its objects live under
|
|
188
|
+
`~/.supatype/projects/<project>/storage-service/`; the first start imports the buckets and objects
|
|
189
|
+
the server's store held, and each later start imports what changed there since, so what the
|
|
190
|
+
server's store took while the service was down reaches it and an object deleted in the service
|
|
191
|
+
stays deleted. An object the service refuses is skipped and named once. The old files stay for
|
|
192
|
+
one release: the next CLI release removes them and says which, keeping and naming the objects the
|
|
193
|
+
service refused. The service comes
|
|
194
|
+
from a per-platform archive on the CDN (`storage/v<version>/`, signed like every component), or
|
|
195
|
+
`overrides.storage`; its port is `SUPATYPE_STORAGE_PORT` (default 8002). When it cannot start, dev
|
|
196
|
+
says so and the server's store answers as before.
|
|
197
|
+
|
|
198
|
+
* **self-host:** the compose stack serves functions from `functions.path`. The functions worker, the
|
|
199
|
+
server and the control plane were all told `/project/functions` whatever the config said, so a
|
|
200
|
+
project keeping its functions elsewhere had every one answer 404; hooks were likewise fixed at
|
|
201
|
+
`/project/hooks` rather than following `supatype.root`. A `functions.path` or `supatype.root`
|
|
202
|
+
outside the project directory is refused with a message saying why, since the stack mounts only
|
|
203
|
+
the project. `functions deploy` names the real directory instead of a fixed `functions/`.
|
|
204
|
+
|
|
205
|
+
* **dev, self-host, init:** Resend and SES settings reach the auth server. Native `dev` sent them as
|
|
206
|
+
`RESEND_API_KEY`, `RESEND_FROM` and `SES_FROM`, which the server does not read, docker `dev` sent
|
|
207
|
+
none of them, and the self-host compose file had no way to pass them, so `email.provider: "resend"`
|
|
208
|
+
or `"ses"` fell back to the noop mailer and sent nothing. All three now use
|
|
209
|
+
`SUPATYPE_RESEND_API_KEY`, `SUPATYPE_RESEND_FROM` and `SUPATYPE_SES_FROM`, and the compose file
|
|
210
|
+
passes them through from `.env`. `init` scaffolds the email settings under those names too, and
|
|
211
|
+
SMTP's as `SUPATYPE_SMTP_*`; the unprefixed `SMTP_HOST` and the rest it used to write were never
|
|
212
|
+
read either. Rename any of these already in a project's `.env`.
|
|
213
|
+
|
|
214
|
+
* **dev:** magic-link, confirmation, invite and recovery links in native `dev` open the auth
|
|
215
|
+
server's verify endpoint. They pointed at `http://localhost:<port>/verify` and 404'd: the external
|
|
216
|
+
URL ends in `/auth/v1`, and the server's default `/verify` replaced that path rather than adding to
|
|
217
|
+
it. Native `dev` now sets the same `/auth/v1/verify` paths the compose file does.
|
|
218
|
+
|
|
219
|
+
* **migrate:** restoring a migration's schema sources refuses a file that lands beside the project
|
|
220
|
+
under a path starting with the project's own (`/srv/app2/x.ts` for `/srv/app`). The check compared
|
|
221
|
+
string prefixes, so it took that file for one inside the project. The snapshot is now read by the
|
|
222
|
+
same tar reader as `init --example`, so a name with a backslash, a NUL, a leading drive or an
|
|
223
|
+
absolute path is refused too (a backslash was read as a separator), an entry naming the project
|
|
224
|
+
root itself (`./`) is refused rather than failing on write, and a name that only starts with two
|
|
225
|
+
dots (`..notes/x.ts`) is restored rather than refused. The backup taken before a restore copies
|
|
226
|
+
the files the snapshot overwrites, not the paths its manifest lists, which were never checked.
|
|
227
|
+
|
|
228
|
+
* **schema:** an `id: SupatypeAuthUserId` primary key under `create: Owner<"id">` (also inside `Any`
|
|
229
|
+
or `All`) no longer gets a `gen_random_uuid()` default. A random id names no user, and the default
|
|
230
|
+
kept the engine from defaulting the column to the caller, so an insert leaving `id` out was
|
|
231
|
+
refused. Under any other create rule the key keeps its random default, as nothing else fills it.
|
|
232
|
+
The generated `Insert` type leaves `id` optional either way, since the database fills it.
|
|
233
|
+
* **self-host:** `self-host native backup`, `serve`, `reload`, `status`, `logs` and `install-service`
|
|
234
|
+
run their own action with their own options. They were declared as executable subcommands, so
|
|
235
|
+
their options and actions landed on `self-host native` and `self-host`.
|
|
236
|
+
* **seed:** a seed file in a project without `"type": "module"` (a Next.js app) can import
|
|
237
|
+
`@supatype/cli/seed`. The export map had only an `import` condition, and a CommonJS seed failed
|
|
238
|
+
with `ERR_PACKAGE_PATH_NOT_EXPORTED`.
|
|
239
|
+
* **seed:** a failure whose message already carries its remedy (a column the database does not have)
|
|
240
|
+
prints the remedy once, not twice.
|
|
241
|
+
* **init:** a new project depends on `@supatype/client`, pinned like the other packages; the
|
|
242
|
+
generated `supatype/generated/client.ts` imports it.
|
|
243
|
+
* **init:** the wizard does not ask the project name `init <name>` already gave, does not ask for
|
|
244
|
+
production storage when production is decided later, and shows a yes/no prompt's default as `Y/n`
|
|
245
|
+
or `y/N`. `init --mode standalone` leads its next steps with the self-host steps, then local
|
|
246
|
+
development.
|
|
247
|
+
* **app:** `supatype app add` and `app remove` rewrite `supatype.config.ts` at its own indentation and
|
|
248
|
+
keep it valid TypeScript (they wrote `mode: "proxy",,` against init's config, and a comma in a
|
|
249
|
+
comment after the last entry was taken for its separator), and the same for the `server` block
|
|
250
|
+
`supatype add domain` writes. In a dev project they say to restart `supatype dev`, which keeps
|
|
251
|
+
serving the old app until it restarts; in a self-hosted one, to run `self-host compose up -d`, which
|
|
252
|
+
renders the compose file itself.
|
|
253
|
+
* **dev:** "Create an admin user now?" is asked once per project. A "no" is kept in
|
|
254
|
+
`.supatype/admin-prompt.json`, so later starts neither ask nor wait; a run that is not interactive
|
|
255
|
+
was never asked.
|
|
256
|
+
* **security:** a project with no `JWT_SECRET` gets one in `.env` from `dev` or `keys`: the shell's
|
|
257
|
+
when usable, else a generated one. Before, it signed with a published fallback, and the docker dev
|
|
258
|
+
path wrote that fallback into the `.env` a self-host deployment reads. A secret already in `.env`
|
|
259
|
+
is kept, whatever it is. A native dev project that never had one signs with the new secret, so its
|
|
260
|
+
existing sessions sign out once.
|
|
261
|
+
* **push:** on a native dev stack, the service-role key push uses to create storage buckets is the
|
|
262
|
+
project's, from `.env`, as on docker. It was signed with the published dev secret, which a stack
|
|
263
|
+
running with its own `JWT_SECRET` refused with 401.
|
|
264
|
+
* **env:** `.env` is read the way Docker Compose reads it, through one parser: `KEY=x # note` is
|
|
265
|
+
`x`, a quoted value keeps its `#`, `export KEY=` is understood, and the last assignment of a key
|
|
266
|
+
wins. The CLI kept ` # note` in the value and read the first of two assignments, so it could sign
|
|
267
|
+
keys with a secret, or wait on a port, that the stack did not have (F14:
|
|
268
|
+
`SUPATYPE_DEV_DB_PORT` appended a second time was ignored). Updating a key assigned twice leaves
|
|
269
|
+
one line for it.
|
|
270
|
+
* **dev, self-host:** database passwords are encoded in every connection URL the CLI builds. The
|
|
271
|
+
compose file cannot encode them, so the commands that start or recreate containers (`dev` at
|
|
272
|
+
startup, and `self-host compose up`, `render` and `restart`) refuse a `POSTGRES_PASSWORD`,
|
|
273
|
+
`AUTHENTICATOR_PASSWORD` or `SUPATYPE_SQL_EDITOR_PASSWORD` holding a character that breaks a URL,
|
|
274
|
+
naming the variable and how to generate a safe one. Writing the compose file does not check, so
|
|
275
|
+
`update` and the dev watcher never exit over a password an older stack runs with. `push`, `diff`
|
|
276
|
+
and dev's database recovery, which start only the database, print the same message as a warning.
|
|
277
|
+
`self-host compose down`, `status` and `logs` run against the compose file already on disk rather
|
|
278
|
+
than rewriting it from the current config, so such a stack can still be stopped and inspected.
|
|
279
|
+
With no compose file on disk yet they render one, without the check.
|
|
280
|
+
* **self-host:** `self-host compose logs --service <name>` shows that service. The option was
|
|
281
|
+
taken by the hidden native `logs` command, declared in a way that attached its options to
|
|
282
|
+
`self-host` itself, so every service was shown. The other native commands had the same fault.
|
|
283
|
+
* **dev, self-host:** `compose up` failing with "all predefined address pools have been fully
|
|
284
|
+
subnetted" says Docker is out of network addresses, how many Supatype networks there are, and that
|
|
285
|
+
`docker network prune` frees the unused ones.
|
|
286
|
+
* **cli:** running the CLI from a monorepo checkout that has not been built says to run
|
|
287
|
+
`pnpm install && pnpm build` at the repository root, rather than a bare "Cannot find module".
|
|
288
|
+
* **self-host, dev:** storage has no quota and no per-file limit unless `.env` sets one.
|
|
289
|
+
`STORAGE_QUOTA`, `TIER_MAX_UPLOAD_SIZE`, `MAX_UPLOAD_SIZE` (bytes, `-1` for unlimited, the
|
|
290
|
+
default) and `PROJECT_TIER` now reach the storage service, which on its own applied the free
|
|
291
|
+
tier's 1 GiB quota and 50 MB file limit to every self-hosted and local project.
|
|
292
|
+
* **dev, push, self-host:** `DATABASE_URL` follows a database port exported in the shell
|
|
293
|
+
(`SUPATYPE_DEV_DB_PORT`, or `SUPATYPE_DB_PORT` for a self-host stack). Compose binds the shell's
|
|
294
|
+
port, and the URL was reconciled against `.env` alone, so seeds and host-side commands reached a
|
|
295
|
+
port nothing listened on. The shell's port is the run's: the URL changes for that run and `.env`
|
|
296
|
+
keeps its own.
|
|
297
|
+
* **dev, self-host:** a project moved from native dev to Docker routes realtime and functions to the
|
|
298
|
+
stack's own services. The compose render left native's `realtime_url` (a host port) in
|
|
299
|
+
`.supatype/manifest.json`, so every realtime request answered 502.
|
|
300
|
+
* **dev:** native dev routes functions to the Deno the server runs. It kept the
|
|
301
|
+
`functions-worker:8001` URL `init` writes for the compose stack, so every function answered 502
|
|
302
|
+
with "lookup functions-worker: no such host".
|
|
303
|
+
* **dev:** native dev checks the port functions run on (8001, or `SUPATYPE_DENO_PORT`) before it
|
|
304
|
+
starts, as it does Postgres, the server, PostgREST and realtime, and stops naming the variable
|
|
305
|
+
that moves it. With the port taken, Deno failed after the stack was up and every function
|
|
306
|
+
answered 502. The port checked is the port the server gets: an exported `SUPATYPE_DENO_PORT`,
|
|
307
|
+
else the one in `.env.local` or `.env`, else 8001. A blank `SUPATYPE_DENO_PORT=` in `.env` leaves
|
|
308
|
+
8001 rather than reaching the server as an empty port.
|
|
309
|
+
* **update:** `supatype update` exits 1 naming each component it could not fetch. A run where every
|
|
310
|
+
download failed ended on "All components are up to date." with exit 0, and a pinned version was
|
|
311
|
+
written into `supatype.config.ts` even when its download had failed.
|
|
312
|
+
* **init:** `supatype init` uses an exported `SUPATYPE_KONG_PORT` as the project's gateway port, in
|
|
313
|
+
`.env` and in what it prints, and the wizard does not ask for one. It chose its own port, so `.env`
|
|
314
|
+
and the "API on" line named a port the stack, which binds the shell's, never listened on.
|
|
315
|
+
|
|
316
|
+
|
|
3
317
|
## 0.7.0
|
|
4
318
|
|
|
5
319
|
Highlights: `adopt` takes what a push refuses, with `--key`, `--release` and `--reclaim`, and
|
package/bin/supatype.js
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { existsSync } from "node:fs"
|
|
3
|
+
import { fileURLToPath } from "node:url"
|
|
4
|
+
|
|
5
|
+
// Installed from npm, this file sits under a `node_modules` directory and starts the compiled
|
|
6
|
+
// program for this machine (dist/cli-launcher.js says why). In the monorepo it runs the CLI's
|
|
7
|
+
// JavaScript, which is what the CLI's own tests and a workspace link exercise. Node reports this
|
|
8
|
+
// file's real path, so a workspace package linked into an app's node_modules still counts as the
|
|
9
|
+
// monorepo. A copy kept outside node_modules (Deno's npm cache, a vendored copy) counts as installed
|
|
10
|
+
// too: the JavaScript's own dependencies are development-only, so it could not run there.
|
|
11
|
+
function hasJavaScriptDependencies() {
|
|
12
|
+
try {
|
|
13
|
+
import.meta.resolve("commander")
|
|
14
|
+
return true
|
|
15
|
+
} catch {
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const installed = fileURLToPath(import.meta.url).split(/[\\/]/).includes("node_modules") || !hasJavaScriptDependencies()
|
|
20
|
+
const cli = new URL(installed ? "../dist/cli-launcher.js" : "../dist/cli.js", import.meta.url)
|
|
21
|
+
|
|
22
|
+
// A fresh clone of the monorepo has no dist until its first build. Only that case gets the hint:
|
|
23
|
+
// a module missing from inside a built dist is reported as it is.
|
|
24
|
+
function unbuilt(e) {
|
|
25
|
+
return e?.code === "ERR_MODULE_NOT_FOUND" && !existsSync(fileURLToPath(cli))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
import(cli.href)
|
|
29
|
+
.catch((e) => {
|
|
30
|
+
if (!unbuilt(e)) throw e
|
|
31
|
+
console.error(
|
|
32
|
+
"The Supatype CLI has not been built: dist/cli.js is missing.\n" +
|
|
33
|
+
"Run `pnpm install && pnpm build` at the repository root, then try again.",
|
|
34
|
+
)
|
|
35
|
+
process.exit(1)
|
|
36
|
+
})
|
|
37
|
+
.then((m) => m.run())
|
|
38
|
+
.catch((e) => {
|
|
39
|
+
console.error(e?.message ?? e)
|
|
40
|
+
process.exit(1)
|
|
41
|
+
})
|
package/deno.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare namespace Deno {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* The slice of Node's async_hooks
|
|
55
|
+
* The slice of Node's async_hooks a function may use. Deno provides the module at runtime;
|
|
56
56
|
* a functions tsconfig loads no Node types, so without it the import resolves to nothing.
|
|
57
57
|
*/
|
|
58
58
|
declare module "node:async_hooks" {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this project has already been asked to create its first admin.
|
|
3
|
+
*
|
|
4
|
+
* `supatype dev` asks "Create an admin user now?" when a project has no admin, and it asked on every
|
|
5
|
+
* start of a project whose owner had said no, waiting each time. The answer is kept in the project's
|
|
6
|
+
* `.supatype/` directory (gitignored, so it is one developer's answer, not the team's), and a "no"
|
|
7
|
+
* is not asked again. `supatype admin create-user` creates one at any time.
|
|
8
|
+
*/
|
|
9
|
+
/** True when the first-admin prompt was answered "no" in this project. */
|
|
10
|
+
export declare function adminPromptDeclined(cwd: string): boolean;
|
|
11
|
+
/** Keep the "no", so the prompt is not asked again. Best effort: failing to write only means it asks again. */
|
|
12
|
+
export declare function recordAdminPromptDeclined(cwd: string): void;
|
|
13
|
+
//# sourceMappingURL=admin-prompt-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-prompt-state.d.ts","sourceRoot":"","sources":["../src/admin-prompt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,+GAA+G;AAC/G,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ3D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this project has already been asked to create its first admin.
|
|
3
|
+
*
|
|
4
|
+
* `supatype dev` asks "Create an admin user now?" when a project has no admin, and it asked on every
|
|
5
|
+
* start of a project whose owner had said no, waiting each time. The answer is kept in the project's
|
|
6
|
+
* `.supatype/` directory (gitignored, so it is one developer's answer, not the team's), and a "no"
|
|
7
|
+
* is not asked again. `supatype admin create-user` creates one at any time.
|
|
8
|
+
*/
|
|
9
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { readJsonObjectFile } from "./json-file.js";
|
|
12
|
+
function statePath(cwd) {
|
|
13
|
+
return join(cwd, ".supatype", "admin-prompt.json");
|
|
14
|
+
}
|
|
15
|
+
/** True when the first-admin prompt was answered "no" in this project. */
|
|
16
|
+
export function adminPromptDeclined(cwd) {
|
|
17
|
+
return readJsonObjectFile(statePath(cwd))?.["declined"] === true;
|
|
18
|
+
}
|
|
19
|
+
/** Keep the "no", so the prompt is not asked again. Best effort: failing to write only means it asks again. */
|
|
20
|
+
export function recordAdminPromptDeclined(cwd) {
|
|
21
|
+
const path = statePath(cwd);
|
|
22
|
+
try {
|
|
23
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
24
|
+
writeFileSync(path, `${JSON.stringify({ declined: true })}\n`);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// Not worth failing a dev start over: the cost is one more question.
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=admin-prompt-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-prompt-state.js","sourceRoot":"","sources":["../src/admin-prompt-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAA;AACpD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;AAClE,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;IAC3B,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7C,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,CAAA;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;IACvE,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt-columns.d.ts","sourceRoot":"","sources":["../src/adopt-columns.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"adopt-columns.d.ts","sourceRoot":"","sources":["../src/adopt-columns.ts"],"names":[],"mappings":"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"}
|
package/dist/adopt-columns.js
CHANGED
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
* CLI did not leave as it wrote it is never put back: an edit made meanwhile is the person's.
|
|
17
17
|
*/
|
|
18
18
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
19
|
-
import {
|
|
19
|
+
import { normalize, relative } from "node:path";
|
|
20
20
|
import { Node, Project, ts } from "ts-morph";
|
|
21
21
|
import { extractSchemaAstFromTypes, walkSchemaSourceAbsPaths } from "./type-extractor.js";
|
|
22
|
-
import { isJsonObject, keptName } from "@supatype/shared";
|
|
22
|
+
import { isJsonObject, keptName, pathInside, toPosixPath } from "@supatype/shared";
|
|
23
23
|
import { objectAt } from "./ast-read.js";
|
|
24
24
|
import { isDbColumnState } from "./engine-answers.js";
|
|
25
|
+
import { errorMessage } from "./error-message.js";
|
|
25
26
|
const TYPES_MODULE = "@supatype/types";
|
|
26
27
|
/** Why a column the database fills cannot be declared as one where the engine cannot read it. */
|
|
27
28
|
const NO_IDENTITY_COLUMNS = "this engine does not support identity and generated columns; update it, or declare the column by hand";
|
|
@@ -213,8 +214,8 @@ export function planColumnDeclaration(input) {
|
|
|
213
214
|
}
|
|
214
215
|
catch (err) {
|
|
215
216
|
if (input.live === undefined)
|
|
216
|
-
return manual(`the schema could not be read (${
|
|
217
|
-
return withCanonicalLine(manual(`the schema could not be read (${
|
|
217
|
+
return manual(`the schema could not be read (${errorMessage(err)})`);
|
|
218
|
+
return withCanonicalLine(manual(`the schema could not be read (${errorMessage(err)})`), input.live, input.identityColumns);
|
|
218
219
|
}
|
|
219
220
|
// Declared already (adopting a table hands over its declared columns too): nothing to add.
|
|
220
221
|
const declaring = modelsWithTable(ast, table).filter((m) => declaresColumn(m, column));
|
|
@@ -323,7 +324,7 @@ export function applyColumnDeclaration(plan, entryPath, cwd) {
|
|
|
323
324
|
}
|
|
324
325
|
catch (err) {
|
|
325
326
|
// Nothing of ours is known to be in it: a failed write is not undone over whatever is there.
|
|
326
|
-
return manual(`the file could not be written (${
|
|
327
|
+
return manual(`the file could not be written (${errorMessage(err)})`);
|
|
327
328
|
}
|
|
328
329
|
const problem = verify(plan, entryPath, cwd);
|
|
329
330
|
return problem === undefined ? plan : undo(`the edited schema did not read back as planned (${problem})`);
|
|
@@ -340,7 +341,7 @@ function verify(plan, entryPath, cwd) {
|
|
|
340
341
|
ast = extractSchemaAstFromTypes(entryPath, cwd);
|
|
341
342
|
}
|
|
342
343
|
catch (err) {
|
|
343
|
-
return
|
|
344
|
+
return errorMessage(err);
|
|
344
345
|
}
|
|
345
346
|
const models = modelsWithTable(ast, plan.table);
|
|
346
347
|
if (models.length !== 1 || models[0].name !== plan.model)
|
|
@@ -355,7 +356,7 @@ const DUPLICATE_CODES = new Set([2300, 2440, 2395]);
|
|
|
355
356
|
/** The first "duplicate identifier" kind of error in `text`, checked as one file on its own. */
|
|
356
357
|
function duplicateIdentifier(path, text) {
|
|
357
358
|
// The compiler host asks for files by forward-slash names on every platform.
|
|
358
|
-
const fileName = path
|
|
359
|
+
const fileName = toPosixPath(path);
|
|
359
360
|
const options = { noLib: true, noResolve: true, types: [], noEmit: true };
|
|
360
361
|
const host = ts.createCompilerHost(options);
|
|
361
362
|
const source = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
|
|
@@ -405,7 +406,7 @@ function findModelDeclaration(entryPath, modelName) {
|
|
|
405
406
|
paths = walkSchemaSourceAbsPaths(entryPath);
|
|
406
407
|
}
|
|
407
408
|
catch (err) {
|
|
408
|
-
return { reason: `the schema files could not be read (${
|
|
409
|
+
return { reason: `the schema files could not be read (${errorMessage(err)})` };
|
|
409
410
|
}
|
|
410
411
|
const project = new Project({ useInMemoryFileSystem: false, skipAddingFilesFromTsConfig: true });
|
|
411
412
|
const declarations = [];
|
|
@@ -585,9 +586,6 @@ function declaredLocally(sourceFile, name) {
|
|
|
585
586
|
function relativeName(sourceFile) {
|
|
586
587
|
return relative(process.cwd(), sourceFile.getFilePath()) || sourceFile.getFilePath();
|
|
587
588
|
}
|
|
588
|
-
function messageOf(err) {
|
|
589
|
-
return err instanceof Error ? err.message : String(err);
|
|
590
|
-
}
|
|
591
589
|
// ─── Before adopt ──────────────────────────────────────────────────────────────
|
|
592
590
|
/** `column:<table>.<name>`, as `--key` names a column; undefined for any other key. */
|
|
593
591
|
export function parseColumnKey(key) {
|
|
@@ -618,7 +616,7 @@ export async function previewKeyedColumns(keys, shown, opts, deps) {
|
|
|
618
616
|
live = liveColumns(await deps.introspect());
|
|
619
617
|
}
|
|
620
618
|
catch (err) {
|
|
621
|
-
unread =
|
|
619
|
+
unread = errorMessage(err);
|
|
622
620
|
}
|
|
623
621
|
return columns.map(({ table, column }) => {
|
|
624
622
|
const head = `column ${table}.${column}: record as managed by Supatype`;
|
|
@@ -665,7 +663,7 @@ export async function declareAdoptedColumns(adopted, opts, deps) {
|
|
|
665
663
|
live = liveColumns(await deps.introspect());
|
|
666
664
|
}
|
|
667
665
|
catch (err) {
|
|
668
|
-
deps.say.warn(`Could not read the adopted column(s) from the database: ${
|
|
666
|
+
deps.say.warn(`Could not read the adopted column(s) from the database: ${errorMessage(err)}`);
|
|
669
667
|
}
|
|
670
668
|
const results = [];
|
|
671
669
|
for (const item of columns) {
|
|
@@ -702,7 +700,7 @@ export async function declareAdoptedColumns(adopted, opts, deps) {
|
|
|
702
700
|
deps.say.info(message);
|
|
703
701
|
}
|
|
704
702
|
catch (err) {
|
|
705
|
-
deps.say.warn(`Types were not regenerated (${
|
|
703
|
+
deps.say.warn(`Types were not regenerated (${errorMessage(err)}); run \`supatype generate\`.`);
|
|
706
704
|
}
|
|
707
705
|
const names = declared.map((d) => `${d.table}.${d.column}`).join(", ");
|
|
708
706
|
deps.say.plain(`The next \`supatype push\` treats ${names} as declared field(s).`);
|
|
@@ -782,8 +780,6 @@ function liveColumns(state) {
|
|
|
782
780
|
* a schema import names it; otherwise the platform's own absolute path.
|
|
783
781
|
*/
|
|
784
782
|
function displayPath(file, cwd) {
|
|
785
|
-
|
|
786
|
-
// On another drive `relative` answers the absolute path itself.
|
|
787
|
-
return rel === "" || rel.startsWith("..") || isAbsolute(rel) ? file : rel.split(sep).join("/");
|
|
783
|
+
return pathInside(cwd, file) ? toPosixPath(relative(cwd, file)) : file;
|
|
788
784
|
}
|
|
789
785
|
//# sourceMappingURL=adopt-columns.js.map
|