@supatype/cli 0.1.7 → 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 +128 -128
- package/.turbo/turbo-typecheck.log +1 -1
- package/LICENSE +202 -0
- package/deno.d.ts +1 -1
- package/dist/app/framework.js +1 -1
- package/dist/app/framework.js.map +1 -1
- package/dist/augmentation-generator.d.ts +1 -1
- package/dist/augmentation-generator.js +3 -3
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/binary-cache.d.ts +30 -8
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +47 -35
- package/dist/binary-cache.js.map +1 -1
- package/dist/cache-pins.d.ts +1 -1
- package/dist/cache-pins.js +2 -2
- package/dist/cache-pins.js.map +1 -1
- 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 +9 -1
- package/dist/cli-install-method.d.ts.map +1 -1
- package/dist/cli-install-method.js +22 -4
- package/dist/cli-install-method.js.map +1 -1
- 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.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.js +1 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/admin.js +6 -6
- 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.js +3 -3
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/db.d.ts +3 -3
- package/dist/commands/db.js +9 -9
- 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.js +17 -17
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +3 -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.js +5 -5
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/hooks.d.ts +2 -2
- package/dist/commands/hooks.js +4 -4
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.js +28 -28
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- 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.js +3 -3
- 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 +2 -8
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +20 -12
- 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 +3 -3
- package/dist/config.js.map +1 -1
- package/dist/db-preflight.d.ts +4 -4
- package/dist/db-preflight.js +14 -14
- package/dist/db-preflight.js.map +1 -1
- package/dist/dev-compose.d.ts +3 -3
- package/dist/dev-compose.js +27 -27
- 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 +2 -2
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +1 -1
- package/dist/env-file.js.map +1 -1
- package/dist/field-masking-tier.d.ts +5 -5
- package/dist/field-masking-tier.d.ts.map +1 -1
- package/dist/field-masking-tier.js +6 -6
- package/dist/field-masking-tier.js.map +1 -1
- package/dist/functions-deno-types.d.ts +1 -1
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +3 -3
- package/dist/functions-deno-types.js.map +1 -1
- 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 +1 -1
- package/dist/hook-upload.js +3 -3
- package/dist/hooks-generator.d.ts +1 -1
- package/dist/hooks-generator.js +9 -9
- 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 +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/local-secrets.d.ts +5 -5
- package/dist/local-secrets.js +5 -5
- 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 +3 -3
- package/dist/model-hooks.js +4 -4
- 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 +1 -1
- package/dist/postgres-ctl.js +4 -4
- 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 +12 -12
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +9 -9
- 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 +1 -1
- package/dist/resolve-target.d.ts.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 +3 -3
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js +2 -2
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-push-lock.js +3 -3
- 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 +5 -5
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +24 -24
- package/dist/self-host-compose.js.map +1 -1
- package/dist/service-role-check.js +3 -3
- package/dist/service-role-check.js.map +1 -1
- 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.js +1 -1
- 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.js +27 -27
- 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 +1 -1
- 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.js +1 -1
- 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 +3 -2
- package/scripts/build-release-artifacts.sh +112 -0
- package/scripts/generate-homebrew-formula.mjs +47 -45
- 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 +3 -3
- package/src/binary-cache.ts +51 -36
- package/src/cache-pins.ts +2 -2
- package/src/cli-artifacts.ts +65 -0
- package/src/cli-install-method.ts +24 -4
- 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 +1 -1
- package/src/commands/add.ts +1 -1
- package/src/commands/admin.ts +6 -6
- package/src/commands/adopt.ts +1 -1
- package/src/commands/app.ts +2 -2
- package/src/commands/cache.ts +3 -3
- package/src/commands/db.ts +9 -9
- package/src/commands/deploy.ts +12 -12
- package/src/commands/dev.ts +19 -19
- package/src/commands/doctor.ts +3 -3
- package/src/commands/engine.ts +1 -1
- package/src/commands/functions.ts +5 -5
- package/src/commands/hooks.ts +6 -6
- package/src/commands/init.ts +28 -28
- package/src/commands/login.ts +2 -2
- 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 +3 -3
- package/src/commands/self-host.ts +1 -1
- package/src/commands/self-update.ts +23 -73
- package/src/commands/status.ts +1 -1
- package/src/commands/update.ts +1 -1
- package/src/config.ts +3 -3
- package/src/db-preflight.ts +15 -15
- package/src/dev-compose.ts +27 -27
- 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 +2 -2
- package/src/field-masking-tier.ts +6 -6
- package/src/functions-deno-types.ts +3 -3
- package/src/functions-router-gen.ts +1 -1
- package/src/gitignore.ts +3 -3
- package/src/hook-upload.ts +3 -3
- package/src/hooks-generator.ts +9 -9
- package/src/index.ts +1 -1
- package/src/init-project-detect.ts +1 -1
- package/src/link.ts +1 -1
- package/src/local-secrets.ts +5 -5
- package/src/main.ts +20 -0
- package/src/model-hooks.ts +4 -4
- package/src/pgbouncer-userlist.ts +2 -2
- package/src/postgres-ctl.ts +4 -4
- package/src/process-manager.ts +4 -4
- package/src/project-config.ts +16 -16
- 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 +1 -1
- package/src/rest-cache-admin.ts +2 -2
- package/src/runtime-routes.ts +2 -2
- package/src/schema-ast-v2.ts +4 -4
- package/src/schema-push-lock.ts +3 -3
- package/src/scripts/postinstall.ts +1 -1
- package/src/self-host-compose.ts +25 -25
- package/src/service-role-check.ts +3 -3
- 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 +1 -1
- package/src/tsx-runner.ts +1 -1
- package/src/type-extractor.ts +27 -27
- 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 +1 -1
- package/src/ui/runtime/run-clack-flow.tsx +1 -1
- package/src/ui/runtime/stdin-after-ink.ts +1 -1
- package/src/ui/theme.ts +1 -1
- package/src/valkey-sidecar.ts +2 -2
- package/tests/access-composition.test.ts +6 -6
- package/tests/admin-studio-membership.test.ts +1 -1
- package/tests/api-schemas.test.ts +1 -1
- package/tests/archive-name-alias.test.ts +1 -1
- package/tests/cli-help.test.ts +8 -2
- package/tests/db-preflight.test.ts +1 -1
- package/tests/doctor-render.test.ts +3 -3
- package/tests/doctor-service-role.test.ts +2 -2
- package/tests/engine-push-output.test.ts +1 -1
- package/tests/env-file.test.ts +3 -3
- package/tests/external-database-compose.test.ts +5 -5
- package/tests/external-database-config.test.ts +2 -2
- package/tests/field-masking-tier.test.ts +1 -1
- package/tests/homebrew-formula.test.ts +68 -26
- package/tests/hook-upload.test.ts +1 -1
- package/tests/hooks-generator.test.ts +1 -1
- package/tests/init.test.ts +2 -2
- package/tests/keys.test.ts +8 -2
- package/tests/local-secrets.test.ts +3 -3
- package/tests/model-hooks.test.ts +6 -6
- package/tests/runtime-contract.test.ts +2 -2
- package/tests/service-role-check.test.ts +3 -3
- package/tests/storage-provision.test.ts +1 -1
- package/tests/type-extractor.test.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +7 -1
- package/scripts/build-release-bundle.mjs +0 -27
|
@@ -20,7 +20,7 @@ import { apiSchemaList, validateProjectConfig, type SupatypeProjectConfig } from
|
|
|
20
20
|
*
|
|
21
21
|
* The rule is deliberately **not** "is the database external". A native `supatype dev` has no
|
|
22
22
|
* extension either, and calling that tier 1 would point PostgREST at a schema whose tables the API
|
|
23
|
-
* roles no longer hold privileges on
|
|
23
|
+
* roles no longer hold privileges on, every request denied.
|
|
24
24
|
*/
|
|
25
25
|
const project = (database: unknown, rest: Record<string, unknown> = {}): SupatypeProjectConfig =>
|
|
26
26
|
validateProjectConfig(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"
|
|
2
|
+
import { createHash } from "node:crypto"
|
|
2
3
|
import { join } from "node:path"
|
|
3
4
|
import { tmpdir } from "node:os"
|
|
4
5
|
import { spawnSync } from "node:child_process"
|
|
@@ -7,19 +8,36 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest"
|
|
|
7
8
|
let counter = 0
|
|
8
9
|
let tmpDir: string
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"supatype-cli-
|
|
14
|
-
"supatype-cli-
|
|
11
|
+
// The published artefacts: one archive per platform, plus the musl variants Homebrew does not
|
|
12
|
+
// use, since Homebrew on Linux is glibc.
|
|
13
|
+
const ARCHIVES = [
|
|
14
|
+
"supatype-cli-darwin-arm64.tar.gz",
|
|
15
|
+
"supatype-cli-darwin-amd64.tar.gz",
|
|
16
|
+
"supatype-cli-linux-arm64.tar.gz",
|
|
17
|
+
"supatype-cli-linux-amd64.tar.gz",
|
|
18
|
+
"supatype-cli-linux-amd64-musl.tar.gz",
|
|
19
|
+
"supatype-cli-windows-amd64.zip",
|
|
15
20
|
]
|
|
16
21
|
|
|
22
|
+
const script = () => join(import.meta.dirname, "../scripts/generate-homebrew-formula.mjs")
|
|
23
|
+
|
|
24
|
+
/** Write stub archives and the checksums manifest that build-release-artifacts.sh produces. */
|
|
25
|
+
function writeArtifacts(names: string[]): Record<string, string> {
|
|
26
|
+
const hashes: Record<string, string> = {}
|
|
27
|
+
const lines: string[] = []
|
|
28
|
+
for (const name of names) {
|
|
29
|
+
const body = `stub-${name}\n`
|
|
30
|
+
writeFileSync(join(tmpDir, name), body, "utf8")
|
|
31
|
+
hashes[name] = createHash("sha256").update(body).digest("hex")
|
|
32
|
+
lines.push(`${hashes[name]} ${name}`)
|
|
33
|
+
}
|
|
34
|
+
writeFileSync(join(tmpDir, "checksums.sha256"), lines.join("\n") + "\n", "utf8")
|
|
35
|
+
return hashes
|
|
36
|
+
}
|
|
37
|
+
|
|
17
38
|
beforeEach(() => {
|
|
18
39
|
tmpDir = join(tmpdir(), `homebrew-formula-${Date.now()}-${++counter}`)
|
|
19
40
|
mkdirSync(tmpDir, { recursive: true })
|
|
20
|
-
for (const name of PLATFORMS) {
|
|
21
|
-
writeFileSync(join(tmpDir, name), `stub-${name}\n`, "utf8")
|
|
22
|
-
}
|
|
23
41
|
})
|
|
24
42
|
|
|
25
43
|
afterEach(() => {
|
|
@@ -27,32 +45,56 @@ afterEach(() => {
|
|
|
27
45
|
})
|
|
28
46
|
|
|
29
47
|
describe("generate-homebrew-formula.mjs", () => {
|
|
30
|
-
it("
|
|
48
|
+
it("points at the published archives, with the hashes from the manifest", () => {
|
|
49
|
+
const hashes = writeArtifacts(ARCHIVES)
|
|
31
50
|
const outPath = join(tmpDir, "supatype.rb")
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
process.
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
encoding: "utf8",
|
|
38
|
-
env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
|
|
39
|
-
},
|
|
40
|
-
)
|
|
51
|
+
const result = spawnSync(process.execPath, [script(), "9.9.9", tmpDir], {
|
|
52
|
+
encoding: "utf8",
|
|
53
|
+
env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
|
|
54
|
+
})
|
|
41
55
|
|
|
42
56
|
expect(result.status, result.stderr).toBe(0)
|
|
43
57
|
const formula = readFileSync(outPath, "utf8")
|
|
58
|
+
|
|
44
59
|
expect(formula).toContain('version "9.9.9"')
|
|
45
|
-
expect(formula).toContain("
|
|
46
|
-
expect(formula).
|
|
60
|
+
expect(formula).toContain('license "Apache-2.0"')
|
|
61
|
+
expect(formula).toContain(
|
|
62
|
+
"https://releases.supatype.com/cli/v9.9.9/supatype-cli-darwin-arm64.tar.gz",
|
|
63
|
+
)
|
|
64
|
+
// The hash has to be the manifest's, not one the generator computed for itself: the manifest
|
|
65
|
+
// is the signed record of what was published.
|
|
66
|
+
expect(formula).toContain(`sha256 "${hashes["supatype-cli-darwin-arm64.tar.gz"]}"`)
|
|
67
|
+
// Every archive holds one executable called `supatype`, so there is no per-platform rename.
|
|
68
|
+
expect(formula).toContain('bin.install "supatype"')
|
|
47
69
|
expect(formula).toContain('system bin/"supatype", "_postinstall"')
|
|
48
|
-
expect(formula).toContain('bin.install "supatype-cli-#{arch}" => "supatype"')
|
|
49
70
|
})
|
|
50
71
|
|
|
51
|
-
it("
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
const result = spawnSync(process.execPath, [script, "
|
|
72
|
+
it("does not reference the musl or windows artefacts", () => {
|
|
73
|
+
writeArtifacts(ARCHIVES)
|
|
74
|
+
const outPath = join(tmpDir, "supatype.rb")
|
|
75
|
+
const result = spawnSync(process.execPath, [script(), "9.9.9", tmpDir], {
|
|
76
|
+
encoding: "utf8",
|
|
77
|
+
env: { ...process.env, HOMEBREW_FORMULA_OUT: outPath },
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
expect(result.status, result.stderr).toBe(0)
|
|
81
|
+
const formula = readFileSync(outPath, "utf8")
|
|
82
|
+
expect(formula).not.toContain("musl")
|
|
83
|
+
expect(formula).not.toContain("windows")
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it("fails when the manifest is missing, rather than hashing the files itself", () => {
|
|
87
|
+
writeArtifacts(ARCHIVES)
|
|
88
|
+
rmSync(join(tmpDir, "checksums.sha256"))
|
|
89
|
+
const result = spawnSync(process.execPath, [script(), "1.0.0", tmpDir], { encoding: "utf8" })
|
|
90
|
+
expect(result.status).not.toBe(0)
|
|
91
|
+
expect(result.stderr).toContain("checksums.sha256")
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it("fails when the manifest omits a platform it needs", () => {
|
|
95
|
+
writeArtifacts(ARCHIVES.filter((n) => n !== "supatype-cli-linux-amd64.tar.gz"))
|
|
96
|
+
const result = spawnSync(process.execPath, [script(), "1.0.0", tmpDir], { encoding: "utf8" })
|
|
55
97
|
expect(result.status).not.toBe(0)
|
|
56
|
-
expect(result.stderr).toContain("
|
|
98
|
+
expect(result.stderr).toContain("No checksum for supatype-cli-linux-amd64.tar.gz")
|
|
57
99
|
})
|
|
58
100
|
})
|
|
@@ -86,7 +86,7 @@ describe("readHookUpload", () => {
|
|
|
86
86
|
})
|
|
87
87
|
|
|
88
88
|
it("refuses a hook with a second file rather than dropping it", () => {
|
|
89
|
-
// Silent truncation would deploy successfully and fail at import
|
|
89
|
+
// Silent truncation would deploy successfully and fail at import, which reads to the caller as
|
|
90
90
|
// that table's writes being broken for no visible reason.
|
|
91
91
|
const { cwd, hooks } = project()
|
|
92
92
|
writeHook(hooks, "moderate-post", HANDLER, { "helpers.ts": "export const x = 1\n" })
|
|
@@ -71,7 +71,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
|
|
|
71
71
|
describe("the generated module compiles", () => {
|
|
72
72
|
/**
|
|
73
73
|
* The generator emits TypeScript, so the only test that really proves it works is a compiler.
|
|
74
|
-
* A missing brace or a type that does not resolve would otherwise reach a user's editor
|
|
74
|
+
* A missing brace or a type that does not resolve would otherwise reach a user's editor, and this
|
|
75
75
|
* file is imported by their hook, so a broken emit breaks their function rather than our build.
|
|
76
76
|
*/
|
|
77
77
|
it("typechecks under strict mode, together with a handler that uses it", () => {
|
package/tests/init.test.ts
CHANGED
|
@@ -329,7 +329,7 @@ describe("scaffold()", () => {
|
|
|
329
329
|
expect(config).toContain('provider: "local"')
|
|
330
330
|
expect(config).toContain("Production storage: external S3")
|
|
331
331
|
const env = readFileSync(join(tmpRoot, ".env"), "utf8")
|
|
332
|
-
expect(env).toContain("local development
|
|
333
|
-
expect(env).toContain("production
|
|
332
|
+
expect(env).toContain("local development, MinIO")
|
|
333
|
+
expect(env).toContain("production, external bucket")
|
|
334
334
|
})
|
|
335
335
|
})
|
package/tests/keys.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for `supatype keys
|
|
2
|
+
* Tests for `supatype keys`, JWT generation command.
|
|
3
3
|
* Uses subprocess tests (requires built dist/) for the CLI integration,
|
|
4
4
|
* plus direct module tests for the signing logic.
|
|
5
5
|
*/
|
|
@@ -20,10 +20,16 @@ function runCli(
|
|
|
20
20
|
): { stdout: string; stderr: string; exitCode: number } {
|
|
21
21
|
const result = spawnSync(process.execPath, [CLI_BIN, ...args], {
|
|
22
22
|
encoding: "utf8",
|
|
23
|
-
timeout:
|
|
23
|
+
timeout: 60_000,
|
|
24
24
|
cwd: opts.cwd,
|
|
25
25
|
env: { ...process.env, ...opts.env },
|
|
26
26
|
})
|
|
27
|
+
if (result.signal) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`CLI subprocess killed by ${result.signal} after the spawn timeout. `
|
|
30
|
+
+ `Args: ${args.join(" ")}. This is usually machine contention, not a CLI fault.`,
|
|
31
|
+
)
|
|
32
|
+
}
|
|
27
33
|
return {
|
|
28
34
|
stdout: String(result.stdout ?? ""),
|
|
29
35
|
stderr: String(result.stderr ?? ""),
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { upsertEnvFile } from "../src/env-file.js"
|
|
15
15
|
|
|
16
16
|
// The bug these exist to prevent: `supatype dev` used to pin POSTGRES_PASSWORD and JWT_SECRET
|
|
17
|
-
// to published constants in `.env` on every run
|
|
17
|
+
// to published constants in `.env` on every run, the same `.env` a self-host deployment reads.
|
|
18
18
|
// A generated secret survived until the developer's next `dev`, then reverted silently, and the
|
|
19
19
|
// deployment went out with a secret anyone can look up.
|
|
20
20
|
|
|
@@ -32,7 +32,7 @@ describe("resolving local secrets", () => {
|
|
|
32
32
|
expect(devAuthenticatorPassword(dir)).toBe("auth-mine")
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
// A project with no `.env` still has to start, so the constants remain
|
|
35
|
+
// A project with no `.env` still has to start, so the constants remain, as fallbacks only.
|
|
36
36
|
it("falls back when the project has none", () => {
|
|
37
37
|
const dir = project()
|
|
38
38
|
expect(devJwtSecret(dir)).toBe(FALLBACK_JWT_SECRET)
|
|
@@ -43,7 +43,7 @@ describe("resolving local secrets", () => {
|
|
|
43
43
|
|
|
44
44
|
describe("the dev env write does not clobber secrets", () => {
|
|
45
45
|
// This is the regression. `upsertEnvFile` replaces any key handed to it, so the guarantee has
|
|
46
|
-
// to be that the dev path never hands it these
|
|
46
|
+
// to be that the dev path never hands it these, asserted here at the level that matters:
|
|
47
47
|
// write what dev writes, then check the secrets are byte-identical.
|
|
48
48
|
it("leaves generated secrets untouched across repeated writes", () => {
|
|
49
49
|
const dir = project(
|
|
@@ -33,7 +33,7 @@ function addFunction(dir: string, name: string): void {
|
|
|
33
33
|
writeFileSync(join(dir, "functions", name, "index.ts"), "export default () => new Response()", "utf8")
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
describe("model hooks
|
|
36
|
+
describe("model hooks: declaration", () => {
|
|
37
37
|
it("extracts both the shorthand and the options form", () => {
|
|
38
38
|
const { ast } = project(`
|
|
39
39
|
import type { Model, UUID } from "@supatype/types"
|
|
@@ -84,7 +84,7 @@ export type Post = Model<{ id: UUID }, {
|
|
|
84
84
|
})
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
describe("model hooks
|
|
87
|
+
describe("model hooks: push-time validation", () => {
|
|
88
88
|
const schema = `
|
|
89
89
|
import type { Model, UUID } from "@supatype/types"
|
|
90
90
|
|
|
@@ -142,7 +142,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
|
|
|
142
142
|
})
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
describe("model hooks
|
|
145
|
+
describe("model hooks: manifest map", () => {
|
|
146
146
|
const schema = `
|
|
147
147
|
import type { Model, UUID } from "@supatype/types"
|
|
148
148
|
|
|
@@ -193,7 +193,7 @@ export type Post = Model<{ id: UUID }, {
|
|
|
193
193
|
|
|
194
194
|
it("never creates a manifest from scratch", () => {
|
|
195
195
|
// `functions_enabled` is a plain bool on the server's side, so a manifest carrying only hooks
|
|
196
|
-
// would read as functions *disabled
|
|
196
|
+
// would read as functions *disabled*, the defect fixed one commit earlier, by another door.
|
|
197
197
|
const { dir, ast } = project(schema)
|
|
198
198
|
expect(syncManifestHooks(dir, ast)).toBe(false)
|
|
199
199
|
expect(existsSync(join(dir, ".supatype", "manifest.json"))).toBe(false)
|
|
@@ -220,7 +220,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts" }>
|
|
|
220
220
|
})
|
|
221
221
|
})
|
|
222
222
|
|
|
223
|
-
describe("model hooks
|
|
223
|
+
describe("model hooks: generated module on disk", () => {
|
|
224
224
|
it("removes a stale module when the last hook is deleted", () => {
|
|
225
225
|
// Otherwise a typed module sits there claiming tables are hooked, and a handler importing it
|
|
226
226
|
// keeps compiling while never running.
|
|
@@ -250,7 +250,7 @@ export type Post = Model<{ id: UUID }, { tableName: "posts"; hooks: { beforeChan
|
|
|
250
250
|
})
|
|
251
251
|
})
|
|
252
252
|
|
|
253
|
-
describe("model hooks
|
|
253
|
+
describe("model hooks: doctor report", () => {
|
|
254
254
|
const schema = `
|
|
255
255
|
import type { Model, UUID } from "@supatype/types"
|
|
256
256
|
|
|
@@ -130,7 +130,7 @@ describe("runtime contract", () => {
|
|
|
130
130
|
|
|
131
131
|
// PostgREST must connect as `authenticator`, never as POSTGRES_USER. POSTGRES_USER is
|
|
132
132
|
// `supatype_admin`, a superuser, and a superuser session may SET ROLE to any role in the
|
|
133
|
-
// cluster
|
|
133
|
+
// cluster: so a request whose JWT named one got it. Verified against a live stack: a
|
|
134
134
|
// token with `role: "supatype_admin"` returned every row of an RLS-protected table.
|
|
135
135
|
it("self-host compose connects PostgREST as authenticator, not the superuser", () => {
|
|
136
136
|
const compose = renderSelfHostCompose(baseConfig)
|
|
@@ -149,7 +149,7 @@ describe("runtime contract", () => {
|
|
|
149
149
|
})
|
|
150
150
|
|
|
151
151
|
// `supatype dev --provider docker` renders *this* file, so a `${VAR:?}` with no default
|
|
152
|
-
// takes local dev down before anything starts
|
|
152
|
+
// takes local dev down before anything starts, `docker compose` refuses to interpolate and
|
|
153
153
|
// exits 1. Adding one therefore means wiring it into `upsertDevComposeEnv` as well. This
|
|
154
154
|
// list is the reminder; if it fails, do that rather than just updating the list.
|
|
155
155
|
it("requires only variables the dev path also sets", () => {
|
|
@@ -66,7 +66,7 @@ describe("checkServiceRoleRoutes", () => {
|
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
it("warns rather than fails on a hook entry", () => {
|
|
69
|
-
// It was the documented form once, and the worker grants hooks whatever the list says
|
|
69
|
+
// It was the documented form once, and the worker grants hooks whatever the list says, so it is
|
|
70
70
|
// harmless, and worth saying because a reader would assume the line is what grants.
|
|
71
71
|
const problems = checkServiceRoleRoutes(config(["hooks/moderate-post"]), projectWith([]))
|
|
72
72
|
expect(problems.errors).toEqual([])
|
|
@@ -89,7 +89,7 @@ describe("serviceRoleProblemLines", () => {
|
|
|
89
89
|
|
|
90
90
|
it("lists what could have been named instead", () => {
|
|
91
91
|
const lines = serviceRoleProblemLines({
|
|
92
|
-
errors: [' "x"
|
|
92
|
+
errors: [' "x": no functions/x/index.ts'],
|
|
93
93
|
missing: ["x"],
|
|
94
94
|
warnings: [],
|
|
95
95
|
available: ["audit", "send-email"],
|
|
@@ -99,7 +99,7 @@ describe("serviceRoleProblemLines", () => {
|
|
|
99
99
|
|
|
100
100
|
it("says so when there are no functions at all", () => {
|
|
101
101
|
const lines = serviceRoleProblemLines({
|
|
102
|
-
errors: [' "x"
|
|
102
|
+
errors: [' "x": nope'],
|
|
103
103
|
missing: ["x"],
|
|
104
104
|
warnings: [],
|
|
105
105
|
available: [],
|
|
@@ -80,7 +80,7 @@ describe("provisionBuckets", () => {
|
|
|
80
80
|
|
|
81
81
|
await provisionBuckets("http://localhost:54321/storage/v1", "key", [{ id: "photos", public: false }])
|
|
82
82
|
|
|
83
|
-
expect(warn).toHaveBeenCalledWith('[storage] Storage API unreachable
|
|
83
|
+
expect(warn).toHaveBeenCalledWith('[storage] Storage API unreachable, skipped bucket "photos"')
|
|
84
84
|
})
|
|
85
85
|
})
|
|
86
86
|
|
|
@@ -1255,8 +1255,8 @@ export type Invoice = Model<{
|
|
|
1255
1255
|
|
|
1256
1256
|
it("extracts Code and Currency as JSONB carrying their declared shape", () => {
|
|
1257
1257
|
// Both were exported from `@supatype/types` and rejected by the extractor, so a schema using
|
|
1258
|
-
// either failed the push with "unknown type". Each carries two values
|
|
1259
|
-
// source, an amount with its currency
|
|
1258
|
+
// either failed the push with "unknown type". Each carries two values, a language with its
|
|
1259
|
+
// source, an amount with its currency, so JSONB is the column that does not drop one.
|
|
1260
1260
|
const dir = mkdtempSync(join(tmpdir(), "supatype-code-currency-"))
|
|
1261
1261
|
dirs.push(dir)
|
|
1262
1262
|
const schemaPath = join(dir, "schema.ts")
|