@supatype/cli 0.7.0 → 0.9.0
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/CHANGELOG.md +314 -0
- package/bin/supatype.js +40 -4
- package/deno.d.ts +1 -1
- package/dist/admin-prompt-state.d.ts +13 -0
- package/dist/admin-prompt-state.d.ts.map +1 -0
- package/dist/admin-prompt-state.js +30 -0
- package/dist/admin-prompt-state.js.map +1 -0
- package/dist/adopt-columns.d.ts.map +1 -1
- package/dist/adopt-columns.js +13 -17
- package/dist/adopt-columns.js.map +1 -1
- package/dist/after-hooks-health.d.ts +19 -0
- package/dist/after-hooks-health.d.ts.map +1 -0
- package/dist/after-hooks-health.js +69 -0
- package/dist/after-hooks-health.js.map +1 -0
- package/dist/app-config.d.ts +1 -1
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +103 -144
- package/dist/app-config.js.map +1 -1
- package/dist/app-vite-env.d.ts +5 -1
- package/dist/app-vite-env.d.ts.map +1 -1
- package/dist/app-vite-env.js +9 -15
- package/dist/app-vite-env.js.map +1 -1
- package/dist/applied-ast-artifacts.d.ts +16 -0
- package/dist/applied-ast-artifacts.d.ts.map +1 -0
- package/dist/applied-ast-artifacts.js +37 -0
- package/dist/applied-ast-artifacts.js.map +1 -0
- package/dist/archive-extract.d.ts +3 -0
- package/dist/archive-extract.d.ts.map +1 -0
- package/dist/archive-extract.js +19 -0
- package/dist/archive-extract.js.map +1 -0
- package/dist/augmentation-generator.d.ts +5 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +13 -4
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/binary-cache.d.ts +27 -3
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +117 -85
- package/dist/binary-cache.js.map +1 -1
- package/dist/binary-download-lock.d.ts.map +1 -1
- package/dist/binary-download-lock.js +1 -3
- package/dist/binary-download-lock.js.map +1 -1
- package/dist/byo-preflight.d.ts.map +1 -1
- package/dist/byo-preflight.js +2 -10
- package/dist/byo-preflight.js.map +1 -1
- package/dist/byte-size.d.ts +9 -0
- package/dist/byte-size.d.ts.map +1 -0
- package/dist/byte-size.js +36 -0
- package/dist/byte-size.js.map +1 -0
- package/dist/cache-clean.d.ts +0 -2
- package/dist/cache-clean.d.ts.map +1 -1
- package/dist/cache-clean.js +1 -27
- package/dist/cache-clean.js.map +1 -1
- package/dist/cache-pins.d.ts.map +1 -1
- package/dist/cache-pins.js +3 -20
- package/dist/cache-pins.js.map +1 -1
- package/dist/cache-root.d.ts +7 -0
- package/dist/cache-root.d.ts.map +1 -0
- package/dist/cache-root.js +11 -0
- package/dist/cache-root.js.map +1 -0
- package/dist/cli-artifacts.d.ts.map +1 -1
- package/dist/cli-artifacts.js +2 -1
- package/dist/cli-artifacts.js.map +1 -1
- package/dist/cli-install-method.d.ts.map +1 -1
- package/dist/cli-install-method.js +7 -1
- package/dist/cli-install-method.js.map +1 -1
- package/dist/cli-launcher.d.ts +21 -0
- package/dist/cli-launcher.d.ts.map +1 -0
- package/dist/cli-launcher.js +112 -0
- package/dist/cli-launcher.js.map +1 -0
- package/dist/cli-old-versions.d.ts +44 -0
- package/dist/cli-old-versions.d.ts.map +1 -0
- package/dist/cli-old-versions.js +83 -0
- package/dist/cli-old-versions.js.map +1 -0
- package/dist/cli-program-path.d.ts +20 -0
- package/dist/cli-program-path.d.ts.map +1 -0
- package/dist/cli-program-path.js +41 -0
- package/dist/cli-program-path.js.map +1 -0
- package/dist/cli-standalone.d.ts +2 -3
- package/dist/cli-standalone.d.ts.map +1 -1
- package/dist/cli-standalone.js +51 -24
- package/dist/cli-standalone.js.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cloud-credentials.d.ts +6 -0
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +13 -0
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +18 -18
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +27 -8
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +37 -11
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.js +2 -4
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +116 -106
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +3 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +50 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +276 -267
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +32 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +66 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts +30 -0
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +503 -507
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +11 -8
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/hooks.d.ts.map +1 -1
- package/dist/commands/hooks.js +46 -23
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +37 -4
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +509 -386
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts.map +1 -1
- package/dist/commands/internal.js +2 -1
- package/dist/commands/internal.js.map +1 -1
- package/dist/commands/keys.d.ts +46 -20
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +196 -156
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +30 -11
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +5 -4
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pg.js +2 -0
- package/dist/commands/pg.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +17 -7
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/push.d.ts +39 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +221 -77
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts +35 -0
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +72 -38
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +71 -42
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +9 -3
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/status.js +5 -5
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/types.js +2 -5
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +212 -101
- package/dist/commands/update.js.map +1 -1
- package/dist/component-launch.d.ts +11 -0
- package/dist/component-launch.d.ts.map +1 -0
- package/dist/component-launch.js +35 -0
- package/dist/component-launch.js.map +1 -0
- package/dist/components.d.ts +7 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +7 -2
- package/dist/components.js.map +1 -1
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +5 -14
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-engine-run.d.ts +6 -5
- package/dist/compose-engine-run.d.ts.map +1 -1
- package/dist/compose-engine-run.js +44 -37
- package/dist/compose-engine-run.js.map +1 -1
- package/dist/compose-engine-service.d.ts +10 -0
- package/dist/compose-engine-service.d.ts.map +1 -0
- package/dist/compose-engine-service.js +16 -0
- package/dist/compose-engine-service.js.map +1 -0
- package/dist/compose-host-path.d.ts +14 -0
- package/dist/compose-host-path.d.ts.map +1 -0
- package/dist/compose-host-path.js +18 -0
- package/dist/compose-host-path.js.map +1 -0
- package/dist/compose-image-pull.d.ts +43 -0
- package/dist/compose-image-pull.d.ts.map +1 -0
- package/dist/compose-image-pull.js +27 -0
- package/dist/compose-image-pull.js.map +1 -0
- package/dist/compose-kong.d.ts +4 -0
- package/dist/compose-kong.d.ts.map +1 -1
- package/dist/compose-kong.js +23 -9
- package/dist/compose-kong.js.map +1 -1
- package/dist/compose-local-server-image.d.ts.map +1 -1
- package/dist/compose-local-server-image.js +7 -3
- package/dist/compose-local-server-image.js.map +1 -1
- package/dist/compose-render-mode.d.ts.map +1 -1
- package/dist/compose-render-mode.js +7 -4
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts +12 -2
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +27 -12
- package/dist/compose-services.js.map +1 -1
- package/dist/config-snapshot.d.ts +6 -0
- package/dist/config-snapshot.d.ts.map +1 -0
- package/dist/config-snapshot.js +23 -0
- package/dist/config-snapshot.js.map +1 -0
- package/dist/config.d.ts +11 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -3
- package/dist/config.js.map +1 -1
- package/dist/database-url-owner.d.ts +59 -0
- package/dist/database-url-owner.d.ts.map +1 -0
- package/dist/database-url-owner.js +133 -0
- package/dist/database-url-owner.js.map +1 -0
- package/dist/db-port-offer.d.ts +18 -0
- package/dist/db-port-offer.d.ts.map +1 -0
- package/dist/db-port-offer.js +68 -0
- package/dist/db-port-offer.js.map +1 -0
- package/dist/db-port.d.ts +42 -18
- package/dist/db-port.d.ts.map +1 -1
- package/dist/db-port.js +34 -32
- package/dist/db-port.js.map +1 -1
- package/dist/db-preflight.d.ts +37 -0
- package/dist/db-preflight.d.ts.map +1 -1
- package/dist/db-preflight.js +219 -77
- package/dist/db-preflight.js.map +1 -1
- package/dist/db-rows.d.ts +11 -0
- package/dist/db-rows.d.ts.map +1 -1
- package/dist/db-rows.js +27 -0
- package/dist/db-rows.js.map +1 -1
- package/dist/debounce.d.ts +11 -0
- package/dist/debounce.d.ts.map +1 -0
- package/dist/debounce.js +23 -0
- package/dist/debounce.js.map +1 -0
- package/dist/dev-api-keys.d.ts +12 -2
- package/dist/dev-api-keys.d.ts.map +1 -1
- package/dist/dev-api-keys.js +33 -17
- package/dist/dev-api-keys.js.map +1 -1
- package/dist/dev-compose.d.ts +10 -12
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +252 -288
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-db-ready.d.ts.map +1 -1
- package/dist/dev-db-ready.js +2 -1
- package/dist/dev-db-ready.js.map +1 -1
- package/dist/dev-db-reset.d.ts.map +1 -1
- package/dist/dev-db-reset.js +5 -4
- package/dist/dev-db-reset.js.map +1 -1
- package/dist/dev-functions-watch.d.ts.map +1 -1
- package/dist/dev-functions-watch.js +5 -16
- package/dist/dev-functions-watch.js.map +1 -1
- package/dist/dev-log-bus.d.ts +8 -0
- package/dist/dev-log-bus.d.ts.map +1 -1
- package/dist/dev-log-bus.js +13 -0
- package/dist/dev-log-bus.js.map +1 -1
- package/dist/dev-ports.d.ts +27 -7
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +68 -41
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +7 -12
- package/dist/dev-schema-watch.js.map +1 -1
- package/dist/dev-session-lock.js +4 -3
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +15 -0
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +27 -1
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +45 -0
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +221 -33
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-output.d.ts +7 -1
- package/dist/diff-output.d.ts.map +1 -1
- package/dist/diff-output.js +91 -2
- package/dist/diff-output.js.map +1 -1
- package/dist/docker-address-pool.d.ts +23 -0
- package/dist/docker-address-pool.d.ts.map +1 -0
- package/dist/docker-address-pool.js +56 -0
- package/dist/docker-address-pool.js.map +1 -0
- package/dist/docker-exec.d.ts +92 -0
- package/dist/docker-exec.d.ts.map +1 -0
- package/dist/docker-exec.js +139 -0
- package/dist/docker-exec.js.map +1 -0
- package/dist/docker-postgres.d.ts +1 -6
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +67 -85
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +14 -1
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +55 -24
- package/dist/docker-runtime.js.map +1 -1
- package/dist/dotenv-parse.d.ts +22 -0
- package/dist/dotenv-parse.d.ts.map +1 -0
- package/dist/dotenv-parse.js +63 -0
- package/dist/dotenv-parse.js.map +1 -0
- package/dist/engine-answers.d.ts +0 -2
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +4 -3
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +13 -12
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-floor.d.ts +29 -0
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +56 -0
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-ownership-gate.d.ts +13 -1
- package/dist/engine-ownership-gate.d.ts.map +1 -1
- package/dist/engine-ownership-gate.js +36 -6
- package/dist/engine-ownership-gate.js.map +1 -1
- package/dist/ensure-binary.d.ts +9 -0
- package/dist/ensure-binary.d.ts.map +1 -1
- package/dist/ensure-binary.js +38 -5
- package/dist/ensure-binary.js.map +1 -1
- package/dist/ensure-component-binaries.d.ts.map +1 -1
- package/dist/ensure-component-binaries.js +2 -1
- package/dist/ensure-component-binaries.js.map +1 -1
- package/dist/env-file.d.ts +30 -8
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +84 -57
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +11 -0
- package/dist/env-lines.d.ts.map +1 -0
- package/dist/env-lines.js +36 -0
- package/dist/env-lines.js.map +1 -0
- package/dist/error-message.d.ts +34 -1
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +102 -2
- package/dist/error-message.js.map +1 -1
- package/dist/fetch-within.d.ts +10 -0
- package/dist/fetch-within.d.ts.map +1 -0
- package/dist/fetch-within.js +12 -0
- package/dist/fetch-within.js.map +1 -0
- package/dist/field-masking-tier.d.ts.map +1 -1
- package/dist/field-masking-tier.js +7 -5
- package/dist/field-masking-tier.js.map +1 -1
- package/dist/frontend-env.d.ts +43 -0
- package/dist/frontend-env.d.ts.map +1 -0
- package/dist/frontend-env.js +81 -0
- package/dist/frontend-env.js.map +1 -0
- package/dist/functions-context-refresh.d.ts +6 -2
- package/dist/functions-context-refresh.d.ts.map +1 -1
- package/dist/functions-context-refresh.js +11 -3
- package/dist/functions-context-refresh.js.map +1 -1
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +9 -2
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/{functions-router-gen.d.ts → functions-discovery.d.ts} +8 -10
- package/dist/functions-discovery.d.ts.map +1 -0
- package/dist/functions-discovery.js +87 -0
- package/dist/functions-discovery.js.map +1 -0
- package/dist/functions-template.d.ts.map +1 -1
- package/dist/functions-template.js +20 -12
- package/dist/functions-template.js.map +1 -1
- package/dist/functions-worker-files.d.ts +55 -0
- package/dist/functions-worker-files.d.ts.map +1 -0
- package/dist/functions-worker-files.js +149 -0
- package/dist/functions-worker-files.js.map +1 -0
- package/dist/generated/functions-worker-source.d.ts +2 -0
- package/dist/generated/functions-worker-source.d.ts.map +1 -0
- package/dist/generated/functions-worker-source.js +12 -0
- package/dist/generated/functions-worker-source.js.map +1 -0
- package/dist/generated/release-images.d.ts +18 -0
- package/dist/generated/release-images.d.ts.map +1 -0
- package/dist/generated/release-images.js +8 -0
- package/dist/generated/release-images.js.map +1 -0
- package/dist/generated-files-engine.d.ts +33 -0
- package/dist/generated-files-engine.d.ts.map +1 -0
- package/dist/generated-files-engine.js +45 -0
- package/dist/generated-files-engine.js.map +1 -0
- package/dist/hook-actor.d.ts +17 -0
- package/dist/hook-actor.d.ts.map +1 -0
- package/dist/hook-actor.js +37 -0
- package/dist/hook-actor.js.map +1 -0
- package/dist/hook-columns.d.ts +30 -0
- package/dist/hook-columns.d.ts.map +1 -0
- package/dist/hook-columns.js +77 -0
- package/dist/hook-columns.js.map +1 -0
- package/dist/hook-events.d.ts +11 -0
- package/dist/hook-events.d.ts.map +1 -0
- package/dist/hook-events.js +11 -0
- package/dist/hook-events.js.map +1 -0
- package/dist/hook-upload.d.ts +29 -15
- package/dist/hook-upload.d.ts.map +1 -1
- package/dist/hook-upload.js +88 -59
- package/dist/hook-upload.js.map +1 -1
- package/dist/hooks-generator.d.ts +5 -0
- package/dist/hooks-generator.d.ts.map +1 -1
- package/dist/hooks-generator.js +92 -21
- package/dist/hooks-generator.js.map +1 -1
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +31 -4
- package/dist/host-database.js.map +1 -1
- package/dist/init-dependency-versions.d.ts +3 -1
- package/dist/init-dependency-versions.d.ts.map +1 -1
- package/dist/init-dependency-versions.js +32 -6
- package/dist/init-dependency-versions.js.map +1 -1
- package/dist/init-example.d.ts +48 -0
- package/dist/init-example.d.ts.map +1 -0
- package/dist/init-example.js +110 -0
- package/dist/init-example.js.map +1 -0
- package/dist/init-package-json.d.ts +38 -1
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +150 -37
- package/dist/init-package-json.js.map +1 -1
- package/dist/init-setup-steps.d.ts +37 -0
- package/dist/init-setup-steps.d.ts.map +1 -0
- package/dist/init-setup-steps.js +118 -0
- package/dist/init-setup-steps.js.map +1 -0
- package/dist/jwt-secret-length.d.ts +5 -13
- package/dist/jwt-secret-length.d.ts.map +1 -1
- package/dist/jwt-secret-length.js +7 -22
- package/dist/jwt-secret-length.js.map +1 -1
- package/dist/jwt-secret-rules.d.ts +24 -0
- package/dist/jwt-secret-rules.d.ts.map +1 -0
- package/dist/jwt-secret-rules.js +46 -0
- package/dist/jwt-secret-rules.js.map +1 -0
- package/dist/local-gateway.d.ts +3 -6
- package/dist/local-gateway.d.ts.map +1 -1
- package/dist/local-gateway.js +7 -9
- package/dist/local-gateway.js.map +1 -1
- package/dist/local-secrets.d.ts +95 -11
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +153 -18
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +2 -7
- package/dist/local-stack.js.map +1 -1
- package/dist/local-storage.d.ts +7 -2
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/local-storage.js +11 -3
- package/dist/local-storage.js.map +1 -1
- package/dist/mailer-env.d.ts +37 -0
- package/dist/mailer-env.d.ts.map +1 -0
- package/dist/mailer-env.js +98 -0
- package/dist/mailer-env.js.map +1 -0
- package/dist/model-cache.d.ts +4 -8
- package/dist/model-cache.d.ts.map +1 -1
- package/dist/model-cache.js.map +1 -1
- package/dist/model-hooks.d.ts +21 -7
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +62 -39
- package/dist/model-hooks.js.map +1 -1
- package/dist/native-dev-env.d.ts +37 -1
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +64 -2
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-functions-watch.d.ts +56 -5
- package/dist/native-functions-watch.d.ts.map +1 -1
- package/dist/native-functions-watch.js +119 -38
- package/dist/native-functions-watch.js.map +1 -1
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +2 -2
- package/dist/native-keyspace.js.map +1 -1
- package/dist/native-realtime.d.ts +11 -3
- package/dist/native-realtime.d.ts.map +1 -1
- package/dist/native-realtime.js +162 -10
- package/dist/native-realtime.js.map +1 -1
- package/dist/native-roles-sql.d.ts +14 -0
- package/dist/native-roles-sql.d.ts.map +1 -1
- package/dist/native-roles-sql.js +82 -1
- package/dist/native-roles-sql.js.map +1 -1
- package/dist/native-storage-import.d.ts +19 -0
- package/dist/native-storage-import.d.ts.map +1 -0
- package/dist/native-storage-import.js +327 -0
- package/dist/native-storage-import.js.map +1 -0
- package/dist/native-storage.d.ts +45 -0
- package/dist/native-storage.d.ts.map +1 -0
- package/dist/native-storage.js +140 -0
- package/dist/native-storage.js.map +1 -0
- package/dist/native-worker.d.ts +26 -0
- package/dist/native-worker.d.ts.map +1 -0
- package/dist/native-worker.js +63 -0
- package/dist/native-worker.js.map +1 -0
- package/dist/owner-default.d.ts +9 -1
- package/dist/owner-default.d.ts.map +1 -1
- package/dist/owner-default.js +17 -4
- package/dist/owner-default.js.map +1 -1
- package/dist/post-apply.d.ts +3 -0
- package/dist/post-apply.d.ts.map +1 -0
- package/dist/post-apply.js +17 -0
- package/dist/post-apply.js.map +1 -0
- package/dist/postgres-ctl.d.ts +98 -7
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +273 -40
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +15 -3
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +18 -15
- package/dist/postgres-image.js.map +1 -1
- package/dist/postgrest-release.d.ts +9 -0
- package/dist/postgrest-release.d.ts.map +1 -1
- package/dist/postgrest-release.js +23 -0
- package/dist/postgrest-release.js.map +1 -1
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +3 -1
- package/dist/process-manager.js.map +1 -1
- package/dist/project-config.d.ts +44 -7
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +48 -4
- package/dist/project-config.js.map +1 -1
- package/dist/pull-utils.d.ts +15 -0
- package/dist/pull-utils.d.ts.map +1 -1
- package/dist/pull-utils.js +149 -23
- package/dist/pull-utils.js.map +1 -1
- package/dist/push-refusal.d.ts.map +1 -1
- package/dist/push-refusal.js +3 -2
- package/dist/push-refusal.js.map +1 -1
- package/dist/realtime-launch.d.ts +2 -5
- package/dist/realtime-launch.d.ts.map +1 -1
- package/dist/realtime-launch.js +6 -23
- package/dist/realtime-launch.js.map +1 -1
- package/dist/recorded-field-masking-tier.d.ts.map +1 -1
- package/dist/recorded-field-masking-tier.js +4 -3
- package/dist/recorded-field-masking-tier.js.map +1 -1
- package/dist/release-images.d.ts +31 -0
- package/dist/release-images.d.ts.map +1 -0
- package/dist/release-images.js +90 -0
- package/dist/release-images.js.map +1 -0
- package/dist/required-host-components.d.ts.map +1 -1
- package/dist/required-host-components.js +4 -0
- package/dist/required-host-components.js.map +1 -1
- package/dist/resolve-api-url.d.ts +17 -3
- package/dist/resolve-api-url.d.ts.map +1 -1
- package/dist/resolve-api-url.js +71 -30
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +64 -0
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +75 -27
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-ready.d.ts.map +1 -1
- package/dist/rest-ready.js +2 -1
- package/dist/rest-ready.js.map +1 -1
- package/dist/route-manifest.d.ts +25 -2
- package/dist/route-manifest.d.ts.map +1 -1
- package/dist/route-manifest.js +48 -4
- package/dist/route-manifest.js.map +1 -1
- package/dist/run-until-stopped.d.ts +12 -0
- package/dist/run-until-stopped.d.ts.map +1 -0
- package/dist/run-until-stopped.js +42 -0
- package/dist/run-until-stopped.js.map +1 -0
- package/dist/schema-ast-v2.d.ts +2 -1
- package/dist/schema-ast-v2.d.ts.map +1 -1
- 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 +59 -46
- package/dist/schema-push-lock.js.map +1 -1
- package/dist/schema-sources.d.ts +19 -4
- package/dist/schema-sources.d.ts.map +1 -1
- package/dist/schema-sources.js +56 -35
- package/dist/schema-sources.js.map +1 -1
- package/dist/seed-auth-connect.d.ts +14 -0
- package/dist/seed-auth-connect.d.ts.map +1 -0
- package/dist/seed-auth-connect.js +97 -0
- package/dist/seed-auth-connect.js.map +1 -0
- package/dist/seed-runner.d.ts.map +1 -1
- package/dist/seed-runner.js +22 -1
- package/dist/seed-runner.js.map +1 -1
- package/dist/seed.d.ts +6 -3
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +44 -29
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +311 -159
- package/dist/self-host-compose.js.map +1 -1
- package/dist/service-role-key-file.d.ts +32 -0
- package/dist/service-role-key-file.d.ts.map +1 -0
- package/dist/service-role-key-file.js +90 -0
- package/dist/service-role-key-file.js.map +1 -0
- package/dist/shell-ports.d.ts +13 -2
- package/dist/shell-ports.d.ts.map +1 -1
- package/dist/shell-ports.js +20 -15
- package/dist/shell-ports.js.map +1 -1
- package/dist/stop-signals.d.ts +7 -0
- package/dist/stop-signals.d.ts.map +1 -0
- package/dist/stop-signals.js +12 -0
- package/dist/stop-signals.js.map +1 -0
- package/dist/storage-launch.d.ts +11 -0
- package/dist/storage-launch.d.ts.map +1 -0
- package/dist/storage-launch.js +41 -0
- package/dist/storage-launch.js.map +1 -0
- package/dist/storage-provision.d.ts +50 -5
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +101 -33
- package/dist/storage-provision.js.map +1 -1
- package/dist/systemd.d.ts +1 -1
- package/dist/systemd.d.ts.map +1 -1
- package/dist/systemd.js +26 -11
- package/dist/systemd.js.map +1 -1
- package/dist/tar-reader.d.ts +29 -0
- package/dist/tar-reader.d.ts.map +1 -0
- package/dist/tar-reader.js +99 -0
- package/dist/tar-reader.js.map +1 -0
- package/dist/target-client.d.ts +14 -1
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +134 -23
- package/dist/target-client.js.map +1 -1
- package/dist/target-request.d.ts +25 -0
- package/dist/target-request.d.ts.map +1 -0
- package/dist/target-request.js +33 -0
- package/dist/target-request.js.map +1 -0
- package/dist/target-warning.d.ts +7 -0
- package/dist/target-warning.d.ts.map +1 -0
- package/dist/target-warning.js +12 -0
- package/dist/target-warning.js.map +1 -0
- package/dist/tsx-runner.d.ts.map +1 -1
- package/dist/tsx-runner.js +2 -1
- package/dist/tsx-runner.js.map +1 -1
- package/dist/type-extractor.d.ts +6 -0
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +138 -70
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/clack.d.ts.map +1 -1
- package/dist/ui/clack.js +11 -1
- package/dist/ui/clack.js.map +1 -1
- package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
- package/dist/ui/dev/DevDashboard.js +13 -5
- package/dist/ui/dev/DevDashboard.js.map +1 -1
- package/dist/ui/fatal.d.ts.map +1 -1
- package/dist/ui/fatal.js +6 -7
- package/dist/ui/fatal.js.map +1 -1
- package/dist/ui/flows/FlowApp.d.ts.map +1 -1
- package/dist/ui/flows/FlowApp.js +16 -1
- package/dist/ui/flows/FlowApp.js.map +1 -1
- package/dist/ui/flows/prompt-fields.d.ts +16 -6
- package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
- package/dist/ui/flows/prompt-fields.js +19 -9
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/messages.d.ts +6 -0
- package/dist/ui/messages.d.ts.map +1 -1
- package/dist/ui/messages.js +17 -0
- package/dist/ui/messages.js.map +1 -1
- package/dist/ui/progress.d.ts +7 -0
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +22 -8
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
- package/dist/ui/runtime/command-chrome.js +2 -0
- package/dist/ui/runtime/command-chrome.js.map +1 -1
- package/dist/ui/runtime/prompt-interrupt.d.ts +10 -0
- package/dist/ui/runtime/prompt-interrupt.d.ts.map +1 -0
- package/dist/ui/runtime/prompt-interrupt.js +24 -0
- package/dist/ui/runtime/prompt-interrupt.js.map +1 -0
- package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +5 -2
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts +14 -1
- package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -1
- package/dist/ui/runtime/stdin-after-ink.js +44 -3
- package/dist/ui/runtime/stdin-after-ink.js.map +1 -1
- package/dist/url-safe-passwords.d.ts +25 -0
- package/dist/url-safe-passwords.d.ts.map +1 -0
- package/dist/url-safe-passwords.js +70 -0
- package/dist/url-safe-passwords.js.map +1 -0
- package/dist/valkey-sidecar.d.ts +33 -6
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +90 -61
- package/dist/valkey-sidecar.js.map +1 -1
- package/dist/worker-module-files.d.ts +3 -0
- package/dist/worker-module-files.d.ts.map +1 -0
- package/dist/worker-module-files.js +18 -0
- package/dist/worker-module-files.js.map +1 -0
- package/package.json +22 -16
- package/dist/functions-router-gen.d.ts.map +0 -1
- package/dist/functions-router-gen.js +0 -302
- package/dist/functions-router-gen.js.map +0 -1
package/dist/type-extractor.js
CHANGED
|
@@ -4,9 +4,11 @@ import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
import { isJsonObject, isOneOf } from "@supatype/shared";
|
|
6
6
|
import { isIdentityDependent } from "./cache-identity-scope.js";
|
|
7
|
+
import { HOOK_EVENTS, isAfterHookEvent } from "./hook-events.js";
|
|
7
8
|
import { applyImportRename, createResolveContext, needsChecker, resolveTypeNode, tryResolveTypeReference, unknownTypeError, } from "./type-resolver.js";
|
|
8
9
|
import { emitField, emitModel, emitSchema, defaultPgTypeForKind, isFieldKind, scalar, } from "./schema-ast-v2.js";
|
|
9
10
|
import { jsonTypeArgText } from "./json-type-text.js";
|
|
11
|
+
import { callerOwnedIds } from "./owner-default.js";
|
|
10
12
|
import { compileBounds, measureFormFor } from "./field-bounds.js";
|
|
11
13
|
export function extractSchemaAstFromTypes(schemaPath, cwd = process.cwd()) {
|
|
12
14
|
const absPath = resolve(cwd, schemaPath);
|
|
@@ -67,10 +69,12 @@ export function extractSchemaAstFromTypes(schemaPath, cwd = process.cwd()) {
|
|
|
67
69
|
const name = getPropertyName(member.name);
|
|
68
70
|
if (!name)
|
|
69
71
|
continue;
|
|
72
|
+
if (member.questionToken !== undefined)
|
|
73
|
+
refuseQuestionToken(member.type, stmt.name.text, name);
|
|
70
74
|
fields[name] = parseFieldType(name, member.type, sourceFile, blockAliases, bucketAliases, bucketsById, fieldContext, resolveCtx);
|
|
71
75
|
}
|
|
72
76
|
const { tableName, access, options, indexes, constraints, hooks, validators, searchFields, cache, } = parseModelMeta(metaArg, sourceFile, stmt.name.text, fieldsArg, fields, resolveCtx);
|
|
73
|
-
models.push(emitModel(stmt.name.text, fields, options, tableName, access, indexes, hooks, constraints, validators, searchFields, cache));
|
|
77
|
+
models.push(emitModel(stmt.name.text, withUuidKeyDefaults(fields, access["create"]), options, tableName, access, indexes, hooks, constraints, validators, searchFields, cache));
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
if (models.length === 0)
|
|
@@ -94,6 +98,26 @@ export function extractSchemaAstFromTypes(schemaPath, cwd = process.cwd()) {
|
|
|
94
98
|
}),
|
|
95
99
|
});
|
|
96
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* A `?` on a model field reads as "nullable" but the column comes out NOT NULL, because nullability
|
|
103
|
+
* is carried by `Optional<>`, not by the property. Refuse it so the two never disagree silently.
|
|
104
|
+
*/
|
|
105
|
+
function refuseQuestionToken(type, modelName, fieldName) {
|
|
106
|
+
// From the field's own file: a field can come from another one through an intersection.
|
|
107
|
+
const typeText = type.getText();
|
|
108
|
+
throw new Error(`${modelName}.${fieldName} is declared with \`?\`, which Supatype does not read as nullable. ` +
|
|
109
|
+
`Write \`${fieldName}: Optional<${typeText}>\` for a nullable column, or drop the \`?\` for a required one.`);
|
|
110
|
+
}
|
|
111
|
+
const GEO_SHAPES = ["point", "polygon", "linestring"];
|
|
112
|
+
/** The shape of `Geo<"polygon">`; a bare `Geo` is a point. */
|
|
113
|
+
function parseGeoShape(arg, fieldName, sourceFile) {
|
|
114
|
+
if (arg === undefined)
|
|
115
|
+
return "point";
|
|
116
|
+
const shape = literalStringType(arg);
|
|
117
|
+
if (shape !== null && isOneOf(GEO_SHAPES)(shape))
|
|
118
|
+
return shape;
|
|
119
|
+
throw new Error(`Field "${fieldName}": Geo<${arg.getText(sourceFile)}> is not a shape Geo has. Use point, polygon or linestring.`);
|
|
120
|
+
}
|
|
97
121
|
/**
|
|
98
122
|
* The project root as a real path, so it compares with the real paths of the files under it. A
|
|
99
123
|
* root reached through a symlink (macOS `/var` is `/private/var`) otherwise puts every file "outside".
|
|
@@ -362,6 +386,19 @@ function isArrayLikeTypeNode(node, sourceFile) {
|
|
|
362
386
|
}
|
|
363
387
|
return false;
|
|
364
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* `fields` with `gen_random_uuid()` on each uuid primary key that declares no default of its own,
|
|
391
|
+
* except an auth user id `createRule` makes the caller's: a random uuid would name no user, and the
|
|
392
|
+
* engine defaults that column to the caller instead. A default the schema writes is never touched.
|
|
393
|
+
*/
|
|
394
|
+
function withUuidKeyDefaults(fields, createRule) {
|
|
395
|
+
const callerOwned = callerOwnedIds(createRule, fields);
|
|
396
|
+
const entries = Object.entries(fields).map(([name, field]) => {
|
|
397
|
+
const randomKey = field.kind === "uuid" && field["primaryKey"] === true && field["default"] === undefined && !callerOwned.has(name);
|
|
398
|
+
return [name, randomKey ? { ...field, default: { kind: "genRandomUuid" } } : field];
|
|
399
|
+
});
|
|
400
|
+
return Object.fromEntries(entries);
|
|
401
|
+
}
|
|
365
402
|
function parseFieldType(fieldName, typeNode, sourceFile, blockAliases, bucketAliases, bucketsById, context = {}, resolveCtx) {
|
|
366
403
|
const flags = {
|
|
367
404
|
required: true,
|
|
@@ -630,14 +667,8 @@ function parseFieldType(fieldName, typeNode, sourceFile, blockAliases, bucketAli
|
|
|
630
667
|
kernel: { ...parsed.kernel, default: { kind: "value", value: flags.fieldDefault } },
|
|
631
668
|
};
|
|
632
669
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
...parsed,
|
|
636
|
-
kernel: { ...parsed.kernel, default: { kind: "genRandomUuid" } },
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
else if (parsed.kernel.primaryKey === true &&
|
|
640
|
-
(parsed.kind === "serial" || parsed.kind === "bigSerial")) {
|
|
670
|
+
// A uuid key's default waits for the model's access rule: withUuidKeyDefaults decides it.
|
|
671
|
+
if (parsed.kernel.primaryKey === true && (parsed.kind === "serial" || parsed.kind === "bigSerial")) {
|
|
641
672
|
flags.serverGenerated = true;
|
|
642
673
|
}
|
|
643
674
|
if (flags.serverGenerated === true) {
|
|
@@ -934,7 +965,7 @@ function parseScalarType(typeNode, sourceFile, blockAliases, bucketAliases, buck
|
|
|
934
965
|
}
|
|
935
966
|
case "GeoPoint":
|
|
936
967
|
case "Geo":
|
|
937
|
-
return scalar("geo", { kernel: { geoType:
|
|
968
|
+
return scalar("geo", { kernel: { geoType: parseGeoShape(typeNode.typeArguments?.[0], fieldName, sourceFile), srid: 4326 } });
|
|
938
969
|
case "Asset":
|
|
939
970
|
case "FileAsset": {
|
|
940
971
|
const bucket = resolveBucketName(typeNode.typeArguments?.[0], sourceFile, bucketAliases, "assets");
|
|
@@ -1071,12 +1102,12 @@ function collectBucketContext(sourceFile, resolveCtx) {
|
|
|
1071
1102
|
return { aliases, bucketsById };
|
|
1072
1103
|
}
|
|
1073
1104
|
function buildExtractedBucketAst(id, parsed) {
|
|
1074
|
-
|
|
1075
|
-
|
|
1105
|
+
// Visibility only when the schema names it: a push leaves an unnamed one as the live bucket has
|
|
1106
|
+
// it, and a filled-in `private` named it, undoing a runtime change on every push.
|
|
1107
|
+
const mode = parsed.accessMode;
|
|
1076
1108
|
const row = {
|
|
1077
1109
|
id,
|
|
1078
|
-
public:
|
|
1079
|
-
accessMode: mode,
|
|
1110
|
+
...(mode !== undefined && { public: mode === "public", accessMode: mode }),
|
|
1080
1111
|
...(parsed.allowedMimeTypes !== undefined && parsed.allowedMimeTypes.length > 0
|
|
1081
1112
|
? { allowedMimeTypes: parsed.allowedMimeTypes }
|
|
1082
1113
|
: {}),
|
|
@@ -1110,9 +1141,9 @@ function parseBucketTypeLiteral(lit, sourceFile, bucketId, resolveCtx) {
|
|
|
1110
1141
|
continue;
|
|
1111
1142
|
}
|
|
1112
1143
|
if (key === "accept") {
|
|
1113
|
-
const types =
|
|
1114
|
-
if (types
|
|
1115
|
-
out.allowedMimeTypes = types;
|
|
1144
|
+
const types = acceptList(member.type, sourceFile, bucketId);
|
|
1145
|
+
if (types.length > 0)
|
|
1146
|
+
out.allowedMimeTypes = acceptedMimeTypes(bucketId, types);
|
|
1116
1147
|
continue;
|
|
1117
1148
|
}
|
|
1118
1149
|
if (key === "access") {
|
|
@@ -1142,32 +1173,51 @@ function parseSizeStringLiteral(typeNode, sourceFile) {
|
|
|
1142
1173
|
function parseJsonStringLiteral(typeNode, sourceFile) {
|
|
1143
1174
|
return parseSizeStringLiteral(typeNode, sourceFile);
|
|
1144
1175
|
}
|
|
1145
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* A MIME type a bucket can accept: `type/subtype` in RFC 6838's restricted names, or `type/*`. The
|
|
1178
|
+
* storage service's own rule (`packages/storage/src/bucket-rules.ts`), so a type it would refuse at
|
|
1179
|
+
* provisioning stops the schema here instead.
|
|
1180
|
+
*/
|
|
1181
|
+
export const BUCKET_MIME_TYPE = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/(\*|[a-z0-9][a-z0-9!#$&^_.+-]{0,126})$/i;
|
|
1182
|
+
/** `types`, when each is a MIME type a bucket can accept; throws naming the first that is not. */
|
|
1183
|
+
function acceptedMimeTypes(bucketId, types) {
|
|
1184
|
+
const bad = types.find((type) => !BUCKET_MIME_TYPE.test(type));
|
|
1185
|
+
if (bad === undefined)
|
|
1186
|
+
return types;
|
|
1187
|
+
throw new Error(`Bucket "${bucketId}": accept holds "${bad}", which is not a MIME type. ` +
|
|
1188
|
+
`Use "type/subtype" or "type/*", such as "image/png" or "image/*".`);
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* The MIME types a bucket's `accept` lists, an empty list meaning no limit. Any form but string
|
|
1192
|
+
* literals written in place is refused: it was read as no list at all, so the bucket took every type.
|
|
1193
|
+
*/
|
|
1194
|
+
function acceptList(typeNode, sourceFile, bucketId) {
|
|
1195
|
+
const types = parseMimeAcceptList(typeNode);
|
|
1196
|
+
if (types !== null)
|
|
1197
|
+
return types;
|
|
1198
|
+
throw new Error(`Bucket "${bucketId}": could not read its \`accept\` list from \`${typeNode.getText(sourceFile)}\`.\n` +
|
|
1199
|
+
` accept lists MIME types as string literals in place, e.g. accept: ["image/png", "image/*"]`);
|
|
1200
|
+
}
|
|
1201
|
+
/** The string literals a tuple or a union lists, or null when it is written any other way. */
|
|
1202
|
+
function parseMimeAcceptList(typeNode) {
|
|
1146
1203
|
if (ts.isTypeOperatorNode(typeNode) && typeNode.operator === ts.SyntaxKind.ReadonlyKeyword) {
|
|
1147
|
-
return parseMimeAcceptList(typeNode.type
|
|
1204
|
+
return parseMimeAcceptList(typeNode.type);
|
|
1148
1205
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
for (const u of typeNode.types) {
|
|
1163
|
-
const s = literalStringType(u);
|
|
1164
|
-
if (!s)
|
|
1165
|
-
return undefined;
|
|
1166
|
-
values.push(s);
|
|
1167
|
-
}
|
|
1168
|
-
return values.length > 0 ? values : undefined;
|
|
1206
|
+
const members = ts.isTupleTypeNode(typeNode)
|
|
1207
|
+
? typeNode.elements.map((el) => (ts.isNamedTupleMember(el) ? el.type : el))
|
|
1208
|
+
: ts.isUnionTypeNode(typeNode)
|
|
1209
|
+
? [...typeNode.types]
|
|
1210
|
+
: null;
|
|
1211
|
+
if (members === null)
|
|
1212
|
+
return null;
|
|
1213
|
+
const values = [];
|
|
1214
|
+
for (const node of members) {
|
|
1215
|
+
const value = literalStringType(node);
|
|
1216
|
+
if (!value)
|
|
1217
|
+
return null;
|
|
1218
|
+
values.push(value);
|
|
1169
1219
|
}
|
|
1170
|
-
return
|
|
1220
|
+
return values;
|
|
1171
1221
|
}
|
|
1172
1222
|
/** The operations a bucket's `access` may name, the same four a model's may. */
|
|
1173
1223
|
const BUCKET_RULE_KEYS = new Set(["read", "create", "update", "delete"]);
|
|
@@ -1200,25 +1250,32 @@ function parsePartialBucketAccess(typeNode, sourceFile, bucketId, resolveCtx) {
|
|
|
1200
1250
|
}
|
|
1201
1251
|
return access;
|
|
1202
1252
|
}
|
|
1203
|
-
/**
|
|
1253
|
+
/** Each size unit `maxSize` reads, as a power of two. */
|
|
1254
|
+
const SIZE_UNIT_EXPONENTS = { B: 0, KB: 10, MB: 20, GB: 30 };
|
|
1255
|
+
/** The units `maxSize` reads, as a sentence names them: "B, KB, MB or GB". */
|
|
1256
|
+
function sizeUnitList() {
|
|
1257
|
+
const units = Object.keys(SIZE_UNIT_EXPONENTS);
|
|
1258
|
+
return `${units.slice(0, -1).join(", ")} or ${units.at(-1) ?? ""}`;
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Parse human-readable size from schema types, e.g. `50MB`. A number and a unit it does not read,
|
|
1262
|
+
* or a size past the most bytes a number holds exactly, are each named as what they are: both used
|
|
1263
|
+
* to say only "Invalid maxSize literal" (local test round 3b).
|
|
1264
|
+
*/
|
|
1204
1265
|
function parseDataSizeBytes(lit) {
|
|
1205
|
-
const m = lit.trim().match(/^(\d+(?:\.\d+)?)\s*(
|
|
1266
|
+
const m = lit.trim().match(/^(\d+(?:\.\d+)?)\s*([A-Za-z]+)$/);
|
|
1206
1267
|
if (!m?.[1] || !m[2])
|
|
1207
1268
|
throw new Error(`Invalid maxSize literal: "${lit}". Use forms like "50MB", "100KB".`);
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1210
|
-
throw new Error(`Invalid maxSize
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
const exp = pow[unit];
|
|
1219
|
-
if (exp === undefined)
|
|
1220
|
-
throw new Error(`Unsupported maxSize unit in: "${lit}"`);
|
|
1221
|
-
return Math.round(n * Math.pow(2, exp));
|
|
1269
|
+
const exp = SIZE_UNIT_EXPONENTS[m[2].toUpperCase()];
|
|
1270
|
+
if (exp === undefined) {
|
|
1271
|
+
throw new Error(`Invalid maxSize "${lit}": "${m[2]}" is not a size unit here: use ${sizeUnitList()}.`);
|
|
1272
|
+
}
|
|
1273
|
+
const bytes = Math.round(Number(m[1]) * Math.pow(2, exp));
|
|
1274
|
+
if (!Number.isSafeInteger(bytes)) {
|
|
1275
|
+
const largest = `${Math.floor(Number.MAX_SAFE_INTEGER / Math.pow(2, 30))}GB`;
|
|
1276
|
+
throw new Error(`maxSize "${lit}" is too big: the largest is ${largest} (${Number.MAX_SAFE_INTEGER} bytes).`);
|
|
1277
|
+
}
|
|
1278
|
+
return bytes;
|
|
1222
1279
|
}
|
|
1223
1280
|
function stripQuotes(s) {
|
|
1224
1281
|
return s.replace(/^['"]|['"]$/g, "");
|
|
@@ -1233,10 +1290,12 @@ function bucketsEqual(a, b) {
|
|
|
1233
1290
|
}
|
|
1234
1291
|
function attachStorageFieldMeta(field, bucketId, bucketsById) {
|
|
1235
1292
|
const cfg = bucketsById.get(bucketId);
|
|
1236
|
-
if (cfg
|
|
1293
|
+
if (cfg !== undefined) {
|
|
1294
|
+
// A bucket that names no mode reads as private, as the storage service treats one; only the
|
|
1295
|
+
// bucket entry leaves it out, so a push keeps the live bucket's visibility.
|
|
1237
1296
|
return {
|
|
1238
1297
|
...field,
|
|
1239
|
-
kernel: { ...field.kernel, accessMode: cfg.accessMode },
|
|
1298
|
+
kernel: { ...field.kernel, accessMode: cfg.accessMode ?? "private" },
|
|
1240
1299
|
};
|
|
1241
1300
|
}
|
|
1242
1301
|
return field;
|
|
@@ -1322,7 +1381,8 @@ function parseInlineBlockDefinition(ref, sourceFile, blockAliases, bucketAliases
|
|
|
1322
1381
|
name,
|
|
1323
1382
|
...(label !== undefined && { label }),
|
|
1324
1383
|
...(icon !== undefined && { icon }),
|
|
1325
|
-
|
|
1384
|
+
// A block has no access rule of its own, so none of its uuid keys is the caller's.
|
|
1385
|
+
fields: withUuidKeyDefaults(fields, undefined),
|
|
1326
1386
|
};
|
|
1327
1387
|
}
|
|
1328
1388
|
/** `"always"` / `"by-default"`, the TypeScript spelling, as the AST spells it (identity-contract). */
|
|
@@ -1907,15 +1967,6 @@ function parseModelConstraints(metaArg, sourceFile, modelName, fields, resolveCt
|
|
|
1907
1967
|
return parsed;
|
|
1908
1968
|
});
|
|
1909
1969
|
}
|
|
1910
|
-
const HOOK_EVENTS = ["beforeChange", "afterChange", "beforeDelete", "afterDelete"];
|
|
1911
|
-
/**
|
|
1912
|
-
* Read `hooks` from a model's meta.
|
|
1913
|
-
*
|
|
1914
|
-
* Deliberately strict: an entry that is neither a string nor an object with a `function` name is
|
|
1915
|
-
* **dropped**, and `validateModelHooks` then reports the model whose hook did not survive. A hook
|
|
1916
|
-
* silently not firing is the failure this feature cannot have, so an unreadable declaration must
|
|
1917
|
-
* fail the push rather than extract to nothing.
|
|
1918
|
-
*/
|
|
1919
1970
|
/**
|
|
1920
1971
|
* Read `validate` from a model's meta: field name to the function that checks it.
|
|
1921
1972
|
*
|
|
@@ -1958,6 +2009,17 @@ function parseModelValidators(metaArg, sourceFile, modelName, fields) {
|
|
|
1958
2009
|
}
|
|
1959
2010
|
return out;
|
|
1960
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Read `hooks` from a model's meta.
|
|
2014
|
+
*
|
|
2015
|
+
* Deliberately strict: an entry that is neither a string nor an object with a `function` name is
|
|
2016
|
+
* **dropped**, and `validateModelHooks` then reports the model whose hook did not survive. A hook
|
|
2017
|
+
* silently not firing is the failure this feature cannot have, so an unreadable declaration must
|
|
2018
|
+
* fail the push rather than extract to nothing.
|
|
2019
|
+
*
|
|
2020
|
+
* `columns` is kept only on an after-hook: a before-hook sees the request rather than the stored
|
|
2021
|
+
* row, so there is nothing for it to choose.
|
|
2022
|
+
*/
|
|
1961
2023
|
function parseModelHooks(metaArg, sourceFile) {
|
|
1962
2024
|
if (!metaArg || !ts.isTypeLiteralNode(metaArg))
|
|
1963
2025
|
return {};
|
|
@@ -1973,13 +2035,14 @@ function parseModelHooks(metaArg, sourceFile) {
|
|
|
1973
2035
|
const event = getPropertyName(member.name);
|
|
1974
2036
|
if (!event || !HOOK_EVENTS.includes(event))
|
|
1975
2037
|
continue;
|
|
1976
|
-
const parsed = parseModelHookValue(member.type, sourceFile);
|
|
2038
|
+
const parsed = parseModelHookValue(member.type, sourceFile, isAfterHookEvent(event));
|
|
1977
2039
|
if (parsed !== null)
|
|
1978
2040
|
hooks[event] = parsed;
|
|
1979
2041
|
}
|
|
1980
2042
|
return hooks;
|
|
1981
2043
|
}
|
|
1982
|
-
|
|
2044
|
+
/** A hook or validator entry; `columns` is read only when `afterHook`, the one place it means anything. */
|
|
2045
|
+
function parseModelHookValue(node, sourceFile, afterHook = false) {
|
|
1983
2046
|
const literal = literalStringType(node);
|
|
1984
2047
|
if (literal !== null) {
|
|
1985
2048
|
return literal.trim().length > 0 ? { function: literal } : null;
|
|
@@ -1989,6 +2052,7 @@ function parseModelHookValue(node, sourceFile) {
|
|
|
1989
2052
|
let fn;
|
|
1990
2053
|
let timeout;
|
|
1991
2054
|
let onUnavailable;
|
|
2055
|
+
let allColumns = false;
|
|
1992
2056
|
for (const member of node.members) {
|
|
1993
2057
|
if (!ts.isPropertySignature(member) || !member.type)
|
|
1994
2058
|
continue;
|
|
@@ -2006,6 +2070,9 @@ function parseModelHookValue(node, sourceFile) {
|
|
|
2006
2070
|
if (value === "reject" || value === "log")
|
|
2007
2071
|
onUnavailable = value;
|
|
2008
2072
|
}
|
|
2073
|
+
else if (key === "columns") {
|
|
2074
|
+
allColumns = afterHook && literalStringType(member.type) === "all";
|
|
2075
|
+
}
|
|
2009
2076
|
}
|
|
2010
2077
|
if (fn === undefined)
|
|
2011
2078
|
return null;
|
|
@@ -2013,6 +2080,7 @@ function parseModelHookValue(node, sourceFile) {
|
|
|
2013
2080
|
function: fn,
|
|
2014
2081
|
...(timeout !== undefined && { timeout }),
|
|
2015
2082
|
...(onUnavailable !== undefined && { onUnavailable }),
|
|
2083
|
+
...(allColumns && { columns: "all" }),
|
|
2016
2084
|
};
|
|
2017
2085
|
}
|
|
2018
2086
|
function parseModelIndexes(metaArg, sourceFile, fields) {
|