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,10 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SourceDir } from '../../sourceRoots.js';
|
|
2
2
|
export declare const START_SERVER_ENTRY = ".zite/server.ts";
|
|
3
3
|
export declare const START_INSTANCE_ENTRY = ".zite/start.ts";
|
|
4
|
-
export type StartTarget =
|
|
4
|
+
export type StartTarget = 'cloudflare' | 'node';
|
|
5
5
|
/**
|
|
6
6
|
* The server entry every Start app builds with. Platform-owned: regenerated,
|
|
7
|
-
* never edited. On Workers it's an entrypoint the host can
|
|
7
|
+
* never edited. On Workers it's an entrypoint, so the host can hand each fetch
|
|
8
|
+
* its props; on Node, a plain fetch handler.
|
|
8
9
|
*/
|
|
9
10
|
export declare const renderStartServerEntry: (target?: StartTarget) => string;
|
|
10
11
|
/** The start instance: the platform's middleware, then the app's own `src/start.ts` when it has one. */
|
|
@@ -13,8 +14,12 @@ export declare const hasAppStart: (appDir: string) => boolean;
|
|
|
13
14
|
/** Writes `file` under `appDir` when its content differs. Returns whether it wrote. */
|
|
14
15
|
export declare const writeIfChanged: (appDir: string, file: string, content: string) => boolean;
|
|
15
16
|
export declare const isStartAppDir: (appPath: string) => boolean;
|
|
17
|
+
export declare const workspaceHasStartApps: () => boolean;
|
|
16
18
|
export declare function regenerateStartEntries(app: SourceDir): void;
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* App modules that mention createAutomation or createProviderTrigger: what the workflow registry imports. Describe
|
|
21
|
+
* decides what each one really exports.
|
|
22
|
+
*/
|
|
18
23
|
export declare function workflowFiles(appDir: string): string[];
|
|
19
24
|
/** The registry zite() builds in place of zitejs's empty one. */
|
|
20
25
|
export declare const renderWorkflowModules: (appDir: string, files: string[]) => string;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
2
|
-
import { dirname, join, relative } from
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
const
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
|
+
import { listSourceDirs } from '../../sourceRoots.js';
|
|
4
|
+
export const START_SERVER_ENTRY = '.zite/server.ts';
|
|
5
|
+
export const START_INSTANCE_ENTRY = '.zite/start.ts';
|
|
6
|
+
const APP_START_FILES = ['src/start.ts', 'src/start.tsx'];
|
|
6
7
|
/**
|
|
7
8
|
* The server entry every Start app builds with. Platform-owned: regenerated,
|
|
8
|
-
* never edited. On Workers it's an entrypoint the host can
|
|
9
|
+
* never edited. On Workers it's an entrypoint, so the host can hand each fetch
|
|
10
|
+
* its props; on Node, a plain fetch handler.
|
|
9
11
|
*/
|
|
10
|
-
export const renderStartServerEntry = (target =
|
|
12
|
+
export const renderStartServerEntry = (target = 'cloudflare') => target === 'cloudflare'
|
|
11
13
|
? `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
14
|
+
// First, so an SDK client an app module builds as it loads gets zitejs's fetch.
|
|
15
|
+
import 'zitejs/start/fetch';
|
|
12
16
|
import handler from '@tanstack/react-start/server-entry';
|
|
13
17
|
import { createZiteWorker } from 'zitejs/start/worker';
|
|
14
18
|
import { getRouter } from '../src/router';
|
|
@@ -16,30 +20,34 @@ import { getRouter } from '../src/router';
|
|
|
16
20
|
export default createZiteWorker({ handler, getRouter });
|
|
17
21
|
`
|
|
18
22
|
: `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
23
|
+
// First, so an SDK client an app module builds as it loads gets zitejs's fetch.
|
|
24
|
+
import 'zitejs/start/fetch';
|
|
19
25
|
import handler, { createServerEntry } from '@tanstack/react-start/server-entry';
|
|
20
26
|
import { createZiteFetch } from 'zitejs/start/server';
|
|
21
27
|
import { getRouter } from '../src/router';
|
|
22
28
|
|
|
23
29
|
export default createServerEntry({ fetch: createZiteFetch({ handler, getRouter }) });
|
|
24
30
|
`;
|
|
31
|
+
const START_INSTANCE_HEADER = `// Generated by zitejs for TanStack Start apps. The platform owns this file.
|
|
32
|
+
// TanStack's start-instance file, the only place Start 1.169 registers global middleware. Generated so the platform's
|
|
33
|
+
// CSRF check and run log can't be dropped; the app's own src/start.ts composes after them.
|
|
34
|
+
`;
|
|
25
35
|
/** The start instance: the platform's middleware, then the app's own `src/start.ts` when it has one. */
|
|
26
36
|
export const renderStartInstance = (hasAppStart) => hasAppStart
|
|
27
|
-
?
|
|
28
|
-
import { createZiteStart } from 'zitejs/start/instance';
|
|
37
|
+
? `${START_INSTANCE_HEADER}import { createZiteStart } from 'zitejs/start/instance';
|
|
29
38
|
import { startInstance as app } from '../src/start';
|
|
30
39
|
|
|
31
40
|
export const startInstance = createZiteStart(app);
|
|
32
41
|
`
|
|
33
|
-
:
|
|
34
|
-
import { createZiteStart } from 'zitejs/start/instance';
|
|
42
|
+
: `${START_INSTANCE_HEADER}import { createZiteStart } from 'zitejs/start/instance';
|
|
35
43
|
|
|
36
44
|
export const startInstance = createZiteStart();
|
|
37
45
|
`;
|
|
38
|
-
export const hasAppStart = (appDir) => APP_START_FILES.some(
|
|
46
|
+
export const hasAppStart = (appDir) => APP_START_FILES.some(file => existsSync(join(appDir, file)));
|
|
39
47
|
/** Writes `file` under `appDir` when its content differs. Returns whether it wrote. */
|
|
40
48
|
export const writeIfChanged = (appDir, file, content) => {
|
|
41
49
|
const target = join(appDir, file);
|
|
42
|
-
if (existsSync(target) && readFileSync(target,
|
|
50
|
+
if (existsSync(target) && readFileSync(target, 'utf-8') === content)
|
|
43
51
|
return false;
|
|
44
52
|
mkdirSync(dirname(target), { recursive: true });
|
|
45
53
|
writeFileSync(target, content);
|
|
@@ -47,13 +55,15 @@ export const writeIfChanged = (appDir, file, content) => {
|
|
|
47
55
|
};
|
|
48
56
|
export const isStartAppDir = (appPath) => {
|
|
49
57
|
try {
|
|
50
|
-
return JSON.parse(readFileSync(join(appPath,
|
|
58
|
+
return (JSON.parse(readFileSync(join(appPath, 'zite.config.json'), 'utf-8'))
|
|
59
|
+
?.runtime === 'start');
|
|
51
60
|
}
|
|
52
61
|
catch {
|
|
53
62
|
return false;
|
|
54
63
|
}
|
|
55
64
|
};
|
|
56
65
|
const isStartApp = (app) => isStartAppDir(app.path);
|
|
66
|
+
export const workspaceHasStartApps = () => listSourceDirs().some(isStartApp);
|
|
57
67
|
export function regenerateStartEntries(app) {
|
|
58
68
|
if (!isStartApp(app))
|
|
59
69
|
return;
|
|
@@ -68,26 +78,32 @@ export function regenerateStartEntries(app) {
|
|
|
68
78
|
}
|
|
69
79
|
const SOURCE_FILE = /\.[mc]?[jt]sx?$/;
|
|
70
80
|
const NOT_APP_CODE = /(\.(test|spec)\.[^.]+|\.d\.ts|routeTree\.gen\.ts)$/;
|
|
71
|
-
|
|
81
|
+
const REGISTERED = /create(Automation|ProviderTrigger)/;
|
|
82
|
+
/**
|
|
83
|
+
* App modules that mention createAutomation or createProviderTrigger: what the workflow registry imports. Describe
|
|
84
|
+
* decides what each one really exports.
|
|
85
|
+
*/
|
|
72
86
|
export function workflowFiles(appDir) {
|
|
73
87
|
const found = [];
|
|
74
88
|
const walk = (dir) => {
|
|
75
89
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
76
90
|
const full = join(dir, entry.name);
|
|
77
91
|
if (entry.isDirectory()) {
|
|
78
|
-
if (entry.name !==
|
|
92
|
+
if (entry.name !== 'node_modules')
|
|
79
93
|
walk(full);
|
|
80
94
|
}
|
|
81
|
-
else if (SOURCE_FILE.test(entry.name) &&
|
|
82
|
-
|
|
95
|
+
else if (SOURCE_FILE.test(entry.name) &&
|
|
96
|
+
!NOT_APP_CODE.test(entry.name) &&
|
|
97
|
+
REGISTERED.test(readFileSync(full, 'utf-8'))) {
|
|
98
|
+
found.push(relative(appDir, full).split('\\').join('/'));
|
|
83
99
|
}
|
|
84
100
|
}
|
|
85
101
|
};
|
|
86
|
-
if (existsSync(join(appDir,
|
|
87
|
-
walk(join(appDir,
|
|
102
|
+
if (existsSync(join(appDir, 'src')))
|
|
103
|
+
walk(join(appDir, 'src'));
|
|
88
104
|
return found.sort();
|
|
89
105
|
}
|
|
90
106
|
/** The registry zite() builds in place of zitejs's empty one. */
|
|
91
107
|
export const renderWorkflowModules = (appDir, files) => `export const workflowModules = {\n${files
|
|
92
|
-
.map(
|
|
93
|
-
.join(
|
|
108
|
+
.map(file => ` ${JSON.stringify(file)}: () => import(${JSON.stringify(join(appDir, file))}),`)
|
|
109
|
+
.join('\n')}\n};\n`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devAppId: string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devSignIn: Readonly<Record<string, string>> | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What the build knows of one module: Rollup's and Rolldown's `getModuleInfo`. */
|
|
2
|
+
export type GraphModule = {
|
|
3
|
+
code: string | null;
|
|
4
|
+
importedIds: readonly string[];
|
|
5
|
+
dynamicallyImportedIds: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export type ModuleGraph = (id: string) => GraphModule | null;
|
|
8
|
+
/** The hash of `entry`'s module and everything it reaches, as `graph` has them. */
|
|
9
|
+
export declare function registrationHash(appDir: string, entry: string, graph: ModuleGraph): string;
|
|
10
|
+
/** `module -> registration hash` for each of `entries`, keyed by its app-relative path, as the workflow registry is. */
|
|
11
|
+
export declare const registrationHashes: (appDir: string, entries: readonly string[], graph: ModuleGraph) => Record<string, string>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// A provider trigger's registration hash, which publish compares to register the trigger again exactly when the code
|
|
2
|
+
// its module can run changes. Read from the bundler's module graph as the build leaves it: every app file the module
|
|
3
|
+
// imports, statically or with `import()`, as the app wrote it, and the version of each package those files import.
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
const sha256 = (text) => createHash('sha256').update(text).digest('hex');
|
|
8
|
+
const PACKAGE_IN_PATH = /^(.*[\\/]node_modules[\\/])((?:@[^\\/]+[\\/])?[^\\/]+)/;
|
|
9
|
+
const BARE_SPECIFIER = /^((?:@[^/]+\/)?[^/]+)/;
|
|
10
|
+
const versionAt = (manifest) => {
|
|
11
|
+
try {
|
|
12
|
+
const { version } = JSON.parse(readFileSync(manifest, 'utf-8'));
|
|
13
|
+
return typeof version === 'string' ? version : undefined;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
// An external package, from the app's node_modules or the workspace's above it, as Node finds it.
|
|
20
|
+
const installedVersion = (appDir, name) => {
|
|
21
|
+
for (let dir = appDir;; dir = path.dirname(dir)) {
|
|
22
|
+
const manifest = path.join(dir, 'node_modules', name, 'package.json');
|
|
23
|
+
if (existsSync(manifest))
|
|
24
|
+
return versionAt(manifest);
|
|
25
|
+
if (path.dirname(dir) === dir)
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** What a module adds to the hash, and whether the walk goes on through its imports. */
|
|
30
|
+
const pieceOf = (appDir, id, module) => {
|
|
31
|
+
const file = id.split('?')[0];
|
|
32
|
+
const inPackage = PACKAGE_IN_PATH.exec(file);
|
|
33
|
+
if (inPackage) {
|
|
34
|
+
const name = inPackage[2].split('\\').join('/');
|
|
35
|
+
return {
|
|
36
|
+
piece: `package ${name}@${versionAt(path.join(inPackage[1], inPackage[2], 'package.json')) ?? 'unknown'}`,
|
|
37
|
+
follow: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (id.startsWith('\0') || id.startsWith('virtual:'))
|
|
41
|
+
return {
|
|
42
|
+
piece: `virtual ${id} ${sha256(module?.code ?? '')}`,
|
|
43
|
+
follow: false,
|
|
44
|
+
};
|
|
45
|
+
if (!path.isAbsolute(file)) {
|
|
46
|
+
// A builtin is its name; an external package its name and the version installed.
|
|
47
|
+
const name = id.includes(':') ? undefined : BARE_SPECIFIER.exec(id)?.[1];
|
|
48
|
+
const version = name && installedVersion(appDir, name);
|
|
49
|
+
return {
|
|
50
|
+
piece: version ? `package ${name}@${version}` : `external ${id}`,
|
|
51
|
+
follow: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Paths relative to the app, so where the build ran doesn't count; the file as written, so the build's own
|
|
55
|
+
// transforms don't either.
|
|
56
|
+
const relative = path.relative(appDir, file).split(path.sep).join('/');
|
|
57
|
+
const query = id.slice(file.length);
|
|
58
|
+
let source;
|
|
59
|
+
try {
|
|
60
|
+
source = readFileSync(file);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
source = module?.code ?? '';
|
|
64
|
+
}
|
|
65
|
+
return { piece: `file ${relative}${query} ${sha256(source)}`, follow: true };
|
|
66
|
+
};
|
|
67
|
+
/** The hash of `entry`'s module and everything it reaches, as `graph` has them. */
|
|
68
|
+
export function registrationHash(appDir, entry, graph) {
|
|
69
|
+
const pieces = new Set();
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
const pending = [entry];
|
|
72
|
+
for (let id = pending.pop(); id !== undefined; id = pending.pop()) {
|
|
73
|
+
if (seen.has(id))
|
|
74
|
+
continue;
|
|
75
|
+
seen.add(id);
|
|
76
|
+
const module = graph(id);
|
|
77
|
+
const { piece, follow } = pieceOf(appDir, id, module);
|
|
78
|
+
pieces.add(piece);
|
|
79
|
+
if (follow && module)
|
|
80
|
+
pending.push(...module.importedIds, ...module.dynamicallyImportedIds);
|
|
81
|
+
}
|
|
82
|
+
return sha256([...pieces].sort().join('\n'));
|
|
83
|
+
}
|
|
84
|
+
/** `module -> registration hash` for each of `entries`, keyed by its app-relative path, as the workflow registry is. */
|
|
85
|
+
export const registrationHashes = (appDir, entries, graph) => Object.fromEntries(entries.map(entry => [
|
|
86
|
+
path.relative(appDir, entry.split('?')[0]).split(path.sep).join('/'),
|
|
87
|
+
registrationHash(appDir, entry, graph),
|
|
88
|
+
]));
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `axios` resolves to inside `@slack/web-api` in a Start server build, as classic's prebundle shims it: the axios
|
|
3
|
+
* surface Slack uses, on workerd's fetch. Real axios's fetch adapter sends Slack's `form-data` upload bodies as the text
|
|
4
|
+
* "[object FormData]". The app's own `axios` stays real axios.
|
|
5
|
+
*/
|
|
6
|
+
type HeaderMap = Record<string, string>;
|
|
7
|
+
type Interceptor<T> = {
|
|
8
|
+
fulfilled: (value: T) => T | Promise<T>;
|
|
9
|
+
rejected?: (error: unknown) => unknown;
|
|
10
|
+
};
|
|
11
|
+
export type AxiosRequestConfig = {
|
|
12
|
+
url?: string;
|
|
13
|
+
baseURL?: string;
|
|
14
|
+
method?: string;
|
|
15
|
+
params?: string | URLSearchParams | Record<string, unknown>;
|
|
16
|
+
data?: unknown;
|
|
17
|
+
headers?: Record<string, unknown>;
|
|
18
|
+
transformRequest?: TransformRequest | TransformRequest[];
|
|
19
|
+
responseType?: 'arraybuffer' | 'blob' | 'text' | 'stream' | 'json';
|
|
20
|
+
timeout?: number;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
maxRedirects?: number;
|
|
23
|
+
validateStatus?: (status: number) => boolean;
|
|
24
|
+
[option: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
type TransformRequest = (data: unknown, headers: HeaderMap) => unknown;
|
|
27
|
+
export type AxiosResponse = {
|
|
28
|
+
data: unknown;
|
|
29
|
+
status: number;
|
|
30
|
+
statusText: string;
|
|
31
|
+
headers: HeaderMap;
|
|
32
|
+
config: AxiosRequestConfig;
|
|
33
|
+
request: RequestInit;
|
|
34
|
+
};
|
|
35
|
+
export declare class AxiosError extends Error {
|
|
36
|
+
readonly code?: string | undefined;
|
|
37
|
+
readonly config?: AxiosRequestConfig | undefined;
|
|
38
|
+
readonly request?: RequestInit | undefined;
|
|
39
|
+
readonly response?: AxiosResponse | undefined;
|
|
40
|
+
readonly isAxiosError = true;
|
|
41
|
+
constructor(message: string, code?: string | undefined, config?: AxiosRequestConfig | undefined, request?: RequestInit | undefined, response?: AxiosResponse | undefined);
|
|
42
|
+
}
|
|
43
|
+
declare class CanceledError extends AxiosError {
|
|
44
|
+
constructor(message?: string);
|
|
45
|
+
}
|
|
46
|
+
declare class InterceptorManager<T> {
|
|
47
|
+
readonly handlers: (Interceptor<T> | null)[];
|
|
48
|
+
use(fulfilled: Interceptor<T>['fulfilled'], rejected?: Interceptor<T>['rejected']): number;
|
|
49
|
+
eject(id: number): void;
|
|
50
|
+
clear(): void;
|
|
51
|
+
}
|
|
52
|
+
type AxiosInstance = {
|
|
53
|
+
(configOrUrl: string | AxiosRequestConfig, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
54
|
+
defaults: AxiosRequestConfig & {
|
|
55
|
+
headers: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
interceptors: {
|
|
58
|
+
request: InterceptorManager<AxiosRequestConfig>;
|
|
59
|
+
response: InterceptorManager<AxiosResponse>;
|
|
60
|
+
};
|
|
61
|
+
getUri(config?: AxiosRequestConfig): string;
|
|
62
|
+
request(configOrUrl: string | AxiosRequestConfig, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
63
|
+
get(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
64
|
+
delete(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
65
|
+
head(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
66
|
+
options(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
67
|
+
post(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
68
|
+
put(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
69
|
+
patch(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
70
|
+
create(config?: AxiosRequestConfig): AxiosInstance;
|
|
71
|
+
isAxiosError(value: unknown): value is AxiosError;
|
|
72
|
+
AxiosError: typeof AxiosError;
|
|
73
|
+
CanceledError: typeof CanceledError;
|
|
74
|
+
};
|
|
75
|
+
declare const axios: AxiosInstance;
|
|
76
|
+
export default axios;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `axios` resolves to inside `@slack/web-api` in a Start server build, as classic's prebundle shims it: the axios
|
|
3
|
+
* surface Slack uses, on workerd's fetch. Real axios's fetch adapter sends Slack's `form-data` upload bodies as the text
|
|
4
|
+
* "[object FormData]". The app's own `axios` stays real axios.
|
|
5
|
+
*/
|
|
6
|
+
export class AxiosError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
config;
|
|
9
|
+
request;
|
|
10
|
+
response;
|
|
11
|
+
isAxiosError = true;
|
|
12
|
+
constructor(message, code, config, request, response) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.request = request;
|
|
17
|
+
this.response = response;
|
|
18
|
+
this.name = 'AxiosError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class CanceledError extends AxiosError {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message ?? 'canceled', 'ERR_CANCELED');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// The per-method header buckets axios keeps beside the headers themselves.
|
|
27
|
+
const HEADER_BUCKETS = [
|
|
28
|
+
'common',
|
|
29
|
+
'get',
|
|
30
|
+
'post',
|
|
31
|
+
'put',
|
|
32
|
+
'patch',
|
|
33
|
+
'delete',
|
|
34
|
+
'head',
|
|
35
|
+
'options',
|
|
36
|
+
];
|
|
37
|
+
const isRecord = (value) => typeof value === 'object' && value !== null;
|
|
38
|
+
const isNodeFormData = (body) => isRecord(body) &&
|
|
39
|
+
typeof body.getHeaders === 'function' &&
|
|
40
|
+
typeof body.getBuffer === 'function';
|
|
41
|
+
const buildURL = (url, params) => {
|
|
42
|
+
if (!params)
|
|
43
|
+
return url;
|
|
44
|
+
const entries = typeof params === 'string' || params instanceof URLSearchParams
|
|
45
|
+
? new URLSearchParams(params)
|
|
46
|
+
: new URLSearchParams(Object.entries(params).flatMap(([key, value]) => value === undefined || value === null ? [] : [[key, String(value)]]));
|
|
47
|
+
const query = entries.toString();
|
|
48
|
+
return query ? `${url}${url.includes('?') ? '&' : '?'}${query}` : url;
|
|
49
|
+
};
|
|
50
|
+
const mergeHeaders = (...sources) => {
|
|
51
|
+
const result = {};
|
|
52
|
+
for (const source of sources) {
|
|
53
|
+
if (!source)
|
|
54
|
+
continue;
|
|
55
|
+
const entries = source instanceof Headers
|
|
56
|
+
? [...source.entries()]
|
|
57
|
+
: isRecord(source)
|
|
58
|
+
? Object.entries(source)
|
|
59
|
+
: [];
|
|
60
|
+
for (const [key, value] of entries) {
|
|
61
|
+
if (value !== undefined && value !== null)
|
|
62
|
+
result[key.toLowerCase()] = value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
const joinURL = (baseURL, url = '') => baseURL && !url.startsWith('http')
|
|
68
|
+
? `${baseURL.replace(/\/$/, '')}/${url.replace(/^\//, '')}`
|
|
69
|
+
: url;
|
|
70
|
+
const withCharset = (contentType) => /charset=/i.test(contentType) ? contentType : `${contentType}; charset=utf-8`;
|
|
71
|
+
const dispatchRequest = async (config) => {
|
|
72
|
+
const url = buildURL(joinURL(config.baseURL, config.url), config.params);
|
|
73
|
+
const method = (config.method ?? 'GET').toUpperCase();
|
|
74
|
+
const buckets = config.headers ?? {};
|
|
75
|
+
const merged = mergeHeaders(buckets.common, buckets[method.toLowerCase()], buckets);
|
|
76
|
+
const headers = {};
|
|
77
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
78
|
+
if (!HEADER_BUCKETS.includes(key) && !isRecord(value))
|
|
79
|
+
headers[key] = String(value);
|
|
80
|
+
}
|
|
81
|
+
let body = config.data;
|
|
82
|
+
const transforms = config.transformRequest === undefined
|
|
83
|
+
? []
|
|
84
|
+
: [config.transformRequest].flat();
|
|
85
|
+
for (const transform of transforms)
|
|
86
|
+
body = transform(body, headers);
|
|
87
|
+
if (isNodeFormData(body)) {
|
|
88
|
+
Object.assign(headers, body.getHeaders());
|
|
89
|
+
if (headers['content-type'])
|
|
90
|
+
headers['content-type'] = withCharset(headers['content-type']);
|
|
91
|
+
body = body.getBuffer();
|
|
92
|
+
}
|
|
93
|
+
else if (typeof body === 'string') {
|
|
94
|
+
headers['content-type'] = withCharset(headers['content-type'] ?? 'application/x-www-form-urlencoded');
|
|
95
|
+
}
|
|
96
|
+
else if (isRecord(body) &&
|
|
97
|
+
!(body instanceof ArrayBuffer) &&
|
|
98
|
+
!ArrayBuffer.isView(body) &&
|
|
99
|
+
!(body instanceof ReadableStream) &&
|
|
100
|
+
!(body instanceof Blob) &&
|
|
101
|
+
!(body instanceof FormData) &&
|
|
102
|
+
!(body instanceof URLSearchParams)) {
|
|
103
|
+
// As Slack's serializer would: its Web API reads form fields, with anything structured JSON-encoded.
|
|
104
|
+
const params = new URLSearchParams();
|
|
105
|
+
for (const [key, value] of Object.entries(body)) {
|
|
106
|
+
if (value === undefined || value === null)
|
|
107
|
+
continue;
|
|
108
|
+
params.append(key, typeof value === 'string' ||
|
|
109
|
+
typeof value === 'number' ||
|
|
110
|
+
typeof value === 'boolean'
|
|
111
|
+
? String(value)
|
|
112
|
+
: JSON.stringify(value));
|
|
113
|
+
}
|
|
114
|
+
body = params.toString();
|
|
115
|
+
headers['content-type'] ??=
|
|
116
|
+
'application/x-www-form-urlencoded; charset=utf-8';
|
|
117
|
+
}
|
|
118
|
+
const init = {
|
|
119
|
+
method,
|
|
120
|
+
headers,
|
|
121
|
+
body: method === 'GET' || method === 'HEAD'
|
|
122
|
+
? undefined
|
|
123
|
+
: body,
|
|
124
|
+
signal: config.signal,
|
|
125
|
+
redirect: config.maxRedirects === 0 ? 'manual' : 'follow',
|
|
126
|
+
};
|
|
127
|
+
let timer;
|
|
128
|
+
if (config.timeout && config.timeout > 0 && !config.signal) {
|
|
129
|
+
const controller = new AbortController();
|
|
130
|
+
init.signal = controller.signal;
|
|
131
|
+
timer = setTimeout(() => controller.abort(), config.timeout);
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const res = await fetch(url, init);
|
|
135
|
+
const responseHeaders = {};
|
|
136
|
+
res.headers.forEach((value, key) => {
|
|
137
|
+
responseHeaders[key] = value;
|
|
138
|
+
});
|
|
139
|
+
let data;
|
|
140
|
+
if (config.responseType === 'arraybuffer')
|
|
141
|
+
data = await res.arrayBuffer();
|
|
142
|
+
else if (config.responseType === 'blob')
|
|
143
|
+
data = await res.blob();
|
|
144
|
+
else if (config.responseType === 'text')
|
|
145
|
+
data = await res.text();
|
|
146
|
+
else if (config.responseType === 'stream')
|
|
147
|
+
data = res.body;
|
|
148
|
+
else if ((res.headers.get('content-type') ?? '').includes('application/json'))
|
|
149
|
+
data = await res.json();
|
|
150
|
+
else {
|
|
151
|
+
const text = await res.text();
|
|
152
|
+
try {
|
|
153
|
+
data = JSON.parse(text);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
data = text;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const response = {
|
|
160
|
+
data,
|
|
161
|
+
status: res.status,
|
|
162
|
+
statusText: res.statusText,
|
|
163
|
+
headers: responseHeaders,
|
|
164
|
+
config,
|
|
165
|
+
request: init,
|
|
166
|
+
};
|
|
167
|
+
const validateStatus = config.validateStatus ??
|
|
168
|
+
((status) => status >= 200 && status < 300);
|
|
169
|
+
if (!validateStatus(res.status)) {
|
|
170
|
+
throw new AxiosError(`Request failed with status code ${res.status}`, 'ERR_BAD_RESPONSE', config, init, response);
|
|
171
|
+
}
|
|
172
|
+
return response;
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (error instanceof AxiosError)
|
|
176
|
+
throw error;
|
|
177
|
+
if (error instanceof Error && error.name === 'AbortError')
|
|
178
|
+
throw new AxiosError('timeout exceeded', 'ECONNABORTED', config);
|
|
179
|
+
throw new AxiosError(error instanceof Error ? error.message : 'Network Error', 'ERR_NETWORK', config);
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
if (timer)
|
|
183
|
+
clearTimeout(timer);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
class InterceptorManager {
|
|
187
|
+
handlers = [];
|
|
188
|
+
use(fulfilled, rejected) {
|
|
189
|
+
this.handlers.push({ fulfilled, rejected });
|
|
190
|
+
return this.handlers.length - 1;
|
|
191
|
+
}
|
|
192
|
+
eject(id) {
|
|
193
|
+
this.handlers[id] = null;
|
|
194
|
+
}
|
|
195
|
+
clear() {
|
|
196
|
+
this.handlers.length = 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const createInstance = (defaultConfig = {}) => {
|
|
200
|
+
const defaults = { ...defaultConfig, headers: { ...defaultConfig.headers } };
|
|
201
|
+
// Slack clears `defaults.headers.post['Content-Type']`, so every bucket exists.
|
|
202
|
+
for (const bucket of HEADER_BUCKETS)
|
|
203
|
+
defaults.headers[bucket] ??= {};
|
|
204
|
+
const interceptors = {
|
|
205
|
+
request: new InterceptorManager(),
|
|
206
|
+
response: new InterceptorManager(),
|
|
207
|
+
};
|
|
208
|
+
const request = async (configOrUrl, config) => {
|
|
209
|
+
const given = typeof configOrUrl === 'string'
|
|
210
|
+
? { ...config, url: configOrUrl }
|
|
211
|
+
: { ...configOrUrl };
|
|
212
|
+
let merged = {
|
|
213
|
+
...defaults,
|
|
214
|
+
...given,
|
|
215
|
+
headers: mergeHeaders(defaults.headers, given.headers),
|
|
216
|
+
};
|
|
217
|
+
// As axios: request interceptors run last-registered first. Slack serializes every request body in one.
|
|
218
|
+
for (const interceptor of [...interceptors.request.handlers].reverse()) {
|
|
219
|
+
if (interceptor)
|
|
220
|
+
merged = await interceptor.fulfilled(merged);
|
|
221
|
+
}
|
|
222
|
+
let response = await dispatchRequest(merged);
|
|
223
|
+
for (const interceptor of interceptors.response.handlers) {
|
|
224
|
+
if (interceptor)
|
|
225
|
+
response = await interceptor.fulfilled(response);
|
|
226
|
+
}
|
|
227
|
+
return response;
|
|
228
|
+
};
|
|
229
|
+
const withData = (method) => (url, data, config) => request({ ...config, method, url, data });
|
|
230
|
+
const withoutData = (method) => (url, config) => request({ ...config, method, url });
|
|
231
|
+
return Object.assign(request, {
|
|
232
|
+
defaults,
|
|
233
|
+
interceptors,
|
|
234
|
+
getUri: (config = {}) => {
|
|
235
|
+
const merged = { ...defaults, ...config };
|
|
236
|
+
return buildURL(joinURL(merged.baseURL, merged.url), merged.params);
|
|
237
|
+
},
|
|
238
|
+
request,
|
|
239
|
+
get: withoutData('get'),
|
|
240
|
+
delete: withoutData('delete'),
|
|
241
|
+
head: withoutData('head'),
|
|
242
|
+
options: withoutData('options'),
|
|
243
|
+
post: withData('post'),
|
|
244
|
+
put: withData('put'),
|
|
245
|
+
patch: withData('patch'),
|
|
246
|
+
create: (config = {}) => createInstance({ ...defaults, ...config }),
|
|
247
|
+
isAxiosError: (value) => isRecord(value) && value.isAxiosError === true,
|
|
248
|
+
AxiosError,
|
|
249
|
+
CanceledError,
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
const axios = createInstance();
|
|
253
|
+
export default axios;
|