zitejs 0.9.153 → 0.9.155
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 +93 -0
- package/dist/cjs/auth/client.d.ts +357 -0
- package/dist/cjs/auth/client.js +66 -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/backend/index.d.ts +6 -6
- package/dist/cjs/backend/index.js +13 -13
- package/dist/cjs/backend/index.test.js +102 -102
- package/dist/cjs/bundle/index.js +29 -16
- package/dist/cjs/caller/index.js +43 -43
- package/dist/cjs/check/index.d.ts +44 -1
- package/dist/cjs/check/index.js +198 -61
- 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 +19 -6
- package/dist/cjs/client/index.d.ts +2 -2
- package/dist/cjs/client/index.js +25 -25
- package/dist/cjs/dev/index.js +81 -53
- 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.js +42 -42
- package/dist/cjs/integrations/rules.test.js +60 -55
- package/dist/cjs/internal/appMode.d.ts +14 -0
- package/dist/cjs/internal/appMode.js +19 -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/runtime/filterConditionTypes.test-d.js +11 -11
- package/dist/cjs/runtime/index.d.ts +22 -22
- package/dist/cjs/runtime/index.js +28 -28
- package/dist/cjs/runtime/index.test.js +34 -34
- package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +29 -29
- 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/build/entries.d.ts +25 -0
- package/dist/cjs/start/build/entries.js +121 -0
- 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/describe/describeBuilt.d.ts +5 -0
- package/dist/cjs/start/describe/describeBuilt.js +144 -0
- 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 +8 -8
- package/dist/cjs/steps/index.js +53 -53
- package/dist/cjs/steps/index.test.js +218 -218
- 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 +651 -665
- package/dist/cjs/sync/lib.test.js +81 -14
- 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 +1 -1
- package/dist/cjs/types/fields.js +105 -97
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/types/tables.d.ts +1 -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 +51 -42
- package/dist/cjs/vite/index.test.js +10 -2
- package/dist/esm/auth/actions.d.ts +28 -0
- package/dist/esm/auth/actions.js +55 -0
- package/dist/esm/auth/client.d.ts +357 -0
- package/dist/esm/auth/client.js +62 -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/backend/index.d.ts +6 -6
- package/dist/esm/backend/index.js +13 -13
- package/dist/esm/backend/index.test.js +106 -106
- package/dist/esm/bundle/index.js +29 -16
- package/dist/esm/caller/index.js +44 -44
- package/dist/esm/check/index.d.ts +44 -1
- package/dist/esm/check/index.js +194 -61
- 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 +19 -6
- package/dist/esm/client/index.d.ts +2 -2
- package/dist/esm/client/index.js +25 -25
- package/dist/esm/dev/index.js +88 -60
- 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.js +42 -42
- package/dist/esm/integrations/rules.test.js +62 -57
- package/dist/esm/internal/appMode.d.ts +14 -0
- package/dist/esm/internal/appMode.js +13 -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/runtime/filterConditionTypes.test-d.js +12 -12
- package/dist/esm/runtime/index.d.ts +22 -22
- package/dist/esm/runtime/index.js +31 -31
- package/dist/esm/runtime/index.test.js +36 -36
- package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +30 -30
- 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/automations/registration.d.ts +13 -0
- package/dist/esm/start/automations/registration.js +25 -0
- 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/build/entries.d.ts +25 -0
- package/dist/esm/start/build/entries.js +109 -0
- package/dist/esm/start/build/placeholders/authHooksModule.d.ts +1 -0
- package/dist/esm/start/build/placeholders/authHooksModule.js +3 -0
- 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/build/placeholders/workflowModules.d.ts +1 -0
- package/dist/esm/start/build/placeholders/workflowModules.js +3 -0
- 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 +487 -0
- package/dist/esm/start/classicOnly.d.ts +1 -0
- package/dist/esm/start/classicOnly.js +4 -0
- package/dist/esm/start/clientErrorMessage.test.d.ts +1 -0
- package/dist/esm/start/clientErrorMessage.test.js +105 -0
- package/dist/esm/start/describe/describe.d.ts +120 -0
- package/dist/esm/start/describe/describe.js +372 -0
- package/dist/esm/start/describe/describeBuilt.d.ts +5 -0
- package/dist/esm/start/describe/describeBuilt.js +102 -0
- package/dist/esm/start/describe/descriptions.d.ts +4 -0
- package/dist/esm/start/describe/descriptions.js +54 -0
- package/dist/esm/start/errors.d.ts +62 -0
- package/dist/esm/start/errors.js +163 -0
- package/dist/esm/start/errors.test.d.ts +1 -0
- package/dist/esm/start/errors.test.js +54 -0
- 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 -0
- package/dist/esm/start/factories.test-d.js +60 -0
- 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 +3 -0
- package/dist/esm/start/host.js +4 -0
- package/dist/esm/start/index.d.ts +10 -0
- package/dist/esm/start/index.js +7 -0
- 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/arrayFields.d.ts +10 -0
- package/dist/esm/start/platform/airtable/arrayFields.js +30 -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/platform/airtable/dispatch.d.ts +57 -0
- package/dist/esm/start/platform/airtable/dispatch.js +541 -0
- package/dist/esm/start/platform/airtable/formulas.d.ts +70 -0
- package/dist/esm/start/platform/airtable/formulas.js +261 -0
- 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/platform/data/baseRunner.d.ts +97 -0
- package/dist/esm/start/platform/data/baseRunner.js +117 -0
- package/dist/esm/start/platform/data/dispatch.d.ts +17 -0
- package/dist/esm/start/platform/data/dispatch.js +216 -0
- 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/platform/data/sqlNameMappings.d.ts +58 -0
- package/dist/esm/start/platform/data/sqlNameMappings.js +92 -0
- package/dist/esm/start/platform/data/transformations.d.ts +97 -0
- package/dist/esm/start/platform/data/transformations.js +262 -0
- package/dist/esm/start/platform/data/types.d.ts +94 -0
- package/dist/esm/start/platform/data/types.js +14 -0
- 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/platform/redactSecrets.js +156 -0
- package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
- package/dist/esm/start/platform/redactSecrets.test.js +151 -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 +6 -0
- package/dist/esm/start/previewClaim.js +24 -0
- 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 +44 -0
- package/dist/esm/start/router.js +280 -0
- package/dist/esm/start/serve/authHooks.d.ts +7 -0
- 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/serve/instance.d.ts +12 -0
- 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 +373 -0
- package/dist/esm/start/types.js +1 -0
- package/dist/esm/start/version.d.ts +1 -0
- package/dist/esm/start/version.js +2 -0
- package/dist/esm/steps/index.d.ts +8 -8
- package/dist/esm/steps/index.js +54 -54
- package/dist/esm/steps/index.test.js +220 -220
- 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 +655 -669
- package/dist/esm/sync/lib.test.js +81 -14
- 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 +1 -1
- package/dist/esm/types/fields.js +106 -98
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/index.js +2 -2
- package/dist/esm/types/tables.d.ts +1 -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 +56 -47
- package/dist/esm/vite/index.test.js +10 -2
- package/package.json +129 -16
- package/dist/cjs/auth-server/index.d.ts +0 -369
- package/dist/cjs/auth-server/index.js +0 -119
- package/dist/cjs/meta/index.d.ts +0 -14
- package/dist/cjs/meta/index.js +0 -12
- package/dist/cjs/notifications/index.d.ts +0 -25
- package/dist/cjs/notifications/index.js +0 -12
- package/dist/esm/auth-server/index.d.ts +0 -369
- package/dist/esm/auth-server/index.js +0 -116
- package/dist/esm/meta/index.d.ts +0 -14
- package/dist/esm/meta/index.js +0 -8
- package/dist/esm/notifications/index.d.ts +0 -25
- package/dist/esm/notifications/index.js +0 -8
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { asZiteError, SIGN_IN_REQUIRED, ZITE_ERROR_STATUS } from '../errors.js';
|
|
2
|
+
import { describeApp } from '../describe/describe.js';
|
|
3
|
+
import { asDemoRefusal, failedOnDemo, noteDemoRefusal } from './demo.js';
|
|
4
|
+
import { watchOutboundFetches } from '../platform/outbound.js';
|
|
5
|
+
import { callPlatform } from '../platform/calls.js';
|
|
6
|
+
import { takeAnalytics } from '../platform/analytics.js';
|
|
7
|
+
import { takeUploadSession } from './uploads.js';
|
|
8
|
+
import { UPLOAD_SESSION_PATH } from '../../internal/serviceUrls.js';
|
|
9
|
+
import { sendRunReport } from '../platform/telemetry.js';
|
|
10
|
+
import { ANALYTICS_PATH, MANIFEST_PATH, manifestAnswer, opensPage, platformHeadOf, } from './pageHead.js';
|
|
11
|
+
import { builtSiteHead } from '../build/placeholders/siteHead.js';
|
|
12
|
+
import { ziteProvider } from './provider.js';
|
|
13
|
+
import { localPlatform } from './local/provider.js';
|
|
14
|
+
import { signInLocally, userOfIdentity, withSetCookies, } from './local/signIn.js';
|
|
15
|
+
import { hostContextFromLocal, loadLocal } from './local/load.js';
|
|
16
|
+
import { createInvoker, headerInvoke } from './invoke.js';
|
|
17
|
+
import { getHost, requireRequest, runWithHost } from './scope.js';
|
|
18
|
+
import { installRequestEnv } from './requestEnv.js';
|
|
19
|
+
import { RUNTIME_VERSION_HEADER } from '../protocol.js';
|
|
20
|
+
import { ZITEJS_VERSION } from '../version.js';
|
|
21
|
+
import { loadUnfinishedWorkflows, loadWorkflows, } from '../automations/workflowRun.js';
|
|
22
|
+
export { runWithHost } from './scope.js';
|
|
23
|
+
export { describeApp } from '../describe/describe.js';
|
|
24
|
+
/**
|
|
25
|
+
* Routes every zitejs data, integration and email call to this request's
|
|
26
|
+
* platform on its app token, and only inside an access scope. The access kind
|
|
27
|
+
* travels with the call so the platform can record what a page read and
|
|
28
|
+
* narrow anonymous reads. A request with no token or URLs fails each call
|
|
29
|
+
* that would leave the app loudly: there is nowhere else for it to go. What
|
|
30
|
+
* props already answer, integrations.get and ZiteMeta.getWorkspace, needs none.
|
|
31
|
+
*/
|
|
32
|
+
export function installPlatformTransport() {
|
|
33
|
+
const platformCall = async (integrationId, className, methodName, params) => {
|
|
34
|
+
const { host, scope } = requireRequest(`${className}.${methodName}`);
|
|
35
|
+
return callPlatform(host, {
|
|
36
|
+
integrationId,
|
|
37
|
+
className,
|
|
38
|
+
methodName,
|
|
39
|
+
params,
|
|
40
|
+
access: scope.kind,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const sdkCall = async (...call) => {
|
|
44
|
+
try {
|
|
45
|
+
return await platformCall(...call);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
noteDemoRefusal(getHost(), error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
globalThis.__wrapSdkCall = sdkCall;
|
|
53
|
+
watchOutboundFetches();
|
|
54
|
+
}
|
|
55
|
+
/** What the host dispatched this request with. Headers are ignored: props are the only thing it alone can set. */
|
|
56
|
+
export function hostContextFromProps(request, props) {
|
|
57
|
+
const host = {
|
|
58
|
+
requestId: props.requestId,
|
|
59
|
+
url: request.url,
|
|
60
|
+
user: props.user,
|
|
61
|
+
mode: props.mode,
|
|
62
|
+
invoke: props.invoke,
|
|
63
|
+
appUrl: props.appUrl ?? undefined,
|
|
64
|
+
baseId: props.baseId ?? undefined,
|
|
65
|
+
previewClaim: props.previewClaim,
|
|
66
|
+
env: props.env,
|
|
67
|
+
envConnections: props.envConnections,
|
|
68
|
+
connectionServices: props.connectionServices,
|
|
69
|
+
runRoot: props.runRoot,
|
|
70
|
+
durable: props.durable,
|
|
71
|
+
runs: [],
|
|
72
|
+
workspace: props.workspace,
|
|
73
|
+
connections: props.connections,
|
|
74
|
+
provider: ziteProvider(props),
|
|
75
|
+
};
|
|
76
|
+
if (props.page) {
|
|
77
|
+
const { runtimeUrl, demo, ...site } = props.page;
|
|
78
|
+
host.head = platformHeadOf(site, { url: request.url, mode: props.mode }, { context: props, runtimeUrl, demo });
|
|
79
|
+
}
|
|
80
|
+
return host;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A request the host didn't dispatch: the host's warm-up, `zitejs describe` under `vite preview`, a server off Zite,
|
|
84
|
+
* and tests. Only the host can set props, so without them a build answers warm and describe, nobody is signed in, only
|
|
85
|
+
* an entry that passes its own provider (a test's) reaches a platform, and pages show the Settings the build baked.
|
|
86
|
+
*/
|
|
87
|
+
export function hostContextFromRequest(request, provider) {
|
|
88
|
+
return {
|
|
89
|
+
requestId: crypto.randomUUID(),
|
|
90
|
+
url: request.url,
|
|
91
|
+
user: null,
|
|
92
|
+
mode: 'live',
|
|
93
|
+
invoke: headerInvoke(request.headers),
|
|
94
|
+
runs: [],
|
|
95
|
+
provider,
|
|
96
|
+
...(builtSiteHead && {
|
|
97
|
+
head: platformHeadOf(builtSiteHead, { url: request.url, mode: 'live' }),
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** As the dispatcher answers a caller an internal app turns away: a server function, a page, or a call. */
|
|
102
|
+
const signInRequired = (request) => {
|
|
103
|
+
const url = new URL(request.url);
|
|
104
|
+
if (url.pathname.startsWith('/_serverFn/') ||
|
|
105
|
+
request.headers.has('x-tsr-serverfn')) {
|
|
106
|
+
return new Response(SIGN_IN_REQUIRED, {
|
|
107
|
+
status: 401,
|
|
108
|
+
headers: { 'content-type': 'text/plain; charset=utf-8' },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (!opensPage(request))
|
|
112
|
+
return Response.json({ error: 'SIGN_IN_REQUIRED' }, { status: 401 });
|
|
113
|
+
const login = new URL('/auth/login', url);
|
|
114
|
+
login.searchParams.set('redirectUrl', url.href);
|
|
115
|
+
return new Response(null, {
|
|
116
|
+
status: 302,
|
|
117
|
+
headers: { location: login.pathname + login.search },
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
// The platform's own paths on the app's origin, which no app route answers and no sign-in stands before.
|
|
121
|
+
const isPlatformPath = (pathname) => pathname === ANALYTICS_PATH || pathname === UPLOAD_SESSION_PATH;
|
|
122
|
+
/** Every server function TanStack compiled, written in by `zite()` at build. Empty in dev, where TanStack doesn't call its id hook. */
|
|
123
|
+
export const builtFunctionIds = () => '__ZITE_FN_IDS__'.split(',').filter(id => id && !id.startsWith('__ZITE'));
|
|
124
|
+
const parseBuiltJson = (json) => {
|
|
125
|
+
try {
|
|
126
|
+
return JSON.parse(json);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return {};
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
/** Each server function's `description` option, written in by `zite()` at build. */
|
|
133
|
+
export const builtFunctionDescriptions = () => parseBuiltJson('__ZITE_FN_DESCRIPTIONS__');
|
|
134
|
+
/** Each route's file, by route id, written in by `zite()` at build. */
|
|
135
|
+
export const builtRouteFiles = () => parseBuiltJson('__ZITE_ROUTE_FILES__');
|
|
136
|
+
/** Each registry module's registration hash, by its path, written in by `zite()` at build from the module graph. */
|
|
137
|
+
export const builtRegistrationHashes = () => parseBuiltJson('__ZITE_REGISTRATION_HASHES__');
|
|
138
|
+
// Server functions also run while a streamed page renders, so the run log is
|
|
139
|
+
// complete only once the body ends: read to the end, cancelled by the reader or
|
|
140
|
+
// failed. A TransformStream's flush hears only the first.
|
|
141
|
+
const onBodyEnd = (response, done) => {
|
|
142
|
+
if (!response.body) {
|
|
143
|
+
done();
|
|
144
|
+
return response;
|
|
145
|
+
}
|
|
146
|
+
const reader = response.body.getReader();
|
|
147
|
+
let ended = false;
|
|
148
|
+
const end = () => {
|
|
149
|
+
if (ended)
|
|
150
|
+
return;
|
|
151
|
+
ended = true;
|
|
152
|
+
done();
|
|
153
|
+
};
|
|
154
|
+
const body = new ReadableStream({
|
|
155
|
+
async pull(controller) {
|
|
156
|
+
try {
|
|
157
|
+
const { done: finished, value } = await reader.read();
|
|
158
|
+
if (finished) {
|
|
159
|
+
end();
|
|
160
|
+
controller.close();
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
controller.enqueue(value);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
end();
|
|
168
|
+
controller.error(error);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
cancel(reason) {
|
|
172
|
+
end();
|
|
173
|
+
return reader.cancel(reason);
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
return new Response(body, response);
|
|
177
|
+
};
|
|
178
|
+
// TanStack renders any loader error as a 500. A page refused with a ZiteError
|
|
179
|
+
// (a missing role, a record that isn't there) answers with that error's status.
|
|
180
|
+
const pageStatus = (host) => {
|
|
181
|
+
const matches = host.router?.state?.matches;
|
|
182
|
+
const failed = asZiteError(matches?.find(match => match.status === 'error')?.error);
|
|
183
|
+
return failed ? ZITE_ERROR_STATUS[failed.code] : undefined;
|
|
184
|
+
};
|
|
185
|
+
// The platform binding is what only the host's dispatch carries.
|
|
186
|
+
const isDispatched = (props) => !!props?.platform;
|
|
187
|
+
/**
|
|
188
|
+
* The handlers of a Start app's server entry. A request the host dispatched
|
|
189
|
+
* carries its identity, app token and platform URLs in props. Without props, a
|
|
190
|
+
* developer's dev token or API key in env selects the `local` provider;
|
|
191
|
+
* anything else (describe under `vite preview`, tests) uses `provider` if one is given.
|
|
192
|
+
*/
|
|
193
|
+
export function createZiteHandlers(options) {
|
|
194
|
+
installPlatformTransport();
|
|
195
|
+
installRequestEnv();
|
|
196
|
+
// Loaded on first use, so a page request never pays for importing workflow modules.
|
|
197
|
+
let workflows;
|
|
198
|
+
const loadedWorkflows = () => (workflows ??= loadWorkflows());
|
|
199
|
+
const invoke = createInvoker({
|
|
200
|
+
workflows: loadedWorkflows,
|
|
201
|
+
functionIds: builtFunctionIds,
|
|
202
|
+
handler: options.handler,
|
|
203
|
+
});
|
|
204
|
+
const fetch = async (incoming, _env, ctx) => {
|
|
205
|
+
const given = ctx?.props;
|
|
206
|
+
const props = isDispatched(given) ? given : undefined;
|
|
207
|
+
const local = props ? undefined : localPlatform();
|
|
208
|
+
const { pathname } = new URL(incoming.url);
|
|
209
|
+
const mounted = local && !headerInvoke(incoming.headers) && !isPlatformPath(pathname)
|
|
210
|
+
? await signInLocally(incoming)
|
|
211
|
+
: undefined;
|
|
212
|
+
if (mounted && 'answered' in mounted)
|
|
213
|
+
return mounted.answered;
|
|
214
|
+
const request = mounted?.request ?? incoming;
|
|
215
|
+
const host = props
|
|
216
|
+
? hostContextFromProps(request, props)
|
|
217
|
+
: local
|
|
218
|
+
? hostContextFromLocal(request, local)
|
|
219
|
+
: hostContextFromRequest(request, options.provider);
|
|
220
|
+
if (mounted)
|
|
221
|
+
host.user = userOfIdentity(mounted.signedIn.user);
|
|
222
|
+
// A browser asks for an installable app's manifest before anyone signs in.
|
|
223
|
+
const manifest = host.invoke === null &&
|
|
224
|
+
request.method === 'GET' &&
|
|
225
|
+
pathname === MANIFEST_PATH
|
|
226
|
+
? host.head?.site.manifest
|
|
227
|
+
: undefined;
|
|
228
|
+
if (manifest)
|
|
229
|
+
return manifestAnswer(manifest);
|
|
230
|
+
// The platform walls internal apps before dispatch; this is the same wall again, before any app code.
|
|
231
|
+
if (props?.accessMode === 'internal' && host.invoke === null && !host.user)
|
|
232
|
+
return signInRequired(request);
|
|
233
|
+
if (ctx?.waitUntil)
|
|
234
|
+
host.waitUntil = promise => ctx.waitUntil(promise);
|
|
235
|
+
// The platform's, before any app route could answer them.
|
|
236
|
+
if (host.invoke === null && pathname === ANALYTICS_PATH)
|
|
237
|
+
return takeAnalytics(request, host);
|
|
238
|
+
if (host.invoke === null && pathname === UPLOAD_SESSION_PATH)
|
|
239
|
+
return takeUploadSession(request, host);
|
|
240
|
+
if (local && host.invoke === null)
|
|
241
|
+
await loadLocal(host);
|
|
242
|
+
// Starting this isolate was the point: the platform warms a build before its
|
|
243
|
+
// first visitors, and no app code runs.
|
|
244
|
+
if (host.invoke?.kind === 'warm')
|
|
245
|
+
return new Response(null, { status: 204 });
|
|
246
|
+
if (host.invoke?.kind === 'describe') {
|
|
247
|
+
return Response.json(await describeApp({
|
|
248
|
+
fnIds: builtFunctionIds(),
|
|
249
|
+
descriptions: builtFunctionDescriptions(),
|
|
250
|
+
routeFiles: builtRouteFiles(),
|
|
251
|
+
registrationHashes: builtRegistrationHashes(),
|
|
252
|
+
getRouter: options.getRouter,
|
|
253
|
+
request,
|
|
254
|
+
workflows: await loadedWorkflows(),
|
|
255
|
+
unfinishedWorkflows: await loadUnfinishedWorkflows(),
|
|
256
|
+
}), { headers: { [RUNTIME_VERSION_HEADER]: ZITEJS_VERSION } });
|
|
257
|
+
}
|
|
258
|
+
let response = await runWithHost(host, () => invoke(host, request) ?? options.handler.fetch(request));
|
|
259
|
+
const status = response.status === 500 ? pageStatus(host) : undefined;
|
|
260
|
+
if (status)
|
|
261
|
+
response = new Response(response.body, {
|
|
262
|
+
status,
|
|
263
|
+
headers: response.headers,
|
|
264
|
+
});
|
|
265
|
+
if (host.invoke === null &&
|
|
266
|
+
!opensPage(request) &&
|
|
267
|
+
failedOnDemo(host, response))
|
|
268
|
+
response = asDemoRefusal(response);
|
|
269
|
+
if (mounted)
|
|
270
|
+
response = withSetCookies(response, mounted.signedIn.setCookies);
|
|
271
|
+
return onBodyEnd(response, () => {
|
|
272
|
+
if (!host.runs.length &&
|
|
273
|
+
!host.calls?.length &&
|
|
274
|
+
!host.fetches?.length &&
|
|
275
|
+
!host.pending?.length)
|
|
276
|
+
return;
|
|
277
|
+
const flushed = (async () => {
|
|
278
|
+
await Promise.all(host.pending ?? []);
|
|
279
|
+
if (!host.runs.length && !host.calls?.length && !host.fetches?.length)
|
|
280
|
+
return;
|
|
281
|
+
await sendRunReport(host, {
|
|
282
|
+
runs: host.runs,
|
|
283
|
+
...(host.calls?.length && { calls: host.calls }),
|
|
284
|
+
...(host.fetches?.length && { fetches: host.fetches }),
|
|
285
|
+
});
|
|
286
|
+
})().catch((error) => {
|
|
287
|
+
console.error("[zite] couldn't record runs", error);
|
|
288
|
+
});
|
|
289
|
+
ctx?.waitUntil(flushed);
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
return { fetch };
|
|
293
|
+
}
|
|
294
|
+
/** The fetch handler alone, for the Node entry. */
|
|
295
|
+
export function createZiteFetch(options) {
|
|
296
|
+
return createZiteHandlers(options).fetch;
|
|
297
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// A Start page's upload session, asked of the app's own origin: the app's server asks the platform's uploads service on
|
|
2
|
+
// the request's token, which says the app and the mode, so neither the token nor a platform host reaches the browser.
|
|
3
|
+
import { serviceUrl } from '../../internal/serviceUrls.js';
|
|
4
|
+
import { textUpTo } from '../platform/caps.js';
|
|
5
|
+
import { directAccess, sendOnToken } from '../platform/transport.js';
|
|
6
|
+
const MAX_SESSION_BYTES = 16 * 1024;
|
|
7
|
+
const UPLOADS_TIMEOUT_MS = 15_000;
|
|
8
|
+
const refused = (status, message) => Response.json({ success: false, message }, { status });
|
|
9
|
+
// As the app's own routes are checked (serve/instance.ts): a cookie rides only on a request from the app's own pages.
|
|
10
|
+
const crossSite = (request) => {
|
|
11
|
+
if (!request.headers.has('cookie'))
|
|
12
|
+
return false;
|
|
13
|
+
const site = request.headers.get('sec-fetch-site');
|
|
14
|
+
if (site !== null)
|
|
15
|
+
return site !== 'same-origin';
|
|
16
|
+
return request.headers.get('origin') !== new URL(request.url).origin;
|
|
17
|
+
};
|
|
18
|
+
const sessionBody = (raw) => {
|
|
19
|
+
try {
|
|
20
|
+
const { filename, uploadLength, contentType } = JSON.parse(raw ?? '');
|
|
21
|
+
return JSON.stringify({ filename, uploadLength, contentType });
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const takeUploadSession = async (request, host) => {
|
|
28
|
+
if (request.method !== 'POST')
|
|
29
|
+
return new Response('Method not allowed', { status: 405 });
|
|
30
|
+
if (crossSite(request))
|
|
31
|
+
return refused(403, 'Forbidden');
|
|
32
|
+
const access = await directAccess(host);
|
|
33
|
+
if (!access)
|
|
34
|
+
return refused(503, "Uploads need the platform's app token, and this request has none");
|
|
35
|
+
const body = sessionBody(await textUpTo(request, MAX_SESSION_BYTES));
|
|
36
|
+
if (body === undefined)
|
|
37
|
+
return refused(400, 'Invalid upload session request');
|
|
38
|
+
try {
|
|
39
|
+
const answer = await sendOnToken(access.token, serviceUrl(access.urls, 'uploads'), { method: 'POST', body, timeoutMs: UPLOADS_TIMEOUT_MS });
|
|
40
|
+
return new Response(answer.body, {
|
|
41
|
+
status: answer.status,
|
|
42
|
+
headers: { 'content-type': 'application/json' },
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('[zite] the upload session failed', error);
|
|
47
|
+
return refused(502, 'Upload failed');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ZiteServerOptions } from './server.js';
|
|
2
|
+
export type ZiteWorker = new (ctx: unknown, env: unknown) => {
|
|
3
|
+
fetch(request: Request): Promise<Response>;
|
|
4
|
+
};
|
|
5
|
+
/** A Start app's Worker. The host sends it every request, with that request's props. */
|
|
6
|
+
export declare function createZiteWorker(options: ZiteServerOptions): ZiteWorker;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// For the generated server entry of a Workers build only. Apps never import this.
|
|
2
|
+
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
3
|
+
import { createZiteHandlers } from './server.js';
|
|
4
|
+
/** A Start app's Worker. The host sends it every request, with that request's props. */
|
|
5
|
+
export function createZiteWorker(options) {
|
|
6
|
+
const handlers = createZiteHandlers(options);
|
|
7
|
+
return class extends WorkerEntrypoint {
|
|
8
|
+
async fetch(request) {
|
|
9
|
+
return handlers.fetch(request, this.env, this.ctx);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|