@supatype/cli 0.1.6 → 0.1.9
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +152 -102
- package/.turbo/turbo-typecheck.log +1 -1
- package/LICENSE +202 -0
- package/deno.d.ts +52 -0
- package/dist/app/framework.js +1 -1
- package/dist/app/framework.js.map +1 -1
- package/dist/augmentation-generator.d.ts +22 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +19 -5
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/binary-cache.d.ts +42 -6
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +76 -44
- package/dist/binary-cache.js.map +1 -1
- package/dist/cache-clean.d.ts +15 -0
- package/dist/cache-clean.d.ts.map +1 -0
- package/dist/cache-clean.js +76 -0
- package/dist/cache-clean.js.map +1 -0
- package/dist/cache-pins.d.ts +51 -0
- package/dist/cache-pins.d.ts.map +1 -0
- package/dist/cache-pins.js +184 -0
- package/dist/cache-pins.js.map +1 -0
- package/dist/cli-artifacts.d.ts +32 -0
- package/dist/cli-artifacts.d.ts.map +1 -0
- package/dist/cli-artifacts.js +49 -0
- package/dist/cli-artifacts.js.map +1 -0
- package/dist/cli-install-method.d.ts +27 -0
- package/dist/cli-install-method.d.ts.map +1 -0
- package/dist/cli-install-method.js +78 -0
- package/dist/cli-install-method.js.map +1 -0
- package/dist/cli-package-version.d.ts +1 -1
- package/dist/cli-package-version.d.ts.map +1 -1
- package/dist/cli-package-version.js +6 -1
- package/dist/cli-package-version.js.map +1 -1
- package/dist/cli-standalone.d.ts +13 -4
- package/dist/cli-standalone.d.ts.map +1 -1
- package/dist/cli-standalone.js +86 -31
- package/dist/cli-standalone.js.map +1 -1
- package/dist/cli-version-embedded.d.ts +10 -0
- package/dist/cli-version-embedded.d.ts.map +1 -0
- package/dist/cli-version-embedded.js +13 -0
- package/dist/cli-version-embedded.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/dist/cloud-credentials.d.ts +34 -0
- package/dist/cloud-credentials.d.ts.map +1 -0
- package/dist/cloud-credentials.js +139 -0
- package/dist/cloud-credentials.js.map +1 -0
- package/dist/commands/add.js +1 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/admin.d.ts +11 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +123 -21
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/adopt.js +1 -1
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/app.js +2 -2
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cache.d.ts +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +69 -73
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.d.ts.map +1 -1
- package/dist/commands/cloud.js +32 -8
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts +3 -2
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +149 -3
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +9 -9
- package/dist/commands/deploy.js +12 -12
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +3 -3
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +63 -23
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +28 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +60 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/engine.d.ts +1 -1
- package/dist/commands/engine.js +1 -1
- package/dist/commands/functions.d.ts +7 -0
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +45 -11
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +5 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/hooks.d.ts +12 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +118 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +64 -30
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts +6 -0
- package/dist/commands/internal.d.ts.map +1 -0
- package/dist/commands/internal.js +22 -0
- package/dist/commands/internal.js.map +1 -0
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +8 -2
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/login.d.ts +7 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +110 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logs.d.ts +1 -1
- package/dist/commands/migrate.js +5 -5
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pg.d.ts +1 -1
- package/dist/commands/pg.js +1 -1
- package/dist/commands/plugins.js +1 -1
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/pull.js +2 -2
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +110 -7
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/self-host.d.ts +1 -1
- package/dist/commands/self-host.js +1 -1
- package/dist/commands/self-update.d.ts +3 -2
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +31 -16
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/update.d.ts +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -4
- package/dist/config.js.map +1 -1
- package/dist/db-preflight.d.ts +78 -0
- package/dist/db-preflight.d.ts.map +1 -0
- package/dist/db-preflight.js +452 -0
- package/dist/db-preflight.js.map +1 -0
- package/dist/dev-compose.d.ts +4 -4
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +143 -88
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-log-filter.d.ts +1 -1
- package/dist/dev-log-filter.d.ts.map +1 -1
- package/dist/dev-log-filter.js +1 -1
- package/dist/dev-log-filter.js.map +1 -1
- package/dist/dev-ports.d.ts +2 -2
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +2 -2
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-session.d.ts +5 -5
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +6 -6
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +5 -5
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +7 -7
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/dev-task-colors.d.ts +1 -1
- package/dist/dev-task-colors.d.ts.map +1 -1
- package/dist/dev-task-colors.js +1 -1
- package/dist/dev-task-colors.js.map +1 -1
- package/dist/docker-postgres.d.ts +5 -5
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +5 -5
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +2 -2
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +5 -5
- package/dist/docker-runtime.js.map +1 -1
- package/dist/engine-client.d.ts +1 -1
- package/dist/engine-client.js +3 -3
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-push-output.js +1 -1
- package/dist/engine-push-output.js.map +1 -1
- package/dist/ensure-binary.d.ts.map +1 -1
- package/dist/ensure-binary.js +17 -0
- package/dist/ensure-binary.js.map +1 -1
- package/dist/ensure-component-binaries.js +1 -1
- package/dist/ensure-component-binaries.js.map +1 -1
- package/dist/env-file.d.ts +40 -2
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +132 -11
- package/dist/env-file.js.map +1 -1
- package/dist/field-masking-tier.d.ts +50 -0
- package/dist/field-masking-tier.d.ts.map +1 -0
- package/dist/field-masking-tier.js +91 -0
- package/dist/field-masking-tier.js.map +1 -0
- package/dist/functions-deno-types.d.ts +24 -0
- package/dist/functions-deno-types.d.ts.map +1 -0
- package/dist/functions-deno-types.js +155 -0
- package/dist/functions-deno-types.js.map +1 -0
- package/dist/functions-router-gen.js +1 -1
- package/dist/gitignore.d.ts +2 -2
- package/dist/gitignore.d.ts.map +1 -1
- package/dist/gitignore.js +3 -3
- package/dist/gitignore.js.map +1 -1
- package/dist/hook-upload.d.ts +30 -0
- package/dist/hook-upload.d.ts.map +1 -0
- package/dist/hook-upload.js +86 -0
- package/dist/hook-upload.js.map +1 -0
- package/dist/hooks-generator.d.ts +8 -0
- package/dist/hooks-generator.d.ts.map +1 -0
- package/dist/hooks-generator.js +332 -0
- package/dist/hooks-generator.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/init-project-detect.d.ts +1 -1
- package/dist/init-project-detect.d.ts.map +1 -1
- package/dist/init-project-detect.js +1 -1
- package/dist/init-project-detect.js.map +1 -1
- package/dist/link.d.ts +4 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +2 -0
- package/dist/link.js.map +1 -1
- package/dist/local-secrets.d.ts +71 -0
- package/dist/local-secrets.d.ts.map +1 -0
- package/dist/local-secrets.js +100 -0
- package/dist/local-secrets.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +20 -0
- package/dist/main.js.map +1 -0
- package/dist/model-hooks.d.ts +73 -0
- package/dist/model-hooks.d.ts.map +1 -0
- package/dist/model-hooks.js +211 -0
- package/dist/model-hooks.js.map +1 -0
- package/dist/pgbouncer-userlist.d.ts +1 -1
- package/dist/pgbouncer-userlist.d.ts.map +1 -1
- package/dist/pgbouncer-userlist.js +2 -2
- package/dist/pgbouncer-userlist.js.map +1 -1
- package/dist/postgres-ctl.d.ts +12 -1
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +28 -5
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/process-manager.d.ts +2 -2
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +4 -4
- package/dist/process-manager.js.map +1 -1
- package/dist/project-config.d.ts +122 -2
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +150 -1
- package/dist/project-config.js.map +1 -1
- package/dist/pull-utils.d.ts +2 -2
- package/dist/pull-utils.d.ts.map +1 -1
- package/dist/pull-utils.js +4 -4
- package/dist/pull-utils.js.map +1 -1
- package/dist/realtime-launch.js +1 -1
- package/dist/realtime-launch.js.map +1 -1
- package/dist/release-pins.d.ts +1 -1
- package/dist/release-pins.js +2 -2
- package/dist/release-pins.js.map +1 -1
- package/dist/resolve-api-url.js +1 -1
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +4 -0
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +69 -73
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-cache-admin.js +2 -2
- package/dist/rest-cache-admin.js.map +1 -1
- package/dist/runtime-routes.d.ts +1 -1
- package/dist/runtime-routes.js +1 -1
- package/dist/schema-ast-v2.d.ts +5 -4
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js +5 -3
- 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 +43 -16
- package/dist/schema-push-lock.js.map +1 -1
- package/dist/scripts/postinstall.d.ts +1 -1
- package/dist/scripts/postinstall.js +1 -1
- package/dist/self-host-compose.d.ts +26 -2
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +305 -73
- package/dist/self-host-compose.js.map +1 -1
- package/dist/service-role-check.d.ts +21 -0
- package/dist/service-role-check.d.ts.map +1 -0
- package/dist/service-role-check.js +85 -0
- package/dist/service-role-check.js.map +1 -0
- package/dist/storage-provision.d.ts +1 -1
- package/dist/storage-provision.js +3 -3
- package/dist/storage-provision.js.map +1 -1
- package/dist/studio-dev-server.d.ts +1 -1
- package/dist/studio-dev-server.d.ts.map +1 -1
- package/dist/systemd.d.ts +1 -1
- package/dist/systemd.js +1 -1
- package/dist/target-client.d.ts +17 -0
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +69 -17
- package/dist/target-client.js.map +1 -1
- package/dist/tsx-runner.js +1 -1
- package/dist/tsx-runner.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +738 -34
- package/dist/type-extractor.js.map +1 -1
- package/dist/type-resolver.js +1 -1
- package/dist/type-resolver.js.map +1 -1
- package/dist/ui/brand.d.ts +1 -1
- package/dist/ui/brand.js +1 -1
- package/dist/ui/components/LogoWordmark.d.ts +1 -1
- package/dist/ui/components/LogoWordmark.d.ts.map +1 -1
- package/dist/ui/components/LogoWordmark.js +1 -1
- package/dist/ui/components/LogoWordmark.js.map +1 -1
- package/dist/ui/components/SelectField.js +1 -1
- package/dist/ui/components/SelectField.js.map +1 -1
- package/dist/ui/confirm.d.ts +1 -1
- package/dist/ui/confirm.js +1 -1
- package/dist/ui/fatal.d.ts +1 -1
- package/dist/ui/fatal.d.ts.map +1 -1
- package/dist/ui/fatal.js +1 -1
- package/dist/ui/fatal.js.map +1 -1
- package/dist/ui/flows/prompt-fields.js +1 -1
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/interactive.d.ts +1 -1
- package/dist/ui/interactive.d.ts.map +1 -1
- package/dist/ui/interactive.js +1 -1
- package/dist/ui/interactive.js.map +1 -1
- package/dist/ui/progress.d.ts +1 -1
- package/dist/ui/progress.js +1 -1
- package/dist/ui/runtime/command-chrome.js +2 -2
- package/dist/ui/runtime/command-chrome.js.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +1 -1
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.js +4 -2
- package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
- package/dist/ui/theme.d.ts +1 -1
- package/dist/ui/theme.js +1 -1
- package/dist/valkey-sidecar.d.ts +1 -1
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +2 -2
- package/dist/valkey-sidecar.js.map +1 -1
- package/package.json +6 -2
- package/scripts/build-release-artifacts.sh +112 -0
- package/scripts/generate-homebrew-formula.mjs +123 -0
- package/scripts/mirror-deno-release.sh +1 -1
- package/src/TYPE-RESOLUTION.md +31 -31
- package/src/app/framework.ts +1 -1
- package/src/augmentation-generator.ts +19 -6
- package/src/binary-cache.ts +94 -47
- package/src/cache-clean.ts +81 -0
- package/src/cache-pins.ts +243 -0
- package/src/cli-artifacts.ts +65 -0
- package/src/cli-install-method.ts +87 -0
- package/src/cli-package-version.ts +5 -1
- package/src/cli-standalone.ts +116 -34
- package/src/cli-version-embedded.ts +12 -0
- package/src/cli.ts +7 -1
- package/src/cloud-credentials.ts +183 -0
- package/src/commands/add.ts +1 -1
- package/src/commands/admin.ts +142 -27
- package/src/commands/adopt.ts +1 -1
- package/src/commands/app.ts +2 -2
- package/src/commands/cache.ts +92 -77
- package/src/commands/cloud.ts +32 -8
- package/src/commands/db.ts +164 -3
- package/src/commands/deploy.ts +12 -12
- package/src/commands/dev.ts +72 -23
- package/src/commands/doctor.ts +69 -3
- package/src/commands/engine.ts +1 -1
- package/src/commands/functions.ts +47 -10
- package/src/commands/generate.ts +5 -1
- package/src/commands/hooks.ts +138 -0
- package/src/commands/init.ts +65 -31
- package/src/commands/internal.ts +23 -0
- package/src/commands/link-helpers.ts +9 -2
- package/src/commands/login.ts +127 -0
- package/src/commands/logs.ts +1 -1
- package/src/commands/migrate.ts +5 -5
- package/src/commands/pg.ts +1 -1
- package/src/commands/plugins.ts +1 -1
- package/src/commands/pull.ts +2 -2
- package/src/commands/push.ts +124 -7
- package/src/commands/self-host.ts +1 -1
- package/src/commands/self-update.ts +41 -19
- package/src/commands/status.ts +1 -1
- package/src/commands/update.ts +1 -1
- package/src/config.ts +23 -4
- package/src/db-preflight.ts +575 -0
- package/src/dev-compose.ts +158 -89
- package/src/dev-log-filter.ts +1 -1
- package/src/dev-ports.ts +3 -3
- package/src/dev-session.ts +6 -6
- package/src/dev-shutdown.ts +8 -8
- package/src/dev-task-colors.ts +1 -1
- package/src/docker-postgres.ts +6 -6
- package/src/docker-runtime.ts +5 -5
- package/src/engine-client.ts +3 -3
- package/src/engine-push-output.ts +1 -1
- package/src/ensure-binary.ts +20 -0
- package/src/ensure-component-binaries.ts +1 -1
- package/src/env-file.ts +157 -11
- package/src/field-masking-tier.ts +107 -0
- package/src/functions-deno-types.ts +188 -0
- package/src/functions-router-gen.ts +1 -1
- package/src/gitignore.ts +3 -3
- package/src/hook-upload.ts +107 -0
- package/src/hooks-generator.ts +352 -0
- package/src/index.ts +1 -1
- package/src/init-project-detect.ts +1 -1
- package/src/link.ts +7 -0
- package/src/local-secrets.ts +104 -0
- package/src/main.ts +20 -0
- package/src/model-hooks.ts +260 -0
- package/src/pgbouncer-userlist.ts +2 -2
- package/src/postgres-ctl.ts +32 -5
- package/src/process-manager.ts +4 -4
- package/src/project-config.ts +237 -3
- package/src/pull-utils.ts +4 -4
- package/src/realtime-launch.ts +1 -1
- package/src/release-pins.ts +2 -2
- package/src/resolve-api-url.ts +1 -1
- package/src/resolve-target.ts +113 -68
- package/src/rest-cache-admin.ts +2 -2
- package/src/runtime-routes.ts +2 -2
- package/src/schema-ast-v2.ts +8 -5
- package/src/schema-push-lock.ts +56 -17
- package/src/scripts/postinstall.ts +1 -1
- package/src/self-host-compose.ts +348 -72
- package/src/service-role-check.ts +111 -0
- package/src/storage-provision.ts +3 -3
- package/src/studio-dev-server.ts +1 -1
- package/src/systemd.ts +1 -1
- package/src/target-client.ts +105 -18
- package/src/tsx-runner.ts +1 -1
- package/src/type-extractor.ts +885 -30
- package/src/type-resolver.ts +1 -1
- package/src/ui/README.md +1 -1
- package/src/ui/brand.ts +1 -1
- package/src/ui/components/LogoWordmark.tsx +1 -1
- package/src/ui/components/SelectField.tsx +1 -1
- package/src/ui/confirm.ts +1 -1
- package/src/ui/fatal.ts +1 -1
- package/src/ui/flows/prompt-fields.tsx +1 -1
- package/src/ui/interactive.ts +1 -1
- package/src/ui/progress.ts +1 -1
- package/src/ui/runtime/command-chrome.ts +2 -2
- package/src/ui/runtime/run-clack-flow.tsx +1 -1
- package/src/ui/runtime/stdin-after-ink.ts +4 -2
- package/src/ui/theme.ts +1 -1
- package/src/valkey-sidecar.ts +2 -2
- package/tests/access-composition.test.ts +667 -0
- package/tests/admin-studio-membership.test.ts +121 -0
- package/tests/api-schemas.test.ts +83 -0
- package/tests/archive-name-alias.test.ts +42 -0
- package/tests/augmentation-generator.test.ts +28 -0
- package/tests/cache-clean.test.ts +206 -0
- package/tests/cli-help.test.ts +11 -2
- package/tests/cli-install-method.test.ts +66 -0
- package/tests/command-chrome-coverage.test.ts +31 -26
- package/tests/command-chrome-wrap.test.ts +1 -0
- package/tests/db-preflight.test.ts +72 -0
- package/tests/doctor-render.test.ts +62 -0
- package/tests/doctor-service-role.test.ts +55 -0
- package/tests/engine-push-output.test.ts +1 -1
- package/tests/env-file.test.ts +121 -0
- package/tests/external-database-compose.test.ts +184 -0
- package/tests/external-database-config.test.ts +154 -0
- package/tests/field-masking-tier.test.ts +184 -0
- package/tests/functions-deno-types.test.ts +197 -0
- package/tests/homebrew-formula.test.ts +100 -0
- package/tests/hook-upload.test.ts +125 -0
- package/tests/hooks-generator.test.ts +212 -0
- package/tests/init.test.ts +5 -2
- package/tests/keys.test.ts +8 -2
- package/tests/local-secrets.test.ts +92 -0
- package/tests/model-hooks.test.ts +322 -0
- package/tests/runtime-contract.test.ts +113 -1
- package/tests/service-role-check.test.ts +109 -0
- package/tests/service-role-routes.test.ts +51 -0
- package/tests/storage-provision.test.ts +1 -1
- package/tests/target-client-refresh.test.ts +94 -0
- package/tests/type-extractor.test.ts +187 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +7 -1
- package/scripts/build-release-bundle.mjs +0 -27
- package/tests/engine-distribution.test.ts +0 -418
package/src/commands/init.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Command } from "commander"
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"
|
|
3
3
|
import { resolve, join, basename } from "node:path"
|
|
4
4
|
import { spawnSync } from "node:child_process"
|
|
5
|
+
import { randomBytes } from "node:crypto"
|
|
5
6
|
import { p, runClackFlow } from "../ui/clack.js"
|
|
6
7
|
import { ensureNotCancelled } from "../ui/prompts.js"
|
|
7
8
|
import { generateAndWriteKeys } from "./keys.js"
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
ensureComponentBinaries,
|
|
14
15
|
reportComponentBinaryFailures,
|
|
15
16
|
} from "../ensure-component-binaries.js"
|
|
17
|
+
import { ensureFunctionsDenoTypes } from "../functions-deno-types.js"
|
|
16
18
|
import { mergeSupatypePackageJson } from "../init-package-json.js"
|
|
17
19
|
import { cliPackageVersion } from "../cli-package-version.js"
|
|
18
20
|
import {
|
|
@@ -246,7 +248,7 @@ interface InteractiveInitArgs {
|
|
|
246
248
|
opts: InitCliOptions
|
|
247
249
|
}
|
|
248
250
|
|
|
249
|
-
/** Interactive init
|
|
251
|
+
/** Interactive init: one Ink session for wizard + scaffold + install + finish. */
|
|
250
252
|
async function runInteractiveInit(args: InteractiveInitArgs): Promise<void> {
|
|
251
253
|
const { name, dir, defaultName, modeTarget, opts } = args
|
|
252
254
|
|
|
@@ -499,7 +501,7 @@ async function promptAdminUser(): Promise<{ adminEmail?: string; adminPassword?:
|
|
|
499
501
|
)
|
|
500
502
|
if (!createAdmin) return {}
|
|
501
503
|
|
|
502
|
-
p.note("First sign-in at /admin
|
|
504
|
+
p.note("First sign-in at /admin, created automatically on supatype dev or push.")
|
|
503
505
|
|
|
504
506
|
const adminEmail = ensureNotCancelled(
|
|
505
507
|
await p.text({
|
|
@@ -684,7 +686,7 @@ export function scaffold(
|
|
|
684
686
|
writeFileSync(pkgPath, `${JSON.stringify(merged, null, 2)}\n`, "utf8")
|
|
685
687
|
file("updated", "package.json (added Supatype dependencies)")
|
|
686
688
|
} catch {
|
|
687
|
-
warn("Could not merge into package.json
|
|
689
|
+
warn("Could not merge into package.json, add @supatype/cli and @supatype/types manually.")
|
|
688
690
|
file("skipped", "package.json (invalid JSON)")
|
|
689
691
|
}
|
|
690
692
|
}
|
|
@@ -792,6 +794,12 @@ function scaffoldHelloFunction(
|
|
|
792
794
|
if (!existsSync(join(dir, "functions/.env.local"))) {
|
|
793
795
|
write("functions/.env.local", functionsEnvLocalTemplate())
|
|
794
796
|
}
|
|
797
|
+
const denoTypes = ensureFunctionsDenoTypes(dir, join(dir, "functions"))
|
|
798
|
+
if (denoTypes.wroteDenoDts) file("created", "functions/deno.d.ts")
|
|
799
|
+
if (denoTypes.wroteTsconfig) file("created", "functions/tsconfig.json")
|
|
800
|
+
if (denoTypes.rootExclude === "updated") {
|
|
801
|
+
file("updated", 'tsconfig.json (exclude "functions")')
|
|
802
|
+
}
|
|
795
803
|
}
|
|
796
804
|
|
|
797
805
|
// ─── Templates ───────────────────────────────────────────────────────────────
|
|
@@ -883,7 +891,7 @@ function localConfigTemplate(app: ScaffoldAppOptions): string {
|
|
|
883
891
|
const lines: string[] = [
|
|
884
892
|
`import type { SupatypeConfig } from "@supatype/cli"`,
|
|
885
893
|
``,
|
|
886
|
-
`// Local development overrides
|
|
894
|
+
`// Local development overrides, gitignored, deep-merged over supatype.config.ts.`,
|
|
887
895
|
`// Keeps \`supatype dev\` in local mode while the committed config targets production.`,
|
|
888
896
|
`const localConfig: Partial<SupatypeConfig> = {`,
|
|
889
897
|
` server: { mode: "dev" },`,
|
|
@@ -989,8 +997,8 @@ function holdingPageTemplate(projectName: string): string {
|
|
|
989
997
|
<head>
|
|
990
998
|
<meta charset="UTF-8" />
|
|
991
999
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
992
|
-
<title>${name}
|
|
993
|
-
<meta name="description" content="A Supatype project. Define your types
|
|
1000
|
+
<title>${name}: Supatype</title>
|
|
1001
|
+
<meta name="description" content="A Supatype project. Define your types, we generate your platform." />
|
|
994
1002
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
995
1003
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
996
1004
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
@@ -1138,12 +1146,12 @@ function storageConfigLines(
|
|
|
1138
1146
|
): string[] {
|
|
1139
1147
|
const lines: string[] = []
|
|
1140
1148
|
if (storageLocal === "s3") {
|
|
1141
|
-
lines.push(` storage: { provider: "s3" }, // dev
|
|
1149
|
+
lines.push(` storage: { provider: "s3" }, // dev, configure S3_* in .env`)
|
|
1142
1150
|
} else {
|
|
1143
1151
|
lines.push(` storage: { provider: "local", local_path: ".supatype/storage" },`)
|
|
1144
1152
|
}
|
|
1145
1153
|
if (storageProduction === "s3" && storageLocal !== "s3") {
|
|
1146
|
-
lines.push(` // Production storage: external S3 bucket
|
|
1154
|
+
lines.push(` // Production storage: external S3 bucket, set production S3_* in .env`)
|
|
1147
1155
|
} else if (storageProduction === "local" && storageLocal === "s3") {
|
|
1148
1156
|
lines.push(` // Production storage: MinIO on your server (included in self-host compose)`)
|
|
1149
1157
|
}
|
|
@@ -1166,7 +1174,7 @@ export type Profile = Model<{
|
|
|
1166
1174
|
}
|
|
1167
1175
|
}>
|
|
1168
1176
|
|
|
1169
|
-
/** Example singleton global
|
|
1177
|
+
/** Example singleton global: editable in Studio under Settings. */
|
|
1170
1178
|
export type SiteSettings = Model<{
|
|
1171
1179
|
id: UUID
|
|
1172
1180
|
site_name: string
|
|
@@ -1182,13 +1190,28 @@ export type SiteSettings = Model<{
|
|
|
1182
1190
|
|
|
1183
1191
|
function envTemplate(opts: ScaffoldOptions): string {
|
|
1184
1192
|
const sections: string[] = []
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1193
|
+
// Generated, not constant. These reach a server: the previous defaults meant a self-host
|
|
1194
|
+
// deployment ran with a password of `postgres` and a JWT secret published in this repo,
|
|
1195
|
+
// and anyone holding that secret can mint a token naming any Postgres role. Safe to generate
|
|
1196
|
+
// only because `supatype dev` no longer overwrites them on every run (see local-secrets.ts).
|
|
1197
|
+
const postgresPassword = randomBytes(24).toString("base64url")
|
|
1189
1198
|
|
|
1190
|
-
sections.push(
|
|
1191
|
-
|
|
1199
|
+
sections.push(`DATABASE_URL=postgresql://supatype_admin:${postgresPassword}@localhost:5432/${opts.projectName}
|
|
1200
|
+
POSTGRES_USER=supatype_admin
|
|
1201
|
+
POSTGRES_PASSWORD=${postgresPassword}
|
|
1202
|
+
POSTGRES_DB=${opts.projectName}
|
|
1203
|
+
|
|
1204
|
+
# PostgREST's own database credential. It connects as \`authenticator\`, a role that holds no
|
|
1205
|
+
# privileges and can only switch to anon/authenticated/service_role, so a request whose JWT
|
|
1206
|
+
# names any other role is refused by Postgres rather than honoured.
|
|
1207
|
+
#
|
|
1208
|
+
# Deliberately NOT the same as POSTGRES_PASSWORD: that one is yours, for direct SQL access, and
|
|
1209
|
+
# rotating it should never take the REST API down with it.
|
|
1210
|
+
AUTHENTICATOR_PASSWORD=${randomBytes(24).toString("base64url")}`)
|
|
1211
|
+
|
|
1212
|
+
sections.push(`# JWT: ANON_KEY and SERVICE_ROLE_KEY are derived from this secret.
|
|
1213
|
+
# Changing it invalidates every issued token; re-run \`supatype keys\` afterwards.
|
|
1214
|
+
JWT_SECRET=${randomBytes(48).toString("base64url")}
|
|
1192
1215
|
ANON_KEY=
|
|
1193
1216
|
SERVICE_ROLE_KEY=`)
|
|
1194
1217
|
|
|
@@ -1198,7 +1221,7 @@ SITE_URL=http://localhost:3000`)
|
|
|
1198
1221
|
if (opts.provider === "docker" && opts.kongPort !== undefined) {
|
|
1199
1222
|
const apiUrl = `http://localhost:${opts.kongPort}`
|
|
1200
1223
|
sections.push(
|
|
1201
|
-
`# Local API gateway (Kong)
|
|
1224
|
+
`# Local API gateway (Kong), unique per project so multiple stacks can run concurrently
|
|
1202
1225
|
SUPATYPE_KONG_PORT=${opts.kongPort}
|
|
1203
1226
|
PUBLIC_SUPATYPE_URL=${apiUrl}
|
|
1204
1227
|
API_EXTERNAL_URL=${apiUrl}
|
|
@@ -1212,7 +1235,7 @@ VITE_SUPATYPE_ANON_KEY=`,
|
|
|
1212
1235
|
|
|
1213
1236
|
if (opts.adminEmail && opts.adminPassword) {
|
|
1214
1237
|
sections.push(
|
|
1215
|
-
`# First admin for /admin
|
|
1238
|
+
`# First admin for /admin, consumed on first supatype dev or push (password removed after use)
|
|
1216
1239
|
SUPATYPE_ADMIN_EMAIL=${opts.adminEmail}
|
|
1217
1240
|
SUPATYPE_ADMIN_PASSWORD=${opts.adminPassword}`,
|
|
1218
1241
|
)
|
|
@@ -1246,7 +1269,7 @@ SMTP_PASS=
|
|
|
1246
1269
|
SMTP_SENDER_NAME=${projectName}`
|
|
1247
1270
|
case "console":
|
|
1248
1271
|
default:
|
|
1249
|
-
return `# SMTP
|
|
1272
|
+
return `# SMTP: leave empty to use email autoconfirm in dev (no emails sent)
|
|
1250
1273
|
SMTP_HOST=
|
|
1251
1274
|
SMTP_PORT=
|
|
1252
1275
|
SMTP_USER=
|
|
@@ -1261,7 +1284,7 @@ function storageEnvSections(
|
|
|
1261
1284
|
): string {
|
|
1262
1285
|
if (storageLocal === storageProduction) {
|
|
1263
1286
|
if (storageLocal === "s3") {
|
|
1264
|
-
return `# Storage (local development and production
|
|
1287
|
+
return `# Storage (local development and production, external bucket)
|
|
1265
1288
|
# Use separate buckets for dev and production in your provider.
|
|
1266
1289
|
S3_ENDPOINT=
|
|
1267
1290
|
S3_REGION=us-east-1
|
|
@@ -1272,7 +1295,7 @@ S3_SECRET_KEY=`
|
|
|
1272
1295
|
return `${localStorageEnvSection("local")}
|
|
1273
1296
|
|
|
1274
1297
|
# Production storage (MinIO on your server)
|
|
1275
|
-
# Included in the self-host compose stack
|
|
1298
|
+
# Included in the self-host compose stack, no extra configuration needed.`
|
|
1276
1299
|
}
|
|
1277
1300
|
|
|
1278
1301
|
return [localStorageEnvSection(storageLocal), productionStorageEnvSection(storageProduction)].join(
|
|
@@ -1282,14 +1305,14 @@ S3_SECRET_KEY=`
|
|
|
1282
1305
|
|
|
1283
1306
|
function localStorageEnvSection(storage: StorageProvider): string {
|
|
1284
1307
|
if (storage === "s3") {
|
|
1285
|
-
return `# Storage (local development
|
|
1308
|
+
return `# Storage (local development, external bucket)
|
|
1286
1309
|
S3_ENDPOINT=
|
|
1287
1310
|
S3_REGION=us-east-1
|
|
1288
1311
|
S3_BUCKET=
|
|
1289
1312
|
S3_ACCESS_KEY=
|
|
1290
1313
|
S3_SECRET_KEY=`
|
|
1291
1314
|
}
|
|
1292
|
-
return `# Storage (local development
|
|
1315
|
+
return `# Storage (local development, MinIO)
|
|
1293
1316
|
S3_ENDPOINT=http://localhost:9000
|
|
1294
1317
|
S3_ACCESS_KEY=supatype
|
|
1295
1318
|
S3_SECRET_KEY=supatype-secret`
|
|
@@ -1297,15 +1320,15 @@ S3_SECRET_KEY=supatype-secret`
|
|
|
1297
1320
|
|
|
1298
1321
|
function productionStorageEnvSection(storage: StorageProvider): string {
|
|
1299
1322
|
if (storage === "s3") {
|
|
1300
|
-
return `# Storage (production
|
|
1323
|
+
return `# Storage (production, external bucket)
|
|
1301
1324
|
S3_ENDPOINT=
|
|
1302
1325
|
S3_REGION=us-east-1
|
|
1303
1326
|
S3_BUCKET=
|
|
1304
1327
|
S3_ACCESS_KEY=
|
|
1305
1328
|
S3_SECRET_KEY=`
|
|
1306
1329
|
}
|
|
1307
|
-
return `# Storage (production
|
|
1308
|
-
# Included in the self-host compose stack
|
|
1330
|
+
return `# Storage (production, MinIO on your server)
|
|
1331
|
+
# Included in the self-host compose stack, no extra configuration needed.`
|
|
1309
1332
|
}
|
|
1310
1333
|
|
|
1311
1334
|
function seedTemplate(projectName: string): string {
|
|
@@ -1335,21 +1358,22 @@ seed().catch((e) => {
|
|
|
1335
1358
|
}
|
|
1336
1359
|
|
|
1337
1360
|
function helloFunctionTemplate(): string {
|
|
1338
|
-
return `// hello
|
|
1361
|
+
return `// hello: Supatype Edge Function
|
|
1339
1362
|
// Docs: https://supatype.com/docs/edge-functions
|
|
1340
1363
|
|
|
1341
1364
|
export default async function handler(req: Request): Promise<Response> {
|
|
1342
1365
|
const { method } = req
|
|
1366
|
+
const url = Deno.env.get("SUPATYPE_URL")
|
|
1343
1367
|
|
|
1344
1368
|
if (method === "POST") {
|
|
1345
1369
|
const body = await req.json()
|
|
1346
|
-
return new Response(JSON.stringify({ message: "Hello from hello!", received: body }), {
|
|
1370
|
+
return new Response(JSON.stringify({ message: "Hello from hello!", received: body, url }), {
|
|
1347
1371
|
status: 200,
|
|
1348
1372
|
headers: { "Content-Type": "application/json" },
|
|
1349
1373
|
})
|
|
1350
1374
|
}
|
|
1351
1375
|
|
|
1352
|
-
return new Response(JSON.stringify({ message: "Hello from hello!" }), {
|
|
1376
|
+
return new Response(JSON.stringify({ message: "Hello from hello!", url }), {
|
|
1353
1377
|
status: 200,
|
|
1354
1378
|
headers: { "Content-Type": "application/json" },
|
|
1355
1379
|
})
|
|
@@ -1373,7 +1397,7 @@ dist/
|
|
|
1373
1397
|
supatype.local.config.ts
|
|
1374
1398
|
supatype.local.config.js
|
|
1375
1399
|
supatype.local.config.mjs
|
|
1376
|
-
# Generated by supatype push (legacy paths
|
|
1400
|
+
# Generated by supatype push (legacy paths, prefer output.types in config)
|
|
1377
1401
|
src/types/supatype.d.ts
|
|
1378
1402
|
src/lib/supatype.ts
|
|
1379
1403
|
`
|
|
@@ -1384,7 +1408,7 @@ export function mergeGitignoreTemplate(existingContent: string): string {
|
|
|
1384
1408
|
return existingContent
|
|
1385
1409
|
}
|
|
1386
1410
|
const block = `
|
|
1387
|
-
# Supatype
|
|
1411
|
+
# Supatype: local runtime (contains secrets in link.json)
|
|
1388
1412
|
.supatype/
|
|
1389
1413
|
`
|
|
1390
1414
|
return existingContent.endsWith("\n") ? `${existingContent}${block}` : `${existingContent}\n${block}`
|
|
@@ -1435,6 +1459,16 @@ function printNextSteps(args: {
|
|
|
1435
1459
|
info(`Supatype project ready${name ? ` in ${name}/` : ""}.`)
|
|
1436
1460
|
nextSteps(setupComplete ? "Next steps:" : "Finish setup:", steps)
|
|
1437
1461
|
|
|
1462
|
+
// Shown once, at creation. These are generated per project rather than shipped as
|
|
1463
|
+
// constants, so this is the moment to say they exist and where they live, nothing prints
|
|
1464
|
+
// them again, and the JWT secret is only echoed as a fingerprint from here on.
|
|
1465
|
+
nextSteps("Secrets: generated for this project, kept in .env:", [
|
|
1466
|
+
"POSTGRES_PASSWORD direct SQL access as the superuser",
|
|
1467
|
+
"AUTHENTICATOR_PASSWORD PostgREST's own login; rotating the one above does not affect it",
|
|
1468
|
+
"JWT_SECRET signs ANON_KEY and SERVICE_ROLE_KEY; changing it invalidates every token",
|
|
1469
|
+
"Keep .env out of version control, and use different values in production.",
|
|
1470
|
+
])
|
|
1471
|
+
|
|
1438
1472
|
if (result.app.mode === "none") {
|
|
1439
1473
|
nextSteps("Static frontend (self-host):", [
|
|
1440
1474
|
"supatype app add --static ./public",
|
|
@@ -1462,7 +1496,7 @@ function printNextSteps(args: {
|
|
|
1462
1496
|
selfHostSteps.push("supatype self-host compose up -d # Kong provisions HTTPS automatically")
|
|
1463
1497
|
selfHostSteps.push(`Your Supatype platform goes live at https://${domain}`)
|
|
1464
1498
|
selfHostSteps.push(
|
|
1465
|
-
"Your app, REST, Auth, Storage, Realtime, Functions, and Studio
|
|
1499
|
+
"Your app, REST, Auth, Storage, Realtime, Functions, and Studio, all behind one HTTPS domain (certs persist in valkey-data)",
|
|
1466
1500
|
)
|
|
1467
1501
|
} else {
|
|
1468
1502
|
selfHostSteps.push(
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hidden internal commands (Homebrew post_install, etc.).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Command } from "commander"
|
|
6
|
+
import { downloadAll } from "../binary-cache.js"
|
|
7
|
+
import { error, info } from "../ui/messages.js"
|
|
8
|
+
|
|
9
|
+
export function registerInternalCommands(program: Command): void {
|
|
10
|
+
program
|
|
11
|
+
.command("_postinstall", { hidden: true })
|
|
12
|
+
.description("Prefetch CDN component binaries after install (Homebrew post_install)")
|
|
13
|
+
.action(async () => {
|
|
14
|
+
try {
|
|
15
|
+
info("Prefetching Supatype component binaries for this platform...")
|
|
16
|
+
await downloadAll(undefined, true)
|
|
17
|
+
info("Component prefetch complete.")
|
|
18
|
+
} catch (err) {
|
|
19
|
+
error(err instanceof Error ? err.message : String(err))
|
|
20
|
+
process.exit(1)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command } from "commander"
|
|
2
2
|
import { loadConfig } from "../config.js"
|
|
3
|
+
import { loadCloudCredentials } from "../cloud-credentials.js"
|
|
3
4
|
import {
|
|
4
5
|
createCloudLink,
|
|
5
6
|
createSelfHostLink,
|
|
@@ -23,7 +24,8 @@ function resolveLinkToken(opts: {
|
|
|
23
24
|
opts.serviceRoleKey ??
|
|
24
25
|
process.env["SUPATYPE_ACCESS_TOKEN"] ??
|
|
25
26
|
process.env["SUPATYPE_TOKEN"] ??
|
|
26
|
-
process.env["SERVICE_ROLE_KEY"]
|
|
27
|
+
process.env["SERVICE_ROLE_KEY"] ??
|
|
28
|
+
loadCloudCredentials()?.accessToken
|
|
27
29
|
)
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -211,11 +213,15 @@ export async function runLinkAction(opts: {
|
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
if (!token) {
|
|
214
|
-
error("Authentication required.
|
|
216
|
+
error("Authentication required. Run: supatype login (or set SUPATYPE_ACCESS_TOKEN / pass --token).")
|
|
215
217
|
process.exit(1)
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
const cloudApiUrl = opts.apiUrl.replace(/\/$/, "")
|
|
221
|
+
const creds = loadCloudCredentials()
|
|
222
|
+
const refreshToken =
|
|
223
|
+
(creds?.apiUrl.replace(/\/$/, "") === cloudApiUrl ? creds.refreshToken : undefined) ??
|
|
224
|
+
existing?.refreshToken
|
|
219
225
|
|
|
220
226
|
if (project) {
|
|
221
227
|
const one = await targetFetch<{ slug: string; orgId: string }>(cloudApiUrl, "/api/v1", {
|
|
@@ -250,6 +256,7 @@ export async function runLinkAction(opts: {
|
|
|
250
256
|
orgId: one.orgId,
|
|
251
257
|
environments,
|
|
252
258
|
existing,
|
|
259
|
+
...(refreshToken !== undefined ? { refreshToken } : {}),
|
|
253
260
|
})
|
|
254
261
|
saveProjectLink(cwd, link)
|
|
255
262
|
info(`Linked to cloud project: ${project}`)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud session login / logout for CLI control-plane auth.
|
|
3
|
+
* Self-host uses SERVICE_ROLE_KEY via `supatype link --url`, not this command.
|
|
4
|
+
*/
|
|
5
|
+
import type { Command } from "commander"
|
|
6
|
+
import {
|
|
7
|
+
clearCloudCredentials,
|
|
8
|
+
cloudPasswordLogin,
|
|
9
|
+
loadCloudCredentials,
|
|
10
|
+
persistCloudSession,
|
|
11
|
+
} from "../cloud-credentials.js"
|
|
12
|
+
import { loadProjectLink, saveProjectLink } from "../link.js"
|
|
13
|
+
import { isInteractive } from "../ui/interactive.js"
|
|
14
|
+
import { error, info, plain } from "../ui/messages.js"
|
|
15
|
+
import { ensureNotCancelled, p, printLogo, runClackFlow } from "../ui/prompts.js"
|
|
16
|
+
|
|
17
|
+
function defaultApiUrl(cwd: string, flag?: string): string {
|
|
18
|
+
if (flag?.trim()) return flag.trim().replace(/\/$/, "")
|
|
19
|
+
const link = loadProjectLink(cwd)
|
|
20
|
+
if (link?.kind === "cloud" && link.cloudApiUrl) {
|
|
21
|
+
return link.cloudApiUrl.replace(/\/$/, "")
|
|
22
|
+
}
|
|
23
|
+
return (process.env["SUPATYPE_API_URL"] ?? "https://api.supatype.com").replace(/\/$/, "")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function registerLogin(program: Command): void {
|
|
27
|
+
program
|
|
28
|
+
.command("login")
|
|
29
|
+
.description("Sign in to Supatype Cloud (stores refreshable session for push/deploy)")
|
|
30
|
+
.option("--api-url <url>", "Cloud control plane API URL")
|
|
31
|
+
.option("--email <email>", "Account email (non-interactive)")
|
|
32
|
+
.option("--password <password>", "Account password (prefer SUPATYPE_PASSWORD)")
|
|
33
|
+
.action(async (opts: { apiUrl?: string; email?: string; password?: string }) => {
|
|
34
|
+
const cwd = process.cwd()
|
|
35
|
+
const apiUrl = defaultApiUrl(cwd, opts.apiUrl)
|
|
36
|
+
|
|
37
|
+
let email = opts.email?.trim() ?? process.env["SUPATYPE_EMAIL"]?.trim()
|
|
38
|
+
let password =
|
|
39
|
+
opts.password ?? process.env["SUPATYPE_PASSWORD"] ?? process.env["SUPATYPE_LOGIN_PASSWORD"]
|
|
40
|
+
|
|
41
|
+
if ((!email || !password) && isInteractive()) {
|
|
42
|
+
await runClackFlow(async () => {
|
|
43
|
+
printLogo()
|
|
44
|
+
p.intro("Supatype Cloud login")
|
|
45
|
+
if (!email) {
|
|
46
|
+
email = ensureNotCancelled(
|
|
47
|
+
await p.text({
|
|
48
|
+
message: "Email",
|
|
49
|
+
placeholder: "you@example.com",
|
|
50
|
+
}),
|
|
51
|
+
).trim()
|
|
52
|
+
}
|
|
53
|
+
if (!password) {
|
|
54
|
+
password = ensureNotCancelled(await p.password({ message: "Password" }))
|
|
55
|
+
}
|
|
56
|
+
p.outro("Signing in...")
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!email || !password) {
|
|
61
|
+
error(
|
|
62
|
+
"Email and password required. Pass --email / --password, set SUPATYPE_EMAIL + SUPATYPE_PASSWORD, or run interactively.",
|
|
63
|
+
)
|
|
64
|
+
process.exit(1)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const session = await cloudPasswordLogin(apiUrl, email, password)
|
|
69
|
+
persistCloudSession(cwd, {
|
|
70
|
+
apiUrl,
|
|
71
|
+
accessToken: session.accessToken,
|
|
72
|
+
...(session.refreshToken !== undefined ? { refreshToken: session.refreshToken } : {}),
|
|
73
|
+
...(session.email !== undefined ? { email: session.email } : { email }),
|
|
74
|
+
})
|
|
75
|
+
const link = loadProjectLink(cwd)
|
|
76
|
+
info(`Logged in to ${apiUrl}${session.email ? ` as ${session.email}` : ""}`)
|
|
77
|
+
if (link?.kind === "cloud") {
|
|
78
|
+
info(`Updated cloud session for linked project ${link.projectRef}`)
|
|
79
|
+
} else if (!session.refreshToken) {
|
|
80
|
+
plain("Warning: no refresh_token returned, session may expire in ~1h. Update control plane.")
|
|
81
|
+
} else {
|
|
82
|
+
plain("Tip: link a project with: supatype link --project <slug>")
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
error((err as Error).message)
|
|
86
|
+
process.exit(1)
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
program
|
|
91
|
+
.command("logout")
|
|
92
|
+
.description("Clear stored Supatype Cloud credentials")
|
|
93
|
+
.action(() => {
|
|
94
|
+
const cwd = process.cwd()
|
|
95
|
+
clearCloudCredentials()
|
|
96
|
+
const link = loadProjectLink(cwd)
|
|
97
|
+
if (link?.kind === "cloud") {
|
|
98
|
+
delete link.token
|
|
99
|
+
delete link.refreshToken
|
|
100
|
+
saveProjectLink(cwd, link)
|
|
101
|
+
}
|
|
102
|
+
info("Logged out of Supatype Cloud.")
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
program
|
|
106
|
+
.command("whoami")
|
|
107
|
+
.description("Show the current Supatype Cloud session")
|
|
108
|
+
.action(() => {
|
|
109
|
+
const creds = loadCloudCredentials()
|
|
110
|
+
const cwd = process.cwd()
|
|
111
|
+
const link = loadProjectLink(cwd)
|
|
112
|
+
if (!creds && !(link?.kind === "cloud" && link.token)) {
|
|
113
|
+
info("Not logged in. Run: supatype login")
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
if (creds) {
|
|
117
|
+
plain(`API: ${creds.apiUrl}`)
|
|
118
|
+
if (creds.email) plain(`Email: ${creds.email}`)
|
|
119
|
+
plain(`Refresh token: ${creds.refreshToken ? "yes" : "no"}`)
|
|
120
|
+
plain(`Updated: ${creds.updatedAt}`)
|
|
121
|
+
}
|
|
122
|
+
if (link?.kind === "cloud") {
|
|
123
|
+
plain(`Linked project: ${link.projectRef}`)
|
|
124
|
+
plain(`Link has refresh token: ${link.refreshToken ? "yes" : "no"}`)
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
}
|
package/src/commands/logs.ts
CHANGED
package/src/commands/migrate.ts
CHANGED
|
@@ -58,9 +58,9 @@ export function registerMigrate(program: Command): void {
|
|
|
58
58
|
const size =
|
|
59
59
|
manifest?.compressedBytes !== undefined
|
|
60
60
|
? `${(manifest.compressedBytes / 1024).toFixed(1)} KB`
|
|
61
|
-
: "
|
|
62
|
-
const files = manifest?.fileCount ?? "
|
|
63
|
-
const author = manifest?.pushedBy ?? "
|
|
61
|
+
: "-"
|
|
62
|
+
const files = manifest?.fileCount ?? "-"
|
|
63
|
+
const author = manifest?.pushedBy ?? "-"
|
|
64
64
|
const rolled = m.rolledBack ? " (rolled back)" : ""
|
|
65
65
|
plain(
|
|
66
66
|
`${m.name}${rolled}\n applied: ${m.appliedAt} status: ${m.status}\n author: ${author} files: ${files} snapshot: ${size}`,
|
|
@@ -212,7 +212,7 @@ async function offerSchemaRestore(
|
|
|
212
212
|
const manifestPaths = new Set(manifest.files.map((f) => f.path))
|
|
213
213
|
const orphans = findOrphanSchemaFiles(root, manifest.entryPoint, manifestPaths)
|
|
214
214
|
for (const orphan of orphans) {
|
|
215
|
-
warn(`${orphan} not in snapshot
|
|
215
|
+
warn(`${orphan} not in snapshot, review manually`)
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
info(`Restored schema files from migration ${label}.`)
|
|
@@ -222,6 +222,6 @@ async function offerSchemaRestore(
|
|
|
222
222
|
if ((postDiff.operations ?? []).length === 0) {
|
|
223
223
|
info("Schema matches database after restore.")
|
|
224
224
|
} else {
|
|
225
|
-
info("Run `supatype diff
|
|
225
|
+
info("Run `supatype diff`: schema may still differ from database.")
|
|
226
226
|
}
|
|
227
227
|
}
|
package/src/commands/pg.ts
CHANGED
package/src/commands/plugins.ts
CHANGED
package/src/commands/pull.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { info, plain } from "../ui/messages.js"
|
|
|
10
10
|
export function registerPull(program: Command): void {
|
|
11
11
|
program
|
|
12
12
|
.command("pull")
|
|
13
|
-
.description("Scaffold schema/index.ts from live database introspection (draft
|
|
13
|
+
.description("Scaffold schema/index.ts from live database introspection (draft, review before push)")
|
|
14
14
|
.option("--connection <url>", "Database connection URL (overrides config)")
|
|
15
15
|
.option("--out <path>", "Write scaffold to file (default: stdout)")
|
|
16
16
|
.option("--dry-run", "Print scaffold to stdout without writing files")
|
|
@@ -34,7 +34,7 @@ export function registerPull(program: Command): void {
|
|
|
34
34
|
if (opts.dryRun || !opts.out) {
|
|
35
35
|
plain(scaffold)
|
|
36
36
|
if (!opts.dryRun && !opts.out) {
|
|
37
|
-
info("(draft printed to stdout
|
|
37
|
+
info("(draft printed to stdout, use --out to write a file)")
|
|
38
38
|
}
|
|
39
39
|
return
|
|
40
40
|
}
|