@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which mechanism will enforce this project's per-column rules
|
|
2
|
+
* Which mechanism will enforce this project's per-column rules, decided offline.
|
|
3
3
|
*
|
|
4
4
|
* The engine makes the same decision at push time by asking the database whether `supatype_mask` is
|
|
5
5
|
* installed. The CLI has to answer earlier: it writes `PGRST_DB_SCHEMA` when it generates compose,
|
|
6
6
|
* before any database necessarily exists. It can, because the extension needs
|
|
7
|
-
* `shared_preload_libraries` and a compiled library on the host, so exactly one path ships it
|
|
7
|
+
* `shared_preload_libraries` and a compiled library on the host, so exactly one path ships it,
|
|
8
8
|
* `supatype/postgres`. Everything else gets the view tier:
|
|
9
9
|
*
|
|
10
10
|
* | Config | Ships the extension | Tier |
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Deliberately **not** "is the database external": a native `supatype dev` has no extension either,
|
|
18
18
|
* and treating it as tier 1 would point PostgREST at a schema whose tables the API roles no longer
|
|
19
|
-
* hold privileges on
|
|
19
|
+
* hold privileges on: every request denied.
|
|
20
20
|
*
|
|
21
21
|
* The one case this cannot call is a self-managed Postgres where the operator compiled and installed
|
|
22
22
|
* the extension themselves and points at it with `database.external`. They set `schema.api_schemas`
|
|
@@ -37,12 +37,12 @@ export declare function imageShipsMaskExtension(config: SupatypeProjectConfig):
|
|
|
37
37
|
export declare function schemaHasFieldRules(ast: unknown): boolean;
|
|
38
38
|
/** The tier this project's next push will use. */
|
|
39
39
|
export declare function fieldMaskingTier(config: SupatypeProjectConfig, ast: unknown,
|
|
40
|
-
/** Set on the native path once the Postgres install is known
|
|
40
|
+
/** Set on the native path once the Postgres install is known, see [`nativeMaskLibraryPresent`]. */
|
|
41
41
|
maskLibraryPresent?: boolean): FieldMaskingTier;
|
|
42
42
|
/**
|
|
43
43
|
* The tier for a project on disk, loading its schema to see whether any column is masked.
|
|
44
44
|
*
|
|
45
|
-
* A schema that fails to load falls back to `"none"
|
|
45
|
+
* A schema that fails to load falls back to `"none"`, the default exposed-schema list. Deciding the
|
|
46
46
|
* tier is the wrong moment to report a syntax error, and `push`/`dev` do it properly moments later
|
|
47
47
|
* with the file and line.
|
|
48
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-masking-tier.d.ts","sourceRoot":"","sources":["../src/field-masking-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAOhE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAA;AAY7D,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAG9E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAUzD;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,OAAO;AACZ,
|
|
1
|
+
{"version":3,"file":"field-masking-tier.d.ts","sourceRoot":"","sources":["../src/field-masking-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAOhE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAA;AAY7D,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAG9E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAUzD;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,OAAO;AACZ,mGAAmG;AACnG,kBAAkB,CAAC,EAAE,OAAO,GAC3B,gBAAgB,CAIlB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,qBAAqB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC3B,gBAAgB,CAQlB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which mechanism will enforce this project's per-column rules
|
|
2
|
+
* Which mechanism will enforce this project's per-column rules, decided offline.
|
|
3
3
|
*
|
|
4
4
|
* The engine makes the same decision at push time by asking the database whether `supatype_mask` is
|
|
5
5
|
* installed. The CLI has to answer earlier: it writes `PGRST_DB_SCHEMA` when it generates compose,
|
|
6
6
|
* before any database necessarily exists. It can, because the extension needs
|
|
7
|
-
* `shared_preload_libraries` and a compiled library on the host, so exactly one path ships it
|
|
7
|
+
* `shared_preload_libraries` and a compiled library on the host, so exactly one path ships it,
|
|
8
8
|
* `supatype/postgres`. Everything else gets the view tier:
|
|
9
9
|
*
|
|
10
10
|
* | Config | Ships the extension | Tier |
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Deliberately **not** "is the database external": a native `supatype dev` has no extension either,
|
|
18
18
|
* and treating it as tier 1 would point PostgREST at a schema whose tables the API roles no longer
|
|
19
|
-
* hold privileges on
|
|
19
|
+
* hold privileges on: every request denied.
|
|
20
20
|
*
|
|
21
21
|
* The one case this cannot call is a self-managed Postgres where the operator compiled and installed
|
|
22
22
|
* the extension themselves and points at it with `database.external`. They set `schema.api_schemas`
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { existsSync } from "node:fs";
|
|
26
26
|
// Statically imported: these packages are ESM, where `require` does not exist. The first attempt used
|
|
27
|
-
// it for a lazy import and every command that generates compose would have thrown at runtime
|
|
27
|
+
// it for a lazy import and every command that generates compose would have thrown at runtime, caught
|
|
28
28
|
// by the tests that run the built binary rather than the source.
|
|
29
29
|
import { loadSchemaAst } from "./config.js";
|
|
30
30
|
export { nativeMaskLibraryPresent } from "./postgres-ctl.js";
|
|
@@ -62,7 +62,7 @@ export function schemaHasFieldRules(ast) {
|
|
|
62
62
|
}
|
|
63
63
|
/** The tier this project's next push will use. */
|
|
64
64
|
export function fieldMaskingTier(config, ast,
|
|
65
|
-
/** Set on the native path once the Postgres install is known
|
|
65
|
+
/** Set on the native path once the Postgres install is known, see [`nativeMaskLibraryPresent`]. */
|
|
66
66
|
maskLibraryPresent) {
|
|
67
67
|
if (!schemaHasFieldRules(ast))
|
|
68
68
|
return "none";
|
|
@@ -73,7 +73,7 @@ maskLibraryPresent) {
|
|
|
73
73
|
/**
|
|
74
74
|
* The tier for a project on disk, loading its schema to see whether any column is masked.
|
|
75
75
|
*
|
|
76
|
-
* A schema that fails to load falls back to `"none"
|
|
76
|
+
* A schema that fails to load falls back to `"none"`, the default exposed-schema list. Deciding the
|
|
77
77
|
* tier is the wrong moment to report a syntax error, and `push`/`dev` do it properly moments later
|
|
78
78
|
* with the file and line.
|
|
79
79
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-masking-tier.js","sourceRoot":"","sources":["../src/field-masking-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,sGAAsG;AACtG,
|
|
1
|
+
{"version":3,"file":"field-masking-tier.js","sourceRoot":"","sources":["../src/field-masking-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,sGAAsG;AACtG,qGAAqG;AACrG,iEAAiE;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAA;AAK5B,sEAAsE;AACtE,SAAS,aAAa,CAAC,MAA6B;IAClD,IAAI,oBAAoB,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAClD,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,IAAI,sBAAsB,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzF,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,0BAA0B,CAAA;AACpE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CAAC,MAA6B;IACnE,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;IACnC,OAAO,KAAK,KAAK,SAAS,IAAI,0BAA0B,CAAC,IAAI,CAAC,KA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C,CAAA;IACrF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAA;IACf,CAAC;AACH,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/** Ambient Deno types written into `functions/deno.d.ts`. */
|
|
10
10
|
export declare function functionsDenoAmbientSource(): string;
|
|
11
|
-
/** `functions/tsconfig.json
|
|
11
|
+
/** `functions/tsconfig.json`: owns function files so the app config can exclude them. */
|
|
12
12
|
export declare function functionsTsConfigSource(): string;
|
|
13
13
|
export type FunctionsDenoTypesResult = {
|
|
14
14
|
wroteDenoDts: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions-deno-types.d.ts","sourceRoot":"","sources":["../src/functions-deno-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,6DAA6D;AAC7D,wBAAgB,0BAA0B,IAAI,MAAM,CAsDnD;AAED,
|
|
1
|
+
{"version":3,"file":"functions-deno-types.d.ts","sourceRoot":"","sources":["../src/functions-deno-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,6DAA6D;AAC7D,wBAAgB,0BAA0B,IAAI,MAAM,CAsDnD;AAED,yFAAyF;AACzF,wBAAgB,uBAAuB,IAAI,MAAM,CAiBhD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;IACzD,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,wBAAwB,CAiC1B"}
|
|
@@ -15,7 +15,7 @@ export function functionsDenoAmbientSource() {
|
|
|
15
15
|
return `/**
|
|
16
16
|
* ${MARKER}.
|
|
17
17
|
* Runtime is Deno; this file covers APIs edge functions commonly use.
|
|
18
|
-
* Do not add \`@types/deno\` to the app package.json
|
|
18
|
+
* Do not add \`@types/deno\` to the app package.json, it leaks into the
|
|
19
19
|
* whole project when root tsconfig has no \`"types"\` field.
|
|
20
20
|
*
|
|
21
21
|
* Optional: for the full Deno API, install the Deno VS Code/Cursor extension
|
|
@@ -66,7 +66,7 @@ declare namespace Deno {
|
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
68
|
}
|
|
69
|
-
/** `functions/tsconfig.json
|
|
69
|
+
/** `functions/tsconfig.json`: owns function files so the app config can exclude them. */
|
|
70
70
|
export function functionsTsConfigSource() {
|
|
71
71
|
return `{
|
|
72
72
|
"compilerOptions": {
|
|
@@ -134,7 +134,7 @@ function ensureRootTsconfigExcludesFunctions(projectRoot) {
|
|
|
134
134
|
return "updated";
|
|
135
135
|
}
|
|
136
136
|
catch {
|
|
137
|
-
// JSONC / trailing commas
|
|
137
|
+
// JSONC / trailing commas, try a conservative string splice into an existing exclude array.
|
|
138
138
|
if (/"exclude"\s*:\s*\[/.test(raw)) {
|
|
139
139
|
const next = raw.replace(/("exclude"\s*:\s*\[)/, `$1\n "functions",`);
|
|
140
140
|
if (next !== raw) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions-deno-types.js","sourceRoot":"","sources":["../src/functions-deno-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,MAAM,GAAG,0CAA0C,CAAA;AAEzD,6DAA6D;AAC7D,MAAM,UAAU,0BAA0B;IACxC,OAAO;KACJ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDV,CAAA;AACD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CAAA;AACjC,CAAC"}
|
|
@@ -37,7 +37,7 @@ function importSpecFromRouter(routerFilePath, entrypoint) {
|
|
|
37
37
|
export function generateFunctionsRouterSource(routerFilePath, fns) {
|
|
38
38
|
const imports = fns.map((fn, i) => `import handler_${i} from "${importSpecFromRouter(routerFilePath, fn.entrypoint)}"`);
|
|
39
39
|
const routes = fns.map((fn, i) => ` "${fn.name}": handler_${i},`);
|
|
40
|
-
return `// Auto-generated
|
|
40
|
+
return `// Auto-generated: do not edit (regenerated by supatype dev / functions serve)
|
|
41
41
|
${imports.join("\n")}
|
|
42
42
|
|
|
43
43
|
const handlers: Record<string, (req: Request) => Response | Promise<Response>> = {
|
package/dist/gitignore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const SUPATYPE_GITIGNORE_MARKER = "# Supatype
|
|
2
|
-
export declare const SUPATYPE_GITIGNORE_BLOCK = "# Supatype
|
|
1
|
+
export declare const SUPATYPE_GITIGNORE_MARKER = "# Supatype, local runtime (contains secrets in link.json)";
|
|
2
|
+
export declare const SUPATYPE_GITIGNORE_BLOCK = "# Supatype, local runtime (contains secrets in link.json)\n.env\n.supatype/\nsupatype.local.config.ts\nsupatype.local.config.js\nsupatype.local.config.mjs\n";
|
|
3
3
|
export declare function isSupatypeGitignored(cwd: string): boolean;
|
|
4
4
|
export declare function ensureSupatypeGitignore(cwd: string, opts?: {
|
|
5
5
|
silent?: boolean;
|
package/dist/gitignore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,8DAA8D,CAAA;AACpG,eAAO,MAAM,wBAAwB,iKAMpC,CAAA;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKzD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAoBzF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMzD"}
|
package/dist/gitignore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
export const SUPATYPE_GITIGNORE_MARKER = "# Supatype
|
|
3
|
+
export const SUPATYPE_GITIGNORE_MARKER = "# Supatype, local runtime (contains secrets in link.json)";
|
|
4
4
|
export const SUPATYPE_GITIGNORE_BLOCK = `${SUPATYPE_GITIGNORE_MARKER}
|
|
5
5
|
.env
|
|
6
6
|
.supatype/
|
|
@@ -28,14 +28,14 @@ export function ensureSupatypeGitignore(cwd, opts) {
|
|
|
28
28
|
writeFileSync(gitignorePath, `.env\nnode_modules/\ndist/\n${SUPATYPE_GITIGNORE_BLOCK}`, "utf8");
|
|
29
29
|
}
|
|
30
30
|
if (!opts?.silent) {
|
|
31
|
-
console.warn("Added .supatype/ to .gitignore (link.json contains secrets
|
|
31
|
+
console.warn("Added .supatype/ to .gitignore (link.json contains secrets, never commit).");
|
|
32
32
|
}
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
export function warnIfLinkNotGitignored(cwd) {
|
|
36
36
|
if (isSupatypeGitignored(cwd))
|
|
37
37
|
return;
|
|
38
|
-
console.warn("\n⚠ Warning: .supatype/ is not in .gitignore
|
|
38
|
+
console.warn("\n⚠ Warning: .supatype/ is not in .gitignore, link.json contains tokens and must not be committed.");
|
|
39
39
|
console.warn(" Run with link --fix-gitignore to append the Supatype block.\n");
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=gitignore.js.map
|
package/dist/gitignore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,2DAA2D,CAAA;AACpG,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,yBAAyB;;;;;;CAMnE,CAAA;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;IAChD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5C,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IACnD,OAAO,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAClF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAW,EAAE,IAA2B;IAC9E,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;IAChD,IAAI,oBAAoB,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAE1C,IAAI,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QACnD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAA;QAC9D,aAAa,CAAC,aAAa,EAAE,GAAG,IAAI,KAAK,wBAAwB,EAAE,EAAE,MAAM,CAAC,CAAA;IAC9E,CAAC;SAAM,CAAC;QACN,aAAa,CACX,aAAa,EACb,+BAA+B,wBAAwB,EAAE,EACzD,MAAM,CACP,CAAA;IACH,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;IAC5F,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,IAAI,oBAAoB,CAAC,GAAG,CAAC;QAAE,OAAM;IACrC,OAAO,CAAC,IAAI,CACV,qGAAqG,CACtG,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAA;AAClF,CAAC"}
|
package/dist/hook-upload.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface HookUpload {
|
|
|
17
17
|
* holding the service-role key with nothing able to call it. Uploading it buys nothing and widens what
|
|
18
18
|
* runs with that credential.
|
|
19
19
|
*
|
|
20
|
-
* Throws with a message meant for a terminal when a handler cannot be flattened faithfully
|
|
20
|
+
* Throws with a message meant for a terminal when a handler cannot be flattened faithfully, the
|
|
21
21
|
* alternative is a deploy that succeeds and a hook that fails to import, which reads to the caller as
|
|
22
22
|
* the table's writes being broken for no visible reason.
|
|
23
23
|
*/
|
package/dist/hook-upload.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Package a project's hooks for a managed stack.
|
|
3
3
|
*
|
|
4
4
|
* Self-hosted stacks need none of this: the worker mounts the project directory, so `hooks/` is already
|
|
5
|
-
* where it looks. A managed project has no directory
|
|
5
|
+
* where it looks. A managed project has no directory, its worker reads a ConfigMap, whose keys may only
|
|
6
6
|
* contain alphanumerics, `-`, `_` and `.`. So the tree is flattened here, where it can be checked and
|
|
7
7
|
* explained, rather than in the deploy route where a dropped file would be silent.
|
|
8
8
|
*/
|
|
@@ -17,7 +17,7 @@ const ADAPTER_IMPORT = "../_supatype/hooks.ts";
|
|
|
17
17
|
* Rewrite the one import a hook handler is generated to make.
|
|
18
18
|
*
|
|
19
19
|
* `../_supatype/hooks.ts` is a path that cannot survive flattening, and it is the specifier our own
|
|
20
|
-
* scaffold writes
|
|
20
|
+
* scaffold writes: so it is rewritten rather than refused. Any *other* relative import is refused
|
|
21
21
|
* below: it would resolve to nothing on the worker, and a hook that fails to import is a hooked table
|
|
22
22
|
* whose writes all start failing.
|
|
23
23
|
*/
|
|
@@ -43,7 +43,7 @@ function unsupportedImports(source) {
|
|
|
43
43
|
* holding the service-role key with nothing able to call it. Uploading it buys nothing and widens what
|
|
44
44
|
* runs with that credential.
|
|
45
45
|
*
|
|
46
|
-
* Throws with a message meant for a terminal when a handler cannot be flattened faithfully
|
|
46
|
+
* Throws with a message meant for a terminal when a handler cannot be flattened faithfully, the
|
|
47
47
|
* alternative is a deploy that succeeds and a hook that fails to import, which reads to the caller as
|
|
48
48
|
* the table's writes being broken for no visible reason.
|
|
49
49
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The module source, or `null` when no model declares a hook.
|
|
3
3
|
*
|
|
4
4
|
* Returning null rather than an empty module keeps a `_supatype/hooks.ts` from appearing in projects
|
|
5
|
-
* that have no hooks
|
|
5
|
+
* that have no hooks, a generated file nobody imports is a file somebody eventually edits.
|
|
6
6
|
*/
|
|
7
7
|
export declare function generateHooksModule(ast: unknown): string | null;
|
|
8
8
|
//# sourceMappingURL=hooks-generator.d.ts.map
|
package/dist/hooks-generator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generate `functions/_supatype/hooks.ts
|
|
2
|
+
* Generate `functions/_supatype/hooks.ts`: the typed handler surface for model hooks.
|
|
3
3
|
*
|
|
4
4
|
* Generated into the project rather than shipped as a package, for two reasons: a Deno function
|
|
5
5
|
* resolves a relative `.ts` import with no npm involved, and the types then move in lockstep with the
|
|
@@ -27,7 +27,7 @@ function hookedModels(ast) {
|
|
|
27
27
|
* The module source, or `null` when no model declares a hook.
|
|
28
28
|
*
|
|
29
29
|
* Returning null rather than an empty module keeps a `_supatype/hooks.ts` from appearing in projects
|
|
30
|
-
* that have no hooks
|
|
30
|
+
* that have no hooks, a generated file nobody imports is a file somebody eventually edits.
|
|
31
31
|
*/
|
|
32
32
|
export function generateHooksModule(ast) {
|
|
33
33
|
const models = hookedModels(ast);
|
|
@@ -40,7 +40,7 @@ export function generateHooksModule(ast) {
|
|
|
40
40
|
Update: ${indent(denoSafe(generateUpdateType(model.fields)), 4)}
|
|
41
41
|
}`)
|
|
42
42
|
.join("\n");
|
|
43
|
-
return `// Generated by supatype CLI
|
|
43
|
+
return `// Generated by supatype CLI, do not edit manually.
|
|
44
44
|
//
|
|
45
45
|
// Typed handlers for the models that declare \`hooks\`. Import from a function beside it:
|
|
46
46
|
//
|
|
@@ -87,7 +87,7 @@ interface HookBase {
|
|
|
87
87
|
/**
|
|
88
88
|
* The rows this request is about to overwrite, fetched only if you ask.
|
|
89
89
|
*
|
|
90
|
-
* Resolved by the server from the in-flight request's own filter, as the caller's own role
|
|
90
|
+
* Resolved by the server from the in-flight request's own filter, as the caller's own role, so it
|
|
91
91
|
* cannot show you rows the caller could not read, and you cannot widen the filter. Capped:
|
|
92
92
|
* \`truncated\` is true when there were more, in which case acting on what you got means acting on a
|
|
93
93
|
* prefix you did not choose.
|
|
@@ -115,7 +115,7 @@ export type BeforeDeleteContext<T extends HookedTable> = HookBase & {
|
|
|
115
115
|
|
|
116
116
|
export type AfterChangeContext<T extends HookedTable> = HookBase & {
|
|
117
117
|
readonly operation: "insert" | "update"
|
|
118
|
-
/** Written rows
|
|
118
|
+
/** Written rows: present only when the caller sent \`Prefer: return=representation\`. */
|
|
119
119
|
readonly rows?: HookTables[T]["Row"][]
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -185,7 +185,7 @@ interface WireContext {
|
|
|
185
185
|
*
|
|
186
186
|
* The outcome travels as the **HTTP status**: 200 for proceed, 4xx for a rejection. That keeps the
|
|
187
187
|
* contract in the transport rather than in a second envelope inside the body, so a hook written by
|
|
188
|
-
* hand
|
|
188
|
+
* hand: or in another language, needs to know nothing about this file.
|
|
189
189
|
*/
|
|
190
190
|
export function hook(handler: AnyHandler): (req: Request) => Promise<Response> {
|
|
191
191
|
return async (req: Request): Promise<Response> => {
|
|
@@ -247,7 +247,7 @@ export function hook(handler: AnyHandler): (req: Request) => Promise<Response> {
|
|
|
247
247
|
*
|
|
248
248
|
* The worker takes **one default export per function directory**, so \`hook(single)\` is one hook per
|
|
249
249
|
* directory. That is fine for a single moderation rule and tedious for a model whose whole lifecycle
|
|
250
|
-
* you want in one place
|
|
250
|
+
* you want in one place, hence this. Point every event at the same function name in the schema:
|
|
251
251
|
*
|
|
252
252
|
* hooks: { beforeChange: "post-hooks", afterChange: "post-hooks" }
|
|
253
253
|
*
|
|
@@ -268,7 +268,7 @@ export function hooks(handlers: Record<string, AnyHandler | undefined>): (req: R
|
|
|
268
268
|
* The stack's address from this worker's point of view.
|
|
269
269
|
*
|
|
270
270
|
* \`SUPATYPE_INTERNAL_URL\` in Compose is the in-network gateway; \`SUPATYPE_URL\` is the same value
|
|
271
|
-
* there. Never a public or host URL
|
|
271
|
+
* there. Never a public or host URL, \`localhost\` inside this container is this container.
|
|
272
272
|
*/
|
|
273
273
|
function stackBaseUrl(): string {
|
|
274
274
|
const base =
|
|
@@ -313,7 +313,7 @@ function json(body: unknown, status: number): Response {
|
|
|
313
313
|
* Replace cross-package type imports the client types use but a hook cannot resolve.
|
|
314
314
|
*
|
|
315
315
|
* `RichText` normally generates `import("@supatype/types/lexical").SerializedEditorState`. That works
|
|
316
|
-
* in an app, where the package is installed
|
|
316
|
+
* in an app, where the package is installed, but this file lives in `functions/`, is imported by a
|
|
317
317
|
* Deno handler, and has no node_modules to reach into. Left alone, any hooked model with a rich-text
|
|
318
318
|
* column emitted a module that failed to compile in the user's editor. Caught by compiling the
|
|
319
319
|
* generated file in a test rather than by a reader reporting it.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,6 +9,6 @@ export interface DetectedProjectSetup {
|
|
|
9
9
|
/** Human-readable bullets for the init wizard. */
|
|
10
10
|
summaryLines: string[];
|
|
11
11
|
}
|
|
12
|
-
/** Inspect `cwd` before init prompts
|
|
12
|
+
/** Inspect `cwd` before init prompts, Vite, static dir, existing Supatype config. */
|
|
13
13
|
export declare function detectProjectSetup(cwd: string): DetectedProjectSetup;
|
|
14
14
|
//# sourceMappingURL=init-project-detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-project-detect.d.ts","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,gBAAgB,EAAE,OAAO,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAsCD,
|
|
1
|
+
{"version":3,"file":"init-project-detect.d.ts","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,gBAAgB,EAAE,OAAO,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAsCD,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAiCpE"}
|
|
@@ -49,7 +49,7 @@ function detectStaticDir(cwd) {
|
|
|
49
49
|
return "./public";
|
|
50
50
|
return "./public";
|
|
51
51
|
}
|
|
52
|
-
/** Inspect `cwd` before init prompts
|
|
52
|
+
/** Inspect `cwd` before init prompts, Vite, static dir, existing Supatype config. */
|
|
53
53
|
export function detectProjectSetup(cwd) {
|
|
54
54
|
let entries = [];
|
|
55
55
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-project-detect.js","sourceRoot":"","sources":["../src/init-project-detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,iBAAiB,GAAG;IACxB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;CACT,CAAA;AAEV,MAAM,qBAAqB,GAAG;IAC5B,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;CACb,CAAA;AAcV,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IACzC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAGnD,CAAA;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7E,CAAC;I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;IACpD,MAAM,UAAU,GAAG,oBAAoB,YAAY,CAAC,GAAG,CAAC,EAAE,CAAA;IAC1D,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IAE3F,MAAM,YAAY,GAAa,EAAE,CAAA;IACjC,IAAI,iBAAiB;QAAE,YAAY,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAA;IAC3E,IAAI,aAAa;QAAE,YAAY,CAAC,IAAI,CAAC,sBAAsB,UAAU,GAAG,CAAC,CAAA;SACpE,IAAI,OAAO;QAAE,YAAY,CAAC,IAAI,CAAC,oCAAoC,UAAU,GAAG,CAAC,CAAA;IACtF,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,YAAY,CAAC,IAAI,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAA;IACpD,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAAE,YAAY,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IAEpF,OAAO;QACL,gBAAgB;QAChB,iBAAiB;QACjB,OAAO;QACP,aAAa;QACb,UAAU;QACV,SAAS;QACT,YAAY;KACb,CAAA;AACH,CAAC"}
|
package/dist/link.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface ProjectLink {
|
|
|
16
16
|
defaultEnvironment: string;
|
|
17
17
|
/** Access token (cloud user JWT) or self-host SERVICE_ROLE_KEY. */
|
|
18
18
|
token?: string;
|
|
19
|
-
/** Cloud GoTrue refresh token
|
|
19
|
+
/** Cloud GoTrue refresh token, used to renew short-lived access JWTs. */
|
|
20
20
|
refreshToken?: string;
|
|
21
21
|
orgId?: string | undefined;
|
|
22
22
|
cloudApiUrl?: string;
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAG,CAAU,CAAA;AACtC,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAC9C,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AACvD,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,CAAA;AAE7D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,YAAY,CAAA;IAC5B,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,EAAG,CAAU,CAAA;AACtC,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAC9C,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AACvD,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,CAAA;AAE7D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MA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ned back into it.** These used to be hardcoded constants that
|
|
5
|
-
* `supatype dev` wrote to `.env` on every run
|
|
5
|
+
* `supatype dev` wrote to `.env` on every run, which meant a project could not hold its own
|
|
6
6
|
* secrets: whatever `supatype init` or the developer put there was replaced by the published
|
|
7
7
|
* defaults on the next `dev`, and the same `.env` then went to a server. Resolving instead of
|
|
8
8
|
* pinning is what lets a generated secret survive to production.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
/**
|
|
14
14
|
* Fallback JWT signing secret for a project that has none.
|
|
15
15
|
*
|
|
16
|
-
* Published, therefore worthless as a secret
|
|
16
|
+
* Published, therefore worthless as a secret, anyone can mint a token for a stack still using
|
|
17
17
|
* it. That is precisely why `init` generates one instead of relying on this.
|
|
18
18
|
*/
|
|
19
19
|
export declare const FALLBACK_JWT_SECRET = "super-secret-jwt-token-with-at-least-32-characters-long";
|
|
@@ -37,7 +37,7 @@ export declare function devAuthenticatorPassword(cwd: string): string;
|
|
|
37
37
|
*
|
|
38
38
|
* The compose template requires these with `${VAR:?}` rather than defaulting them, because a
|
|
39
39
|
* default is how a published constant ends up signing a real deployment's tokens. That only
|
|
40
|
-
* works if something guarantees presence
|
|
40
|
+
* works if something guarantees presence, this does, for any project that predates
|
|
41
41
|
* `supatype init` writing them.
|
|
42
42
|
*
|
|
43
43
|
* **Fills with the fallback, does not generate.** Preserving the value such a project has been
|
|
@@ -48,11 +48,11 @@ export declare function devAuthenticatorPassword(cwd: string): string;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function seedMissingLocalSecrets(cwd: string): Record<string, string>;
|
|
50
50
|
/**
|
|
51
|
-
* The database identity the local stack connects with
|
|
51
|
+
* The database identity the local stack connects with, seeded, never overwritten.
|
|
52
52
|
*
|
|
53
53
|
* `POSTGRES_DB` in particular is *project configuration*: `supatype init` sets it to the
|
|
54
54
|
* project name, and the running container's database was created from it. Rewriting it to a
|
|
55
|
-
* default afterwards points every tool at a database that does not exist
|
|
55
|
+
* default afterwards points every tool at a database that does not exist, observed as
|
|
56
56
|
* `supatype push` failing with `FATAL: database "supatype" does not exist` on a project called
|
|
57
57
|
* something else, because the push path rewrote `.env` after `self-host compose up` had already
|
|
58
58
|
* created the database under its real name.
|
package/dist/local-secrets.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The secrets the local stack runs with.
|
|
3
3
|
*
|
|
4
4
|
* **Read from `.env`, never pinned back into it.** These used to be hardcoded constants that
|
|
5
|
-
* `supatype dev` wrote to `.env` on every run
|
|
5
|
+
* `supatype dev` wrote to `.env` on every run, which meant a project could not hold its own
|
|
6
6
|
* secrets: whatever `supatype init` or the developer put there was replaced by the published
|
|
7
7
|
* defaults on the next `dev`, and the same `.env` then went to a server. Resolving instead of
|
|
8
8
|
* pinning is what lets a generated secret survive to production.
|
|
@@ -14,7 +14,7 @@ import { hasEnvValue, readEnvValue } from "./env-file.js";
|
|
|
14
14
|
/**
|
|
15
15
|
* Fallback JWT signing secret for a project that has none.
|
|
16
16
|
*
|
|
17
|
-
* Published, therefore worthless as a secret
|
|
17
|
+
* Published, therefore worthless as a secret, anyone can mint a token for a stack still using
|
|
18
18
|
* it. That is precisely why `init` generates one instead of relying on this.
|
|
19
19
|
*/
|
|
20
20
|
export const FALLBACK_JWT_SECRET = "super-secret-jwt-token-with-at-least-32-characters-long";
|
|
@@ -44,7 +44,7 @@ export function devAuthenticatorPassword(cwd) {
|
|
|
44
44
|
*
|
|
45
45
|
* The compose template requires these with `${VAR:?}` rather than defaulting them, because a
|
|
46
46
|
* default is how a published constant ends up signing a real deployment's tokens. That only
|
|
47
|
-
* works if something guarantees presence
|
|
47
|
+
* works if something guarantees presence, this does, for any project that predates
|
|
48
48
|
* `supatype init` writing them.
|
|
49
49
|
*
|
|
50
50
|
* **Fills with the fallback, does not generate.** Preserving the value such a project has been
|
|
@@ -65,11 +65,11 @@ export function seedMissingLocalSecrets(cwd) {
|
|
|
65
65
|
return out;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* The database identity the local stack connects with
|
|
68
|
+
* The database identity the local stack connects with, seeded, never overwritten.
|
|
69
69
|
*
|
|
70
70
|
* `POSTGRES_DB` in particular is *project configuration*: `supatype init` sets it to the
|
|
71
71
|
* project name, and the running container's database was created from it. Rewriting it to a
|
|
72
|
-
* default afterwards points every tool at a database that does not exist
|
|
72
|
+
* default afterwards points every tool at a database that does not exist, observed as
|
|
73
73
|
* `supatype push` failing with `FATAL: database "supatype" does not exist` on a project called
|
|
74
74
|
* something else, because the push path rewrote `.env` after `self-host compose up` had already
|
|
75
75
|
* created the database under its real name.
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the standalone binary.
|
|
3
|
+
*
|
|
4
|
+
* `bin/supatype.js` stays the npm entry: it loads the CLI with a dynamic import, which Bun
|
|
5
|
+
* cannot follow when compiling. Given `import("../dist/cli.js")` it emits a binary that
|
|
6
|
+
* bundles one module and then fails at runtime with
|
|
7
|
+
* `Cannot find module '../dist/cli.js' from '/$bunfs/root/supatype'`. The import below is
|
|
8
|
+
* static, so the whole graph is embedded.
|
|
9
|
+
*/
|
|
10
|
+
import { run } from "./cli.js";
|
|
11
|
+
import { reportCliFatal } from "./ui/fatal.js";
|
|
12
|
+
// reportCliFatal rather than console.error: it is what run() already uses for a failed
|
|
13
|
+
// command, and it prints a stack under SUPATYPE_DEBUG=1. Open-coding the message here would
|
|
14
|
+
// make a crash report from a curl | bash user less useful than one from an npm user. This
|
|
15
|
+
// only fires for a throw during command registration, since run() catches everything after.
|
|
16
|
+
run().catch((err) => {
|
|
17
|
+
reportCliFatal(err);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,uFAAuF;AACvF,4FAA4F;AAC5F,0FAA0F;AAC1F,4FAA4F;AAC5F,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC3B,cAAc,CAAC,GAAG,CAAC,CAAA;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/model-hooks.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ManifestHookEntry {
|
|
|
29
29
|
onUnavailable?: "reject" | "log";
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* The hook map for `.supatype/manifest.json`, keyed by **table name
|
|
32
|
+
* The hook map for `.supatype/manifest.json`, keyed by **table name**, because that is what the
|
|
33
33
|
* server matches a request path against, not the model name.
|
|
34
34
|
*
|
|
35
35
|
* Defaults are resolved here rather than in the server: one place decides that a `before*` hook
|
|
@@ -44,7 +44,7 @@ export declare const DEFAULT_HOOK_TIMEOUT_MS = 2000;
|
|
|
44
44
|
*
|
|
45
45
|
* **Only updates a manifest that is already there.** Creating one from scratch here would be a
|
|
46
46
|
* hazard: `functions_enabled` is a plain bool on the server's side, so a manifest carrying only
|
|
47
|
-
* hooks would read as functions *disabled
|
|
47
|
+
* hooks would read as functions *disabled*, the exact defect this repo fixed a commit ago, arriving
|
|
48
48
|
* by a different door. The compose path owns creation; this owns one key.
|
|
49
49
|
*
|
|
50
50
|
* Returns true when the file was rewritten.
|
|
@@ -62,7 +62,7 @@ export interface HooksReport {
|
|
|
62
62
|
/**
|
|
63
63
|
* What `supatype doctor` needs to answer "will my hooks actually run?".
|
|
64
64
|
*
|
|
65
|
-
* Local facts only
|
|
65
|
+
* Local facts only: the schema, the functions on disk, and the manifest the server reads. No probe
|
|
66
66
|
* of a running worker, so the answer is the same whether or not the stack is up, and a report that
|
|
67
67
|
* needs a stack is a report nobody runs before deploying.
|
|
68
68
|
*
|