@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/cache.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* supatype cache
|
|
2
|
+
* supatype cache: list and clean cached component binaries + REST Valkey cache.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { Command } from "commander"
|
|
6
|
-
import { existsSync
|
|
7
|
-
import {
|
|
6
|
+
import { existsSync } from "node:fs"
|
|
7
|
+
import {
|
|
8
|
+
BINARY_COMPONENTS,
|
|
9
|
+
formatBytes,
|
|
10
|
+
listCacheEntries,
|
|
11
|
+
resolveCacheProjectDirs,
|
|
12
|
+
} from "../cache-clean.js"
|
|
13
|
+
import { cleanCachedBinaries } from "../cache-pins.js"
|
|
8
14
|
import { cacheRoot, type Component } from "../binary-cache.js"
|
|
9
15
|
import {
|
|
10
16
|
deleteRestCacheEntry,
|
|
@@ -12,9 +18,11 @@ import {
|
|
|
12
18
|
getRestCacheEntry,
|
|
13
19
|
listRestCacheEntries,
|
|
14
20
|
} from "../rest-cache-admin.js"
|
|
15
|
-
import { error, info, plain } from "../ui/messages.js"
|
|
21
|
+
import { error, info, plain, warn } from "../ui/messages.js"
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
function isComponent(value: string): value is Component {
|
|
24
|
+
return (BINARY_COMPONENTS as readonly string[]).includes(value)
|
|
25
|
+
}
|
|
18
26
|
|
|
19
27
|
export function registerCache(program: Command): void {
|
|
20
28
|
const cache = program
|
|
@@ -24,79 +32,106 @@ export function registerCache(program: Command): void {
|
|
|
24
32
|
cache
|
|
25
33
|
.command("list")
|
|
26
34
|
.description("List cached component binaries and their sizes")
|
|
27
|
-
.
|
|
35
|
+
.option("--project <path>", "Include pins from another project directory", collectPaths, [])
|
|
36
|
+
.action(async (opts: { project: string[] }) => {
|
|
37
|
+
const cwd = process.cwd()
|
|
38
|
+
const projectDirs = resolveCacheProjectDirs(cwd, opts.project)
|
|
28
39
|
const root = cacheRoot()
|
|
40
|
+
|
|
29
41
|
if (!existsSync(root)) {
|
|
30
42
|
info("Cache is empty.")
|
|
31
43
|
return
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for (const component of COMPONENTS) {
|
|
38
|
-
const compDir = join(root, component)
|
|
39
|
-
if (!existsSync(compDir)) continue
|
|
40
|
-
|
|
41
|
-
const versions = readdirSync(compDir).filter(
|
|
42
|
-
(v) => statSync(join(compDir, v)).isDirectory(),
|
|
43
|
-
)
|
|
44
|
-
for (const version of versions) {
|
|
45
|
-
const vDir = join(compDir, version)
|
|
46
|
-
const size = dirSize(vDir)
|
|
47
|
-
totalBytes += size
|
|
48
|
-
found = true
|
|
49
|
-
plain(` ${component}@${version} ${formatBytes(size)}`)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!found) {
|
|
46
|
+
const entries = listCacheEntries(projectDirs)
|
|
47
|
+
if (entries.length === 0) {
|
|
54
48
|
info("Cache is empty.")
|
|
55
49
|
return
|
|
56
50
|
}
|
|
57
51
|
|
|
52
|
+
let totalBytes = 0
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
totalBytes += entry.bytes
|
|
55
|
+
const pinLabel = entry.pinned ? " (pinned)" : ""
|
|
56
|
+
plain(` ${entry.component}@${entry.version} ${formatBytes(entry.bytes)}${pinLabel}`)
|
|
57
|
+
}
|
|
58
|
+
|
|
58
59
|
plain(`\nTotal: ${formatBytes(totalBytes)}`)
|
|
59
60
|
info(`Cache root: ${root}`)
|
|
61
|
+
if (projectDirs.length > 0) {
|
|
62
|
+
info(`Pin scan: ${projectDirs.length} project(s)`)
|
|
63
|
+
}
|
|
60
64
|
})
|
|
61
65
|
|
|
62
66
|
cache
|
|
63
67
|
.command("clean [component] [version]")
|
|
64
68
|
.description(
|
|
65
|
-
"Remove cached binaries
|
|
69
|
+
"Remove cached binaries not pinned by local project configs.\n" +
|
|
70
|
+
"Use --force to remove everything (legacy behavior).\n" +
|
|
66
71
|
"Examples:\n" +
|
|
67
|
-
" supatype cache clean
|
|
68
|
-
" supatype cache clean engine
|
|
69
|
-
" supatype cache clean engine 0.4.2"
|
|
72
|
+
" supatype cache clean # remove unpinned versions\n" +
|
|
73
|
+
" supatype cache clean engine # remove unpinned engine versions\n" +
|
|
74
|
+
" supatype cache clean engine 0.4.2 # remove one version (warns if pinned)\n" +
|
|
75
|
+
" supatype cache clean --force # remove all cached binaries",
|
|
70
76
|
)
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
.option("--dry-run", "Show what would be removed without deleting")
|
|
78
|
+
.option("--force", "Remove all matching cache entries, ignoring version pins")
|
|
79
|
+
.option("--project <path>", "Include pins from another project directory", collectPaths, [])
|
|
80
|
+
.action(
|
|
81
|
+
async (
|
|
82
|
+
component?: string,
|
|
83
|
+
version?: string,
|
|
84
|
+
opts?: { dryRun?: boolean; force?: boolean; project?: string[] },
|
|
85
|
+
) => {
|
|
86
|
+
const cwd = process.cwd()
|
|
87
|
+
const projectDirs = resolveCacheProjectDirs(cwd, opts?.project ?? [])
|
|
88
|
+
const root = cacheRoot()
|
|
89
|
+
|
|
90
|
+
if (!existsSync(root)) {
|
|
91
|
+
info("Cache is already empty.")
|
|
92
|
+
return
|
|
93
|
+
}
|
|
77
94
|
|
|
78
|
-
|
|
95
|
+
if (component && !isComponent(component)) {
|
|
96
|
+
error(
|
|
97
|
+
`Unknown component "${component}". Valid: ${BINARY_COMPONENTS.join(", ")}`,
|
|
98
|
+
)
|
|
99
|
+
process.exitCode = 1
|
|
100
|
+
return
|
|
101
|
+
}
|
|
79
102
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
const components: Component[] =
|
|
104
|
+
component !== undefined ? [component as Component] : [...BINARY_COMPONENTS]
|
|
105
|
+
const result = cleanCachedBinaries({
|
|
106
|
+
components,
|
|
107
|
+
...(version !== undefined && version !== "" ? { version } : {}),
|
|
108
|
+
...(opts?.force !== undefined ? { force: opts.force } : {}),
|
|
109
|
+
...(opts?.dryRun !== undefined ? { dryRun: opts.dryRun } : {}),
|
|
110
|
+
projectDirs,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
for (const message of result.warned) {
|
|
114
|
+
warn(message)
|
|
115
|
+
}
|
|
83
116
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!existsSync(vDir)) {
|
|
87
|
-
info(`${comp}@${version} not cached.`)
|
|
88
|
-
continue
|
|
89
|
-
}
|
|
90
|
-
rmSync(vDir, { recursive: true, force: true })
|
|
91
|
-
plain(` removed ${comp}@${version}`)
|
|
92
|
-
} else {
|
|
93
|
-
rmSync(compDir, { recursive: true, force: true })
|
|
94
|
-
plain(` removed ${comp} (all versions)`)
|
|
117
|
+
for (const entry of result.skipped) {
|
|
118
|
+
plain(` kept ${entry.component}@${entry.version} (${entry.reason})`)
|
|
95
119
|
}
|
|
96
|
-
}
|
|
97
120
|
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
for (const entry of result.removed) {
|
|
122
|
+
const prefix = opts?.dryRun ? "would remove" : "removed"
|
|
123
|
+
plain(` ${prefix} ${entry.component}@${entry.version}`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (result.removed.length === 0 && result.skipped.length === 0) {
|
|
127
|
+
info("Nothing to clean.")
|
|
128
|
+
} else if (opts?.dryRun) {
|
|
129
|
+
info(`Dry run: ${result.removed.length} entr${result.removed.length === 1 ? "y" : "ies"} would be removed.`)
|
|
130
|
+
} else {
|
|
131
|
+
info("Done.")
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
)
|
|
100
135
|
|
|
101
136
|
const rest = cache
|
|
102
137
|
.command("rest")
|
|
@@ -125,7 +160,7 @@ export function registerCache(program: Command): void {
|
|
|
125
160
|
)
|
|
126
161
|
}
|
|
127
162
|
if (result.cursor !== "0") {
|
|
128
|
-
plain(`\n(more available
|
|
163
|
+
plain(`\n(more available: cursor ${result.cursor})`)
|
|
129
164
|
}
|
|
130
165
|
} catch (e) {
|
|
131
166
|
error(e instanceof Error ? e.message : String(e))
|
|
@@ -193,26 +228,6 @@ export function registerCache(program: Command): void {
|
|
|
193
228
|
})
|
|
194
229
|
}
|
|
195
230
|
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
try {
|
|
199
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
200
|
-
const full = join(dir, entry.name)
|
|
201
|
-
if (entry.isDirectory()) {
|
|
202
|
-
total += dirSize(full)
|
|
203
|
-
} else {
|
|
204
|
-
total += statSync(full).size
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
} catch {
|
|
208
|
-
// Skip unreadable entries.
|
|
209
|
-
}
|
|
210
|
-
return total
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function formatBytes(bytes: number): string {
|
|
214
|
-
if (bytes < 1024) return `${bytes} B`
|
|
215
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
|
|
216
|
-
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
|
|
217
|
-
return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`
|
|
231
|
+
function collectPaths(value: string, previous: string[]): string[] {
|
|
232
|
+
return [...previous, value]
|
|
218
233
|
}
|
package/src/commands/cloud.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Command } from "commander"
|
|
2
2
|
import { readFileSync, writeFileSync, existsSync } from "node:fs"
|
|
3
3
|
import { resolve } from "node:path"
|
|
4
|
+
import { loadCloudCredentials, persistCloudSession } from "../cloud-credentials.js"
|
|
4
5
|
import { loadProjectLink, migrateLegacyLinkFiles } from "../link.js"
|
|
5
6
|
import { targetFetch } from "../target-client.js"
|
|
6
7
|
import { registerEnvs, registerLinkOptions, runLinkAction } from "./link-helpers.js"
|
|
@@ -28,7 +29,7 @@ export function loadCloudConfig(cwd: string): CloudConfig | null {
|
|
|
28
29
|
}
|
|
29
30
|
return {
|
|
30
31
|
apiUrl: link.cloudApiUrl ?? "https://api.supatype.com",
|
|
31
|
-
token: link.token ?? "",
|
|
32
|
+
token: link.token ?? loadCloudCredentials()?.accessToken ?? "",
|
|
32
33
|
projectSlug: link.projectRef,
|
|
33
34
|
...(link.orgId !== undefined ? { orgId: link.orgId } : {}),
|
|
34
35
|
}
|
|
@@ -44,19 +45,39 @@ function saveCloudConfig(cwd: string, config: CloudConfig): void {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
async function cloudFetch<T>(config: CloudConfig, method: string, path: string, body?: unknown): Promise<T> {
|
|
48
|
+
const cwd = process.cwd()
|
|
49
|
+
const creds = loadCloudCredentials()
|
|
50
|
+
const refreshToken = creds?.refreshToken ?? loadProjectLink(cwd)?.refreshToken
|
|
47
51
|
return targetFetch<T>(config.apiUrl, "/api/v1", {
|
|
48
52
|
method,
|
|
49
53
|
path,
|
|
50
|
-
body,
|
|
54
|
+
...(body !== undefined ? { body } : {}),
|
|
51
55
|
token: config.token,
|
|
52
|
-
orgId: config.orgId,
|
|
56
|
+
...(config.orgId !== undefined ? { orgId: config.orgId } : {}),
|
|
57
|
+
...(refreshToken
|
|
58
|
+
? {
|
|
59
|
+
authRefresh: {
|
|
60
|
+
cloudApiUrl: config.apiUrl,
|
|
61
|
+
refreshToken,
|
|
62
|
+
onRefreshed: ({ accessToken, refreshToken: nextRefresh }) => {
|
|
63
|
+
persistCloudSession(cwd, {
|
|
64
|
+
apiUrl: config.apiUrl,
|
|
65
|
+
accessToken,
|
|
66
|
+
...(nextRefresh !== undefined ? { refreshToken: nextRefresh } : {}),
|
|
67
|
+
})
|
|
68
|
+
config.token = accessToken
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
: {}),
|
|
53
73
|
})
|
|
54
74
|
}
|
|
55
75
|
|
|
56
76
|
export function isCloudLinked(cwd: string): boolean {
|
|
57
77
|
migrateLegacyLinkFiles(cwd)
|
|
58
78
|
const link = loadProjectLink(cwd)
|
|
59
|
-
|
|
79
|
+
if (!(link?.kind === "cloud" && link.projectRef)) return false
|
|
80
|
+
return Boolean(link.token || loadCloudCredentials()?.accessToken)
|
|
60
81
|
}
|
|
61
82
|
|
|
62
83
|
export async function pushSchemaToLinkedProject(
|
|
@@ -260,15 +281,18 @@ function getCloudConfigOrExit(): CloudConfig {
|
|
|
260
281
|
const cwd = process.cwd()
|
|
261
282
|
let config = loadCloudConfig(cwd)
|
|
262
283
|
if (!config) {
|
|
284
|
+
const creds = loadCloudCredentials()
|
|
263
285
|
const token =
|
|
264
286
|
process.env["SUPATYPE_ACCESS_TOKEN"] ??
|
|
265
|
-
process.env["SUPATYPE_TOKEN"]
|
|
266
|
-
|
|
287
|
+
process.env["SUPATYPE_TOKEN"] ??
|
|
288
|
+
creds?.accessToken
|
|
289
|
+
const apiUrl =
|
|
290
|
+
process.env["SUPATYPE_API_URL"] ?? creds?.apiUrl ?? "https://api.supatype.com"
|
|
267
291
|
if (!token) {
|
|
268
|
-
error("Not connected to Supatype Cloud. Run: supatype link, or set SUPATYPE_ACCESS_TOKEN.")
|
|
292
|
+
error("Not connected to Supatype Cloud. Run: supatype login (then supatype link), or set SUPATYPE_ACCESS_TOKEN.")
|
|
269
293
|
process.exit(1)
|
|
270
294
|
}
|
|
271
|
-
config = { apiUrl, token }
|
|
295
|
+
config = { apiUrl: apiUrl.replace(/\/$/, ""), token }
|
|
272
296
|
}
|
|
273
297
|
return config
|
|
274
298
|
}
|
package/src/commands/db.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Database connection commands:
|
|
3
|
-
* supatype db connection-string
|
|
4
|
-
* supatype db reset-password
|
|
3
|
+
* supatype db connection-string: show the connection string for the linked project
|
|
4
|
+
* supatype db reset-password: reset the database password
|
|
5
|
+
* supatype db check: does this database meet what Supatype needs of it?
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import type { Command } from "commander"
|
|
@@ -10,7 +11,16 @@ import { connectionString } from "../project-config.js"
|
|
|
10
11
|
import { loadProjectLink } from "../link.js"
|
|
11
12
|
import { resolveTarget } from "../resolve-target.js"
|
|
12
13
|
import { targetFetch } from "../target-client.js"
|
|
13
|
-
import { error, info, plain } from "../ui/messages.js"
|
|
14
|
+
import { error, info, plain, warn } from "../ui/messages.js"
|
|
15
|
+
import {
|
|
16
|
+
applyRemedies,
|
|
17
|
+
needsOperatorPassword,
|
|
18
|
+
operatorRemedies,
|
|
19
|
+
runPreflight,
|
|
20
|
+
transactionalRemedies,
|
|
21
|
+
type CheckResult,
|
|
22
|
+
type Severity,
|
|
23
|
+
} from "../db-preflight.js"
|
|
14
24
|
|
|
15
25
|
export function registerDb(program: Command): void {
|
|
16
26
|
const db = program
|
|
@@ -110,4 +120,155 @@ export function registerDb(program: Command): void {
|
|
|
110
120
|
process.exitCode = 1
|
|
111
121
|
}
|
|
112
122
|
})
|
|
123
|
+
|
|
124
|
+
db
|
|
125
|
+
.command("check")
|
|
126
|
+
.description("Check whether a database meets Supatype's requirements (for external Postgres)")
|
|
127
|
+
.option("--connection <url>", "Postgres URL to check (else config `connection`, else DATABASE_URL)")
|
|
128
|
+
.option("--schema <name>", "Schema Supatype will manage (else config `schema.pg_schema`)")
|
|
129
|
+
.option("--emit", "Print the remediation SQL instead of applying it")
|
|
130
|
+
.option("--fix", "Apply the remediation in a single transaction")
|
|
131
|
+
.option(
|
|
132
|
+
"--authenticator-password <password>",
|
|
133
|
+
"Password for the `authenticator` role when it has to be created",
|
|
134
|
+
)
|
|
135
|
+
.action(async (opts: {
|
|
136
|
+
connection?: string
|
|
137
|
+
schema?: string
|
|
138
|
+
emit?: boolean
|
|
139
|
+
fix?: boolean
|
|
140
|
+
authenticatorPassword?: string
|
|
141
|
+
}) => {
|
|
142
|
+
if (opts.emit && opts.fix) {
|
|
143
|
+
error("Pass either --emit or --fix, not both: one prints the SQL, the other runs it.")
|
|
144
|
+
process.exitCode = 1
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const cwd = process.cwd()
|
|
149
|
+
let url = opts.connection?.trim()
|
|
150
|
+
let schema = opts.schema?.trim()
|
|
151
|
+
if (!url || !schema) {
|
|
152
|
+
try {
|
|
153
|
+
const config = loadConfig(cwd)
|
|
154
|
+
url = url ?? connectionString(config)
|
|
155
|
+
schema = schema ?? config.schema?.pg_schema ?? "public"
|
|
156
|
+
} catch {
|
|
157
|
+
// Runnable outside a project, which is the point, an operator should be able to check a
|
|
158
|
+
// database before committing to any config at all.
|
|
159
|
+
url = url ?? process.env["DATABASE_URL"]
|
|
160
|
+
schema = schema ?? "public"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!url) {
|
|
164
|
+
error("No connection. Pass --connection, set DATABASE_URL, or set `connection` in supatype.config.ts.")
|
|
165
|
+
process.exitCode = 1
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const pgMod = await import("pg")
|
|
170
|
+
const client = new pgMod.default.Client({ connectionString: url })
|
|
171
|
+
try {
|
|
172
|
+
await client.connect()
|
|
173
|
+
} catch (err) {
|
|
174
|
+
error(`Could not connect: ${(err as Error).message}`)
|
|
175
|
+
process.exitCode = 1
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
const report = await runPreflight(client, {
|
|
181
|
+
schema: schema!,
|
|
182
|
+
...(opts.authenticatorPassword !== undefined && {
|
|
183
|
+
authenticatorPassword: opts.authenticatorPassword,
|
|
184
|
+
}),
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const fixable = transactionalRemedies(report)
|
|
188
|
+
const manual = operatorRemedies(report)
|
|
189
|
+
|
|
190
|
+
if (opts.emit) {
|
|
191
|
+
// Machine-consumable: SQL on stdout, commentary on stderr, so it can be piped to psql.
|
|
192
|
+
if (fixable.length === 0) {
|
|
193
|
+
warn("Nothing to emit: no SQL-fixable findings.")
|
|
194
|
+
} else {
|
|
195
|
+
plain("BEGIN;")
|
|
196
|
+
for (const r of fixable) plain(`\n-- ${r.title}\n${r.remedy}`)
|
|
197
|
+
plain("\nCOMMIT;")
|
|
198
|
+
}
|
|
199
|
+
if (manual.length > 0) {
|
|
200
|
+
warn(`\n${manual.length} finding(s) need operator action and are not included above:`)
|
|
201
|
+
for (const r of manual) warn(` ${r.title}, ${r.detail}`)
|
|
202
|
+
}
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
printReport(report.results)
|
|
207
|
+
|
|
208
|
+
if (opts.fix) {
|
|
209
|
+
if (fixable.length === 0) {
|
|
210
|
+
info("Nothing to fix.")
|
|
211
|
+
} else if (needsOperatorPassword(fixable)) {
|
|
212
|
+
// The credential is the operator's by decision. Creating the role with a placeholder
|
|
213
|
+
// password would be worse than refusing, and harder to notice.
|
|
214
|
+
error(
|
|
215
|
+
"`authenticator` has to be created and no password was given. Nothing was changed.\n" +
|
|
216
|
+
" Re-run with --authenticator-password <password>, or use --emit and apply the SQL yourself.\n" +
|
|
217
|
+
" Use the same value for AUTHENTICATOR_PASSWORD in your .env.",
|
|
218
|
+
)
|
|
219
|
+
process.exitCode = 1
|
|
220
|
+
return
|
|
221
|
+
} else {
|
|
222
|
+
info(`\nApplying ${fixable.length} remediation(s) in one transaction...`)
|
|
223
|
+
try {
|
|
224
|
+
await applyRemedies(client, fixable)
|
|
225
|
+
info("Applied. Re-run `supatype db check` to confirm.")
|
|
226
|
+
} catch (err) {
|
|
227
|
+
error(`Rolled back: the database is unchanged: ${(err as Error).message}`)
|
|
228
|
+
process.exitCode = 1
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (manual.length > 0) {
|
|
233
|
+
warn(`\n${manual.length} finding(s) cannot be fixed in a transaction:`)
|
|
234
|
+
for (const r of manual) {
|
|
235
|
+
warn(` ${r.title}: needs a server setting change and likely a restart`)
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (report.worst === "fail") {
|
|
242
|
+
plain("")
|
|
243
|
+
error("This database is not ready. Re-run with --emit to see the SQL, or --fix to apply it.")
|
|
244
|
+
process.exitCode = 1
|
|
245
|
+
} else if (fixable.length > 0) {
|
|
246
|
+
plain("")
|
|
247
|
+
info("Re-run with --emit to see suggested SQL, or --fix to apply it.")
|
|
248
|
+
}
|
|
249
|
+
} catch (err) {
|
|
250
|
+
// An unexpected failure must not read as a clean bill of health.
|
|
251
|
+
error(`Preflight could not complete: ${(err as Error).message}`)
|
|
252
|
+
process.exitCode = 1
|
|
253
|
+
} finally {
|
|
254
|
+
await client.end().catch(() => undefined)
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const SEVERITY_LABEL: Record<Severity, string> = {
|
|
260
|
+
pass: "ok ",
|
|
261
|
+
warn: "note",
|
|
262
|
+
degrade: "off ",
|
|
263
|
+
fail: "FAIL",
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function printReport(results: readonly CheckResult[]): void {
|
|
267
|
+
for (const r of results) {
|
|
268
|
+
const line = `[${SEVERITY_LABEL[r.severity]}] ${r.title}, ${r.detail}`
|
|
269
|
+
if (r.severity === "fail") error(line)
|
|
270
|
+
else if (r.severity === "degrade" || r.severity === "warn") warn(line)
|
|
271
|
+
else plain(line)
|
|
272
|
+
if (r.impact) plain(` ${r.impact}`)
|
|
273
|
+
}
|
|
113
274
|
}
|
package/src/commands/deploy.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deploy commands:
|
|
3
|
-
* supatype deploy
|
|
4
|
-
* supatype deploy --local
|
|
5
|
-
* supatype deploy --app-only
|
|
6
|
-
* supatype deploy --schema-only
|
|
7
|
-
* supatype deploy --skip-build
|
|
8
|
-
* supatype deploy --preview
|
|
9
|
-
* supatype deploy rollback
|
|
10
|
-
* supatype deploy status
|
|
11
|
-
* supatype deploy logs <version
|
|
3
|
+
* supatype deploy: Supatype Cloud by default (linked via supatype link), else platform projectRef; use --local for engine + DB
|
|
4
|
+
* supatype deploy --local: push schema via local engine + optional static app to .supatype/static
|
|
5
|
+
* supatype deploy --app-only: only build & deploy the static site
|
|
6
|
+
* supatype deploy --schema-only: only push schema changes
|
|
7
|
+
* supatype deploy --skip-build: deploy existing build output (no build step)
|
|
8
|
+
* supatype deploy --preview: deploy to a preview URL
|
|
9
|
+
* supatype deploy rollback: roll back to previous deployment
|
|
10
|
+
* supatype deploy status: show current deployment info
|
|
11
|
+
* supatype deploy logs <version>, show build logs
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import type { Command } from "commander"
|
|
@@ -31,7 +31,7 @@ export function registerDeploy(program: Command): void {
|
|
|
31
31
|
const deploy = program
|
|
32
32
|
.command("deploy")
|
|
33
33
|
.description(
|
|
34
|
-
"Deploy schema and app
|
|
34
|
+
"Deploy schema and app, Supatype Cloud by default when linked (`supatype link`); pass --local for engine + your database",
|
|
35
35
|
)
|
|
36
36
|
.option("--local", "Use local schema engine and database_url from config (skip cloud control plane)")
|
|
37
37
|
.option("--environment <name>", "Target environment when linked", "production")
|
|
@@ -119,7 +119,7 @@ export function registerDeploy(program: Command): void {
|
|
|
119
119
|
error("No build section found in supatype.config.ts")
|
|
120
120
|
process.exit(1)
|
|
121
121
|
}
|
|
122
|
-
// No build config
|
|
122
|
+
// No build config: skip app deployment silently
|
|
123
123
|
return
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -151,7 +151,7 @@ export function registerDeploy(program: Command): void {
|
|
|
151
151
|
buildEnv["NEXT_PUBLIC_SUPATYPE_URL"] = cloudCfg.apiUrl || `https://${cloudCfg.projectSlug}.supatype.dev`
|
|
152
152
|
buildEnv["VITE_SUPATYPE_URL"] = buildEnv["NEXT_PUBLIC_SUPATYPE_URL"]!
|
|
153
153
|
buildEnv["PUBLIC_SUPATYPE_URL"] = buildEnv["NEXT_PUBLIC_SUPATYPE_URL"]!
|
|
154
|
-
// NEVER inject service_role key
|
|
154
|
+
// NEVER inject service_role key, only anon key is safe for client-side
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// Install dependencies
|