zitejs 0.10.0-start.8 → 0.10.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 +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 +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 +43 -43
- package/dist/cjs/check/index.d.ts +44 -1
- package/dist/cjs/check/index.js +188 -113
- 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/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 +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/{esm/start → cjs/start/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 +46 -42
- 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 +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 +44 -44
- package/dist/esm/check/index.d.ts +44 -1
- package/dist/esm/check/index.js +187 -116
- 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/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 +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 +487 -0
- package/dist/esm/start/classicOnly.d.ts +1 -0
- package/dist/esm/start/classicOnly.js +4 -0
- package/dist/esm/start/describe/describe.d.ts +120 -0
- package/dist/esm/start/describe/describe.js +372 -0
- package/dist/{cjs/start → esm/start/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 +20 -4
- package/dist/esm/start/errors.js +90 -26
- 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 -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 +2 -2
- package/dist/esm/start/host.js +3 -3
- package/dist/esm/start/index.d.ts +10 -63
- package/dist/esm/start/index.js +7 -149
- 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 +28 -4
- package/dist/esm/start/router.js +224 -21
- 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 +51 -47
- package/package.json +95 -37
- package/dist/cjs/auth-server/index.d.ts +0 -369
- package/dist/cjs/auth-server/index.js +0 -119
- 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/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.d.ts +0 -80
- package/dist/esm/start/describe.js +0 -197
- 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 -50
- package/dist/esm/start/workflow.js +0 -13
- package/dist/esm/start/workflow.test-d.js +0 -39
- 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,23 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* the page to, read once, before the router hides it.
|
|
10
|
-
*/
|
|
11
|
-
export const previewClaim = () => {
|
|
12
|
-
if (typeof window === "undefined")
|
|
13
|
-
return currentHost()?.previewClaim;
|
|
14
|
-
captured ??= new URL(window.location.href).searchParams.get(PREVIEW_CLAIM_PARAM);
|
|
15
|
-
return captured ?? undefined;
|
|
16
|
-
};
|
|
1
|
+
import { browserPreviewClaim, PREVIEW_CLAIM_PARAM, } from '../auth/previewClaim.js';
|
|
2
|
+
import { currentHost } from './host.js';
|
|
3
|
+
import { PREVIEW_CLAIM_HEADER } from './protocol.js';
|
|
4
|
+
export { PREVIEW_CLAIM_PARAM };
|
|
5
|
+
/** An editor preview's access: on the server the host hands it over, in the browser it's on the URL. */
|
|
6
|
+
export const previewClaim = () => typeof window === 'undefined'
|
|
7
|
+
? currentHost()?.previewClaim
|
|
8
|
+
: browserPreviewClaim();
|
|
17
9
|
let carrying = false;
|
|
18
10
|
/** Every same-origin fetch from the page carries the claim: server functions and the app's own routes alike. */
|
|
19
11
|
export const carryPreviewClaim = (claim) => {
|
|
20
|
-
if (carrying || typeof window ===
|
|
12
|
+
if (carrying || typeof window === 'undefined')
|
|
21
13
|
return;
|
|
22
14
|
carrying = true;
|
|
23
15
|
const original = window.fetch.bind(window);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { isReservedIntegrationId, RESERVED_INTEGRATION_IDS, } from '../internal/reservedIds.js';
|
|
2
|
+
export type { AppContext, ExpiringToken, HostConnection, HostMode, HostPage, HostProps, PlatformBinding, SiteHead, WebManifest, } from './types.js';
|
|
3
|
+
/** What the host dispatches a request to do beside serving it; without props, only `warm` and `describe`. */
|
|
4
|
+
export declare const INVOKE_KINDS: readonly ["webhook", "describe", "workflow", "register", "warm", "authHook", "function"];
|
|
5
|
+
export type InvokeKind = (typeof INVOKE_KINDS)[number];
|
|
6
|
+
export declare const isInvokeKind: (kind: unknown) => kind is InvokeKind;
|
|
7
|
+
/** `warm` or `describe`, on a request the host sends without props. */
|
|
8
|
+
export declare const INVOKE_HEADER = "x-zite-invoke";
|
|
9
|
+
/** Where the host POSTs a workflow, registration, auth hook or test run, with `{ input }`. */
|
|
10
|
+
export declare const INVOKE_PATH = "/_zite/invoke";
|
|
11
|
+
/** On describe's answer: the zitejs the build's server code was bundled from. */
|
|
12
|
+
export declare const RUNTIME_VERSION_HEADER = "x-zitejs-version";
|
|
13
|
+
/** An editor preview's access, on every same-origin fetch its pages make. */
|
|
14
|
+
export declare const PREVIEW_CLAIM_HEADER = "x-zite-preview";
|
|
15
|
+
/** At the gateway, the connection a call on Zite's AI key bills to. */
|
|
16
|
+
export declare const GATEWAY_CONNECTION_HEADER = "x-zite-gateway-connection";
|
|
17
|
+
/** On a demo's refused answer, beside its 403, so the platform's runtime shows the demo notice. */
|
|
18
|
+
export declare const ERROR_CODE_HEADER = "x-zite-error-code";
|
|
19
|
+
export declare const DEMO_READ_ONLY_CODE = "DEMO_READ_ONLY";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// What a Start build and the platform's host say to each other on the wire. Import-free but for the reserved ids,
|
|
2
|
+
// themselves import-free, so the host takes these without loading anything of zitejs.
|
|
3
|
+
export { isReservedIntegrationId, RESERVED_INTEGRATION_IDS, } from '../internal/reservedIds.js';
|
|
4
|
+
/** What the host dispatches a request to do beside serving it; without props, only `warm` and `describe`. */
|
|
5
|
+
export const INVOKE_KINDS = [
|
|
6
|
+
'webhook',
|
|
7
|
+
'describe',
|
|
8
|
+
'workflow',
|
|
9
|
+
'register',
|
|
10
|
+
'warm',
|
|
11
|
+
'authHook',
|
|
12
|
+
'function',
|
|
13
|
+
];
|
|
14
|
+
export const isInvokeKind = (kind) => INVOKE_KINDS.includes(kind);
|
|
15
|
+
/** `warm` or `describe`, on a request the host sends without props. */
|
|
16
|
+
export const INVOKE_HEADER = 'x-zite-invoke';
|
|
17
|
+
/** Where the host POSTs a workflow, registration, auth hook or test run, with `{ input }`. */
|
|
18
|
+
export const INVOKE_PATH = '/_zite/invoke';
|
|
19
|
+
/** On describe's answer: the zitejs the build's server code was bundled from. */
|
|
20
|
+
export const RUNTIME_VERSION_HEADER = 'x-zitejs-version';
|
|
21
|
+
/** An editor preview's access, on every same-origin fetch its pages make. */
|
|
22
|
+
export const PREVIEW_CLAIM_HEADER = 'x-zite-preview';
|
|
23
|
+
/** At the gateway, the connection a call on Zite's AI key bills to. */
|
|
24
|
+
export const GATEWAY_CONNECTION_HEADER = 'x-zite-gateway-connection';
|
|
25
|
+
/** On a demo's refused answer, beside its 403, so the platform's runtime shows the demo notice. */
|
|
26
|
+
export const ERROR_CODE_HEADER = 'x-zite-error-code';
|
|
27
|
+
export const DEMO_READ_ONLY_CODE = 'DEMO_READ_ONLY';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { User } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* By the role's id, as classic's does: a role's name can change. Takes the user, or a context carrying one as
|
|
4
|
+
* classic's `hasRole(context, id)` does; signed out, no one has a role.
|
|
5
|
+
*/
|
|
6
|
+
export declare const hasRole: (who: User | {
|
|
7
|
+
user: User | null;
|
|
8
|
+
} | null | undefined, roleId: string) => boolean;
|
|
9
|
+
/** Signed-in users with this role, by its id. */
|
|
10
|
+
export declare const role: (id: string) => import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, {
|
|
11
|
+
user: User;
|
|
12
|
+
}>], undefined>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createMiddleware } from '@tanstack/react-start';
|
|
2
|
+
import { signedIn } from './access.js';
|
|
3
|
+
import { ZiteError } from './errors.js';
|
|
4
|
+
import { withStatus } from './failures.js';
|
|
5
|
+
import { tag } from './middlewareKind.js';
|
|
6
|
+
/**
|
|
7
|
+
* By the role's id, as classic's does: a role's name can change. Takes the user, or a context carrying one as
|
|
8
|
+
* classic's `hasRole(context, id)` does; signed out, no one has a role.
|
|
9
|
+
*/
|
|
10
|
+
export const hasRole = (who, roleId) => {
|
|
11
|
+
const user = who && 'user' in who ? who.user : who;
|
|
12
|
+
return user?.roles.some(({ id }) => id === roleId) ?? false;
|
|
13
|
+
};
|
|
14
|
+
/** Signed-in users with this role, by its id. */
|
|
15
|
+
export const role = (id) => tag(createMiddleware()
|
|
16
|
+
.middleware([signedIn])
|
|
17
|
+
.server(({ next, context, serverFnMeta }) => withStatus(!!serverFnMeta, async () => {
|
|
18
|
+
if (!hasRole(context.user, id)) {
|
|
19
|
+
// A role's id means nothing to the app's users; the editor still reads which one.
|
|
20
|
+
throw new ZiteError({
|
|
21
|
+
code: 'FORBIDDEN',
|
|
22
|
+
message: `Requires the ${id} role`,
|
|
23
|
+
userFacingMessage: "You don't have access to this.",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return next();
|
|
27
|
+
})), { kind: 'role', role: id });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { QueryClient } from
|
|
2
|
-
import { type AnyRoute, type RouterConstructorOptions, type RouterHistory } from
|
|
3
|
-
import type
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { type AnyRoute, type RouterConstructorOptions, type RouterHistory } from '@tanstack/react-router';
|
|
3
|
+
import { type ProfileChanges } from '../auth/profileUpdates.js';
|
|
4
|
+
import type { HostMode, PlatformHead, User } from './types.js';
|
|
5
|
+
export declare const QUERY_STALE_TIME_MS = 30000;
|
|
4
6
|
/** The router context every Zite app's root route declares: `createRootRouteWithContext<ZiteRouterContext>()`. */
|
|
5
7
|
export type ZiteRouterContext = {
|
|
6
8
|
user: User | null;
|
|
@@ -8,8 +10,28 @@ export type ZiteRouterContext = {
|
|
|
8
10
|
};
|
|
9
11
|
type Dehydrated = {
|
|
10
12
|
user: User | null;
|
|
13
|
+
mode?: HostMode;
|
|
14
|
+
head?: PlatformHead;
|
|
11
15
|
};
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @internal What a page carries to the browser beside its queries: the signed-in user, the mode it was served in, and
|
|
18
|
+
* the platform's head entries, which the browser renders again as it navigates.
|
|
19
|
+
*/
|
|
20
|
+
export declare const dehydrateZite: (context: ZiteRouterContext) => Dehydrated;
|
|
21
|
+
/** @internal The user after a profile edit, named as the host names them: first and last name, else the email. */
|
|
22
|
+
export declare const withProfile: (user: User, changes: ProfileChanges) => User;
|
|
23
|
+
/** @internal In the browser: `updateProfile` from zitejs/auth updates the router's user and reruns its guards and loaders. */
|
|
24
|
+
export declare const refreshOnProfileUpdate: (router: {
|
|
25
|
+
invalidate: () => Promise<void>;
|
|
26
|
+
}, context: ZiteRouterContext) => void;
|
|
27
|
+
/** @internal Takes in what the page carried. */
|
|
28
|
+
export declare const hydrateZite: (context: ZiteRouterContext, dehydrated: Dehydrated) => void;
|
|
29
|
+
type ZiteRouterOptions<TRouteTree extends AnyRoute> = Omit<RouterConstructorOptions<TRouteTree, 'never', false, RouterHistory, Dehydrated>, 'context' | 'dehydrate' | 'hydrate'>;
|
|
30
|
+
/**
|
|
31
|
+
* @internal Tells the editor's preview the page crashed, as classic's runtime reports an emptied #root: a Start page
|
|
32
|
+
* has none, and an error a route's boundary catches is the crash. Being signed out isn't one.
|
|
33
|
+
*/
|
|
34
|
+
export declare const reportCrash: (error: unknown) => void;
|
|
13
35
|
/**
|
|
14
36
|
* The router for `src/router.tsx`. The signed-in user is in `context.user`: on the server from the platform, in the
|
|
15
37
|
* browser from the page it rendered, so no request asks for it again. `context.queryClient` is new for each request
|
|
@@ -17,4 +39,6 @@ type ZiteRouterOptions<TRouteTree extends AnyRoute> = Omit<RouterConstructorOpti
|
|
|
17
39
|
* with the page.
|
|
18
40
|
*/
|
|
19
41
|
export declare function createZiteRouter<TRouteTree extends AnyRoute>(options: ZiteRouterOptions<TRouteTree>): import("@tanstack/router-core").RouterCore<TRouteTree, "never", false, RouterHistory, Dehydrated>;
|
|
42
|
+
/** @internal Whether createZiteRouter built it: describe refuses a router file whose router it didn't. */
|
|
43
|
+
export declare const isZiteRouter: (router: unknown) => boolean;
|
|
20
44
|
export {};
|
package/dist/esm/start/router.js
CHANGED
|
@@ -1,19 +1,78 @@
|
|
|
1
|
-
import { createElement as h, useEffect, useState } from
|
|
2
|
-
import { QueryClient } from
|
|
3
|
-
import { createRouter, Link, useRouter, } from
|
|
4
|
-
import { setupRouterSsrQueryIntegration } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createElement as h, useEffect, useState } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { createRouter, Link, useRouter, } from '@tanstack/react-router';
|
|
4
|
+
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query';
|
|
5
|
+
import { createMiddleware } from '@tanstack/react-start';
|
|
6
|
+
import { asCrossed, errorFromThrown, isSignInError, withThrownRejections, } from './errors.js';
|
|
7
|
+
import { carryPreviewClaim, PREVIEW_CLAIM_PARAM, previewClaim, } from './previewClaim.js';
|
|
8
|
+
import { currentHost } from './host.js';
|
|
9
|
+
import { INVOKE_PATH } from './protocol.js';
|
|
10
|
+
import { keepRenderedMode } from '../internal/appMode.js';
|
|
11
|
+
import { onProfileUpdated, } from '../auth/profileUpdates.js';
|
|
12
|
+
import { keepHydratedHead, withPlatformHead, } from './platformHead.js';
|
|
13
|
+
// Long enough that a page's queries don't refetch as the browser picks it up, short enough to stay fresh.
|
|
14
|
+
export const QUERY_STALE_TIME_MS = 30_000;
|
|
15
|
+
/**
|
|
16
|
+
* @internal What a page carries to the browser beside its queries: the signed-in user, the mode it was served in, and
|
|
17
|
+
* the platform's head entries, which the browser renders again as it navigates.
|
|
18
|
+
*/
|
|
19
|
+
export const dehydrateZite = (context) => {
|
|
20
|
+
const host = currentHost();
|
|
21
|
+
return {
|
|
22
|
+
user: context.user,
|
|
23
|
+
mode: host?.mode,
|
|
24
|
+
...(host?.head && { head: host.head }),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/** @internal The user after a profile edit, named as the host names them: first and last name, else the email. */
|
|
28
|
+
export const withProfile = (user, changes) => {
|
|
29
|
+
const { firstName: _firstName, lastName: _lastName, ...rest } = user;
|
|
30
|
+
const firstName = changes.firstName !== undefined ? changes.firstName : user.firstName;
|
|
31
|
+
const lastName = changes.lastName !== undefined ? changes.lastName : user.lastName;
|
|
32
|
+
return {
|
|
33
|
+
...rest,
|
|
34
|
+
name: [firstName, lastName].filter(Boolean).join(' ') || user.email,
|
|
35
|
+
...(firstName && { firstName }),
|
|
36
|
+
...(lastName && { lastName }),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** @internal In the browser: `updateProfile` from zitejs/auth updates the router's user and reruns its guards and loaders. */
|
|
40
|
+
export const refreshOnProfileUpdate = (router, context) => onProfileUpdated(changes => {
|
|
41
|
+
if (!context.user)
|
|
42
|
+
return;
|
|
43
|
+
context.user = withProfile(context.user, changes);
|
|
44
|
+
void router.invalidate();
|
|
45
|
+
});
|
|
46
|
+
/** @internal Takes in what the page carried. */
|
|
47
|
+
export const hydrateZite = (context, dehydrated) => {
|
|
48
|
+
context.user = dehydrated.user;
|
|
49
|
+
keepRenderedMode(dehydrated.mode);
|
|
50
|
+
keepHydratedHead(dehydrated.head);
|
|
51
|
+
};
|
|
52
|
+
const ziteWindow = () => typeof window === 'undefined' ? undefined : window;
|
|
53
|
+
const box = {
|
|
54
|
+
maxWidth: 480,
|
|
55
|
+
margin: '15vh auto',
|
|
56
|
+
padding: 24,
|
|
57
|
+
fontFamily: 'system-ui, sans-serif',
|
|
58
|
+
textAlign: 'center',
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @internal Tells the editor's preview the page crashed, as classic's runtime reports an emptied #root: a Start page
|
|
62
|
+
* has none, and an error a route's boundary catches is the crash. Being signed out isn't one.
|
|
63
|
+
*/
|
|
64
|
+
export const reportCrash = (error) => {
|
|
65
|
+
if (!isSignInError(error))
|
|
66
|
+
ziteWindow()?._ziteOnCrash?.(error);
|
|
67
|
+
};
|
|
10
68
|
// As classic's crash screen: the message, "Fix it for me" in the editor, and a reload. The server renders from the
|
|
11
|
-
//
|
|
69
|
+
// error the router already mapped and the browser from the one that crossed, so both show the same text.
|
|
12
70
|
function ZiteErrorComponent({ error }) {
|
|
13
71
|
const router = useRouter();
|
|
14
72
|
const [allowAiFix, setAllowAiFix] = useState(false);
|
|
15
73
|
useEffect(() => setAllowAiFix(ziteWindow()?.__ziteAllowAiFix === true), []);
|
|
16
|
-
|
|
74
|
+
useEffect(() => markReady('error'), []);
|
|
75
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
17
76
|
const reload = () => {
|
|
18
77
|
const onReload = ziteWindow()?._ziteOnReload;
|
|
19
78
|
if (onReload)
|
|
@@ -21,14 +80,110 @@ function ZiteErrorComponent({ error }) {
|
|
|
21
80
|
else
|
|
22
81
|
router.invalidate();
|
|
23
82
|
};
|
|
24
|
-
return h(
|
|
83
|
+
return h('div', { role: 'alert', style: box }, h('p', { style: { fontWeight: 600 } }, 'Something went wrong'), h('pre', { style: { whiteSpace: 'pre-wrap', textAlign: 'left' } }, message), allowAiFix &&
|
|
84
|
+
!isSignInError(error) &&
|
|
85
|
+
h('button', {
|
|
86
|
+
type: 'button',
|
|
87
|
+
onClick: () => ziteWindow()?._ziteOnFixError?.(error),
|
|
88
|
+
}, 'Fix it for me'), h('button', { type: 'button', onClick: reload }, 'Try again'));
|
|
25
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* `<html data-zite-ready>`: what the platform's screenshots wait for. `1` once
|
|
92
|
+
* the page has rendered with nothing loading, `error` when the error screen did.
|
|
93
|
+
*/
|
|
94
|
+
const markReady = (state) => {
|
|
95
|
+
if (typeof document !== 'undefined')
|
|
96
|
+
document.documentElement.dataset.ziteReady = state;
|
|
97
|
+
};
|
|
98
|
+
const watchReady = (router) => () => {
|
|
99
|
+
const { status, isLoading, matches } = router.state;
|
|
100
|
+
if (status !== 'idle' ||
|
|
101
|
+
isLoading ||
|
|
102
|
+
matches.some(match => match.status === 'pending'))
|
|
103
|
+
return;
|
|
104
|
+
markReady(matches.some(match => match.status === 'error') ? 'error' : '1');
|
|
105
|
+
};
|
|
26
106
|
function ZiteNotFound() {
|
|
27
|
-
return h(
|
|
107
|
+
return h('div', { style: box }, h('p', { style: { fontWeight: 600 } }, 'Page not found'), h(Link, { to: '/' }, 'Go home'));
|
|
28
108
|
}
|
|
29
109
|
function ZitePending() {
|
|
30
|
-
return h(
|
|
110
|
+
return h('div', { 'aria-busy': true, style: { ...box, color: '#888' } }, 'Loading…');
|
|
31
111
|
}
|
|
112
|
+
const rejectingWithErrors = (load) => (...args) => {
|
|
113
|
+
const out = load(...args);
|
|
114
|
+
return out instanceof Promise
|
|
115
|
+
? out.then(withThrownRejections)
|
|
116
|
+
: withThrownRejections(out);
|
|
117
|
+
};
|
|
118
|
+
// A loader's error crosses to the browser as thrown, and so does a deferred value's rejection; only an Error goes
|
|
119
|
+
// through the zite-error adapter. A route's onError may replace its error; routes outlive a request's router, so each
|
|
120
|
+
// is wrapped once.
|
|
121
|
+
const wrapped = new WeakSet();
|
|
122
|
+
const failWithErrors = (routes) => {
|
|
123
|
+
for (const route of routes) {
|
|
124
|
+
if (wrapped.has(route))
|
|
125
|
+
continue;
|
|
126
|
+
wrapped.add(route);
|
|
127
|
+
const own = route.options.onError;
|
|
128
|
+
const loader = route.options.loader;
|
|
129
|
+
route.update({
|
|
130
|
+
onError: (error) => {
|
|
131
|
+
let failure = error;
|
|
132
|
+
try {
|
|
133
|
+
own?.(error);
|
|
134
|
+
}
|
|
135
|
+
catch (replaced) {
|
|
136
|
+
failure = replaced;
|
|
137
|
+
}
|
|
138
|
+
const normalized = errorFromThrown(failure);
|
|
139
|
+
// The server renders a failed route's error component in-process.
|
|
140
|
+
if (typeof window === 'undefined' && normalized instanceof Error)
|
|
141
|
+
throw asCrossed(normalized);
|
|
142
|
+
if (normalized !== error)
|
|
143
|
+
throw normalized;
|
|
144
|
+
},
|
|
145
|
+
...(loader && {
|
|
146
|
+
loader: typeof loader === 'function'
|
|
147
|
+
? rejectingWithErrors(loader)
|
|
148
|
+
: { ...loader, handler: rejectingWithErrors(loader.handler) },
|
|
149
|
+
}),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
// The host's test run of a server function, answered at the invoke path in TanStack's own request, so the function runs
|
|
154
|
+
// as a page's call does. Root middleware, so it stands before any route of the app's and describe lists no route.
|
|
155
|
+
const invokeRoute = createMiddleware().server(({ next, pathname }) => {
|
|
156
|
+
const run = pathname === INVOKE_PATH ? currentHost()?.functionRun : undefined;
|
|
157
|
+
return run ? run() : next();
|
|
158
|
+
});
|
|
159
|
+
const invoking = new WeakSet();
|
|
160
|
+
const withInvokeRoute = (root) => {
|
|
161
|
+
if (invoking.has(root))
|
|
162
|
+
return;
|
|
163
|
+
invoking.add(root);
|
|
164
|
+
const { server } = root.options;
|
|
165
|
+
root.options.server = {
|
|
166
|
+
...server,
|
|
167
|
+
middleware: [invokeRoute, ...(server?.middleware ?? [])],
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
// The platform's head goes on every page whatever the app's root asks for, as the page's defaults and the platform's
|
|
171
|
+
// own tags. On the server and in the browser, where it's the one the page carried; once per root, as routes outlive
|
|
172
|
+
// a request's router.
|
|
173
|
+
const headed = new WeakSet();
|
|
174
|
+
const withRootHead = (root) => {
|
|
175
|
+
if (headed.has(root))
|
|
176
|
+
return;
|
|
177
|
+
headed.add(root);
|
|
178
|
+
const own = root.options.head;
|
|
179
|
+
const head = ctx => {
|
|
180
|
+
const asked = own?.(ctx);
|
|
181
|
+
return asked instanceof Promise
|
|
182
|
+
? asked.then(withPlatformHead)
|
|
183
|
+
: withPlatformHead(asked);
|
|
184
|
+
};
|
|
185
|
+
root.options.head = head;
|
|
186
|
+
};
|
|
32
187
|
// The claim stays on every URL the router writes, and the app's own routes never see it.
|
|
33
188
|
const keepPreviewClaim = (claim, own) => ({
|
|
34
189
|
input: ({ url }) => {
|
|
@@ -49,13 +204,18 @@ const keepPreviewClaim = (claim, own) => ({
|
|
|
49
204
|
* with the page.
|
|
50
205
|
*/
|
|
51
206
|
export function createZiteRouter(options) {
|
|
52
|
-
const queryClient = new QueryClient(
|
|
207
|
+
const queryClient = new QueryClient({
|
|
208
|
+
defaultOptions: { queries: { staleTime: QUERY_STALE_TIME_MS } },
|
|
209
|
+
});
|
|
53
210
|
const claim = previewClaim();
|
|
54
211
|
if (claim)
|
|
55
212
|
carryPreviewClaim(claim);
|
|
56
|
-
const context = {
|
|
213
|
+
const context = {
|
|
214
|
+
user: currentHost()?.user ?? null,
|
|
215
|
+
queryClient,
|
|
216
|
+
};
|
|
57
217
|
const router = createRouter({
|
|
58
|
-
defaultPreload:
|
|
218
|
+
defaultPreload: 'intent',
|
|
59
219
|
defaultPreloadStaleTime: 0,
|
|
60
220
|
scrollRestoration: true,
|
|
61
221
|
defaultErrorComponent: ZiteErrorComponent,
|
|
@@ -63,15 +223,58 @@ export function createZiteRouter(options) {
|
|
|
63
223
|
defaultPendingComponent: ZitePending,
|
|
64
224
|
...options,
|
|
65
225
|
...(claim && { rewrite: keepPreviewClaim(claim, options.rewrite) }),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
226
|
+
// Whichever screen shows it: a route may have its own.
|
|
227
|
+
defaultOnCatch: (error, info) => {
|
|
228
|
+
markReady('error');
|
|
229
|
+
reportCrash(error);
|
|
230
|
+
options.defaultOnCatch?.(error, info);
|
|
70
231
|
},
|
|
232
|
+
context,
|
|
233
|
+
dehydrate: () => dehydrateZite(context),
|
|
234
|
+
hydrate: (dehydrated) => hydrateZite(context, dehydrated),
|
|
71
235
|
});
|
|
236
|
+
if (typeof window === 'undefined')
|
|
237
|
+
withInvokeRoute(router.routeTree);
|
|
238
|
+
withRootHead(router.routeTree);
|
|
239
|
+
failWithErrors(Object.values(router.routesById));
|
|
72
240
|
setupRouterSsrQueryIntegration({ router, queryClient });
|
|
241
|
+
const mark = watchReady(router);
|
|
242
|
+
router.subscribe('onResolved', mark);
|
|
243
|
+
router.subscribe('onRendered', mark);
|
|
73
244
|
const host = currentHost();
|
|
74
245
|
if (host)
|
|
75
246
|
host.router = router;
|
|
247
|
+
if (typeof window === 'undefined')
|
|
248
|
+
refuseOtherRequests(router, host);
|
|
249
|
+
else
|
|
250
|
+
refreshOnProfileUpdate(router, context);
|
|
251
|
+
loadPlatformPagesAsDocuments(router);
|
|
252
|
+
Object.defineProperty(router, ZITE_ROUTER, { value: true });
|
|
76
253
|
return router;
|
|
77
254
|
}
|
|
255
|
+
// Shared across copies of zitejs in one bundle, like an automation's tag.
|
|
256
|
+
const ZITE_ROUTER = Symbol.for('zitejs:router');
|
|
257
|
+
/** @internal Whether createZiteRouter built it: describe refuses a router file whose router it didn't. */
|
|
258
|
+
export const isZiteRouter = (router) => typeof router === 'object' &&
|
|
259
|
+
router !== null &&
|
|
260
|
+
router[ZITE_ROUTER] === true;
|
|
261
|
+
// The platform serves these, so no route of the app's matches them: going there, by a link or a guard's redirect,
|
|
262
|
+
// loads the document instead.
|
|
263
|
+
const PLATFORM_PAGES = /^\/auth(\/|$)/;
|
|
264
|
+
const loadPlatformPagesAsDocuments = (router) => {
|
|
265
|
+
const commit = router.commitLocation;
|
|
266
|
+
router.commitLocation = next => commit(PLATFORM_PAGES.test(next.pathname)
|
|
267
|
+
? { ...next, maskedLocation: undefined, external: true }
|
|
268
|
+
: next);
|
|
269
|
+
};
|
|
270
|
+
// A router built once for the isolate would render the first visitor's user and cached queries into every
|
|
271
|
+
// later visitor's page, and its guards would treat everyone as that visitor.
|
|
272
|
+
const refuseOtherRequests = (router, builtFor) => {
|
|
273
|
+
const load = router.load.bind(router);
|
|
274
|
+
router.load = async (...args) => {
|
|
275
|
+
if (currentHost() !== builtFor) {
|
|
276
|
+
throw new Error('This router was built for another request. Call createZiteRouter inside getRouter, so each request gets its own.');
|
|
277
|
+
}
|
|
278
|
+
return load(...args);
|
|
279
|
+
};
|
|
280
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { authHooksModule } from '../build/placeholders/authHooksModule.js';
|
|
2
|
+
export const AUTH_HOOK_NAMES = [
|
|
3
|
+
'beforeSignUp',
|
|
4
|
+
'beforeSignIn',
|
|
5
|
+
'afterSignUp',
|
|
6
|
+
'afterSignIn',
|
|
7
|
+
'verifySession',
|
|
8
|
+
];
|
|
9
|
+
export const isAuthHookName = (name) => AUTH_HOOK_NAMES.includes(name);
|
|
10
|
+
/** The hooks the app's `zite.auth.ts` defines, by name. */
|
|
11
|
+
export async function loadAuthHooks() {
|
|
12
|
+
if (!authHooksModule)
|
|
13
|
+
return {};
|
|
14
|
+
const hooks = (await authHooksModule()).default?.hooks ?? {};
|
|
15
|
+
return Object.fromEntries(AUTH_HOOK_NAMES.flatMap(name => typeof hooks[name] === 'function'
|
|
16
|
+
? [[name, hooks[name]]]
|
|
17
|
+
: []));
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HostRequestState } from '../types.js';
|
|
2
|
+
/** A platform call a demo refused, which then decides how the request's failure answers. */
|
|
3
|
+
export declare const noteDemoRefusal: (host: HostRequestState | undefined, error: unknown) => void;
|
|
4
|
+
/**
|
|
5
|
+
* As classic's executor outcome: a demo's failure after a refusal is the refusal, and so is a 5xx after the app called
|
|
6
|
+
* out, since a demo holds no account to call with.
|
|
7
|
+
*/
|
|
8
|
+
export declare const failedOnDemo: (host: HostRequestState, response: Response) => boolean;
|
|
9
|
+
export declare const asDemoRefusal: (response: Response) => Response;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Classic's demo answers a call the demo refused with 403 `DEMO_READ_ONLY`, on which the platform's runtime shows the
|
|
2
|
+
// visitor its "not available in the demo" notice (restly's app-runtime demo.ts). A refused call reaches a Start app as
|
|
3
|
+
// an error it may catch or rethrow, so the answer keeps its body and says so in a header.
|
|
4
|
+
import { DEMO_UNAVAILABLE_MESSAGE } from '../platform/data/dispatch.js';
|
|
5
|
+
import { DEMO_READ_ONLY_CODE, ERROR_CODE_HEADER } from '../protocol.js';
|
|
6
|
+
/** A platform call a demo refused, which then decides how the request's failure answers. */
|
|
7
|
+
export const noteDemoRefusal = (host, error) => {
|
|
8
|
+
if (host?.mode === 'demo' &&
|
|
9
|
+
error instanceof Error &&
|
|
10
|
+
error.message.includes(DEMO_UNAVAILABLE_MESSAGE))
|
|
11
|
+
host.demoRefused = true;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* As classic's executor outcome: a demo's failure after a refusal is the refusal, and so is a 5xx after the app called
|
|
15
|
+
* out, since a demo holds no account to call with.
|
|
16
|
+
*/
|
|
17
|
+
export const failedOnDemo = (host, response) => host.mode === 'demo' &&
|
|
18
|
+
response.status >= 400 &&
|
|
19
|
+
(!!host.demoRefused || (response.status >= 500 && !!host.fetches?.length));
|
|
20
|
+
export const asDemoRefusal = (response) => {
|
|
21
|
+
const headers = new Headers(response.headers);
|
|
22
|
+
headers.set(ERROR_CODE_HEADER, DEMO_READ_ONLY_CODE);
|
|
23
|
+
return new Response(response.body, { status: 403, headers });
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The generated server entry's first import: an SDK client an app builds at load (`new OpenAI()` at a module's top
|
|
2
|
+
// level) keeps the fetch it found then, so the wrapper must already be in place, and so must process.env's view.
|
|
3
|
+
import { watchOutboundFetches } from '../platform/outbound.js';
|
|
4
|
+
import { installRequestEnv } from './requestEnv.js';
|
|
5
|
+
watchOutboundFetches();
|
|
6
|
+
installRequestEnv();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type AnySerializationAdapter } from
|
|
2
|
-
import type { SSROption } from
|
|
3
|
-
import type { AnyFunctionMiddleware, AnyRequestMiddleware, StartInstance } from
|
|
1
|
+
import { type AnySerializationAdapter } from '@tanstack/react-router';
|
|
2
|
+
import type { SSROption } from '@tanstack/router-core';
|
|
3
|
+
import type { AnyFunctionMiddleware, AnyRequestMiddleware, StartInstance } from '@tanstack/start-client-core';
|
|
4
4
|
/**
|
|
5
5
|
* The start instance every Start app builds with: the platform's middleware and
|
|
6
6
|
* adapters first, then whatever the app's own `src/start.ts` sets.
|
|
7
7
|
*/
|
|
8
8
|
export declare function createZiteStart<const TAdapters extends ReadonlyArray<AnySerializationAdapter> = [], TDefaultSsr extends SSROption = SSROption, const TRequest extends ReadonlyArray<AnyRequestMiddleware> = [], const TFunction extends ReadonlyArray<AnyFunctionMiddleware> = []>(app?: StartInstance<TAdapters, TDefaultSsr, TRequest, TFunction>): StartInstance<readonly [import("@tanstack/react-router").SerializationAdapter<Error, {
|
|
9
|
-
|
|
9
|
+
stack?: string | undefined;
|
|
10
|
+
code: "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "RATE_LIMITED" | "INTERNAL_ERROR";
|
|
10
11
|
message: string;
|
|
11
|
-
}, never>, ...TAdapters], TDefaultSsr, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, ...TRequest], readonly [import("@tanstack/react-start").FunctionMiddlewareAfterClient<{}, unknown, undefined, undefined, undefined>, import("@tanstack/react-start").FunctionMiddlewareAfterServer<{}, unknown, undefined, undefined, undefined, undefined, undefined>, ...TFunction]>;
|
|
12
|
+
}, never>, ...TAdapters], TDefaultSsr, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, ...TRequest], readonly [import("@tanstack/react-start").FunctionMiddlewareAfterClient<{}, unknown, undefined, undefined, undefined>, import("@tanstack/react-start").FunctionMiddlewareAfterServer<{}, unknown, undefined, undefined, undefined, undefined, undefined>, ...TFunction]>;
|