@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework.js","sourceRoot":"","sources":["../../src/app/framework.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmBzC,MAAM,kBAAkB,GAA4C;IAClE,MAAM,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;IAC1E,KAAK,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE;IAC3E,IAAI,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;IACxE,WAAW,EAAE,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE;IAC7F,SAAS,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE;IAC/E,IAAI,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE;IAC5E,MAAM,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;CAC/D,CAAA;AAED,8DAA8D;AAC9D,MAAM,mBAAmB,GAAoD;IAC3E,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,OAAO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I,IAAI,GAAG,CAAC,CAAA;IACZ,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,KAAK,CAAC,MAAM,EAAE;YAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAA;aAC1C,IAAI,KAAK,CAAC,WAAW,EAAE;YAAE,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;IACxE,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
+
export interface AstModel {
|
|
2
|
+
name?: string;
|
|
3
|
+
tableName?: string;
|
|
4
|
+
fields: Record<string, Record<string, unknown>>;
|
|
5
|
+
annotations?: {
|
|
6
|
+
db?: {
|
|
7
|
+
tableName?: string;
|
|
8
|
+
indexes?: unknown[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Shared with the hooks generator on purpose.
|
|
14
|
+
*
|
|
15
|
+
* A hook's `row` must be the same shape the client sees for that table, and two copies of this logic
|
|
16
|
+
* would drift: the client would gain a column type the hook handler did not, which is the failure
|
|
17
|
+
* mode this codebase has already paid for once.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveTableName(model: AstModel): string;
|
|
1
20
|
export declare function generateClientAugmentation(ast: unknown): string;
|
|
21
|
+
export declare function generateRowType(fields: Record<string, Record<string, unknown>>): string;
|
|
22
|
+
export declare function generateInsertType(fields: Record<string, Record<string, unknown>>): string;
|
|
23
|
+
export declare function generateUpdateType(fields: Record<string, Record<string, unknown>>): string;
|
|
2
24
|
//# sourceMappingURL=augmentation-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augmentation-generator.d.ts","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"augmentation-generator.d.ts","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC/C,WAAW,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE;YAAE,SAAS,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;SAAE,CAAA;KACjD,CAAA;CACF;AAMD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAQxD;AAUD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA2B/D;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAOvF;AAMD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAU1F;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAO1F"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Shared with the hooks generator on purpose.
|
|
3
|
+
*
|
|
4
|
+
* A hook's `row` must be the same shape the client sees for that table, and two copies of this logic
|
|
5
|
+
* would drift: the client would gain a column type the hook handler did not, which is the failure
|
|
6
|
+
* mode this codebase has already paid for once.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveTableName(model) {
|
|
2
9
|
const fromAnnotations = model.annotations?.db?.tableName;
|
|
3
10
|
if (typeof fromAnnotations === "string" && fromAnnotations.length > 0)
|
|
4
11
|
return fromAnnotations;
|
|
@@ -24,7 +31,7 @@ export function generateClientAugmentation(ast) {
|
|
|
24
31
|
.map((model) => ({ model, tableName: resolveTableName(model) }))
|
|
25
32
|
.sort((a, b) => a.tableName.localeCompare(b.tableName));
|
|
26
33
|
const lines = [];
|
|
27
|
-
lines.push("// Generated by supatype CLI
|
|
34
|
+
lines.push("// Generated by supatype CLI, do not edit manually.");
|
|
28
35
|
lines.push("");
|
|
29
36
|
lines.push("declare module \"@supatype/client\" {");
|
|
30
37
|
lines.push(" interface SupatypeModels {");
|
|
@@ -42,7 +49,7 @@ export function generateClientAugmentation(ast) {
|
|
|
42
49
|
lines.push("");
|
|
43
50
|
return lines.join("\n");
|
|
44
51
|
}
|
|
45
|
-
function generateRowType(fields) {
|
|
52
|
+
export function generateRowType(fields) {
|
|
46
53
|
const entries = Object.entries(fields).sort(([a], [b]) => a.localeCompare(b));
|
|
47
54
|
if (entries.length === 0)
|
|
48
55
|
return "Record<string, unknown>";
|
|
@@ -54,7 +61,7 @@ function generateRowType(fields) {
|
|
|
54
61
|
function insertColumnOptionalOnInsert(meta) {
|
|
55
62
|
return meta["default"] !== undefined || fieldServerGenerated(meta);
|
|
56
63
|
}
|
|
57
|
-
function generateInsertType(fields) {
|
|
64
|
+
export function generateInsertType(fields) {
|
|
58
65
|
const entries = Object.entries(fields).sort(([a], [b]) => a.localeCompare(b));
|
|
59
66
|
if (entries.length === 0)
|
|
60
67
|
return "Record<string, unknown>";
|
|
@@ -66,7 +73,7 @@ function generateInsertType(fields) {
|
|
|
66
73
|
.join("\n");
|
|
67
74
|
return `{\n${body}\n}`;
|
|
68
75
|
}
|
|
69
|
-
function generateUpdateType(fields) {
|
|
76
|
+
export function generateUpdateType(fields) {
|
|
70
77
|
const entries = Object.entries(fields).sort(([a], [b]) => a.localeCompare(b));
|
|
71
78
|
if (entries.length === 0)
|
|
72
79
|
return "Record<string, unknown>";
|
|
@@ -79,6 +86,13 @@ function toTsType(meta) {
|
|
|
79
86
|
const kind = typeof meta["kind"] === "string" ? meta["kind"] : "json";
|
|
80
87
|
const required = meta["required"] === true;
|
|
81
88
|
const base = (() => {
|
|
89
|
+
// A field that knows its own shape says so. Without this, everything stored as JSONB collapses
|
|
90
|
+
// to `Record<string, unknown>` in the generated row, so `Currency` would arrive as an opaque
|
|
91
|
+
// object rather than `{ amount: string; code: "USD" }`, and the schema's precision would be
|
|
92
|
+
// lost exactly where a caller reads it.
|
|
93
|
+
const declared = meta["tsType"];
|
|
94
|
+
if (typeof declared === "string" && declared.length > 0)
|
|
95
|
+
return declared;
|
|
82
96
|
switch (kind) {
|
|
83
97
|
case "uuid":
|
|
84
98
|
case "slug":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augmentation-generator.js","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"AAaA,
|
|
1
|
+
{"version":3,"file":"augmentation-generator.js","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC9C,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,CAAA;IACxD,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,eAAe,CAAA;IAC7F,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,SAAS,CAAA;IAC7F,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI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AC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AAC3E,CAAC"}
|
package/dist/binary-cache.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Binary cache
|
|
2
|
+
* Binary cache: manages supatype component binaries.
|
|
3
3
|
*
|
|
4
4
|
* Components: engine, server, postgres, deno, realtime.
|
|
5
5
|
* Cache root: ~/.supatype/cache/{component}/{version}/
|
|
@@ -26,7 +26,7 @@ export declare function hasEngineOverride(config: SupatypeProjectConfig): boolea
|
|
|
26
26
|
export declare function hasStudioOverride(config: SupatypeProjectConfig): boolean;
|
|
27
27
|
/** True if `overrides` contains any non-empty string path (contributor local builds). */
|
|
28
28
|
export declare function hasMeaningfulOverrides(config: SupatypeProjectConfig): boolean;
|
|
29
|
-
/** Lines for a startup banner
|
|
29
|
+
/** Lines for a startup banner, non-empty override paths only. */
|
|
30
30
|
export declare function describeActiveOverrides(config: SupatypeProjectConfig): string[];
|
|
31
31
|
/**
|
|
32
32
|
* True when this working tree is associated with a remote Supatype Cloud project:
|
|
@@ -47,14 +47,23 @@ export declare function cachePath(component: Component, version: string): string
|
|
|
47
47
|
export declare function cachedBinaryPath(component: Component, version: string, platform: PlatformId): string;
|
|
48
48
|
/** True when the platform binary for `version` is present and passes format checks. */
|
|
49
49
|
export declare function isCachedBinaryReady(component: Component, version: string, platform?: PlatformId): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Names a published archive may carry, most-canonical first.
|
|
52
|
+
*
|
|
53
|
+
* `supatype-postgres` published the Intel macOS archive as `darwin-x86_64` while every other platform
|
|
54
|
+
* used `amd64`, the spelling the CLI derives from `process.arch === "x64"`. Releases already on the CDN
|
|
55
|
+
* carry the old name, so both are accepted and the *signed* checksums manifest decides which exists.
|
|
56
|
+
* Nothing is guessed: the URL and the hash always come from the same manifest entry.
|
|
57
|
+
*/
|
|
58
|
+
export declare function archiveNameCandidates(component: Component, version: string, platform: PlatformId): string[];
|
|
50
59
|
export declare function currentPlatform(): PlatformId;
|
|
51
60
|
/**
|
|
52
61
|
* Resolve the binary path for a component.
|
|
53
62
|
*
|
|
54
63
|
* Resolution order:
|
|
55
|
-
* 1. config.overrides?.[component]
|
|
64
|
+
* 1. config.overrides?.[component]: local build path (must exist)
|
|
56
65
|
* 2. Cached binary at ~/.supatype/cache/{component}/{version}/
|
|
57
|
-
* 3. Throws
|
|
66
|
+
* 3. Throws, so the caller should call download() first.
|
|
58
67
|
*
|
|
59
68
|
* Hard error if any meaningful `overrides` entry is set while the project is linked to cloud
|
|
60
69
|
* (`project.ref`, `.supatype/cloud.json`, or `.supatype/linked.json`).
|
|
@@ -71,15 +80,42 @@ export declare function resolveBinary(component: Component, config: SupatypeProj
|
|
|
71
80
|
/** Download if missing or invalid; return cached path for the given platform. */
|
|
72
81
|
export declare function ensureCachedBinary(component: Component, version: string, platform: PlatformId): Promise<string>;
|
|
73
82
|
export declare function download(component: Component, version: string, platform: PlatformId): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Fetch checksums.sha256, optionally verify its minisign signature, and
|
|
85
|
+
* return the expected SHA256 for `binaryFilename`.
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Fetch a checksums manifest and verify its minisign signature, returning the entry for one of
|
|
89
|
+
* `binaryFilenames`.
|
|
90
|
+
*
|
|
91
|
+
* Exported so the standalone CLI download path enforces the same rule as component downloads.
|
|
92
|
+
* It previously verified nothing at all, which made the CLI stricter about a postgres archive
|
|
93
|
+
* than about overwriting its own executable.
|
|
94
|
+
*/
|
|
95
|
+
export declare function fetchChecksums(checksumsUrl: string, minisigUrl: string, binaryFilenames: string | string[]): Promise<ChecksumMatch>;
|
|
74
96
|
/**
|
|
75
97
|
* Verify a minisign signature. Supports both Ed25519 legacy mode ("Ed", over the
|
|
76
98
|
* raw file) and prehashed mode ("ED", over BLAKE2b-512(file)). Throws if invalid.
|
|
77
99
|
*/
|
|
78
100
|
export declare function verifyMinisign(fileBytes: Buffer, sigFileContent: string, pubKeyStr: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Extract the SHA256 hash for `filename` from a checksums.sha256 file.
|
|
103
|
+
* Format: `<hash> <filename>` (sha256sum output, two spaces), or `<hash> *<filename>` when
|
|
104
|
+
* the publisher used binary mode.
|
|
105
|
+
*
|
|
106
|
+
* Exported so the standalone CLI download path parses the manifest the same way rather than
|
|
107
|
+
* carrying a second implementation.
|
|
108
|
+
*/
|
|
109
|
+
export declare function extractChecksum(checksumsText: string, filenames: string | string[]): ChecksumMatch;
|
|
110
|
+
/** Which published name matched, and its hash, both from the same signed manifest entry. */
|
|
111
|
+
export interface ChecksumMatch {
|
|
112
|
+
filename: string;
|
|
113
|
+
checksum: string;
|
|
114
|
+
}
|
|
79
115
|
/** Confirm a downloaded/cached artifact matches the expected CDN format (tests, CI). */
|
|
80
116
|
export declare function validateArtifactFormat(component: Component, filePath: string, platform: PlatformId): void;
|
|
81
117
|
/**
|
|
82
|
-
* On Windows, Git Bash represents paths as /c/Users
|
|
118
|
+
* On Windows, Git Bash represents paths as /c/Users/..., convert to C:\Users\...
|
|
83
119
|
*/
|
|
84
120
|
export declare function normalisePlatformPath(p: string): string;
|
|
85
121
|
export declare function pinnedVersion(component: Component, config: SupatypeProjectConfig): string | undefined;
|
|
@@ -101,7 +137,7 @@ export declare function fetchAllLatestVersions(): Promise<Partial<Record<Compone
|
|
|
101
137
|
*/
|
|
102
138
|
/**
|
|
103
139
|
* Verify cached binaries for the current platform (used by integration CI).
|
|
104
|
-
* Only checks components present in `versions
|
|
140
|
+
* Only checks components present in `versions`; unpublished CDN components
|
|
105
141
|
* (no latest.json yet) are skipped with a log so CI can land before first release.
|
|
106
142
|
* Throws if a pinned component is missing from cache or fails format checks.
|
|
107
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-cache.d.ts","sourceRoot":"","sources":["../src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AC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAe1F;AAMD;;;;GAIG;AACH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,GAAG,IAAI,CAqB3F;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,EAChD,QAAQ,UAAQ,GACf,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
package/dist/binary-cache.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Binary cache
|
|
2
|
+
* Binary cache: manages supatype component binaries.
|
|
3
3
|
*
|
|
4
4
|
* Components: engine, server, postgres, deno, realtime.
|
|
5
5
|
* Cache root: ~/.supatype/cache/{component}/{version}/
|
|
@@ -48,7 +48,7 @@ export function hasMeaningfulOverrides(config) {
|
|
|
48
48
|
}
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
|
-
/** Lines for a startup banner
|
|
51
|
+
/** Lines for a startup banner, non-empty override paths only. */
|
|
52
52
|
export function describeActiveOverrides(config) {
|
|
53
53
|
const o = config.overrides;
|
|
54
54
|
if (!o)
|
|
@@ -147,6 +147,21 @@ function binaryName(component, version, platform) {
|
|
|
147
147
|
case "realtime": return `supatype-realtime-${platform.os}-${platform.arch}${win ? ".exe" : ""}`;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Names a published archive may carry, most-canonical first.
|
|
152
|
+
*
|
|
153
|
+
* `supatype-postgres` published the Intel macOS archive as `darwin-x86_64` while every other platform
|
|
154
|
+
* used `amd64`, the spelling the CLI derives from `process.arch === "x64"`. Releases already on the CDN
|
|
155
|
+
* carry the old name, so both are accepted and the *signed* checksums manifest decides which exists.
|
|
156
|
+
* Nothing is guessed: the URL and the hash always come from the same manifest entry.
|
|
157
|
+
*/
|
|
158
|
+
export function archiveNameCandidates(component, version, platform) {
|
|
159
|
+
const canonical = binaryName(component, version, platform);
|
|
160
|
+
if (component === "postgres" && platform.os === "darwin" && platform.arch === "amd64") {
|
|
161
|
+
return [canonical, canonical.replace("darwin-amd64", "darwin-x86_64")];
|
|
162
|
+
}
|
|
163
|
+
return [canonical];
|
|
164
|
+
}
|
|
150
165
|
// ---------------------------------------------------------------------------
|
|
151
166
|
// Platform detection
|
|
152
167
|
// ---------------------------------------------------------------------------
|
|
@@ -175,9 +190,9 @@ export function currentPlatform() {
|
|
|
175
190
|
* Resolve the binary path for a component.
|
|
176
191
|
*
|
|
177
192
|
* Resolution order:
|
|
178
|
-
* 1. config.overrides?.[component]
|
|
193
|
+
* 1. config.overrides?.[component]: local build path (must exist)
|
|
179
194
|
* 2. Cached binary at ~/.supatype/cache/{component}/{version}/
|
|
180
|
-
* 3. Throws
|
|
195
|
+
* 3. Throws, so the caller should call download() first.
|
|
181
196
|
*
|
|
182
197
|
* Hard error if any meaningful `overrides` entry is set while the project is linked to cloud
|
|
183
198
|
* (`project.ref`, `.supatype/cloud.json`, or `.supatype/linked.json`).
|
|
@@ -256,7 +271,7 @@ async function acquireDownloadSlot(component, version, platform) {
|
|
|
256
271
|
if (tryAcquireDownloadLock(component, version))
|
|
257
272
|
return;
|
|
258
273
|
if (isDownloadInProgress(component, version)) {
|
|
259
|
-
console.log(`[supatype] ${component} v${version} is downloading in another process
|
|
274
|
+
console.log(`[supatype] ${component} v${version} is downloading in another process, waiting...`);
|
|
260
275
|
const outcome = await waitForComponentDownload(component, version, isReady, (c) => {
|
|
261
276
|
console.log(`[supatype] Still waiting for ${c} download...`);
|
|
262
277
|
});
|
|
@@ -265,7 +280,7 @@ async function acquireDownloadSlot(component, version, platform) {
|
|
|
265
280
|
if (outcome === "timeout") {
|
|
266
281
|
throw new Error(`Timed out waiting for ${component} v${version} download. Run: supatype update`);
|
|
267
282
|
}
|
|
268
|
-
console.warn(`[supatype] ${component} v${version} download did not finish in the other process
|
|
283
|
+
console.warn(`[supatype] ${component} v${version} download did not finish in the other process, retrying.`);
|
|
269
284
|
continue;
|
|
270
285
|
}
|
|
271
286
|
if (tryAcquireDownloadLock(component, version))
|
|
@@ -275,7 +290,7 @@ async function acquireDownloadSlot(component, version, platform) {
|
|
|
275
290
|
}
|
|
276
291
|
export async function download(component, version, platform) {
|
|
277
292
|
if (version === VERSION_PIN_LOCAL) {
|
|
278
|
-
throw new Error(`cannot download CDN binary when version is "${VERSION_PIN_LOCAL}"
|
|
293
|
+
throw new Error(`cannot download CDN binary when version is "${VERSION_PIN_LOCAL}": set overrides.${component === "postgres" ? "postgres_dir" : component} or pin a semver`);
|
|
279
294
|
}
|
|
280
295
|
const dir = cachePath(component, version);
|
|
281
296
|
mkdirSync(dir, { recursive: true });
|
|
@@ -286,25 +301,28 @@ export async function download(component, version, platform) {
|
|
|
286
301
|
console.log(`[supatype] ${component} v${version} already cached.`);
|
|
287
302
|
return destPath;
|
|
288
303
|
}
|
|
289
|
-
console.warn(`[supatype] ${component} v${version} cache invalid
|
|
304
|
+
console.warn(`[supatype] ${component} v${version} cache invalid, re-downloading (${destPath}).`);
|
|
290
305
|
unlinkSync(destPath);
|
|
291
306
|
}
|
|
292
307
|
await acquireDownloadSlot(component, version, platform);
|
|
293
308
|
if (isCachedBinaryReady(component, version, platform)) {
|
|
294
309
|
return destPath;
|
|
295
310
|
}
|
|
296
|
-
const binaryUrl = `${CDN_BASE}${CDN_PATHS[component](version, platform)}`;
|
|
297
311
|
const checksumsUrl = `${CDN_BASE}${checksumsDirPath(component, version)}`;
|
|
298
312
|
const minisigUrl = `${checksumsUrl}.minisig`;
|
|
299
313
|
console.log(`[supatype] Downloading ${component} v${version} (${platform.os}/${platform.arch})...`);
|
|
300
314
|
const tmpPath = destPath + ".tmp";
|
|
301
315
|
try {
|
|
302
316
|
// ── Fetch checksums + optional minisig (retried on transient failures) ───
|
|
303
|
-
const
|
|
317
|
+
const match = await withRetry(() => fetchChecksums(checksumsUrl, minisigUrl, archiveNameCandidates(component, version, platform)));
|
|
318
|
+
// The directory from the path template, the filename from the manifest: a release published under
|
|
319
|
+
// a legacy name is fetched under that name rather than one the CLI assumed.
|
|
320
|
+
const cdnDir = CDN_PATHS[component](version, platform).replace(/\/[^/]+$/, "");
|
|
321
|
+
const binaryUrl = `${CDN_BASE}${cdnDir}/${match.filename}`;
|
|
304
322
|
// ── Stream-download binary with progress (retried on transient failures) ─
|
|
305
323
|
await withRetry(() => streamToFileWithProgress(binaryUrl, tmpPath));
|
|
306
324
|
// ── Verify SHA256 ────────────────────────────────────────────────────────
|
|
307
|
-
await verifyChecksum(tmpPath,
|
|
325
|
+
await verifyChecksum(tmpPath, match.checksum, component);
|
|
308
326
|
writeFileSync(destPath, readFileSync(tmpPath));
|
|
309
327
|
assertArtifactFormat(component, destPath, platform);
|
|
310
328
|
if (process.platform !== "win32" && EXECUTABLE_COMPONENTS.has(component)) {
|
|
@@ -340,7 +358,15 @@ export async function download(component, version, platform) {
|
|
|
340
358
|
* Fetch checksums.sha256, optionally verify its minisign signature, and
|
|
341
359
|
* return the expected SHA256 for `binaryFilename`.
|
|
342
360
|
*/
|
|
343
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Fetch a checksums manifest and verify its minisign signature, returning the entry for one of
|
|
363
|
+
* `binaryFilenames`.
|
|
364
|
+
*
|
|
365
|
+
* Exported so the standalone CLI download path enforces the same rule as component downloads.
|
|
366
|
+
* It previously verified nothing at all, which made the CLI stricter about a postgres archive
|
|
367
|
+
* than about overwriting its own executable.
|
|
368
|
+
*/
|
|
369
|
+
export async function fetchChecksums(checksumsUrl, minisigUrl, binaryFilenames) {
|
|
344
370
|
const csResp = await fetch(checksumsUrl);
|
|
345
371
|
if (!csResp.ok) {
|
|
346
372
|
throw new Error(`Failed to fetch checksums from ${checksumsUrl}: HTTP ${csResp.status}`);
|
|
@@ -350,13 +376,13 @@ async function fetchChecksums(checksumsUrl, minisigUrl, binaryFilename) {
|
|
|
350
376
|
if (!pubKey) {
|
|
351
377
|
// Fail closed: a missing public key means we cannot verify authenticity, only
|
|
352
378
|
// integrity (SHA256). Published builds always embed the key, so this only
|
|
353
|
-
// happens in source/contributor builds
|
|
379
|
+
// happens in source/contributor builds. Never silently downgrade.
|
|
354
380
|
if (process.env["SUPATYPE_ALLOW_UNVERIFIED_DOWNLOADS"] === "1") {
|
|
355
|
-
console.warn("[supatype] \u26a0 SUPATYPE_ALLOW_UNVERIFIED_DOWNLOADS=1
|
|
381
|
+
console.warn("[supatype] \u26a0 SUPATYPE_ALLOW_UNVERIFIED_DOWNLOADS=1: no minisign public " +
|
|
356
382
|
"key configured; verifying SHA256 only (authenticity NOT checked).");
|
|
357
|
-
return extractChecksum(checksumsText,
|
|
383
|
+
return extractChecksum(checksumsText, binaryFilenames);
|
|
358
384
|
}
|
|
359
|
-
throw new Error("No minisign public key configured
|
|
385
|
+
throw new Error("No minisign public key configured, so cannot verify release authenticity.\n" +
|
|
360
386
|
"Published @supatype/cli builds embed the key automatically; if you are building " +
|
|
361
387
|
"from source, set SUPATYPE_RELEASE_PUBLIC_KEY to the release public key, or set " +
|
|
362
388
|
"SUPATYPE_ALLOW_UNVERIFIED_DOWNLOADS=1 to download with SHA256-only verification (unsafe).");
|
|
@@ -369,13 +395,13 @@ async function fetchChecksums(checksumsUrl, minisigUrl, binaryFilename) {
|
|
|
369
395
|
}
|
|
370
396
|
const sigText = await sigResp.text();
|
|
371
397
|
verifyMinisign(Buffer.from(checksumsText, "utf8"), sigText, pubKey);
|
|
372
|
-
return extractChecksum(checksumsText,
|
|
398
|
+
return extractChecksum(checksumsText, binaryFilenames);
|
|
373
399
|
}
|
|
374
400
|
// ---------------------------------------------------------------------------
|
|
375
401
|
// Minisign signature verification (pure Node.js, no external deps)
|
|
376
402
|
// ---------------------------------------------------------------------------
|
|
377
403
|
/**
|
|
378
|
-
* Ed25519 SPKI DER prefix
|
|
404
|
+
* Ed25519 SPKI DER prefix, wraps a raw 32-byte public key into the
|
|
379
405
|
* SubjectPublicKeyInfo structure that Node.js crypto.createPublicKey expects.
|
|
380
406
|
*
|
|
381
407
|
* Breakdown:
|
|
@@ -402,7 +428,7 @@ export function verifyMinisign(fileBytes, sigFileContent, pubKeyStr) {
|
|
|
402
428
|
const pkEd25519 = pkBytes.subarray(10, 42);
|
|
403
429
|
// Parse signature file:
|
|
404
430
|
// line 0: untrusted comment
|
|
405
|
-
// line 1: base64 sig bytes
|
|
431
|
+
// line 1: base64 sig bytes: [2 algo][8 keyId][64 Ed25519 sig]
|
|
406
432
|
// line 2: trusted comment
|
|
407
433
|
// line 3: base64 global sig (over sig bytes + trusted comment)
|
|
408
434
|
const sigLines = sigFileContent.trim().split("\n");
|
|
@@ -415,16 +441,16 @@ export function verifyMinisign(fileBytes, sigFileContent, pubKeyStr) {
|
|
|
415
441
|
const sigKeyId = sigBytes.subarray(2, 10);
|
|
416
442
|
const signature = sigBytes.subarray(10, 74);
|
|
417
443
|
// Both Ed25519 modes are supported:
|
|
418
|
-
// "Ed" (0x45, 0x64)
|
|
419
|
-
// "ED" (0x45, 0x44)
|
|
444
|
+
// "Ed" (0x45, 0x64) legacy: signature is over the raw file bytes.
|
|
445
|
+
// "ED" (0x45, 0x44) prehashed: signature is over BLAKE2b-512(file).
|
|
420
446
|
// Modern minisign (and our release pipeline) default to prehashed mode.
|
|
421
447
|
if (algo[0] !== 0x45 || (algo[1] !== 0x64 && algo[1] !== 0x44)) {
|
|
422
|
-
throw new Error("Unsupported minisign algorithm
|
|
448
|
+
throw new Error("Unsupported minisign algorithm, expected Ed25519 ('Ed' legacy or 'ED' prehashed).\n" +
|
|
423
449
|
`Got: 0x${algo[0]?.toString(16)}${algo[1]?.toString(16)}`);
|
|
424
450
|
}
|
|
425
451
|
const prehashed = algo[1] === 0x44;
|
|
426
452
|
if (!sigKeyId.equals(pkKeyId)) {
|
|
427
|
-
throw new Error("Minisign key ID mismatch
|
|
453
|
+
throw new Error("Minisign key ID mismatch: the signature was produced with a different key.\n" +
|
|
428
454
|
"This could indicate a compromised release. Do not proceed.");
|
|
429
455
|
}
|
|
430
456
|
const spkiDer = Buffer.concat([ED25519_SPKI_PREFIX, pkEd25519]);
|
|
@@ -436,23 +462,29 @@ export function verifyMinisign(fileBytes, sigFileContent, pubKeyStr) {
|
|
|
436
462
|
: fileBytes;
|
|
437
463
|
const valid = cryptoVerify(null, signedData, keyObject, signature);
|
|
438
464
|
if (!valid) {
|
|
439
|
-
throw new Error("Minisign signature verification FAILED
|
|
465
|
+
throw new Error("Minisign signature verification FAILED: the checksum file may have been tampered with.\n" +
|
|
440
466
|
"This could indicate a supply chain attack. Aborting download.");
|
|
441
467
|
}
|
|
442
468
|
}
|
|
443
469
|
/**
|
|
444
470
|
* Extract the SHA256 hash for `filename` from a checksums.sha256 file.
|
|
445
|
-
* Format: `<hash> <filename>` (sha256sum output, two spaces)
|
|
471
|
+
* Format: `<hash> <filename>` (sha256sum output, two spaces), or `<hash> *<filename>` when
|
|
472
|
+
* the publisher used binary mode.
|
|
473
|
+
*
|
|
474
|
+
* Exported so the standalone CLI download path parses the manifest the same way rather than
|
|
475
|
+
* carrying a second implementation.
|
|
446
476
|
*/
|
|
447
|
-
function extractChecksum(checksumsText,
|
|
448
|
-
const
|
|
449
|
-
for (const
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
477
|
+
export function extractChecksum(checksumsText, filenames) {
|
|
478
|
+
const targets = (Array.isArray(filenames) ? filenames : [filenames]).map((f) => basename(f));
|
|
479
|
+
for (const target of targets) {
|
|
480
|
+
for (const line of checksumsText.split("\n")) {
|
|
481
|
+
const parts = line.trim().split(/\s+/);
|
|
482
|
+
if (parts.length >= 2 && parts[1]?.replace(/^\*/, "") === target) {
|
|
483
|
+
return { filename: target, checksum: parts[0] };
|
|
484
|
+
}
|
|
453
485
|
}
|
|
454
486
|
}
|
|
455
|
-
throw new Error(`Checksum not found for "${
|
|
487
|
+
throw new Error(`Checksum not found for ${targets.map((t) => `"${t}"`).join(" or ")} in checksums.sha256.\n` +
|
|
456
488
|
"The checksums file may be from a different release.");
|
|
457
489
|
}
|
|
458
490
|
// ---------------------------------------------------------------------------
|
|
@@ -519,9 +551,9 @@ export function validateArtifactFormat(component, filePath, platform) {
|
|
|
519
551
|
}
|
|
520
552
|
/**
|
|
521
553
|
* Per-component CDN artifact shapes:
|
|
522
|
-
* engine, server, deno, realtime
|
|
523
|
-
* postgres (unix)
|
|
524
|
-
* postgres (windows)
|
|
554
|
+
* engine, server, deno, realtime: native executable (ELF / Mach-O / PE)
|
|
555
|
+
* postgres (unix) .tar.gz (gzip)
|
|
556
|
+
* postgres (windows) .zip
|
|
525
557
|
*/
|
|
526
558
|
function assertArtifactFormat(component, filePath, platform) {
|
|
527
559
|
if (component === "postgres") {
|
|
@@ -544,7 +576,7 @@ function assertGzipArchive(filePath) {
|
|
|
544
576
|
readSync(fd, magic, 0, 2, 0);
|
|
545
577
|
if (magic[0] !== 0x1f || magic[1] !== 0x8b) {
|
|
546
578
|
throw new Error("Downloaded postgres file is not a gzip archive (bad magic bytes). " +
|
|
547
|
-
"The CDN object may be corrupt or cached HTML
|
|
579
|
+
"The CDN object may be corrupt or cached HTML, so delete ~/.supatype/cache and retry.");
|
|
548
580
|
}
|
|
549
581
|
}
|
|
550
582
|
finally {
|
|
@@ -559,7 +591,7 @@ function assertZipArchive(filePath) {
|
|
|
559
591
|
readSync(fd, magic, 0, 4, 0);
|
|
560
592
|
if (magic[0] !== 0x50 || magic[1] !== 0x4b) {
|
|
561
593
|
throw new Error("Downloaded postgres file is not a zip archive (bad magic bytes). " +
|
|
562
|
-
"The CDN object may be corrupt or cached HTML
|
|
594
|
+
"The CDN object may be corrupt or cached HTML, so delete ~/.supatype/cache and retry.");
|
|
563
595
|
}
|
|
564
596
|
}
|
|
565
597
|
finally {
|
|
@@ -575,12 +607,12 @@ function assertNativeExecutable(filePath, component, platform) {
|
|
|
575
607
|
const goCArchive = magic[0] === 0x21 && magic[1] === 0x3c && magic[2] === 0x61 && magic[3] === 0x72;
|
|
576
608
|
if (goCArchive) {
|
|
577
609
|
throw new Error(`Downloaded ${component} file is a Go static archive (c-archive), not an executable. ` +
|
|
578
|
-
"The CDN object may be from a bad release build
|
|
610
|
+
"The CDN object may be from a bad release build, so delete ~/.supatype/cache and retry.");
|
|
579
611
|
}
|
|
580
612
|
if (platform.os === "windows") {
|
|
581
613
|
if (magic[0] !== 0x4d || magic[1] !== 0x5a) {
|
|
582
614
|
throw new Error(`Downloaded ${component} file is not a Windows PE executable (bad magic bytes). ` +
|
|
583
|
-
"The CDN object may be corrupt or cached HTML
|
|
615
|
+
"The CDN object may be corrupt or cached HTML, so delete ~/.supatype/cache and retry.");
|
|
584
616
|
}
|
|
585
617
|
return;
|
|
586
618
|
}
|
|
@@ -588,7 +620,7 @@ function assertNativeExecutable(filePath, component, platform) {
|
|
|
588
620
|
const elf = magic[0] === 0x7f && magic[1] === 0x45 && magic[2] === 0x4c && magic[3] === 0x46;
|
|
589
621
|
if (!elf) {
|
|
590
622
|
throw new Error(`Downloaded ${component} file is not an ELF executable (bad magic bytes). ` +
|
|
591
|
-
"The CDN object may be corrupt or cached HTML
|
|
623
|
+
"The CDN object may be corrupt or cached HTML, so delete ~/.supatype/cache and retry.");
|
|
592
624
|
}
|
|
593
625
|
return;
|
|
594
626
|
}
|
|
@@ -599,7 +631,7 @@ function assertNativeExecutable(filePath, component, platform) {
|
|
|
599
631
|
magic.readUInt32BE(0) === 0xca_fe_ba_be;
|
|
600
632
|
if (!macho) {
|
|
601
633
|
throw new Error(`Downloaded ${component} file is not a Mach-O executable (bad magic bytes). ` +
|
|
602
|
-
"The CDN object may be corrupt or cached HTML
|
|
634
|
+
"The CDN object may be corrupt or cached HTML, so delete ~/.supatype/cache and retry.");
|
|
603
635
|
}
|
|
604
636
|
}
|
|
605
637
|
finally {
|
|
@@ -638,7 +670,7 @@ async function withRetry(fn, attempts = 3) {
|
|
|
638
670
|
// Helpers
|
|
639
671
|
// ---------------------------------------------------------------------------
|
|
640
672
|
/**
|
|
641
|
-
* On Windows, Git Bash represents paths as /c/Users
|
|
673
|
+
* On Windows, Git Bash represents paths as /c/Users/..., convert to C:\Users\...
|
|
642
674
|
*/
|
|
643
675
|
export function normalisePlatformPath(p) {
|
|
644
676
|
let result = p;
|
|
@@ -722,7 +754,7 @@ export async function fetchAllLatestVersions() {
|
|
|
722
754
|
*/
|
|
723
755
|
/**
|
|
724
756
|
* Verify cached binaries for the current platform (used by integration CI).
|
|
725
|
-
* Only checks components present in `versions
|
|
757
|
+
* Only checks components present in `versions`; unpublished CDN components
|
|
726
758
|
* (no latest.json yet) are skipped with a log so CI can land before first release.
|
|
727
759
|
* Throws if a pinned component is missing from cache or fails format checks.
|
|
728
760
|
*/
|
|
@@ -734,7 +766,7 @@ export function verifyCachedBinaries(versions) {
|
|
|
734
766
|
for (const component of BINARY_COMPONENTS) {
|
|
735
767
|
const version = versions[component];
|
|
736
768
|
if (typeof version !== "string" || version.trim() === "") {
|
|
737
|
-
console.log(`[supatype] skipping verify for ${component} (no version
|
|
769
|
+
console.log(`[supatype] skipping verify for ${component} (no version, CDN latest.json not published yet)`);
|
|
738
770
|
continue;
|
|
739
771
|
}
|
|
740
772
|
const destPath = join(cachePath(component, version), binaryName(component, version, platform));
|