zitejs 0.10.0-start.9 → 0.10.1-device.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/dist/cjs/auth/actions.d.ts +28 -0
- package/dist/cjs/auth/actions.js +95 -0
- package/dist/cjs/auth/client.d.ts +357 -0
- package/dist/cjs/auth/client.js +71 -0
- package/dist/cjs/auth/config.js +9 -3
- package/dist/cjs/auth/index.d.ts +2 -249
- package/dist/cjs/auth/index.js +11 -108
- package/dist/cjs/auth/index.test.js +60 -0
- package/dist/cjs/auth/previewClaim.d.ts +7 -0
- package/dist/cjs/auth/previewClaim.js +16 -0
- package/dist/cjs/auth/profileUpdates.d.ts +9 -0
- package/dist/cjs/auth/profileUpdates.js +11 -0
- package/dist/cjs/auth/useAuth.test.js +1 -0
- package/dist/cjs/backend/index.d.ts +15 -9
- package/dist/cjs/backend/index.js +13 -13
- package/dist/cjs/backend/index.test.js +102 -102
- package/dist/cjs/bundle/index.d.ts +8 -0
- package/dist/cjs/bundle/index.js +38 -24
- package/dist/cjs/caller/index.js +37 -48
- package/dist/cjs/check/index.d.ts +20 -9
- package/dist/cjs/check/index.js +113 -88
- package/dist/cjs/check/start/routeTree.d.ts +8 -0
- package/dist/cjs/check/start/routeTree.js +118 -0
- package/dist/cjs/check/start/tsgo.d.ts +2 -0
- package/dist/cjs/check/start/tsgo.js +35 -0
- package/dist/cjs/cli.js +10 -4
- package/dist/cjs/client/index.d.ts +26 -2
- package/dist/cjs/client/index.js +25 -25
- package/dist/cjs/dev/index.js +79 -54
- package/dist/cjs/dev/signin.d.ts +16 -0
- package/dist/cjs/dev/signin.js +84 -0
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/integrations/client.d.ts +3 -3
- package/dist/cjs/integrations/client.js +5 -4
- package/dist/cjs/integrations/client.test-d.js +15 -15
- package/dist/cjs/integrations/index.d.ts +2 -2
- package/dist/cjs/integrations/rules.d.ts +1 -0
- package/dist/cjs/integrations/rules.js +48 -43
- package/dist/cjs/integrations/rules.test.js +60 -54
- package/dist/cjs/internal/appMode.d.ts +14 -0
- package/dist/cjs/internal/appMode.js +19 -0
- package/dist/cjs/internal/browserMode.d.ts +2 -0
- package/dist/cjs/internal/browserMode.js +18 -0
- package/dist/cjs/internal/deviceCache.d.ts +11 -0
- package/dist/cjs/internal/deviceCache.js +29 -0
- package/dist/cjs/internal/env.js +3 -2
- package/dist/cjs/internal/platformFetch.d.ts +2 -0
- package/dist/cjs/internal/platformFetch.js +14 -0
- package/dist/cjs/internal/reservedIds.d.ts +8 -0
- package/dist/cjs/internal/reservedIds.js +14 -0
- package/dist/cjs/internal/serviceUrls.d.ts +5 -0
- package/dist/cjs/internal/serviceUrls.js +14 -0
- package/dist/cjs/pdf/index.js +2 -1
- package/dist/cjs/query/deviceCache.d.ts +14 -0
- package/dist/cjs/query/deviceCache.js +304 -0
- package/dist/cjs/query/index.d.ts +19 -0
- package/dist/cjs/query/index.js +369 -0
- package/dist/cjs/runtime/filterConditionTypes.test-d.js +11 -11
- package/dist/cjs/runtime/index.d.ts +126 -39
- package/dist/cjs/runtime/index.js +32 -26
- package/dist/cjs/runtime/index.test.js +34 -34
- package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +50 -0
- package/dist/cjs/runtime/writeResultTypes.test-d.js +8 -8
- package/dist/cjs/sourceRoots.js +15 -15
- package/dist/cjs/sourceRoots.test.js +29 -27
- package/dist/cjs/start/{entries.d.ts → build/entries.d.ts} +9 -4
- package/dist/cjs/start/{entries.js → build/entries.js} +38 -21
- package/dist/cjs/start/build/placeholders/devApp.d.ts +1 -0
- package/dist/cjs/start/build/placeholders/devApp.js +6 -0
- package/dist/cjs/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
- package/dist/cjs/start/{describeBuilt.js → describe/describeBuilt.js} +55 -17
- package/dist/cjs/start/platform/aiUsage.d.ts +29 -0
- package/dist/cjs/start/platform/aiUsage.js +215 -0
- package/dist/cjs/start/platform/airtable/cache.d.ts +17 -0
- package/dist/cjs/start/platform/airtable/cache.js +93 -0
- package/dist/cjs/start/protocol.d.ts +19 -0
- package/dist/cjs/start/protocol.js +33 -0
- package/dist/cjs/start/serve/local/provider.d.ts +25 -0
- package/dist/cjs/start/serve/local/provider.js +196 -0
- package/dist/cjs/start/serve/provider.d.ts +19 -0
- package/dist/cjs/start/serve/provider.js +86 -0
- package/dist/cjs/start/types.d.ts +373 -0
- package/dist/cjs/start/types.js +2 -0
- package/dist/cjs/steps/index.d.ts +78 -0
- package/dist/cjs/steps/index.js +507 -0
- package/dist/cjs/steps/index.test.js +635 -0
- package/dist/cjs/sync/index.d.ts +1 -1
- package/dist/cjs/sync/index.js +28 -27
- package/dist/cjs/sync/lib.d.ts +15 -8
- package/dist/cjs/sync/lib.js +655 -655
- package/dist/cjs/sync/lib.test.js +177 -46
- package/dist/cjs/sync/sdkNames.d.ts +67 -9
- package/dist/cjs/sync/sdkNames.js +97 -31
- package/dist/cjs/sync/sdkNames.test.js +189 -113
- package/dist/cjs/types/fields.d.ts +9 -2
- package/dist/cjs/types/fields.js +110 -96
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/types/tables.d.ts +17 -1
- package/dist/cjs/upload/index.js +89 -24
- package/dist/cjs/upload/index.test.js +104 -1
- package/dist/cjs/vite/domTagNames.js +252 -252
- package/dist/cjs/vite/index.d.ts +1 -1
- package/dist/cjs/vite/index.js +87 -42
- package/dist/cjs/vite/index.test.js +36 -0
- package/dist/esm/auth/actions.d.ts +28 -0
- package/dist/esm/auth/actions.js +57 -0
- package/dist/esm/auth/client.d.ts +357 -0
- package/dist/esm/auth/client.js +67 -0
- package/dist/esm/auth/config.js +9 -3
- package/dist/esm/auth/index.d.ts +2 -249
- package/dist/esm/auth/index.js +2 -103
- package/dist/esm/auth/index.test.js +60 -0
- package/dist/esm/auth/previewClaim.d.ts +7 -0
- package/dist/esm/auth/previewClaim.js +12 -0
- package/dist/esm/auth/profileUpdates.d.ts +9 -0
- package/dist/esm/auth/profileUpdates.js +6 -0
- package/dist/esm/auth/useAuth.test.js +1 -0
- package/dist/esm/backend/index.d.ts +15 -9
- package/dist/esm/backend/index.js +13 -13
- package/dist/esm/backend/index.test.js +106 -106
- package/dist/esm/bundle/index.d.ts +8 -0
- package/dist/esm/bundle/index.js +37 -24
- package/dist/esm/caller/index.js +37 -48
- package/dist/esm/check/index.d.ts +20 -9
- package/dist/esm/check/index.js +117 -93
- package/dist/esm/check/start/routeTree.d.ts +8 -0
- package/dist/esm/check/start/routeTree.js +77 -0
- package/dist/esm/check/start/tsgo.d.ts +2 -0
- package/dist/esm/check/start/tsgo.js +29 -0
- package/dist/esm/cli.js +10 -4
- package/dist/esm/client/index.d.ts +26 -2
- package/dist/esm/client/index.js +25 -25
- package/dist/esm/dev/index.js +86 -61
- package/dist/esm/dev/signin.d.ts +16 -0
- package/dist/esm/dev/signin.js +80 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +3 -3
- package/dist/esm/integrations/client.d.ts +3 -3
- package/dist/esm/integrations/client.js +6 -5
- package/dist/esm/integrations/client.test-d.js +19 -19
- package/dist/esm/integrations/index.d.ts +2 -2
- package/dist/esm/integrations/index.js +1 -1
- package/dist/esm/integrations/rules.d.ts +1 -0
- package/dist/esm/integrations/rules.js +48 -43
- package/dist/esm/integrations/rules.test.js +62 -56
- package/dist/esm/internal/appMode.d.ts +14 -0
- package/dist/esm/internal/appMode.js +13 -0
- package/dist/esm/internal/browserMode.d.ts +2 -0
- package/dist/esm/internal/browserMode.js +15 -0
- package/dist/esm/internal/deviceCache.d.ts +11 -0
- package/dist/esm/internal/deviceCache.js +24 -0
- package/dist/esm/internal/env.js +3 -2
- package/dist/esm/internal/platformFetch.d.ts +2 -0
- package/dist/esm/internal/platformFetch.js +9 -0
- package/dist/esm/internal/reservedIds.d.ts +8 -0
- package/dist/esm/internal/reservedIds.js +10 -0
- package/dist/esm/internal/serviceUrls.d.ts +5 -0
- package/dist/esm/internal/serviceUrls.js +10 -0
- package/dist/esm/pdf/index.js +2 -1
- package/dist/esm/query/deviceCache.d.ts +14 -0
- package/dist/esm/query/deviceCache.js +301 -0
- package/dist/esm/query/index.d.ts +19 -0
- package/dist/esm/query/index.js +366 -0
- package/dist/esm/runtime/filterConditionTypes.test-d.js +12 -12
- package/dist/esm/runtime/index.d.ts +126 -39
- package/dist/esm/runtime/index.js +35 -29
- package/dist/esm/runtime/index.test.js +36 -36
- package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
- package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +48 -0
- package/dist/esm/runtime/writeResultTypes.test-d.js +9 -9
- package/dist/esm/signin/conformance.d.ts +100 -0
- package/dist/esm/signin/conformance.js +616 -0
- package/dist/esm/signin/cookies.d.ts +28 -0
- package/dist/esm/signin/cookies.js +67 -0
- package/dist/esm/signin/encoding.d.ts +1 -0
- package/dist/esm/signin/encoding.js +12 -0
- package/dist/esm/signin/endpoints.d.ts +12 -0
- package/dist/esm/signin/endpoints.js +32 -0
- package/dist/esm/signin/http.d.ts +25 -0
- package/dist/esm/signin/http.js +106 -0
- package/dist/esm/signin/index.d.ts +8 -0
- package/dist/esm/signin/index.js +9 -0
- package/dist/esm/signin/keys.d.ts +35 -0
- package/dist/esm/signin/keys.js +230 -0
- package/dist/esm/signin/paths.d.ts +2 -0
- package/dist/esm/signin/paths.js +5 -0
- package/dist/esm/signin/seal.d.ts +19 -0
- package/dist/esm/signin/seal.js +47 -0
- package/dist/esm/signin/signin.d.ts +60 -0
- package/dist/esm/signin/signin.js +447 -0
- package/dist/esm/signin/transport.d.ts +112 -0
- package/dist/esm/signin/transport.js +1 -0
- package/dist/esm/signin/verifier.d.ts +2 -0
- package/dist/esm/signin/verifier.js +4 -0
- package/dist/esm/signin/verify.d.ts +83 -0
- package/dist/esm/signin/verify.js +142 -0
- package/dist/esm/sourceRoots.js +17 -17
- package/dist/esm/sourceRoots.test.js +34 -32
- package/dist/esm/start/access.d.ts +19 -0
- package/dist/esm/start/access.js +43 -0
- package/dist/esm/start/auth.d.ts +28 -0
- package/dist/esm/start/auth.js +33 -0
- package/dist/esm/start/automations/quiet.d.ts +2 -0
- package/dist/esm/start/automations/quiet.js +36 -0
- package/dist/esm/start/{registration.d.ts → automations/registration.d.ts} +1 -1
- package/dist/esm/start/{registration.js → automations/registration.js} +11 -7
- package/dist/esm/start/automations/steps.d.ts +29 -0
- package/dist/esm/start/automations/steps.js +95 -0
- package/dist/esm/start/automations/workflow.d.ts +83 -0
- package/dist/esm/start/automations/workflow.js +36 -0
- package/dist/esm/start/automations/workflow.test-d.d.ts +1 -0
- package/dist/esm/start/automations/workflow.test-d.js +130 -0
- package/dist/esm/start/automations/workflowRun.d.ts +130 -0
- package/dist/esm/start/automations/workflowRun.js +185 -0
- package/dist/esm/start/barrel.test-d.d.ts +10 -0
- package/dist/esm/start/barrel.test-d.js +6 -0
- package/dist/esm/start/{entries.d.ts → build/entries.d.ts} +9 -4
- package/dist/esm/start/{entries.js → build/entries.js} +38 -22
- package/dist/esm/start/build/placeholders/devApp.d.ts +1 -0
- package/dist/esm/start/build/placeholders/devApp.js +3 -0
- package/dist/esm/start/build/placeholders/devSignIn.d.ts +1 -0
- package/dist/esm/start/build/placeholders/devSignIn.js +3 -0
- package/dist/esm/start/build/placeholders/siteHead.d.ts +2 -0
- package/dist/esm/start/build/placeholders/siteHead.js +3 -0
- package/dist/esm/start/{workflowModules.js → build/placeholders/workflowModules.js} +1 -1
- package/dist/esm/start/build/placeholders/workspaceSchema.d.ts +2 -0
- package/dist/esm/start/build/placeholders/workspaceSchema.js +3 -0
- package/dist/esm/start/build/registrationHash.d.ts +11 -0
- package/dist/esm/start/build/registrationHash.js +88 -0
- package/dist/esm/start/build/sdk/axios.d.ts +76 -0
- package/dist/esm/start/build/sdk/axios.js +253 -0
- package/dist/esm/start/build/sdk/nodeFetch.d.ts +41 -0
- package/dist/esm/start/build/sdk/nodeFetch.js +35 -0
- package/dist/esm/start/build/sdk/undici.d.ts +34 -0
- package/dist/esm/start/build/sdk/undici.js +18 -0
- package/dist/esm/start/build/sdkPatches.d.ts +22 -0
- package/dist/esm/start/build/sdkPatches.js +430 -0
- package/dist/esm/start/build/siteHead.d.ts +26 -0
- package/dist/esm/start/build/siteHead.js +88 -0
- package/dist/esm/start/build/vite.d.ts +50 -0
- package/dist/esm/start/build/vite.js +491 -0
- package/dist/esm/start/classicOnly.d.ts +1 -0
- package/dist/esm/start/classicOnly.js +4 -0
- package/dist/esm/start/{describe.d.ts → describe/describe.d.ts} +44 -9
- package/dist/esm/start/describe/describe.js +372 -0
- package/dist/esm/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
- package/dist/esm/start/describe/describeBuilt.js +102 -0
- package/dist/esm/start/{descriptions.js → describe/descriptions.js} +17 -10
- package/dist/esm/start/errors.d.ts +15 -4
- package/dist/esm/start/errors.js +87 -28
- package/dist/esm/start/errors.test.js +47 -16
- package/dist/esm/start/factories.d.ts +14 -0
- package/dist/esm/start/factories.js +23 -0
- package/dist/esm/start/factories.test-d.d.ts +2 -1
- package/dist/esm/start/factories.test-d.js +52 -12
- package/dist/esm/start/failures.d.ts +7 -0
- package/dist/esm/start/failures.js +62 -0
- package/dist/esm/start/fnFactory.d.ts +16 -0
- package/dist/esm/start/fnFactory.js +1 -0
- package/dist/esm/start/host.d.ts +2 -2
- package/dist/esm/start/host.js +3 -3
- package/dist/esm/start/index.d.ts +10 -66
- package/dist/esm/start/index.js +7 -146
- package/dist/esm/start/login.d.ts +5 -0
- package/dist/esm/start/login.js +29 -0
- package/dist/esm/start/middlewareKind.d.ts +13 -0
- package/dist/esm/start/middlewareKind.js +9 -0
- package/dist/esm/start/platform/aiUsage.d.ts +29 -0
- package/dist/esm/start/platform/aiUsage.js +210 -0
- package/dist/esm/start/platform/airtable/built.d.ts +2 -0
- package/dist/esm/start/platform/airtable/built.js +3 -0
- package/dist/esm/start/platform/airtable/cache.d.ts +17 -0
- package/dist/esm/start/platform/airtable/cache.js +89 -0
- package/dist/esm/start/{airtable → platform/airtable}/dispatch.d.ts +5 -2
- package/dist/esm/start/{airtable → platform/airtable}/dispatch.js +195 -119
- package/dist/esm/start/{airtable → platform/airtable}/formulas.d.ts +2 -1
- package/dist/esm/start/{airtable → platform/airtable}/formulas.js +51 -25
- package/dist/esm/start/platform/airtable/index.d.ts +6 -0
- package/dist/esm/start/platform/airtable/index.js +51 -0
- package/dist/esm/start/platform/airtable/settings.d.ts +37 -0
- package/dist/esm/start/platform/airtable/settings.js +138 -0
- package/dist/esm/start/platform/analytics.d.ts +3 -0
- package/dist/esm/start/platform/analytics.js +59 -0
- package/dist/esm/start/platform/calls.d.ts +5 -0
- package/dist/esm/start/platform/calls.js +104 -0
- package/dist/esm/start/platform/caps.d.ts +9 -0
- package/dist/esm/start/platform/caps.js +35 -0
- package/dist/esm/start/platform/connections.d.ts +25 -0
- package/dist/esm/start/platform/connections.js +198 -0
- package/dist/esm/start/{data → platform/data}/baseRunner.d.ts +11 -6
- package/dist/esm/start/platform/data/baseRunner.js +117 -0
- package/dist/esm/start/{data → platform/data}/dispatch.d.ts +3 -2
- package/dist/esm/start/{data → platform/data}/dispatch.js +69 -51
- package/dist/esm/start/platform/data/fetch.d.ts +7 -0
- package/dist/esm/start/platform/data/fetch.js +9 -0
- package/dist/esm/start/platform/data/index.d.ts +27 -0
- package/dist/esm/start/platform/data/index.js +75 -0
- package/dist/esm/start/platform/data/names.d.ts +7 -0
- package/dist/esm/start/platform/data/names.js +18 -0
- package/dist/esm/start/{data → platform/data}/transformations.d.ts +0 -31
- package/dist/esm/start/{data → platform/data}/transformations.js +0 -56
- package/dist/esm/start/{data → platform/data}/types.d.ts +4 -1
- package/dist/esm/start/{data → platform/data}/types.js +2 -2
- package/dist/esm/start/platform/local.d.ts +6 -0
- package/dist/esm/start/platform/local.js +18 -0
- package/dist/esm/start/platform/meta.d.ts +3 -0
- package/dist/esm/start/platform/meta.js +33 -0
- package/dist/esm/start/platform/outbound.d.ts +17 -0
- package/dist/esm/start/platform/outbound.js +510 -0
- package/dist/esm/start/platform/redactSecrets.d.ts +13 -0
- package/dist/esm/start/{redactSecrets.js → platform/redactSecrets.js} +32 -7
- package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
- package/dist/esm/start/platform/requestSecrets.d.ts +15 -0
- package/dist/esm/start/platform/requestSecrets.js +41 -0
- package/dist/esm/start/platform/runLog.d.ts +40 -0
- package/dist/esm/start/platform/runLog.js +149 -0
- package/dist/esm/start/platform/services.d.ts +7 -0
- package/dist/esm/start/platform/services.js +46 -0
- package/dist/esm/start/platform/steps.d.ts +9 -0
- package/dist/esm/start/platform/steps.js +60 -0
- package/dist/esm/start/platform/telemetry.d.ts +13 -0
- package/dist/esm/start/platform/telemetry.js +71 -0
- package/dist/esm/start/platform/transport.d.ts +28 -0
- package/dist/esm/start/platform/transport.js +59 -0
- package/dist/esm/start/platformHead.d.ts +23 -0
- package/dist/esm/start/platformHead.js +133 -0
- package/dist/esm/start/previewClaim.d.ts +3 -7
- package/dist/esm/start/previewClaim.js +9 -17
- package/dist/esm/start/protocol.d.ts +19 -0
- package/dist/esm/start/protocol.js +27 -0
- package/dist/esm/start/roles.d.ts +12 -0
- package/dist/esm/start/roles.js +27 -0
- package/dist/esm/start/router.d.ts +27 -4
- package/dist/esm/start/router.js +221 -22
- package/dist/esm/start/serve/authHooks.js +18 -0
- package/dist/esm/start/serve/demo.d.ts +9 -0
- package/dist/esm/start/serve/demo.js +24 -0
- package/dist/esm/start/serve/fetch.d.ts +1 -0
- package/dist/esm/start/serve/fetch.js +6 -0
- package/dist/esm/start/{instance.d.ts → serve/instance.d.ts} +6 -5
- package/dist/esm/start/serve/instance.js +134 -0
- package/dist/esm/start/serve/invoke.d.ts +13 -0
- package/dist/esm/start/serve/invoke.js +126 -0
- package/dist/esm/start/serve/local/load.d.ts +8 -0
- package/dist/esm/start/serve/local/load.js +44 -0
- package/dist/esm/start/serve/local/provider.d.ts +25 -0
- package/dist/esm/start/serve/local/provider.js +188 -0
- package/dist/esm/start/serve/local/signIn.d.ts +28 -0
- package/dist/esm/start/serve/local/signIn.js +123 -0
- package/dist/esm/start/serve/pageHead.d.ts +20 -0
- package/dist/esm/start/serve/pageHead.js +34 -0
- package/dist/esm/start/serve/provider.d.ts +19 -0
- package/dist/esm/start/serve/provider.js +78 -0
- package/dist/esm/start/serve/requestEnv.d.ts +2 -0
- package/dist/esm/start/serve/requestEnv.js +84 -0
- package/dist/esm/start/serve/scope.d.ts +18 -0
- package/dist/esm/start/serve/scope.js +67 -0
- package/dist/esm/start/serve/server.d.ts +56 -0
- package/dist/esm/start/serve/server.js +297 -0
- package/dist/esm/start/serve/uploads.d.ts +2 -0
- package/dist/esm/start/serve/uploads.js +49 -0
- package/dist/esm/start/serve/worker.d.ts +6 -0
- package/dist/esm/start/serve/worker.js +12 -0
- package/dist/esm/start/types.d.ts +270 -56
- package/dist/esm/start/version.d.ts +1 -1
- package/dist/esm/start/version.js +1 -1
- package/dist/esm/steps/index.d.ts +78 -0
- package/dist/esm/steps/index.js +502 -0
- package/dist/esm/steps/index.test.d.ts +1 -0
- package/dist/esm/steps/index.test.js +633 -0
- package/dist/esm/sync/index.d.ts +1 -1
- package/dist/esm/sync/index.js +32 -31
- package/dist/esm/sync/lib.d.ts +15 -8
- package/dist/esm/sync/lib.js +659 -659
- package/dist/esm/sync/lib.test.js +177 -46
- package/dist/esm/sync/sdkNames.d.ts +67 -9
- package/dist/esm/sync/sdkNames.js +94 -30
- package/dist/esm/sync/sdkNames.test.js +192 -116
- package/dist/esm/types/fields.d.ts +9 -2
- package/dist/esm/types/fields.js +110 -96
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/index.js +2 -2
- package/dist/esm/types/tables.d.ts +17 -1
- package/dist/esm/types/tables.js +2 -2
- package/dist/esm/upload/index.js +89 -24
- package/dist/esm/upload/index.test.js +104 -1
- package/dist/esm/vite/domTagNames.js +252 -252
- package/dist/esm/vite/index.d.ts +1 -1
- package/dist/esm/vite/index.js +92 -47
- package/dist/esm/vite/index.test.js +36 -0
- package/package.json +106 -38
- package/dist/cjs/auth-server/index.d.ts +0 -369
- package/dist/cjs/auth-server/index.js +0 -119
- package/dist/cjs/check/start/describeRules.d.ts +0 -35
- package/dist/cjs/check/start/describeRules.js +0 -89
- package/dist/cjs/check/start/problem.d.ts +0 -11
- package/dist/cjs/check/start/problem.js +0 -5
- package/dist/cjs/check/start/sourceRules.d.ts +0 -3
- package/dist/cjs/check/start/sourceRules.js +0 -441
- package/dist/cjs/start/problems.d.ts +0 -19
- package/dist/cjs/start/problems.js +0 -11
- package/dist/esm/auth-server/index.d.ts +0 -369
- package/dist/esm/auth-server/index.js +0 -116
- package/dist/esm/check/start/describeRules.d.ts +0 -35
- package/dist/esm/check/start/describeRules.js +0 -86
- package/dist/esm/check/start/problem.d.ts +0 -11
- package/dist/esm/check/start/problem.js +0 -1
- package/dist/esm/check/start/sourceRules.d.ts +0 -3
- package/dist/esm/check/start/sourceRules.js +0 -438
- package/dist/esm/start/airtable/index.d.ts +0 -11
- package/dist/esm/start/airtable/index.js +0 -70
- package/dist/esm/start/authHooks.js +0 -10
- package/dist/esm/start/data/baseRunner.js +0 -83
- package/dist/esm/start/data/index.d.ts +0 -18
- package/dist/esm/start/data/index.js +0 -76
- package/dist/esm/start/describe.js +0 -204
- package/dist/esm/start/describeBuilt.js +0 -66
- package/dist/esm/start/instance.js +0 -80
- package/dist/esm/start/problems.d.ts +0 -19
- package/dist/esm/start/problems.js +0 -8
- package/dist/esm/start/redactSecrets.d.ts +0 -7
- package/dist/esm/start/runLog.d.ts +0 -8
- package/dist/esm/start/runLog.js +0 -76
- package/dist/esm/start/scope.d.ts +0 -15
- package/dist/esm/start/scope.js +0 -58
- package/dist/esm/start/server.d.ts +0 -55
- package/dist/esm/start/server.js +0 -317
- package/dist/esm/start/vite.d.ts +0 -9
- package/dist/esm/start/vite.js +0 -173
- package/dist/esm/start/worker.d.ts +0 -11
- package/dist/esm/start/worker.js +0 -20
- package/dist/esm/start/workflow.d.ts +0 -53
- package/dist/esm/start/workflow.js +0 -13
- package/dist/esm/start/workflow.test-d.js +0 -44
- package/dist/esm/start/workflowRun.d.ts +0 -80
- package/dist/esm/start/workflowRun.js +0 -108
- /package/dist/{esm/start/redactSecrets.test.d.ts → cjs/runtime/sendEmailParamsTypes.test-d.d.ts} +0 -0
- /package/dist/{esm/start/workflow.test-d.d.ts → cjs/steps/index.test.d.ts} +0 -0
- /package/dist/esm/start/{authHooksModule.d.ts → build/placeholders/authHooksModule.d.ts} +0 -0
- /package/dist/esm/start/{authHooksModule.js → build/placeholders/authHooksModule.js} +0 -0
- /package/dist/esm/start/{workflowModules.d.ts → build/placeholders/workflowModules.d.ts} +0 -0
- /package/dist/esm/start/{descriptions.d.ts → describe/descriptions.d.ts} +0 -0
- /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.d.ts +0 -0
- /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.js +0 -0
- /package/dist/esm/start/{data → platform/data}/sqlNameMappings.d.ts +0 -0
- /package/dist/esm/start/{data → platform/data}/sqlNameMappings.js +0 -0
- /package/dist/esm/start/{redactSecrets.test.js → platform/redactSecrets.test.js} +0 -0
- /package/dist/esm/start/{authHooks.d.ts → serve/authHooks.d.ts} +0 -0
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
// Source hints for a Start app: line-level findings read from the code, never
|
|
2
|
-
// access decisions, which come from describe. A file that doesn't parse is
|
|
3
|
-
// skipped; tsc reports it.
|
|
4
|
-
import { parse } from "@babel/parser";
|
|
5
|
-
const isNode = (value) => typeof value === "object" && value !== null && typeof value.type === "string";
|
|
6
|
-
const SKIP_KEYS = new Set(["loc", "start", "end", "extra", "leadingComments", "trailingComments", "innerComments", "range"]);
|
|
7
|
-
const walk = (node, visit, ancestors = []) => {
|
|
8
|
-
visit(node, ancestors);
|
|
9
|
-
ancestors.push(node);
|
|
10
|
-
for (const key of Object.keys(node)) {
|
|
11
|
-
if (SKIP_KEYS.has(key))
|
|
12
|
-
continue;
|
|
13
|
-
const value = node[key];
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
for (const child of value)
|
|
16
|
-
if (isNode(child))
|
|
17
|
-
walk(child, visit, ancestors);
|
|
18
|
-
}
|
|
19
|
-
else if (isNode(value)) {
|
|
20
|
-
walk(value, visit, ancestors);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
ancestors.pop();
|
|
24
|
-
};
|
|
25
|
-
const FUNCTION_TYPES = new Set([
|
|
26
|
-
"FunctionDeclaration",
|
|
27
|
-
"FunctionExpression",
|
|
28
|
-
"ArrowFunctionExpression",
|
|
29
|
-
"ObjectMethod",
|
|
30
|
-
"ClassMethod",
|
|
31
|
-
"ClassPrivateMethod",
|
|
32
|
-
]);
|
|
33
|
-
const LOOP_TYPES = new Set(["ForStatement", "ForInStatement", "ForOfStatement", "WhileStatement", "DoWhileStatement"]);
|
|
34
|
-
const atModuleScope = (ancestors) => !ancestors.some((a) => FUNCTION_TYPES.has(a.type));
|
|
35
|
-
const lineOf = (node) => node.loc?.start.line;
|
|
36
|
-
const nameOf = (node) => {
|
|
37
|
-
if (!isNode(node))
|
|
38
|
-
return undefined;
|
|
39
|
-
if (node.type === "Identifier")
|
|
40
|
-
return node.name;
|
|
41
|
-
if (node.type === "StringLiteral")
|
|
42
|
-
return node.value;
|
|
43
|
-
return undefined;
|
|
44
|
-
};
|
|
45
|
-
const propertyNamed = (object, name) => object.properties.find((p) => (p.type === "ObjectProperty" || p.type === "ObjectMethod") && !p.computed && nameOf(p.key) === name);
|
|
46
|
-
const unwrap = (node) => node.type === "TSNonNullExpression" || node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression"
|
|
47
|
-
? unwrap(node.expression)
|
|
48
|
-
: node;
|
|
49
|
-
/** `a.b(…).c(…)`: the calls from the outside in, the member names, and the root identifier. */
|
|
50
|
-
const chainOf = (start) => {
|
|
51
|
-
const calls = [];
|
|
52
|
-
const members = [];
|
|
53
|
-
let current = start;
|
|
54
|
-
while (current) {
|
|
55
|
-
current = unwrap(current);
|
|
56
|
-
if (current.type === "CallExpression") {
|
|
57
|
-
calls.push(current);
|
|
58
|
-
current = current.callee;
|
|
59
|
-
}
|
|
60
|
-
else if (current.type === "MemberExpression" && !current.computed) {
|
|
61
|
-
const member = nameOf(current.property);
|
|
62
|
-
if (member === undefined)
|
|
63
|
-
return { calls, members };
|
|
64
|
-
members.push(member);
|
|
65
|
-
current = current.object;
|
|
66
|
-
}
|
|
67
|
-
else if (current.type === "Identifier") {
|
|
68
|
-
return { root: current.name, calls, members };
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return { calls, members };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return { calls, members };
|
|
75
|
-
};
|
|
76
|
-
const isHandlerCall = (node) => node.type === "CallExpression" && isNode(node.callee) && node.callee.type === "MemberExpression" && nameOf(node.callee.property) === "handler";
|
|
77
|
-
const BUILDER_MEMBERS = new Set(["handler", "validator", "inputValidator", "middleware"]);
|
|
78
|
-
/** The call that hands the factory its options: `signedInFn({ … })`, not `.validator(…)`. */
|
|
79
|
-
const optionsCall = (calls) => calls.find((call) => {
|
|
80
|
-
const callee = call.callee;
|
|
81
|
-
return !(callee.type === "MemberExpression" && BUILDER_MEMBERS.has(nameOf(callee.property) ?? ""));
|
|
82
|
-
});
|
|
83
|
-
const hasMethodOption = (calls) => {
|
|
84
|
-
const call = optionsCall(calls);
|
|
85
|
-
const options = call && call.arguments[0];
|
|
86
|
-
return !!options && options.type === "ObjectExpression" && !!propertyNamed(options, "method");
|
|
87
|
-
};
|
|
88
|
-
const isTopLevelDeclarator = (ancestors) => {
|
|
89
|
-
const [declarator, declaration, outer, program] = ancestors.slice(-4).reverse();
|
|
90
|
-
if (declarator?.type !== "VariableDeclarator" || declaration?.type !== "VariableDeclaration")
|
|
91
|
-
return false;
|
|
92
|
-
return outer?.type === "Program" || (outer?.type === "ExportNamedDeclaration" && program?.type === "Program");
|
|
93
|
-
};
|
|
94
|
-
const parseFile = (path, code) => {
|
|
95
|
-
try {
|
|
96
|
-
const ast = parse(code, {
|
|
97
|
-
sourceType: "module",
|
|
98
|
-
plugins: path.endsWith("x") ? ["typescript", "jsx"] : ["typescript"],
|
|
99
|
-
errorRecovery: true,
|
|
100
|
-
});
|
|
101
|
-
const imports = new Map();
|
|
102
|
-
for (const statement of ast.program.body) {
|
|
103
|
-
if (statement.type !== "ImportDeclaration")
|
|
104
|
-
continue;
|
|
105
|
-
const source = statement.source.value;
|
|
106
|
-
for (const specifier of statement.specifiers) {
|
|
107
|
-
const local = nameOf(specifier.local);
|
|
108
|
-
if (!local)
|
|
109
|
-
continue;
|
|
110
|
-
const imported = specifier.type === "ImportSpecifier" ? (nameOf(specifier.imported) ?? local) : "default";
|
|
111
|
-
imports.set(local, { source, imported });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return { path, program: ast.program, imports };
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const FACTORIES = ["signedInFn", "publicFn", "createServerFn"];
|
|
121
|
-
/**
|
|
122
|
-
* The names a server function can start from, app-wide: zitejs's factories,
|
|
123
|
-
* TanStack's raw one, and the app's own factories built from them
|
|
124
|
-
* (`export const managerFn = signedInFn.middleware([role("manager")])`).
|
|
125
|
-
*/
|
|
126
|
-
const factoryNames = (files) => {
|
|
127
|
-
const names = new Set(FACTORIES);
|
|
128
|
-
for (let changed = true; changed;) {
|
|
129
|
-
changed = false;
|
|
130
|
-
for (const file of files) {
|
|
131
|
-
const isFactory = (local) => names.has(file.imports.get(local)?.imported ?? local);
|
|
132
|
-
for (const statement of file.program.body) {
|
|
133
|
-
if (statement.type === "ExportNamedDeclaration" && statement.source) {
|
|
134
|
-
for (const specifier of statement.specifiers) {
|
|
135
|
-
const exported = nameOf(specifier.exported);
|
|
136
|
-
if (exported && names.has(nameOf(specifier.local) ?? "") && !names.has(exported)) {
|
|
137
|
-
names.add(exported);
|
|
138
|
-
changed = true;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
143
|
-
if (declaration?.type !== "VariableDeclaration")
|
|
144
|
-
continue;
|
|
145
|
-
for (const declarator of declaration.declarations) {
|
|
146
|
-
const name = nameOf(declarator.id);
|
|
147
|
-
const init = declarator.init;
|
|
148
|
-
if (!name || !init || names.has(name) || isHandlerCall(unwrap(init)))
|
|
149
|
-
continue;
|
|
150
|
-
const { root } = chainOf(init);
|
|
151
|
-
if (root && isFactory(root)) {
|
|
152
|
-
names.add(name);
|
|
153
|
-
changed = true;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return names;
|
|
160
|
-
};
|
|
161
|
-
const callsCreateWorkflow = (program) => {
|
|
162
|
-
let found = false;
|
|
163
|
-
walk(program, (node) => {
|
|
164
|
-
if (node.type === "CallExpression" && nameOf(node.callee) === "createWorkflow")
|
|
165
|
-
found = true;
|
|
166
|
-
});
|
|
167
|
-
return found;
|
|
168
|
-
};
|
|
169
|
-
const isServerReachable = (path, callsWorkflow) => /\.(functions|server)\.tsx?$/.test(path) || path.startsWith("src/routes/api/") || path === "src/start.ts" || callsWorkflow;
|
|
170
|
-
/** The names an import brings in as values; types are erased, so they never reach the runtime. */
|
|
171
|
-
const valueImports = (statement) => {
|
|
172
|
-
if (statement.importKind === "type")
|
|
173
|
-
return [];
|
|
174
|
-
const specifiers = statement.specifiers.filter((s) => s.importKind !== "type");
|
|
175
|
-
if (statement.specifiers.length === 0)
|
|
176
|
-
return "all";
|
|
177
|
-
if (specifiers.some((s) => s.type !== "ImportSpecifier"))
|
|
178
|
-
return "all";
|
|
179
|
-
return specifiers.map((s) => nameOf(s.imported) ?? "");
|
|
180
|
-
};
|
|
181
|
-
const MUTATING_METHODS = new Set(["set", "add", "push", "unshift", "splice", "delete", "clear"]);
|
|
182
|
-
const isContainer = (init) => !!init &&
|
|
183
|
-
((init.type === "NewExpression" && ["Map", "Set"].includes(nameOf(init.callee) ?? "")) ||
|
|
184
|
-
init.type === "ArrayExpression" ||
|
|
185
|
-
init.type === "ObjectExpression");
|
|
186
|
-
const callsAny = (node, matches) => {
|
|
187
|
-
let found = false;
|
|
188
|
-
walk(node, (n) => {
|
|
189
|
-
if (n.type === "CallExpression" && isNode(n.callee) && matches(n.callee))
|
|
190
|
-
found = true;
|
|
191
|
-
});
|
|
192
|
-
return found;
|
|
193
|
-
};
|
|
194
|
-
const ROOT_LAYOUTS = new Set(["src/routes/__root.tsx", "src/routes/_app.tsx", "src/routes/_app/route.tsx"]);
|
|
195
|
-
// The Start runtime reads a ZiteError thrown from any copy of zitejs, classic's included.
|
|
196
|
-
const CLASSIC_ALLOWED = { "zitejs/backend": new Set(["ZiteError"]) };
|
|
197
|
-
const CLASSIC_IMPORTS = {
|
|
198
|
-
"zitejs/backend": "server code is a signedInFn/publicFn server function from zitejs/start",
|
|
199
|
-
"zitejs/api": "pages call server functions directly, from a loader or an event handler",
|
|
200
|
-
"react-router-dom": "routing is file routes, with Link and useNavigate from @tanstack/react-router",
|
|
201
|
-
"react-router": "routing is file routes, with Link and useNavigate from @tanstack/react-router",
|
|
202
|
-
};
|
|
203
|
-
const importsModule = (source, module) => source === module || source.startsWith(`${module}/`);
|
|
204
|
-
const containsTypeofWindow = (node) => {
|
|
205
|
-
let found = false;
|
|
206
|
-
walk(node, (n) => {
|
|
207
|
-
if (n.type === "UnaryExpression" && n.operator === "typeof" && nameOf(n.argument) === "window")
|
|
208
|
-
found = true;
|
|
209
|
-
});
|
|
210
|
-
return found;
|
|
211
|
-
};
|
|
212
|
-
const GUARD_TYPES = new Set(["IfStatement", "ConditionalExpression", "LogicalExpression"]);
|
|
213
|
-
const guardedByTypeofWindow = (ancestors) => ancestors.some((a) => GUARD_TYPES.has(a.type) && containsTypeofWindow((a.test ?? a.left)));
|
|
214
|
-
const isRelativePath = (node) => (node?.type === "StringLiteral" && node.value.startsWith("/")) ||
|
|
215
|
-
(node?.type === "TemplateLiteral" && (node.quasis[0]?.value?.cooked ?? "").startsWith("/"));
|
|
216
|
-
/** Every source hint for one Start app, given its files by app-relative path. */
|
|
217
|
-
export function sourceProblems(sources) {
|
|
218
|
-
const files = Object.entries(sources)
|
|
219
|
-
.filter(([path]) => /\.[cm]?[jt]sx?$/.test(path) && !path.endsWith("routeTree.gen.ts") && !path.endsWith(".d.ts"))
|
|
220
|
-
.flatMap(([path, code]) => parseFile(path, code) ?? []);
|
|
221
|
-
const factories = factoryNames(files);
|
|
222
|
-
const problems = [];
|
|
223
|
-
const report = (rule, severity, file, node, message) => problems.push({ rule, severity, file, ...(node && lineOf(node) && { line: lineOf(node) }), message });
|
|
224
|
-
const serverFnFiles = new Map();
|
|
225
|
-
if (!sources["src/router.tsx"]?.includes("createZiteRouter(")) {
|
|
226
|
-
problems.push({
|
|
227
|
-
rule: "router-file",
|
|
228
|
-
severity: "error",
|
|
229
|
-
file: "src/router.tsx",
|
|
230
|
-
message: "export getRouter from src/router.tsx, built with createZiteRouter from zitejs/start, which gives pages the signed-in user",
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
for (const file of files) {
|
|
234
|
-
const { path, program } = file;
|
|
235
|
-
const factoryRoot = (root) => !!root && factories.has(file.imports.get(root)?.imported ?? root);
|
|
236
|
-
const callsWorkflow = callsCreateWorkflow(program);
|
|
237
|
-
const serverReachable = isServerReachable(path, callsWorkflow);
|
|
238
|
-
const localServerFns = new Set();
|
|
239
|
-
const moduleContainers = new Map();
|
|
240
|
-
for (const statement of program.body) {
|
|
241
|
-
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
242
|
-
if (declaration?.type !== "VariableDeclaration")
|
|
243
|
-
continue;
|
|
244
|
-
for (const declarator of declaration.declarations) {
|
|
245
|
-
const name = nameOf(declarator.id);
|
|
246
|
-
const init = declarator.init ? unwrap(declarator.init) : undefined;
|
|
247
|
-
if (!name || !init)
|
|
248
|
-
continue;
|
|
249
|
-
if (isHandlerCall(init) && factoryRoot(chainOf(init).root))
|
|
250
|
-
localServerFns.add(name);
|
|
251
|
-
if (serverReachable && declaration.kind === "const" && isContainer(init))
|
|
252
|
-
moduleContainers.set(name, false);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
for (const directive of program.directives ?? []) {
|
|
256
|
-
if (directive.value.value === "use server") {
|
|
257
|
-
report("use-server", "error", path, directive, "'use server' is Next.js; server code is a signedInFn/publicFn server function");
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
for (const statement of program.body) {
|
|
261
|
-
if (statement.type === "ImportDeclaration") {
|
|
262
|
-
const source = statement.source.value;
|
|
263
|
-
const values = valueImports(statement);
|
|
264
|
-
for (const [module, instead] of Object.entries(CLASSIC_IMPORTS)) {
|
|
265
|
-
const allowed = source === module ? CLASSIC_ALLOWED[module] : undefined;
|
|
266
|
-
const refused = values === "all" ? true : values.some((name) => !allowed?.has(name));
|
|
267
|
-
if (importsModule(source, module) && refused) {
|
|
268
|
-
report("classic-construct", "error", path, statement, `${module} is classic's; in a Start app, ${instead}`);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (source === "cloudflare:workers") {
|
|
272
|
-
report("cloudflare-env", "error", path, statement, "read the app's environment from process.env, not cloudflare:workers");
|
|
273
|
-
}
|
|
274
|
-
const typeOnly = values !== "all" && values.length === 0;
|
|
275
|
-
if (callsWorkflow && !typeOnly && (/\.functions(\.[jt]sx?)?$/.test(source) || importsModule(source, "@tanstack/react-start/server"))) {
|
|
276
|
-
report("workflow-imports", "error", path, statement, `a workflow runs without a page request, so it can't use ${source}; move what it needs into a *.server.ts helper`);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
const exported = statement.type === "ExportNamedDeclaration" ? statement.declaration : undefined;
|
|
280
|
-
const exportedNames = exported?.type === "FunctionDeclaration"
|
|
281
|
-
? [nameOf(exported.id)]
|
|
282
|
-
: exported?.type === "VariableDeclaration"
|
|
283
|
-
? exported.declarations.map((d) => nameOf(d.id))
|
|
284
|
-
: [];
|
|
285
|
-
if (exportedNames.includes("getServerSideProps")) {
|
|
286
|
-
report("next-construct", "error", path, statement, "getServerSideProps is Next.js; a route's loader fetches its data");
|
|
287
|
-
}
|
|
288
|
-
if (serverReachable && statement.type === "VariableDeclaration" && statement.kind === "let") {
|
|
289
|
-
report("module-state", "warning", path, statement, "a module-level let in server code is shared by every request and every user; keep per-request state inside the handler");
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
walk(program, (node, ancestors) => {
|
|
293
|
-
const parent = ancestors.at(-1);
|
|
294
|
-
if (node.type === "CallExpression" && isHandlerCall(node)) {
|
|
295
|
-
const { root, calls } = chainOf(node);
|
|
296
|
-
if (factoryRoot(root)) {
|
|
297
|
-
const declarator = parent?.type === "VariableDeclarator" ? parent : undefined;
|
|
298
|
-
const name = nameOf(declarator?.id);
|
|
299
|
-
if (!declarator || !isTopLevelDeclarator(ancestors)) {
|
|
300
|
-
report("server-fn-not-top-level", "error", path, node, "assign each server function to its own top-level const: one in an object, a function or a helper's return value isn't compiled");
|
|
301
|
-
}
|
|
302
|
-
else if (name) {
|
|
303
|
-
serverFnFiles.set(name, [...(serverFnFiles.get(name) ?? []), path]);
|
|
304
|
-
}
|
|
305
|
-
if (!hasMethodOption(calls)) {
|
|
306
|
-
report("method-missing", "error", path, node, `call ${root} with { method: 'GET' | 'POST', description } before .handler()`);
|
|
307
|
-
}
|
|
308
|
-
if (file.imports.get(root)?.imported === "publicFn" || root === "publicFn") {
|
|
309
|
-
const handler = node.arguments[0];
|
|
310
|
-
if (handler && FUNCTION_TYPES.has(handler.type)) {
|
|
311
|
-
walk(handler, (inner, innerAncestors) => {
|
|
312
|
-
const returned = inner.type === "ReturnStatement"
|
|
313
|
-
? inner.argument
|
|
314
|
-
: inner === handler && handler.type === "ArrowFunctionExpression" && handler.body.type !== "BlockStatement"
|
|
315
|
-
? handler.body
|
|
316
|
-
: undefined;
|
|
317
|
-
if (!returned || innerAncestors.slice(1).some((a) => FUNCTION_TYPES.has(a.type)))
|
|
318
|
-
return;
|
|
319
|
-
const call = unwrap(returned.type === "AwaitExpression" ? returned.argument : returned);
|
|
320
|
-
if (call.type !== "CallExpression")
|
|
321
|
-
return;
|
|
322
|
-
const chain = chainOf(call);
|
|
323
|
-
const method = chain.members[0];
|
|
324
|
-
if (chain.root !== "zite" || (method !== "findAll" && method !== "findOne"))
|
|
325
|
-
return;
|
|
326
|
-
const options = call.arguments[0];
|
|
327
|
-
if (options?.type === "ObjectExpression" && propertyNamed(options, "fields"))
|
|
328
|
-
return;
|
|
329
|
-
report("public-rows", "warning", path, inner, `anyone can call ${declarator ? nameOf(declarator.id) : "this function"}, and it returns whole records; pass fields to return only what the page shows`);
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
if (moduleContainers.size > 0 && !atModuleScope(ancestors)) {
|
|
336
|
-
const target = node.type === "CallExpression" && isNode(node.callee) && node.callee.type === "MemberExpression" &&
|
|
337
|
-
MUTATING_METHODS.has(nameOf(node.callee.property) ?? "")
|
|
338
|
-
? nameOf(node.callee.object)
|
|
339
|
-
: node.type === "AssignmentExpression" && isNode(node.left) && node.left.type === "MemberExpression"
|
|
340
|
-
? nameOf(node.left.object)
|
|
341
|
-
: undefined;
|
|
342
|
-
if (target && moduleContainers.get(target) === false) {
|
|
343
|
-
moduleContainers.set(target, true);
|
|
344
|
-
report("module-state", "warning", path, node, `${target} is module-level, so what a handler writes to it is shared by every request and every user; use the database or keep it inside the handler`);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (node.type === "MemberExpression" && nameOf(node.property) === "inputValidator" && !node.computed) {
|
|
348
|
-
report("input-validator", "warning", path, node, "inputValidator is deprecated, renamed validator; call .validator(…)");
|
|
349
|
-
}
|
|
350
|
-
if (node.type === "CallExpression" && nameOf(node.callee) === "createEndpoint") {
|
|
351
|
-
report("classic-construct", "error", path, node, "createEndpoint is classic's; in a Start app, server code is a signedInFn/publicFn server function");
|
|
352
|
-
}
|
|
353
|
-
if (node.type === "CallExpression" && nameOf(node.callee) === "redirect") {
|
|
354
|
-
const options = node.arguments[0];
|
|
355
|
-
const href = options?.type === "ObjectExpression" ? propertyNamed(options, "href") : undefined;
|
|
356
|
-
const value = href && href.value;
|
|
357
|
-
const toLogin = !!value && (nameOf(value) === "loginHref" || callsAny(value, (callee) => nameOf(callee) === "loginHref"));
|
|
358
|
-
const reload = options && propertyNamed(options, "reloadDocument");
|
|
359
|
-
const reloads = !!reload && isNode(reload.value) && reload.value.type === "BooleanLiteral" && reload.value.value === true;
|
|
360
|
-
if (toLogin && !reloads) {
|
|
361
|
-
report("login-reload", "error", path, node, "the sign-in page isn't one of the app's routes; redirect to it with reloadDocument: true");
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (node.type === "NewExpression" &&
|
|
365
|
-
nameOf(node.callee) === "QueryClient" &&
|
|
366
|
-
atModuleScope(ancestors)) {
|
|
367
|
-
report("module-query-client", "error", path, node, "a module-level QueryClient caches one visitor's data for the next; createZiteRouter makes one per request as context.queryClient");
|
|
368
|
-
}
|
|
369
|
-
if (atModuleScope(ancestors)) {
|
|
370
|
-
const envRead = node.type === "MemberExpression" &&
|
|
371
|
-
isNode(node.object) &&
|
|
372
|
-
node.object.type === "MemberExpression" &&
|
|
373
|
-
nameOf(node.object.object) === "process" &&
|
|
374
|
-
nameOf(node.object.property) === "env" &&
|
|
375
|
-
nameOf(node.property) !== "NODE_ENV";
|
|
376
|
-
if (envRead) {
|
|
377
|
-
report("module-env", "error", path, node, "process.env is the request's, so read it inside a handler or loader, not when the module loads");
|
|
378
|
-
}
|
|
379
|
-
if (node.type === "CallExpression" && isNode(node.callee) && node.callee.type === "MemberExpression" &&
|
|
380
|
-
nameOf(node.callee.object) === "Date" && nameOf(node.callee.property) === "now") {
|
|
381
|
-
report("module-env", "error", path, node, "Date.now() when the module loads is the server's start time; call it where the value is used");
|
|
382
|
-
}
|
|
383
|
-
const isWindowReference = node.type === "Identifier" &&
|
|
384
|
-
node.name === "window" &&
|
|
385
|
-
!(parent?.type === "UnaryExpression" && parent.operator === "typeof") &&
|
|
386
|
-
!(parent?.type === "MemberExpression" && parent.property === node && !parent.computed) &&
|
|
387
|
-
!(parent?.type === "ObjectProperty" && parent.key === node) &&
|
|
388
|
-
!parent?.type.startsWith("TS") &&
|
|
389
|
-
!guardedByTypeofWindow(ancestors);
|
|
390
|
-
if (isWindowReference) {
|
|
391
|
-
// Guards come in too many shapes to tell for sure, so only a warning.
|
|
392
|
-
report("module-env", "warning", path, node, "window doesn't exist while the server renders; use it in an effect or event handler");
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (node.type === "AwaitExpression" &&
|
|
396
|
-
isNode(node.argument) &&
|
|
397
|
-
chainOf(node.argument).root === "zite") {
|
|
398
|
-
const fn = [...ancestors].reverse().findIndex((a) => FUNCTION_TYPES.has(a.type));
|
|
399
|
-
const inner = fn === -1 ? ancestors : ancestors.slice(ancestors.length - fn);
|
|
400
|
-
if (inner.some((a) => LOOP_TYPES.has(a.type))) {
|
|
401
|
-
report("await-in-loop", "warning", path, node, "each await zite.* in a loop is a round trip; batch it with one findAll, bulkCreate or bulkUpdate");
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if ((node.type === "ObjectProperty" || node.type === "ObjectMethod") &&
|
|
405
|
-
(nameOf(node.key) === "loader" || nameOf(node.key) === "beforeLoad")) {
|
|
406
|
-
const body = (node.type === "ObjectMethod" ? node : node.value);
|
|
407
|
-
const isLayout = ROOT_LAYOUTS.has(path) && nameOf(node.key) === "beforeLoad";
|
|
408
|
-
const ssr = parent?.type === "ObjectExpression" ? propertyNamed(parent, "ssr")?.value : undefined;
|
|
409
|
-
const browserOnly = isNode(ssr) && ssr.type === "BooleanLiteral" && ssr.value === false;
|
|
410
|
-
walk(body, (inner) => {
|
|
411
|
-
if (inner.type !== "CallExpression")
|
|
412
|
-
return;
|
|
413
|
-
const callee = nameOf(inner.callee);
|
|
414
|
-
if (!browserOnly && callee === "fetch" && isRelativePath(inner.arguments[0])) {
|
|
415
|
-
report("relative-fetch", "error", path, inner, "a loader also runs on the server, where a relative URL has no host; call a server function instead");
|
|
416
|
-
}
|
|
417
|
-
const source = callee ? file.imports.get(callee)?.source : undefined;
|
|
418
|
-
const serverFn = !!callee && (localServerFns.has(callee) || (!!source && /\.functions(\.[jt]sx?)?$/.test(source)));
|
|
419
|
-
if (isLayout && serverFn) {
|
|
420
|
-
report("layout-server-fn", "warning", path, inner, `${callee} would run on every navigation from the root layout; the signed-in user is already context.user`);
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
for (const [name, paths] of serverFnFiles) {
|
|
427
|
-
const distinct = [...new Set(paths)];
|
|
428
|
-
if (distinct.length > 1) {
|
|
429
|
-
problems.push({
|
|
430
|
-
rule: "duplicate-server-fn",
|
|
431
|
-
severity: "error",
|
|
432
|
-
file: distinct[1],
|
|
433
|
-
message: `${name} is also a server function in ${distinct[0]}; a server function's name is its id, so each is unique in the app`,
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
return problems;
|
|
438
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type AirtableSettings } from "./dispatch.js";
|
|
2
|
-
import type { PlatformSession, ZiteRequestContext } from "../types.js";
|
|
3
|
-
/** The build's Airtable integration `integrationId`, or undefined when it isn't one, or the host can't say. */
|
|
4
|
-
export declare const airtableSettingsOf: (session: PlatformSession, integrationId: string) => Promise<AirtableSettings | undefined>;
|
|
5
|
-
/**
|
|
6
|
-
* One generated Airtable table call, run here with the connection's placeholder
|
|
7
|
-
* token; egress swaps the real one in for Airtable alone, and refreshes it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function runAirtableCall(host: ZiteRequestContext, session: PlatformSession, integrationId: string, settings: AirtableSettings, methodName: string, params: unknown, access: "signedIn" | "anyone" | "webhook" | "workflow"): Promise<unknown>;
|
|
10
|
-
/** For tests: forget what this isolate learned. */
|
|
11
|
-
export declare const resetAirtableSettings: () => void;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { executeAirtableCall } from "./dispatch.js";
|
|
2
|
-
import { ZiteError, isZiteErrorCode } from "../errors.js";
|
|
3
|
-
const AIRTABLE_API = "https://api.airtable.com";
|
|
4
|
-
// The platform id `integrations.get` is answered under (`INTEGRATIONS_SDK_INTEGRATION_ID`).
|
|
5
|
-
const CONNECTIONS = "__connections__";
|
|
6
|
-
// A build's integrations don't change, so per isolate: only answers, never a pending call.
|
|
7
|
-
const settingsHeld = new Map();
|
|
8
|
-
let unsupported = false;
|
|
9
|
-
const NOT_IMPLEMENTED = /does not implement (?:the )?method/i;
|
|
10
|
-
/** The build's Airtable integration `integrationId`, or undefined when it isn't one, or the host can't say. */
|
|
11
|
-
export const airtableSettingsOf = async (session, integrationId) => {
|
|
12
|
-
if (unsupported || !session.integrationSettings)
|
|
13
|
-
return undefined;
|
|
14
|
-
if (settingsHeld.has(integrationId))
|
|
15
|
-
return settingsHeld.get(integrationId) ?? undefined;
|
|
16
|
-
try {
|
|
17
|
-
const answer = await session.integrationSettings(integrationId);
|
|
18
|
-
const settings = answer?.serviceType === "airtable" && typeof answer.baseId === "string"
|
|
19
|
-
? { baseId: answer.baseId, nameMappings: answer.nameMappings ?? null }
|
|
20
|
-
: null;
|
|
21
|
-
settingsHeld.set(integrationId, settings);
|
|
22
|
-
return settings ?? undefined;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
if (error instanceof Error && NOT_IMPLEMENTED.test(error.message)) {
|
|
26
|
-
unsupported = true;
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
throw error;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* One generated Airtable table call, run here with the connection's placeholder
|
|
34
|
-
* token; egress swaps the real one in for Airtable alone, and refreshes it.
|
|
35
|
-
*/
|
|
36
|
-
export async function runAirtableCall(host, session, integrationId, settings, methodName, params, access) {
|
|
37
|
-
// As classic: a demo reaches no connected account.
|
|
38
|
-
if (host.mode === "demo")
|
|
39
|
-
throw new ZiteError("FORBIDDEN", "This action is not available in demo mode");
|
|
40
|
-
const connection = await session.call({
|
|
41
|
-
integrationId: CONNECTIONS,
|
|
42
|
-
className: "Connections",
|
|
43
|
-
methodName: "get",
|
|
44
|
-
params: { name: integrationId },
|
|
45
|
-
access,
|
|
46
|
-
});
|
|
47
|
-
if ("error" in connection) {
|
|
48
|
-
const { code, message, userFacingMessage } = connection.error;
|
|
49
|
-
throw new ZiteError({ code: isZiteErrorCode(code) ? code : "INTERNAL_ERROR", message, userFacingMessage });
|
|
50
|
-
}
|
|
51
|
-
const token = connection.value?.accessToken;
|
|
52
|
-
if (typeof token !== "string") {
|
|
53
|
-
throw new ZiteError("INTERNAL_ERROR", `The ${integrationId} connection has no token`);
|
|
54
|
-
}
|
|
55
|
-
host.airtableReads ??= new Map();
|
|
56
|
-
return executeAirtableCall({
|
|
57
|
-
settings,
|
|
58
|
-
reads: host.airtableReads,
|
|
59
|
-
fetch: (path, init) => fetch(`${AIRTABLE_API}${path}`, {
|
|
60
|
-
method: init.method,
|
|
61
|
-
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
62
|
-
body: init.body === undefined ? undefined : JSON.stringify(init.body),
|
|
63
|
-
}),
|
|
64
|
-
}, methodName, params);
|
|
65
|
-
}
|
|
66
|
-
/** For tests: forget what this isolate learned. */
|
|
67
|
-
export const resetAirtableSettings = () => {
|
|
68
|
-
settingsHeld.clear();
|
|
69
|
-
unsupported = false;
|
|
70
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { authHooksModule } from "./authHooksModule.js";
|
|
2
|
-
export const AUTH_HOOK_NAMES = ["beforeSignUp", "beforeSignIn", "afterSignUp", "afterSignIn", "verifySession"];
|
|
3
|
-
export const isAuthHookName = (name) => AUTH_HOOK_NAMES.includes(name);
|
|
4
|
-
/** The hooks the app's `zite.auth.ts` defines, by name. */
|
|
5
|
-
export async function loadAuthHooks() {
|
|
6
|
-
if (!authHooksModule)
|
|
7
|
-
return {};
|
|
8
|
-
const hooks = (await authHooksModule()).default?.hooks ?? {};
|
|
9
|
-
return Object.fromEntries(AUTH_HOOK_NAMES.flatMap((name) => (typeof hooks[name] === "function" ? [[name, hooks[name]]] : [])));
|
|
10
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Ported from restly's packages/workflow-edge/src/databases (client, records, sql, authUsers, bases):
|
|
2
|
-
// the requests are the same bytes classic's DatabasesSdk sends; the host adds the key and the acting user.
|
|
3
|
-
import { DatabasesApiError, } from "./types.js";
|
|
4
|
-
/** An id as one path segment: an unencoded `/` or a `..` would move the request to another base's URL. */
|
|
5
|
-
export const segment = (id) => {
|
|
6
|
-
const value = String(id);
|
|
7
|
-
const invalid = new DatabasesApiError(`Invalid id: "${value}"`, 400, "Bad Request");
|
|
8
|
-
if (value === "" || value === "." || value === "..")
|
|
9
|
-
throw invalid;
|
|
10
|
-
try {
|
|
11
|
-
return encodeURIComponent(value);
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
// A lone surrogate, which a visitor can send as JSON.
|
|
15
|
-
throw invalid;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
/** Every path, however it was built: none may climb out of where it starts. */
|
|
19
|
-
const apiPath = (path) => {
|
|
20
|
-
const full = `/api/v1${path}`;
|
|
21
|
-
const pathname = full.split("?")[0];
|
|
22
|
-
if (!new URL(full, "https://base-runner.invalid").pathname.endsWith(pathname)) {
|
|
23
|
-
throw new DatabasesApiError(`Invalid path: ${pathname}`, 400, "Bad Request");
|
|
24
|
-
}
|
|
25
|
-
return full;
|
|
26
|
-
};
|
|
27
|
-
export const createBaseRunner = (transport) => {
|
|
28
|
-
const send = async (method, path, body) => {
|
|
29
|
-
const response = await transport({ method, path: apiPath(path), body: body ? JSON.stringify(body) : undefined });
|
|
30
|
-
if (!response.ok) {
|
|
31
|
-
let errorMessage = response.statusText;
|
|
32
|
-
try {
|
|
33
|
-
const errorBody = (await response.json());
|
|
34
|
-
errorMessage = errorBody?.error?.message || errorBody?.message || errorMessage;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// If we can't parse the error body, fall back to statusText
|
|
38
|
-
}
|
|
39
|
-
throw new DatabasesApiError(errorMessage, response.status, response.statusText);
|
|
40
|
-
}
|
|
41
|
-
return response;
|
|
42
|
-
};
|
|
43
|
-
const json = async (method, path, body) => (await send(method, path, body)).json();
|
|
44
|
-
return {
|
|
45
|
-
bases: {
|
|
46
|
-
get: ({ baseId }) => json("GET", `/bases/${segment(baseId)}`),
|
|
47
|
-
},
|
|
48
|
-
records: {
|
|
49
|
-
get: ({ baseId, tableId, recordId, fields }) => json("GET", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records/${segment(recordId)}${fields?.length ? `?fields=${encodeURIComponent(fields.join(","))}` : ""}`),
|
|
50
|
-
findAll: ({ baseId, tableId, filters, offset, sort, limit = 500, fields, }) => json("POST", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records/list`, {
|
|
51
|
-
filters,
|
|
52
|
-
offset,
|
|
53
|
-
sort,
|
|
54
|
-
limit,
|
|
55
|
-
fields,
|
|
56
|
-
}),
|
|
57
|
-
create: ({ baseId, tableId, record }) => json("POST", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records`, { record }),
|
|
58
|
-
update: ({ baseId, tableId, recordId, record, }) => json("PATCH", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records/${segment(recordId)}`, { record }),
|
|
59
|
-
delete: async ({ baseId, tableId, recordId }) => {
|
|
60
|
-
await send("DELETE", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records/${segment(recordId)}`);
|
|
61
|
-
return { id: recordId };
|
|
62
|
-
},
|
|
63
|
-
bulkCreate: ({ baseId, tableId, records, matchOn, }) => json("POST", `/bases/${segment(baseId)}/tables/${segment(tableId)}/records/bulk`, {
|
|
64
|
-
records,
|
|
65
|
-
matchOn,
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
sql: {
|
|
69
|
-
execute: ({ baseId, sql, params, statementTimeoutMs, nameMappings, }) => json("POST", `/bases/${segment(baseId)}/sql`, { sql, params, statementTimeoutMs, nameMappings }),
|
|
70
|
-
},
|
|
71
|
-
auth: {
|
|
72
|
-
findAll: ({ baseId, appIds, filters, filter, offset, sort, limit = 500, }) => json("POST", `/bases/${segment(baseId)}/auth/users/list`, {
|
|
73
|
-
appIds,
|
|
74
|
-
filters,
|
|
75
|
-
filter,
|
|
76
|
-
offset,
|
|
77
|
-
sort,
|
|
78
|
-
limit,
|
|
79
|
-
}),
|
|
80
|
-
update: ({ baseId, userId, profile, }) => json("PATCH", `/bases/${segment(baseId)}/auth/users/${segment(userId)}`, profile),
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DataNameMappings } from "./types.js";
|
|
2
|
-
import type { HostMode, PlatformSession } from "../types.js";
|
|
3
|
-
/** What generated `zite.*` calls go out under. */
|
|
4
|
-
export declare const DATA_INTEGRATION_ID = "databases";
|
|
5
|
-
type Found = {
|
|
6
|
-
baseId: string | null;
|
|
7
|
-
nameMappings: DataNameMappings | null;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* The build's data context, or undefined from a host that predates the app's own
|
|
11
|
-
* dispatch, whose `databases` platform call still answers.
|
|
12
|
-
*/
|
|
13
|
-
export declare const dataContextOf: (session: PlatformSession) => Promise<Found | undefined>;
|
|
14
|
-
/** One `zite.*` call, translated here and sent to base-runner through the platform. */
|
|
15
|
-
export declare function runDataCall(session: PlatformSession, found: Found, mode: HostMode, methodName: string, sent: unknown): Promise<unknown>;
|
|
16
|
-
/** For tests: forget what this isolate learned. */
|
|
17
|
-
export declare const resetDataDispatch: () => void;
|
|
18
|
-
export {};
|