devflare 1.0.0-next.2 → 1.0.0-next.21
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/LLM.md +15743 -1751
- package/README.md +383 -605
- package/bin/devflare.js +14 -4
- package/dist/account-05zgta47.js +475 -0
- package/dist/account-0evqkmnc.js +475 -0
- package/dist/account-0v11zbzk.js +475 -0
- package/dist/account-2w85efas.js +475 -0
- package/dist/account-61gw9s7t.js +475 -0
- package/dist/account-65sk9q34.js +475 -0
- package/dist/account-77vx7q2f.js +475 -0
- package/dist/account-7z38mgqf.js +475 -0
- package/dist/account-8wgprpbt.js +475 -0
- package/dist/account-9gt3tej1.js +475 -0
- package/dist/account-b2ag1esh.js +475 -0
- package/dist/account-bxtcz61a.js +475 -0
- package/dist/account-d43d1eqs.js +475 -0
- package/dist/account-dtndtbad.js +475 -0
- package/dist/account-e95v7f4s.js +475 -0
- package/dist/account-fbyyptg7.js +475 -0
- package/dist/account-gnzhz1c9.js +475 -0
- package/dist/account-gyfqg964.js +475 -0
- package/dist/account-m6jq6fnp.js +475 -0
- package/dist/account-mvnfagh9.js +475 -0
- package/dist/account-p0crq2gh.js +475 -0
- package/dist/account-q6pvs9d9.js +475 -0
- package/dist/account-qkcevx7a.js +475 -0
- package/dist/account-rp4zbvw1.js +475 -0
- package/dist/account-txwqg1rx.js +475 -0
- package/dist/account-w5n5bjh2.js +475 -0
- package/dist/account-zd61t0ey.js +475 -0
- package/dist/api-11gkk043.js +33 -0
- package/dist/api-2n6dd2ws.js +33 -0
- package/dist/api-dbxvch9h.js +33 -0
- package/dist/api-p9hf69kr.js +33 -0
- package/dist/api-r10j00ev.js +33 -0
- package/dist/api-senf2569.js +33 -0
- package/dist/api-swcgnp72.js +33 -0
- package/dist/api-th82mps4.js +27 -0
- package/dist/bridge/client.d.ts +34 -6
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +3 -3
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +73 -0
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/protocol.d.ts +1 -1
- package/dist/bridge/protocol.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +9 -11
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/serialization.d.ts +36 -16
- package/dist/bridge/serialization.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +2 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts +53 -0
- package/dist/bridge/v2/body-streams.d.ts.map +1 -0
- package/dist/bridge/v2/codec.d.ts +106 -0
- package/dist/bridge/v2/codec.d.ts.map +1 -0
- package/dist/bridge/v2/control-messages.d.ts +51 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/legacy-protocol.d.ts +146 -0
- package/dist/bridge/v2/legacy-protocol.d.ts.map +1 -0
- package/dist/bridge/v2/legacy-serialization.d.ts +103 -0
- package/dist/bridge/v2/legacy-serialization.d.ts.map +1 -0
- package/dist/bridge/v2/serialization.d.ts +48 -0
- package/dist/bridge/v2/serialization.d.ts.map +1 -0
- package/dist/bridge/v2/transport.d.ts +31 -0
- package/dist/bridge/v2/transport.d.ts.map +1 -0
- package/dist/bridge/v2/value-codec.d.ts +61 -0
- package/dist/bridge/v2/value-codec.d.ts.map +1 -0
- package/dist/bridge/v2/value-serialization.d.ts +103 -0
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/v2/wire.d.ts +170 -0
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +4505 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +145 -0
- package/dist/build-07mjrvsn.js +53 -0
- package/dist/build-0rfr8k1s.js +53 -0
- package/dist/build-1313sg73.js +52 -0
- package/dist/build-1hnntbks.js +53 -0
- package/dist/build-1r3myv0k.js +53 -0
- package/dist/build-28561w5v.js +54 -0
- package/dist/build-2s5paw5p.js +54 -0
- package/dist/build-4c350cp7.js +54 -0
- package/dist/build-50yqpwb3.js +54 -0
- package/dist/build-55z8psd6.js +53 -0
- package/dist/build-5b9wj2p0.js +53 -0
- package/dist/build-5frhzh1m.js +53 -0
- package/dist/build-6ye9vnab.js +52 -0
- package/dist/build-8gv18jrq.js +52 -0
- package/dist/build-9bgqypy6.js +53 -0
- package/dist/build-9em4ymqn.js +52 -0
- package/dist/build-b1z6wqet.js +54 -0
- package/dist/build-e7wym63t.js +54 -0
- package/dist/build-eh3x12qc.js +52 -0
- package/dist/build-emhyycp7.js +53 -0
- package/dist/build-f1m9jn7b.js +53 -0
- package/dist/build-ffe72jjv.js +54 -0
- package/dist/build-fx90y6za.js +53 -0
- package/dist/build-ge6qp3t4.js +54 -0
- package/dist/build-h31egsze.js +53 -0
- package/dist/build-hpczwagb.js +53 -0
- package/dist/build-hpkbanpw.js +54 -0
- package/dist/build-j2re91xe.js +54 -0
- package/dist/build-j78389rg.js +52 -0
- package/dist/build-m3kckn5g.js +53 -0
- package/dist/build-mf3thcjm.js +53 -0
- package/dist/build-n3n5bv37.js +52 -0
- package/dist/build-ngfy4v5x.js +53 -0
- package/dist/build-pr843h0d.js +52 -0
- package/dist/build-qyg2b45p.js +52 -0
- package/dist/build-r6884kyt.js +53 -0
- package/dist/build-re370wkf.js +53 -0
- package/dist/build-ta8c6t11.js +54 -0
- package/dist/build-vvndgwg0.js +52 -0
- package/dist/build-wp559jkf.js +54 -0
- package/dist/build-wvjj8f28.js +54 -0
- package/dist/build-x4r67275.js +52 -0
- package/dist/build-x7maz3eb.js +54 -0
- package/dist/build-xp4pfhvv.js +52 -0
- package/dist/build-y489r2h9.js +54 -0
- package/dist/build-y6g4bvx5.js +52 -0
- package/dist/build-ypg6f2kw.js +54 -0
- package/dist/build-yts8wwgf.js +54 -0
- package/dist/build-yvn0yhwx.js +52 -0
- package/dist/build-yzkdqexs.js +54 -0
- package/dist/build-z4vmhs5c.js +53 -0
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +2 -0
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +1 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +110 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +1 -0
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +12 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +57 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +49 -2
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +41 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +124 -7
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts +30 -2
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +267 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +58 -0
- package/dist/config/deploy-resources.d.ts.map +1 -0
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +10 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +31 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +14 -23
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +1495 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +2949 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +184 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +468 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +4056 -1875
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts +36 -0
- package/dist/config/service-bindings-validation.d.ts.map +1 -0
- package/dist/config-1japnjmx.js +59 -0
- package/dist/config-287wjn1m.js +59 -0
- package/dist/config-4x6vq82e.js +59 -0
- package/dist/config-5n0avhcx.js +59 -0
- package/dist/config-6m0n7d84.js +59 -0
- package/dist/config-70s2ap5j.js +59 -0
- package/dist/config-7cf004ag.js +59 -0
- package/dist/config-7hge8ze6.js +59 -0
- package/dist/config-7rbp7aek.js +59 -0
- package/dist/config-b8xbbmta.js +59 -0
- package/dist/config-b98dp58n.js +59 -0
- package/dist/config-baee5690.js +59 -0
- package/dist/config-bczpc1ey.js +59 -0
- package/dist/config-cf3djhqy.js +59 -0
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +14 -0
- package/dist/config-fhmwzaw6.js +59 -0
- package/dist/config-g9vkfa4x.js +59 -0
- package/dist/config-gpexkzth.js +59 -0
- package/dist/config-nspw7sgv.js +59 -0
- package/dist/config-ntm4x9wt.js +59 -0
- package/dist/config-nv6hfpg6.js +59 -0
- package/dist/config-pjc33wew.js +59 -0
- package/dist/config-pnz2e8s3.js +59 -0
- package/dist/config-qj5jw8km.js +93 -0
- package/dist/config-qts6nh6g.js +59 -0
- package/dist/config-sg2xrdt4.js +59 -0
- package/dist/config-vzwckat3.js +59 -0
- package/dist/config-wa7hm0w9.js +59 -0
- package/dist/config-x90dkmm7.js +59 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-1jfagtn9.js +1055 -0
- package/dist/deploy-1s6nv5rp.js +921 -0
- package/dist/deploy-2afw0jfg.js +1055 -0
- package/dist/deploy-2fzj68kq.js +1055 -0
- package/dist/deploy-30ph1rrd.js +921 -0
- package/dist/deploy-39dmfn9d.js +921 -0
- package/dist/deploy-44n2pshy.js +1016 -0
- package/dist/deploy-45qxpsfe.js +921 -0
- package/dist/deploy-57nzn9wj.js +1045 -0
- package/dist/deploy-64e57w1g.js +1040 -0
- package/dist/deploy-82j43vta.js +1040 -0
- package/dist/deploy-99m8qhpa.js +1041 -0
- package/dist/deploy-9twkd32f.js +1040 -0
- package/dist/deploy-a2eq2c1n.js +1040 -0
- package/dist/deploy-a3pb1qs5.js +921 -0
- package/dist/deploy-agbtfm04.js +921 -0
- package/dist/deploy-aswbtbf3.js +921 -0
- package/dist/deploy-asyryrvm.js +1055 -0
- package/dist/deploy-bqf3kxy5.js +972 -0
- package/dist/deploy-fv4z648h.js +921 -0
- package/dist/deploy-gsybda2f.js +1038 -0
- package/dist/deploy-h17nzysm.js +921 -0
- package/dist/deploy-hc89h4wg.js +1045 -0
- package/dist/deploy-hc927rw6.js +1045 -0
- package/dist/deploy-jey5pnqn.js +1040 -0
- package/dist/deploy-jf3yczsz.js +1055 -0
- package/dist/deploy-jv0yfqvk.js +1040 -0
- package/dist/deploy-kn3z6spd.js +941 -0
- package/dist/deploy-m22xmz9w.js +921 -0
- package/dist/deploy-nefp2njy.js +1038 -0
- package/dist/deploy-pnnf8tgy.js +1045 -0
- package/dist/deploy-ppp8pg6w.js +1038 -0
- package/dist/deploy-q33bw715.js +1055 -0
- package/dist/deploy-qah2eag6.js +1041 -0
- package/dist/deploy-qdq2gpad.js +1045 -0
- package/dist/deploy-r1yf8913.js +1038 -0
- package/dist/deploy-r8nam9rr.js +1038 -0
- package/dist/deploy-rrm4a0xw.js +921 -0
- package/dist/deploy-s0tfnc12.js +1040 -0
- package/dist/deploy-s636ks9k.js +1041 -0
- package/dist/deploy-sany8t54.js +1045 -0
- package/dist/deploy-skqn61j3.js +1038 -0
- package/dist/deploy-smv2870h.js +921 -0
- package/dist/deploy-sp16nxs5.js +972 -0
- package/dist/deploy-sr805bvq.js +921 -0
- package/dist/deploy-t9dehmn0.js +1041 -0
- package/dist/deploy-taxt7njz.js +1041 -0
- package/dist/deploy-tmdgecs3.js +1055 -0
- package/dist/deploy-tnfvfh9m.js +1040 -0
- package/dist/deploy-v0y8kczr.js +1055 -0
- package/dist/deploy-w5f8db4s.js +1040 -0
- package/dist/deploy-wsxcectr.js +921 -0
- package/dist/deploy-xhj6zbcx.js +1055 -0
- package/dist/deploy-xqm869nf.js +1055 -0
- package/dist/deploy-xyfbhj3v.js +1038 -0
- package/dist/deploy-yv1y5xaa.js +921 -0
- package/dist/deploy-z3ejw37k.js +1040 -0
- package/dist/dev-02tgdc4f.js +2160 -0
- package/dist/dev-0tqhveye.js +2314 -0
- package/dist/dev-1mvcts8w.js +2515 -0
- package/dist/dev-2a283xts.js +2515 -0
- package/dist/dev-3dj2gkfq.js +2314 -0
- package/dist/dev-3e0etsww.js +2314 -0
- package/dist/dev-47dk7c13.js +2314 -0
- package/dist/dev-4a2a31cm.js +2314 -0
- package/dist/dev-4w1stcn8.js +2427 -0
- package/dist/dev-5wkh1z4a.js +2188 -0
- package/dist/dev-62nhytf8.js +2505 -0
- package/dist/dev-6t22zmey.js +2350 -0
- package/dist/dev-75acm2xj.js +2478 -0
- package/dist/dev-802rg9dp.js +2515 -0
- package/dist/dev-89p1sdv7.js +2395 -0
- package/dist/dev-8d1gxjky.js +2427 -0
- package/dist/dev-8yawx3cv.js +2314 -0
- package/dist/dev-9h4p8a0c.js +2393 -0
- package/dist/dev-9xmttj4c.js +2314 -0
- package/dist/dev-at6gy2td.js +2427 -0
- package/dist/dev-bgpxrwms.js +2551 -0
- package/dist/dev-bkbz97z0.js +2314 -0
- package/dist/dev-ct3344kv.js +2160 -0
- package/dist/dev-d1bb2t0f.js +2515 -0
- package/dist/{dev-qnxet3j9.js → dev-dg8dh5c1.js} +947 -809
- package/dist/dev-dr5jb965.js +2427 -0
- package/dist/dev-dwry8494.js +2489 -0
- package/dist/dev-e4sjqtbq.js +2314 -0
- package/dist/dev-ecq26mg4.js +2350 -0
- package/dist/dev-ef237vgp.js +2324 -0
- package/dist/dev-enbdg4st.js +2314 -0
- package/dist/dev-g6112y4w.js +2515 -0
- package/dist/dev-h2kneh95.js +2496 -0
- package/dist/dev-jcrxg8hq.js +2160 -0
- package/dist/dev-jk0gqges.js +2432 -0
- package/dist/dev-k62936am.js +2314 -0
- package/dist/dev-k8ptbvrs.js +2160 -0
- package/dist/dev-kqm107h4.js +2422 -0
- package/dist/dev-kybq3mwr.js +2489 -0
- package/dist/dev-kzs65xcr.js +2551 -0
- package/dist/dev-n0gx7eya.js +2350 -0
- package/dist/dev-n23m6rtb.js +2314 -0
- package/dist/dev-n8qndkyg.js +2512 -0
- package/dist/dev-ny8fmkzg.js +2432 -0
- package/dist/dev-p1c65cga.js +2386 -0
- package/dist/dev-p32fkbwf.js +2489 -0
- package/dist/dev-p4fjbb4h.js +2395 -0
- package/dist/dev-pnfcv79z.js +2160 -0
- package/dist/dev-qm9d4mfh.js +2478 -0
- package/dist/dev-qnrrv5ey.js +2393 -0
- package/dist/dev-qqysg50t.js +2427 -0
- package/dist/dev-r9f3n11q.js +2410 -0
- package/dist/dev-rcthnse5.js +2473 -0
- package/dist/dev-s0815dw4.js +2427 -0
- package/dist/dev-s4tpkg60.js +2314 -0
- package/dist/dev-s82fcesg.js +2314 -0
- package/dist/dev-s9sz53me.js +2401 -0
- package/dist/dev-sdka7z0d.js +2427 -0
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +21 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/miniflare-bindings.d.ts +59 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +35 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
- package/dist/dev-server/miniflare-log.d.ts +20 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/miniflare-worker-config.d.ts +74 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +15 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +55 -0
- package/dist/dev-server/vite-utils.d.ts.map +1 -0
- package/dist/dev-server/worker-source-watcher.d.ts +17 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/dev-t3tjscah.js +2350 -0
- package/dist/dev-t50kdb1j.js +2338 -0
- package/dist/dev-t5xf55pt.js +2314 -0
- package/dist/dev-t63c44bb.js +2314 -0
- package/dist/dev-tgwja5mz.js +2496 -0
- package/dist/dev-wg3d38sy.js +2433 -0
- package/dist/dev-wh4rfgsh.js +2427 -0
- package/dist/dev-wjh8gdd1.js +2284 -0
- package/dist/dev-xzxy9qvq.js +2314 -0
- package/dist/dev-yymaq4ph.js +2392 -0
- package/dist/dev-zg2w2ve3.js +2422 -0
- package/dist/dev-zgx7fhe9.js +2553 -0
- package/dist/dev-zsb2xk1x.js +2427 -0
- package/dist/dev-zty3yhzg.js +2324 -0
- package/dist/doctor-0a2brpyz.js +259 -0
- package/dist/doctor-2shhdak6.js +245 -0
- package/dist/doctor-3mqavqg3.js +245 -0
- package/dist/doctor-5g73w40j.js +245 -0
- package/dist/doctor-5nek32fz.js +245 -0
- package/dist/doctor-7ra1w0sk.js +245 -0
- package/dist/doctor-ak830a0k.js +245 -0
- package/dist/doctor-bye3cs8a.js +245 -0
- package/dist/doctor-c5m9pmwq.js +245 -0
- package/dist/doctor-cqfkgxvw.js +245 -0
- package/dist/doctor-e1h9mhzp.js +245 -0
- package/dist/doctor-fmqsrafk.js +245 -0
- package/dist/doctor-gamefzcs.js +245 -0
- package/dist/doctor-hgs7wr5g.js +245 -0
- package/dist/doctor-j8ytsy94.js +245 -0
- package/dist/doctor-mcmkgp6e.js +245 -0
- package/dist/doctor-qb6m2exc.js +245 -0
- package/dist/doctor-qq4tsh8q.js +245 -0
- package/dist/doctor-rn53ctfs.js +245 -0
- package/dist/doctor-tecv869a.js +245 -0
- package/dist/doctor-wg0245pe.js +245 -0
- package/dist/doctor-z3jfqxtz.js +245 -0
- package/dist/{durable-object-t4kbb0yt.js → durable-object-4hey8fgy.js} +1 -1
- package/dist/durable-object-v3gsnybk.js +13 -0
- package/dist/durable-object-yt8v1dyn.js +13 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index-01kehw41.js +348 -0
- package/dist/index-05pbj4hy.js +1193 -0
- package/dist/index-06bg0z9y.js +185 -0
- package/dist/index-0d7tw5r4.js +136 -0
- package/dist/index-0krb65s3.js +215 -0
- package/dist/index-0m6e4mxz.js +133 -0
- package/dist/index-0mantew0.js +513 -0
- package/dist/index-0mezg6ar.js +1372 -0
- package/dist/index-0tk2rs0q.js +185 -0
- package/dist/index-0vah20er.js +1410 -0
- package/dist/index-0wa0ebm1.js +68 -0
- package/dist/index-124e9t4t.js +232 -0
- package/dist/index-1546yrn0.js +74 -0
- package/dist/index-15fpa5tx.js +232 -0
- package/dist/index-1714y3cz.js +1410 -0
- package/dist/index-18mp5v50.js +538 -0
- package/dist/index-195tc6qh.js +1372 -0
- package/dist/index-1bg8w2gf.js +52 -0
- package/dist/index-1d4jg11n.js +542 -0
- package/dist/index-1e2qtrmj.js +188 -0
- package/dist/index-1ghhgb9d.js +74 -0
- package/dist/index-1nhd9nkd.js +232 -0
- package/dist/index-1p814k7s.js +227 -0
- package/dist/index-1qs5gcm7.js +895 -0
- package/dist/index-1wn8mjep.js +808 -0
- package/dist/index-1xhd5czz.js +185 -0
- package/dist/index-29k04v43.js +574 -0
- package/dist/index-2a2g4fwp.js +993 -0
- package/dist/index-2bmtj21z.js +192 -0
- package/dist/index-2dpmd14d.js +52 -0
- package/dist/index-2fa0afdp.js +1372 -0
- package/dist/index-2jywf4pz.js +1372 -0
- package/dist/index-2qhk9nbx.js +1372 -0
- package/dist/index-2rcrefqd.js +1372 -0
- package/dist/index-2t2m5148.js +1372 -0
- package/dist/index-2vbzamev.js +437 -0
- package/dist/index-2vdep9h0.js +993 -0
- package/dist/index-2vq6bveq.js +574 -0
- package/dist/index-2y90j9cz.js +74 -0
- package/dist/index-33ep0z9x.js +385 -0
- package/dist/index-36h8gkhb.js +1088 -0
- package/dist/index-37jgbaw6.js +1372 -0
- package/dist/index-380ncsqc.js +977 -0
- package/dist/index-38fq7pww.js +560 -0
- package/dist/index-3bxqn033.js +1410 -0
- package/dist/index-3e1x39fc.js +365 -0
- package/dist/index-3e7by9sy.js +223 -0
- package/dist/index-3edvz3hs.js +124 -0
- package/dist/index-3egad6wm.js +538 -0
- package/dist/index-3f8rzmjw.js +232 -0
- package/dist/index-3jme4hgw.js +1234 -0
- package/dist/index-3p7s9mk9.js +360 -0
- package/dist/index-3vd4r37r.js +1372 -0
- package/dist/index-3vgn5e89.js +1682 -0
- package/dist/index-3x7k3t0f.js +513 -0
- package/dist/index-3xfe2dst.js +399 -0
- package/dist/index-464j1zb4.js +513 -0
- package/dist/index-47w35sft.js +244 -0
- package/dist/index-48rxsj95.js +365 -0
- package/dist/index-4bezcdd1.js +385 -0
- package/dist/index-4by4c7rm.js +52 -0
- package/dist/index-4fp11z9e.js +973 -0
- package/dist/index-4knecthc.js +70 -0
- package/dist/index-4phjwd6h.js +412 -0
- package/dist/index-4z5jrw0j.js +594 -0
- package/dist/index-502y7w13.js +538 -0
- package/dist/index-50em8s6c.js +898 -0
- package/dist/index-50mxxb4q.js +185 -0
- package/dist/index-51mzqy0d.js +895 -0
- package/dist/index-53pqqpq9.js +74 -0
- package/dist/index-5achzspr.js +185 -0
- package/dist/index-5ef3jmv7.js +1372 -0
- package/dist/index-5enq8ntr.js +1766 -0
- package/dist/index-5eswe8yv.js +844 -0
- package/dist/index-5fnq9r9m.js +1410 -0
- package/dist/index-5gevxfgs.js +513 -0
- package/dist/index-5gmf048z.js +817 -0
- package/dist/index-5jtkxpjf.js +971 -0
- package/dist/index-5m85bd9x.js +168 -0
- package/dist/index-5n5nn0a8.js +264 -0
- package/dist/index-5p3bgjwr.js +808 -0
- package/dist/index-5vzcszr2.js +1230 -0
- package/dist/index-5w77r4w9.js +513 -0
- package/dist/index-5w9f2b17.js +695 -0
- package/dist/index-627srx16.js +45 -0
- package/dist/index-62b3gt2g.js +12 -0
- package/dist/index-62srkqcm.js +168 -0
- package/dist/index-63cgqe43.js +1372 -0
- package/dist/index-65e7xx1a.js +19 -0
- package/dist/index-65qrje14.js +185 -0
- package/dist/index-666tdx14.js +895 -0
- package/dist/index-66sx3b3v.js +385 -0
- package/dist/index-678j0n13.js +74 -0
- package/dist/index-6bqgf5x8.js +227 -0
- package/dist/index-6ftrth7n.js +1218 -0
- package/dist/index-6g90pvxa.js +215 -0
- package/dist/index-6h8xbs75.js +44 -0
- package/dist/index-6j4m5x2d.js +1372 -0
- package/dist/index-6jwpke14.js +385 -0
- package/dist/index-6knsjvxh.js +1372 -0
- package/dist/index-6kwq6yf8.js +979 -0
- package/dist/index-6mg4yvc6.js +74 -0
- package/dist/index-6phry941.js +133 -0
- package/dist/index-6r59wbek.js +232 -0
- package/dist/index-6sf815ps.js +74 -0
- package/dist/index-6xknvbyk.js +1088 -0
- package/dist/index-6zd89k6y.js +1230 -0
- package/dist/index-71rwg0cn.js +264 -0
- package/dist/index-75ex2m0x.js +695 -0
- package/dist/index-79exzs3q.js +1218 -0
- package/dist/index-7bxj118m.js +264 -0
- package/dist/index-7c6np4mq.js +397 -0
- package/dist/index-7cm339qz.js +133 -0
- package/dist/index-7e359eb5.js +895 -0
- package/dist/index-7ef3ktz5.js +1372 -0
- package/dist/index-7eqyr4j8.js +70 -0
- package/dist/index-7hpjfdzh.js +185 -0
- package/dist/index-7k278fgz.js +273 -0
- package/dist/index-7kazxkjt.js +1372 -0
- package/dist/index-7m0x8m9r.js +844 -0
- package/dist/index-7p74smg8.js +1372 -0
- package/dist/index-7q8fke3k.js +188 -0
- package/dist/index-7qk6eafn.js +1682 -0
- package/dist/index-7r7dfpcm.js +133 -0
- package/dist/index-7vbjt6ba.js +805 -0
- package/dist/index-7z4b0vgd.js +470 -0
- package/dist/index-8052df4m.js +627 -0
- package/dist/index-82epjzrr.js +1410 -0
- package/dist/index-82f1z98k.js +41 -0
- package/dist/index-82xn4azv.js +74 -0
- package/dist/index-82z7rvz6.js +1238 -0
- package/dist/index-83wns7cz.js +70 -0
- package/dist/index-852945d4.js +413 -0
- package/dist/index-86rvj79f.js +133 -0
- package/dist/index-88tcq0t4.js +542 -0
- package/dist/index-8atc1yb9.js +68 -0
- package/dist/index-8evn52g1.js +1218 -0
- package/dist/index-8jkf4nsd.js +695 -0
- package/dist/index-8nx4ce3e.js +133 -0
- package/dist/index-8p7rxkbs.js +1426 -0
- package/dist/index-8q1bcnrh.js +1372 -0
- package/dist/index-8t5gynct.js +971 -0
- package/dist/index-8tj0awnv.js +476 -0
- package/dist/index-8x745h59.js +1069 -0
- package/dist/index-905svbb6.js +470 -0
- package/dist/index-94cb0sac.js +1372 -0
- package/dist/index-95mmvbw7.js +538 -0
- package/dist/index-97x94h0m.js +438 -0
- package/dist/index-9an9qqr1.js +728 -0
- package/dist/index-9bawzcny.js +574 -0
- package/dist/index-9bjjqdfc.js +236 -0
- package/dist/index-9d125myk.js +1372 -0
- package/dist/index-9d7x3vfr.js +236 -0
- package/dist/index-9fbtk7gv.js +817 -0
- package/dist/index-9gg0kqw0.js +470 -0
- package/dist/index-9nf8zs4p.js +1069 -0
- package/dist/index-9ryw7mcw.js +971 -0
- package/dist/{index-gz1gndna.js → index-9wt9x09k.js} +42 -62
- package/dist/index-a3e13a7m.js +478 -0
- package/dist/index-a6j44jmr.js +1372 -0
- package/dist/index-a75ejnvt.js +1711 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/index-ab2nck1h.js +1372 -0
- package/dist/index-abrqnq3e.js +488 -0
- package/dist/index-acwbmagz.js +412 -0
- package/dist/index-afjbpgb1.js +1218 -0
- package/dist/index-aqjdaem7.js +74 -0
- package/dist/index-aqrwyy57.js +288 -0
- package/dist/index-at89fpde.js +470 -0
- package/dist/index-awr0tp6p.js +313 -0
- package/dist/index-b1be9bdh.js +1372 -0
- package/dist/index-b1xs3wc4.js +513 -0
- package/dist/index-b50x7seh.js +513 -0
- package/dist/index-b5ra8w3q.js +52 -0
- package/dist/index-b6448fd0.js +133 -0
- package/dist/index-b64sbzgv.js +884 -0
- package/dist/index-b7r8ntpm.js +1372 -0
- package/dist/index-b9j55r7q.js +240 -0
- package/dist/index-ba9gyy13.js +513 -0
- package/dist/index-bb66mn7p.js +52 -0
- package/dist/index-bc5pvbbd.js +1193 -0
- package/dist/index-bdatd1za.js +1372 -0
- package/dist/index-bj0mk3dw.js +74 -0
- package/dist/index-bj3a8dr0.js +1372 -0
- package/dist/index-bj5avaba.js +109 -0
- package/dist/index-bk3eez1g.js +513 -0
- package/dist/index-btjx137w.js +774 -0
- package/dist/index-btrfqp9h.js +133 -0
- package/dist/index-bx6gangy.js +402 -0
- package/dist/index-c0tc0yts.js +471 -0
- package/dist/index-c0whkev9.js +200 -0
- package/dist/index-c3nxftnp.js +699 -0
- package/dist/index-c643s0gv.js +488 -0
- package/dist/index-ca96qkva.js +1372 -0
- package/dist/index-cdtzkedk.js +993 -0
- package/dist/index-cejgenma.js +1372 -0
- package/dist/index-cp8jt5pr.js +52 -0
- package/dist/index-cpz69pek.js +1372 -0
- package/dist/index-crrdegk5.js +456 -0
- package/dist/index-cskszwkx.js +1372 -0
- package/dist/index-cxf22a0s.js +74 -0
- package/dist/index-cy3c3w81.js +270 -0
- package/dist/index-d2md1j3d.js +185 -0
- package/dist/index-d5dgb1j6.js +74 -0
- package/dist/index-da397xcx.js +1372 -0
- package/dist/index-damyy8bw.js +1372 -0
- package/dist/index-dbr6bfz6.js +528 -0
- package/dist/index-dd1g0g7e.js +360 -0
- package/dist/index-dd6fwwmq.js +456 -0
- package/dist/index-dgww0ewn.js +574 -0
- package/dist/index-dh1954bp.js +52 -0
- package/dist/index-djp2wd1f.js +1372 -0
- package/dist/index-dktb9az5.js +1372 -0
- package/dist/index-dm9q84c7.js +360 -0
- package/dist/index-dmbdj6va.js +805 -0
- package/dist/index-dmf76tac.js +1372 -0
- package/dist/index-dphr32gc.js +420 -0
- package/dist/index-dxh2qyyw.js +52 -0
- package/dist/index-dzayfxjy.js +492 -0
- package/dist/index-e05q77kt.js +397 -0
- package/dist/index-e11b1fb2.js +495 -0
- package/dist/index-e3zvspqj.js +968 -0
- package/dist/index-e4tzzbn9.js +1372 -0
- package/dist/index-e5ct1gwb.js +1372 -0
- package/dist/index-e7ptcz1a.js +1372 -0
- package/dist/index-e7wt0203.js +513 -0
- package/dist/index-ebwsvf9t.js +365 -0
- package/dist/index-ed73jn3d.js +185 -0
- package/dist/index-ed7n5d07.js +185 -0
- package/dist/index-ejs2a4kd.js +513 -0
- package/dist/index-esjrgt3y.js +467 -0
- package/dist/index-ev03khsd.js +513 -0
- package/dist/index-f1gsqm54.js +168 -0
- package/dist/index-f1yshy4s.js +412 -0
- package/dist/index-f51mkh13.js +1088 -0
- package/dist/index-f86n1fpd.js +55 -0
- package/dist/index-f90314kt.js +52 -0
- package/dist/index-f9mhsept.js +185 -0
- package/dist/index-fa6zwffw.js +70 -0
- package/dist/index-fama7kpt.js +52 -0
- package/dist/index-fgk87mk2.js +1067 -0
- package/dist/index-fkyvxe4b.js +968 -0
- package/dist/index-fnk0tkw7.js +412 -0
- package/dist/index-g0h40xke.js +513 -0
- package/dist/index-g0rqh52c.js +385 -0
- package/dist/index-g170d619.js +385 -0
- package/dist/index-g3qtxkms.js +881 -0
- package/dist/index-g5aq66bj.js +1534 -0
- package/dist/index-gactvqcs.js +467 -0
- package/dist/index-gaew61v4.js +470 -0
- package/dist/index-gba371j7.js +542 -0
- package/dist/index-gegyyfnw.js +1372 -0
- package/dist/index-get7he2s.js +133 -0
- package/dist/index-gj5qh491.js +54 -0
- package/dist/index-gn5wy09x.js +205 -0
- package/dist/index-gq39t0rx.js +895 -0
- package/dist/index-gtbgzwfs.js +264 -0
- package/dist/index-gtpz0gkz.js +185 -0
- package/dist/index-h1s66pmp.js +52 -0
- package/dist/index-h5dqna7q.js +1410 -0
- package/dist/index-h8r2d8y5.js +366 -0
- package/dist/index-heeqwrfd.js +385 -0
- package/dist/index-hheb5dyt.js +192 -0
- package/dist/index-hjs9j2g9.js +895 -0
- package/dist/index-hjz2x9nq.js +441 -0
- package/dist/index-hkex7ns5.js +513 -0
- package/dist/index-hmbctwv6.js +517 -0
- package/dist/index-hn5nbxbt.js +147 -0
- package/dist/index-hpjh0qjx.js +1723 -0
- package/dist/index-hpwa6vsw.js +239 -0
- package/dist/index-hpzasdhw.js +513 -0
- package/dist/index-hqdr9wdm.js +74 -0
- package/dist/index-hrvz8d26.js +1372 -0
- package/dist/index-hs6ekcfs.js +412 -0
- package/dist/index-hyvhnf6r.js +971 -0
- package/dist/index-j2kc5rbv.js +895 -0
- package/dist/index-j2xdxwsz.js +133 -0
- package/dist/index-j47hhb3r.js +694 -0
- package/dist/index-j5aphr5x.js +185 -0
- package/dist/index-j68v36q1.js +188 -0
- package/dist/index-j7cf22x7.js +968 -0
- package/dist/index-j7xxrbnr.js +694 -0
- package/dist/index-jdzrvnfj.js +52 -0
- package/dist/index-jg720mq7.js +476 -0
- package/dist/index-jptqxkew.js +470 -0
- package/dist/index-jrzddxvt.js +2167 -0
- package/dist/index-jsymy3mb.js +781 -0
- package/dist/index-jwvy32xk.js +188 -0
- package/dist/index-jxe1b19v.js +133 -0
- package/dist/index-jz96ry5g.js +513 -0
- package/dist/index-k6wtsgs1.js +971 -0
- package/dist/index-k7m5f1dg.js +200 -0
- package/dist/index-kawa49m8.js +371 -0
- package/dist/index-key4e5c9.js +168 -0
- package/dist/index-kgstnk6g.js +239 -0
- package/dist/index-khbmdrn2.js +884 -0
- package/dist/index-khnw972v.js +117 -0
- package/dist/index-kpzfwex6.js +264 -0
- package/dist/index-kse4gn99.js +74 -0
- package/dist/index-ktscz0r2.js +264 -0
- package/dist/index-kwqff3ba.js +1410 -0
- package/dist/index-kxc4gtyt.js +574 -0
- package/dist/index-kybmjvad.js +1212 -0
- package/dist/index-kzm9cea8.js +185 -0
- package/dist/index-m2d74gqg.js +808 -0
- package/dist/index-m2v0fj08.js +74 -0
- package/dist/index-m56w7mjt.js +513 -0
- package/dist/index-m95ha3n4.js +264 -0
- package/dist/index-ma151p8g.js +264 -0
- package/dist/index-mg8vwqxf.js +514 -0
- package/dist/index-mhdsywhs.js +264 -0
- package/dist/index-mjgx910r.js +895 -0
- package/dist/index-mjve6tqn.js +447 -0
- package/dist/index-mkrmaea3.js +185 -0
- package/dist/index-mkxnyyjn.js +264 -0
- package/dist/index-mkxzgn0q.js +1372 -0
- package/dist/index-mp5mrst6.js +1372 -0
- package/dist/index-ms15cr86.js +513 -0
- package/dist/index-mt99xkc6.js +133 -0
- package/dist/index-mttv6k25.js +881 -0
- package/dist/index-myxfx52v.js +385 -0
- package/dist/index-mzmq3v0d.js +1088 -0
- package/dist/index-mzw7732t.js +74 -0
- package/dist/index-n3mjwz22.js +188 -0
- package/dist/index-n3yksgz0.js +1372 -0
- package/dist/index-n4jr3dmk.js +484 -0
- package/dist/index-n5drt64b.js +74 -0
- package/dist/index-n8frmffg.js +264 -0
- package/dist/index-n8k8chde.js +694 -0
- package/dist/index-na796ka6.js +994 -0
- package/dist/index-nbs4q0qg.js +1218 -0
- package/dist/index-newpq2zf.js +968 -0
- package/dist/index-nexg9p7j.js +1271 -0
- package/dist/index-nfm8tb5n.js +74 -0
- package/dist/index-ng9n3znd.js +1372 -0
- package/dist/index-nga2tg9z.js +1372 -0
- package/dist/index-ngbzr9gz.js +805 -0
- package/dist/index-nh90nk7j.js +380 -0
- package/dist/index-nhbkm2ba.js +467 -0
- package/dist/index-njnmfxm5.js +1372 -0
- package/dist/index-nqma24j3.js +385 -0
- package/dist/index-nrfhk0k5.js +1088 -0
- package/dist/index-ntddf5d9.js +993 -0
- package/dist/index-nte9n8w9.js +538 -0
- package/dist/index-ntxp7ke1.js +264 -0
- package/dist/index-nwxnmw41.js +264 -0
- package/dist/index-nxkesg55.js +68 -0
- package/dist/index-p0zppqxm.js +467 -0
- package/dist/index-p1xe5eem.js +513 -0
- package/dist/index-p296ban8.js +191 -0
- package/dist/index-p477xm52.js +385 -0
- package/dist/index-p7q23nce.js +1031 -0
- package/dist/index-p8nmkrgw.js +470 -0
- package/dist/index-p97s12vf.js +904 -0
- package/dist/index-p9hvv0yd.js +401 -0
- package/dist/index-pac7wv88.js +307 -0
- package/dist/index-pkxf6h87.js +895 -0
- package/dist/index-pqp4312v.js +52 -0
- package/dist/index-pt49cgjv.js +1426 -0
- package/dist/index-ptp2pfq1.js +52 -0
- package/dist/index-pw9jn6kz.js +574 -0
- package/dist/index-pyeycp3f.js +74 -0
- package/dist/index-q23xf3vr.js +479 -0
- package/dist/index-q31ne0xa.js +412 -0
- package/dist/index-q34rvh5a.js +247 -0
- package/dist/index-q5errwrj.js +904 -0
- package/dist/index-q5nhzc9m.js +1217 -0
- package/dist/index-q8f4kawk.js +204 -0
- package/dist/index-qer8zv2r.js +997 -0
- package/dist/index-qf2dkqxh.js +249 -0
- package/dist/index-qhyy018y.js +467 -0
- package/dist/index-qmhdydwy.js +70 -0
- package/dist/index-qmtdf7k5.js +639 -0
- package/dist/index-qpmvca5j.js +470 -0
- package/dist/index-qr96vaj1.js +52 -0
- package/dist/index-qtyhg3dn.js +904 -0
- package/dist/index-qwgr4q7s.js +37 -0
- package/dist/index-qye17gq5.js +264 -0
- package/dist/index-r0839f5k.js +133 -0
- package/dist/index-r1rqg72v.js +1372 -0
- package/dist/index-rab2dfh3.js +494 -0
- package/dist/index-rbckga8p.js +971 -0
- package/dist/index-rbxb5x2w.js +1372 -0
- package/dist/index-rck779bj.js +739 -0
- package/dist/index-rfn2gt5f.js +1658 -0
- package/dist/index-rg21w26a.js +470 -0
- package/dist/index-rgcz45t0.js +1372 -0
- package/dist/index-rhnd376q.js +133 -0
- package/dist/index-rjc5z3w6.js +971 -0
- package/dist/index-rkhtayd6.js +385 -0
- package/dist/index-rm8srzmv.js +371 -0
- package/dist/index-rmhk5j03.js +968 -0
- package/dist/index-rp0aye39.js +1426 -0
- package/dist/index-rp4t86bt.js +993 -0
- package/dist/index-rpq5ktdy.js +264 -0
- package/dist/index-rpsmhdd4.js +1218 -0
- package/dist/index-rqpakjyr.js +470 -0
- package/dist/index-rttk33x6.js +232 -0
- package/dist/index-rwa82e89.js +385 -0
- package/dist/index-rz185crv.js +695 -0
- package/dist/index-rz7rx80s.js +1410 -0
- package/dist/index-s22verzj.js +1218 -0
- package/dist/index-s2s3g1nt.js +133 -0
- package/dist/index-s37h3jgk.js +572 -0
- package/dist/index-s7ytytth.js +781 -0
- package/dist/index-sb705m7d.js +52 -0
- package/dist/index-sefnpzwa.js +185 -0
- package/dist/index-sgxw0xzd.js +513 -0
- package/dist/index-stc0caq6.js +1009 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/index-svz82w9h.js +513 -0
- package/dist/index-sx49e8x9.js +884 -0
- package/dist/index-sxadwvw9.js +185 -0
- package/dist/index-sxn223fz.js +1372 -0
- package/dist/index-sy0c2mh0.js +1372 -0
- package/dist/index-syeh1hca.js +264 -0
- package/dist/index-syscwrjp.js +1576 -0
- package/dist/index-t14zr0ys.js +1063 -0
- package/dist/index-t18wyhgf.js +418 -0
- package/dist/index-t4fhcx1n.js +71 -0
- package/dist/index-td4hbgj5.js +1372 -0
- package/dist/index-tjc99447.js +68 -0
- package/dist/index-tknbyxzn.js +2202 -0
- package/dist/index-tkvt9mmq.js +484 -0
- package/dist/index-tmmcf4m6.js +808 -0
- package/dist/index-tpgs5v64.js +366 -0
- package/dist/index-tt4fsv91.js +412 -0
- package/dist/{index-07q6yxyc.js → index-tte89s31.js} +30 -29
- package/dist/index-tvjg7swe.js +1372 -0
- package/dist/index-txndxr4w.js +513 -0
- package/dist/index-tyh5jc55.js +990 -0
- package/dist/index-tyt0wa52.js +470 -0
- package/dist/index-tyt3wcfr.js +1372 -0
- package/dist/index-v35460hf.js +574 -0
- package/dist/index-v3znz08m.js +968 -0
- package/dist/index-v78xbj6n.js +808 -0
- package/dist/index-v7q00d1e.js +1410 -0
- package/dist/index-v915brjk.js +1372 -0
- package/dist/index-v922fmsx.js +52 -0
- package/dist/index-v9w1bbfe.js +842 -0
- package/dist/index-vbbgtm8p.js +513 -0
- package/dist/index-vcjgrmzj.js +456 -0
- package/dist/{index-pf5s73n9.js → index-vdewcg1r.js} +243 -385
- package/dist/index-vhqww6tt.js +307 -0
- package/dist/index-vkkmx4xe.js +1372 -0
- package/dist/index-vrps1gky.js +2202 -0
- package/dist/index-vse8620z.js +1372 -0
- package/dist/index-vt803j3b.js +1372 -0
- package/dist/index-vtjp46c3.js +52 -0
- package/dist/index-vxhxk8mf.js +904 -0
- package/dist/index-w3azfsa0.js +695 -0
- package/dist/index-w4c9vmvg.js +1517 -0
- package/dist/index-w4tq35dn.js +52 -0
- package/dist/index-w5qxvxzq.js +991 -0
- package/dist/index-w5sedpqn.js +986 -0
- package/dist/index-waha3chv.js +1230 -0
- package/dist/index-wdxww0kj.js +1006 -0
- package/dist/index-wdy5y07x.js +1372 -0
- package/dist/index-wf9pnh6j.js +385 -0
- package/dist/{index-z14anrqp.js → index-wfbfz02q.js} +14 -15
- package/dist/index-wnnbbbkt.js +1192 -0
- package/dist/index-wqd8n2qk.js +574 -0
- package/dist/index-wvcmvtjf.js +1372 -0
- package/dist/index-x0jbntp0.js +470 -0
- package/dist/index-x12e6fzy.js +476 -0
- package/dist/index-x6scc3nx.js +70 -0
- package/dist/index-x8e2wsbv.js +971 -0
- package/dist/index-xagpz645.js +2199 -0
- package/dist/index-xbth1r6e.js +572 -0
- package/dist/index-xec4p3v5.js +560 -0
- package/dist/index-xgfyxpfs.js +1218 -0
- package/dist/index-xm9fqhcb.js +447 -0
- package/dist/index-xm9hp9xc.js +1372 -0
- package/dist/index-xp7zkxcx.js +1372 -0
- package/dist/index-xrbj0ebk.js +185 -0
- package/dist/index-xskax7r3.js +50 -0
- package/dist/index-xvk5n96q.js +694 -0
- package/dist/index-xy1jvt4w.js +1229 -0
- package/dist/index-xzg9hhf3.js +470 -0
- package/dist/index-xzpg0kaz.js +70 -0
- package/dist/index-y1d8za14.js +196 -0
- package/dist/index-y3q6qvv3.js +316 -0
- package/dist/index-y44ts1dk.js +52 -0
- package/dist/index-y59hnmd0.js +132 -0
- package/dist/index-y5nt1wjb.js +971 -0
- package/dist/index-y7mkb00x.js +133 -0
- package/dist/index-y82b8w14.js +1372 -0
- package/dist/index-yb07t3c5.js +1372 -0
- package/dist/index-yc3xz3vm.js +431 -0
- package/dist/index-yeaqrevg.js +1372 -0
- package/dist/index-ygwsd1nn.js +438 -0
- package/dist/index-yhdavjk7.js +371 -0
- package/dist/index-yjhns95b.js +188 -0
- package/dist/index-yk23p7he.js +1372 -0
- package/dist/index-ykfgpsmm.js +190 -0
- package/dist/index-ymz3cfab.js +968 -0
- package/dist/index-yq9g1sq7.js +264 -0
- package/dist/index-ys5q9ch9.js +366 -0
- package/dist/index-yt0n4p46.js +973 -0
- package/dist/index-ytq1t9jx.js +232 -0
- package/dist/index-ywmtmf3b.js +513 -0
- package/dist/index-yzb44q6d.js +1372 -0
- package/dist/index-z043xk61.js +133 -0
- package/dist/index-z0gsf674.js +431 -0
- package/dist/index-z32n0ndp.js +1372 -0
- package/dist/index-z40mjts9.js +212 -0
- package/dist/index-z4qgk76w.js +1372 -0
- package/dist/index-z5k5bjc7.js +1218 -0
- package/dist/index-z73sytma.js +895 -0
- package/dist/index-z8njfj2g.js +385 -0
- package/dist/index-z9fjnwa8.js +397 -0
- package/dist/{index-1xpj0m4r.js → index-z9gy8w6b.js} +1 -1
- package/dist/index-zapkc14c.js +264 -0
- package/dist/index-zes6w8yr.js +185 -0
- package/dist/index-zgrqest7.js +695 -0
- package/dist/index-zjv6apef.js +1410 -0
- package/dist/index-zsngz131.js +1372 -0
- package/dist/index-zt22fe2j.js +54 -0
- package/dist/index-zxhc6sb0.js +192 -0
- package/dist/index.d.ts +2 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -269
- package/dist/{init-f9mgmew3.js → init-cwpergap.js} +63 -69
- package/dist/init-wfh63bfz.js +180 -0
- package/dist/login-1amyp1jy.js +77 -0
- package/dist/login-1cdwn1dj.js +77 -0
- package/dist/login-456h8jk3.js +77 -0
- package/dist/login-4n470c4j.js +77 -0
- package/dist/login-4sh7s849.js +77 -0
- package/dist/login-5dmkf0pz.js +77 -0
- package/dist/login-7yex6ppq.js +77 -0
- package/dist/login-83bjfhvz.js +77 -0
- package/dist/login-88tp4gbb.js +77 -0
- package/dist/login-b51faqpc.js +77 -0
- package/dist/login-bxyjqmbj.js +77 -0
- package/dist/login-c4649qss.js +77 -0
- package/dist/login-d80a2qxd.js +77 -0
- package/dist/login-ddw888xb.js +77 -0
- package/dist/login-dp0napaz.js +77 -0
- package/dist/login-e7pytkdc.js +77 -0
- package/dist/login-fe0brfcr.js +77 -0
- package/dist/login-h7sm5trm.js +77 -0
- package/dist/login-j3r6z2t4.js +77 -0
- package/dist/login-jkfkdjg4.js +77 -0
- package/dist/login-kch6f2yj.js +77 -0
- package/dist/login-pmqh94ws.js +77 -0
- package/dist/login-rc82x5j8.js +77 -0
- package/dist/login-tvppwyx2.js +77 -0
- package/dist/login-vd0m3xr4.js +77 -0
- package/dist/login-w76jx22q.js +77 -0
- package/dist/login-ze7y36rc.js +77 -0
- package/dist/previews-02jmcwft.js +1214 -0
- package/dist/previews-2wfvsjfy.js +1337 -0
- package/dist/previews-31bq82km.js +1225 -0
- package/dist/previews-31feb8r3.js +1337 -0
- package/dist/previews-3w4pxqby.js +1337 -0
- package/dist/previews-62pcvvpe.js +1214 -0
- package/dist/previews-6fepv94a.js +1225 -0
- package/dist/previews-76fxkp59.js +1214 -0
- package/dist/previews-844bp6kf.js +1214 -0
- package/dist/previews-8amn46qv.js +1214 -0
- package/dist/previews-93ttrf5f.js +1337 -0
- package/dist/previews-a5xbkksy.js +1214 -0
- package/dist/previews-bdrefjzx.js +1337 -0
- package/dist/previews-bgnryzav.js +1214 -0
- package/dist/previews-bkhv9dnr.js +1214 -0
- package/dist/previews-c2c64z5m.js +1214 -0
- package/dist/previews-cfcn56b4.js +1337 -0
- package/dist/previews-e4wgscsb.js +1214 -0
- package/dist/previews-ew4reetn.js +1214 -0
- package/dist/previews-hzqke1fg.js +1214 -0
- package/dist/previews-j8wa3sge.js +1214 -0
- package/dist/previews-k5n6vhpm.js +1214 -0
- package/dist/previews-mssq1hrm.js +1337 -0
- package/dist/previews-n4sdyxa5.js +1214 -0
- package/dist/previews-npwrwb0b.js +1214 -0
- package/dist/previews-q8ph9wbe.js +1214 -0
- package/dist/previews-rfswrh7q.js +1214 -0
- package/dist/previews-s0y5yp8s.js +1214 -0
- package/dist/previews-s5b6mnz5.js +1214 -0
- package/dist/previews-sdte4984.js +1200 -0
- package/dist/previews-t5tdm6t0.js +1225 -0
- package/dist/previews-tcaz1gt8.js +1337 -0
- package/dist/previews-tk7vpzj9.js +1214 -0
- package/dist/previews-tqt4pk27.js +1214 -0
- package/dist/previews-vqg4psk2.js +1225 -0
- package/dist/productions-2t9q8f57.js +505 -0
- package/dist/productions-4abj58kx.js +505 -0
- package/dist/productions-4dpec71r.js +505 -0
- package/dist/productions-4h80j2c7.js +505 -0
- package/dist/productions-4nedsanh.js +505 -0
- package/dist/productions-5c58yafp.js +505 -0
- package/dist/productions-5xq5cjhx.js +505 -0
- package/dist/productions-6dr0bmd7.js +505 -0
- package/dist/productions-86jaqt7m.js +505 -0
- package/dist/productions-8f6s8dqr.js +505 -0
- package/dist/productions-a2hcwwzf.js +505 -0
- package/dist/productions-b7svyjp7.js +505 -0
- package/dist/productions-bf2cnr05.js +505 -0
- package/dist/productions-bn2q31my.js +505 -0
- package/dist/productions-dkgry3gv.js +505 -0
- package/dist/productions-dv8g7f6g.js +505 -0
- package/dist/productions-e2m9s4tr.js +505 -0
- package/dist/productions-eqh105tk.js +505 -0
- package/dist/productions-etvcm7yf.js +505 -0
- package/dist/productions-f1zpbmjz.js +505 -0
- package/dist/productions-fgshs1m7.js +505 -0
- package/dist/productions-hphmt68n.js +505 -0
- package/dist/productions-j14pvx93.js +505 -0
- package/dist/productions-j7s1ywvg.js +505 -0
- package/dist/productions-jp3v3q3p.js +505 -0
- package/dist/productions-m9p42amj.js +505 -0
- package/dist/productions-mxbneawa.js +505 -0
- package/dist/productions-np4exh9p.js +505 -0
- package/dist/productions-rr1hqgda.js +505 -0
- package/dist/productions-rtf9ksgg.js +505 -0
- package/dist/productions-vhq7yx86.js +505 -0
- package/dist/productions-w2nzftcz.js +505 -0
- package/dist/productions-wbks5h7e.js +505 -0
- package/dist/productions-y99ayk6h.js +505 -0
- package/dist/productions-zpqyw5gm.js +505 -0
- package/dist/router/types.d.ts +24 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +27 -40
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +47 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +8 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +108 -99
- package/dist/runtime/middleware.d.ts +102 -60
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/router.d.ts +7 -0
- package/dist/runtime/router.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +10 -2
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/secrets-8wcj47nh.js +91 -0
- package/dist/secrets-b2ww34ta.js +91 -0
- package/dist/secrets-b7g4z621.js +91 -0
- package/dist/shims/local-media-bindings.d.ts +19 -0
- package/dist/shims/local-media-bindings.d.ts.map +1 -0
- package/dist/shims/local-worker-loader.d.ts +3 -0
- package/dist/shims/local-worker-loader.d.ts.map +1 -0
- package/dist/sveltekit/index.js +187 -75
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +19 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +11 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/bridge-context.d.ts +12 -2
- package/dist/test/bridge-context.d.ts.map +1 -1
- package/dist/test/cf.d.ts +35 -21
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +5 -8
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4595 -43
- package/dist/test/local-worker-loader.d.ts +3 -0
- package/dist/test/local-worker-loader.d.ts.map +1 -0
- package/dist/test/offline-bindings.d.ts +65 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +63 -3
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +10 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +7 -26
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +2 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +40 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +38 -0
- package/dist/test/utilities/platform.d.ts.map +1 -0
- package/dist/test/utilities/queue.d.ts +5 -0
- package/dist/test/utilities/queue.d.ts.map +1 -0
- package/dist/test/utilities/r2.d.ts +12 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +10 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-3b9wws58.js +419 -0
- package/dist/token-47kcz18j.js +419 -0
- package/dist/token-a2b38w0z.js +419 -0
- package/dist/token-exz78pth.js +419 -0
- package/dist/token-fcthx92c.js +419 -0
- package/dist/token-grwp8z4q.js +419 -0
- package/dist/token-jkmm44z2.js +419 -0
- package/dist/token-qxtvzm3b.js +419 -0
- package/dist/token-rq8mvtz9.js +419 -0
- package/dist/token-sct51r47.js +419 -0
- package/dist/token-sfgxcgen.js +419 -0
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/{types-5nyrz1sz.js → types-0qv4xces.js} +266 -148
- package/dist/types-2ejrbba1.js +695 -0
- package/dist/types-2nvrs9jg.js +572 -0
- package/dist/types-2pbe8kzw.js +572 -0
- package/dist/types-2zyt0m43.js +572 -0
- package/dist/types-4xxer9ep.js +572 -0
- package/dist/types-5t5y7a5n.js +572 -0
- package/dist/types-5wd2rygw.js +572 -0
- package/dist/types-7j3ykgx7.js +572 -0
- package/dist/types-7jkbm95a.js +695 -0
- package/dist/types-8g78x34n.js +572 -0
- package/dist/types-a2fk9yns.js +695 -0
- package/dist/types-dyb3c6zw.js +695 -0
- package/dist/types-e2n9f3pd.js +695 -0
- package/dist/types-e6d336q3.js +572 -0
- package/dist/types-hqh2fx0x.js +572 -0
- package/dist/types-j12xmdnd.js +572 -0
- package/dist/types-j4s6qcrc.js +695 -0
- package/dist/types-jqn26et3.js +572 -0
- package/dist/types-n0mxbq26.js +572 -0
- package/dist/types-naz9hvw5.js +572 -0
- package/dist/types-qjcd1jks.js +572 -0
- package/dist/types-r9zb8sw1.js +572 -0
- package/dist/types-rv5xwgsn.js +572 -0
- package/dist/types-t39njdqx.js +572 -0
- package/dist/types-tkgch3xv.js +572 -0
- package/dist/types-vhvt4hvm.js +693 -0
- package/dist/types-vvtb7rrh.js +572 -0
- package/dist/types-w1grncdj.js +572 -0
- package/dist/types-wmw49exb.js +572 -0
- package/dist/types-ymxz9jga.js +572 -0
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +19 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +25 -331
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-18ceqscc.js +513 -0
- package/dist/worker-1yqpwte2.js +513 -0
- package/dist/worker-2aw27zxy.js +513 -0
- package/dist/worker-45tp4a8f.js +513 -0
- package/dist/worker-663em30d.js +513 -0
- package/dist/worker-68zttchg.js +513 -0
- package/dist/worker-729cf3fh.js +513 -0
- package/dist/worker-99tew196.js +513 -0
- package/dist/worker-argxc7fb.js +513 -0
- package/dist/worker-aydzxt4f.js +513 -0
- package/dist/worker-ejdxma7k.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-entrypoint-3rmzd4c1.js +15 -0
- package/dist/worker-entrypoint-4xp7msd7.js +16 -0
- package/dist/{worker-entrypoint-m9th0rg0.js → worker-entrypoint-c259fmfs.js} +1 -1
- package/dist/worker-entrypoint-f1v9y4s8.js +15 -0
- package/dist/worker-f6xqjg65.js +513 -0
- package/dist/worker-fcdsnj14.js +513 -0
- package/dist/worker-fdnn62de.js +513 -0
- package/dist/worker-fk42rzse.js +513 -0
- package/dist/worker-frnh95rg.js +513 -0
- package/dist/worker-jkemk8d2.js +513 -0
- package/dist/worker-k55nfrmp.js +513 -0
- package/dist/worker-kqc6w7ry.js +513 -0
- package/dist/worker-ksvcq8be.js +513 -0
- package/dist/worker-m4ze8djx.js +513 -0
- package/dist/worker-mjzfstv5.js +513 -0
- package/dist/worker-p4rtsndj.js +513 -0
- package/dist/worker-p6d53qan.js +513 -0
- package/dist/worker-qh2qbv97.js +513 -0
- package/dist/worker-r234vnv9.js +513 -0
- package/dist/worker-r47bv7gt.js +513 -0
- package/dist/worker-s4nvbqsm.js +513 -0
- package/dist/worker-ttj7vwce.js +513 -0
- package/dist/worker-wnan5dca.js +513 -0
- package/dist/worker-wv4jdneg.js +513 -0
- package/dist/worker-xcbscr75.js +513 -0
- package/dist/worker-yw3atfb1.js +513 -0
- package/dist/worker-ywwkf3cp.js +513 -0
- package/dist/worker-z8wtk0sh.js +513 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +140 -115
- package/dist/account-rvrj687w.js +0 -397
- package/dist/browser-shim/worker.d.ts +0 -14
- package/dist/browser-shim/worker.d.ts.map +0 -1
- package/dist/build-mnf6v8gd.js +0 -53
- package/dist/deploy-nhceck39.js +0 -70
- package/dist/doctor-e8fy6fj5.js +0 -186
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-ep3445yc.js +0 -2225
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-m2q41jwa.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
package/dist/index-ep3445yc.js
DELETED
|
@@ -1,2225 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
transformWorkerEntrypoint
|
|
3
|
-
} from "./index-z14anrqp.js";
|
|
4
|
-
import {
|
|
5
|
-
discoverEntrypointsSync,
|
|
6
|
-
resolvePackageSpecifier
|
|
7
|
-
} from "./index-tk6ej9dj.js";
|
|
8
|
-
import {
|
|
9
|
-
getRemoteModeStatus,
|
|
10
|
-
isRemoteModeActive
|
|
11
|
-
} from "./index-d8bdkx2h.js";
|
|
12
|
-
import {
|
|
13
|
-
DEFAULT_DO_PATTERN,
|
|
14
|
-
findFiles,
|
|
15
|
-
findFilesSync
|
|
16
|
-
} from "./index-rbht7m9r.js";
|
|
17
|
-
import {
|
|
18
|
-
findDurableObjectClasses
|
|
19
|
-
} from "./index-gz1gndna.js";
|
|
20
|
-
import {
|
|
21
|
-
BridgeClient,
|
|
22
|
-
bridgeEnv,
|
|
23
|
-
createEnvProxy,
|
|
24
|
-
setBindingHints,
|
|
25
|
-
startMiniflare,
|
|
26
|
-
startMiniflareFromConfig
|
|
27
|
-
} from "./index-pf5s73n9.js";
|
|
28
|
-
import {
|
|
29
|
-
loadConfig,
|
|
30
|
-
normalizeDOBinding
|
|
31
|
-
} from "./index-hcex3rgh.js";
|
|
32
|
-
import {
|
|
33
|
-
canProceedWithTest,
|
|
34
|
-
getApiToken,
|
|
35
|
-
getEffectiveAccountId,
|
|
36
|
-
getPrimaryAccount,
|
|
37
|
-
isAuthenticated
|
|
38
|
-
} from "./index-tfyxa77h.js";
|
|
39
|
-
import {
|
|
40
|
-
__require
|
|
41
|
-
} from "./index-37x76zdn.js";
|
|
42
|
-
|
|
43
|
-
// src/test/simple-context.ts
|
|
44
|
-
import { resolve as resolve2, dirname as dirname2, join as join6 } from "path";
|
|
45
|
-
import { existsSync as existsSync2 } from "fs";
|
|
46
|
-
|
|
47
|
-
// src/test/remote-ai.ts
|
|
48
|
-
function createRemoteAI(accountId) {
|
|
49
|
-
let resolvedAccountId = null;
|
|
50
|
-
async function getAccountId() {
|
|
51
|
-
if (accountId)
|
|
52
|
-
return accountId;
|
|
53
|
-
if (resolvedAccountId)
|
|
54
|
-
return resolvedAccountId;
|
|
55
|
-
const primary = await getPrimaryAccount();
|
|
56
|
-
if (!primary) {
|
|
57
|
-
throw new Error("No Cloudflare account found. Run: bunx wrangler login");
|
|
58
|
-
}
|
|
59
|
-
const { accountId: effectiveId } = await getEffectiveAccountId(primary.id);
|
|
60
|
-
resolvedAccountId = effectiveId;
|
|
61
|
-
return effectiveId;
|
|
62
|
-
}
|
|
63
|
-
async function getToken() {
|
|
64
|
-
const token = await getApiToken();
|
|
65
|
-
if (!token) {
|
|
66
|
-
throw new Error("Not authenticated. Run: bunx wrangler login");
|
|
67
|
-
}
|
|
68
|
-
return token;
|
|
69
|
-
}
|
|
70
|
-
const ai = {
|
|
71
|
-
async run(model, inputs) {
|
|
72
|
-
const [acctId, token] = await Promise.all([getAccountId(), getToken()]);
|
|
73
|
-
const url = `https://api.cloudflare.com/client/v4/accounts/${acctId}/ai/run/${model}`;
|
|
74
|
-
const response = await fetch(url, {
|
|
75
|
-
method: "POST",
|
|
76
|
-
headers: {
|
|
77
|
-
Authorization: `Bearer ${token}`,
|
|
78
|
-
"Content-Type": "application/json"
|
|
79
|
-
},
|
|
80
|
-
body: JSON.stringify(inputs)
|
|
81
|
-
});
|
|
82
|
-
if (!response.ok) {
|
|
83
|
-
const errorText = await response.text();
|
|
84
|
-
throw new Error(`AI API error (${response.status}): ${errorText}`);
|
|
85
|
-
}
|
|
86
|
-
const result = await response.json();
|
|
87
|
-
if (!result.success) {
|
|
88
|
-
const message = result.errors?.[0]?.message || "Unknown AI error";
|
|
89
|
-
throw new Error(`AI API error: ${message}`);
|
|
90
|
-
}
|
|
91
|
-
return result.result;
|
|
92
|
-
},
|
|
93
|
-
gateway(_gatewayId) {
|
|
94
|
-
console.warn("AI Gateway is not supported in remote test mode");
|
|
95
|
-
return ai;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
return ai;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// src/test/remote-vectorize.ts
|
|
102
|
-
function createRemoteVectorize(indexName, accountId) {
|
|
103
|
-
let resolvedAccountId = null;
|
|
104
|
-
async function getAccountId() {
|
|
105
|
-
if (accountId)
|
|
106
|
-
return accountId;
|
|
107
|
-
if (resolvedAccountId)
|
|
108
|
-
return resolvedAccountId;
|
|
109
|
-
const primary = await getPrimaryAccount();
|
|
110
|
-
if (!primary) {
|
|
111
|
-
throw new Error("No Cloudflare account found. Run: bunx wrangler login");
|
|
112
|
-
}
|
|
113
|
-
const { accountId: effectiveId } = await getEffectiveAccountId(primary.id);
|
|
114
|
-
resolvedAccountId = effectiveId;
|
|
115
|
-
return effectiveId;
|
|
116
|
-
}
|
|
117
|
-
async function getToken() {
|
|
118
|
-
const token = await getApiToken();
|
|
119
|
-
if (!token) {
|
|
120
|
-
throw new Error("Not authenticated. Run: bunx wrangler login");
|
|
121
|
-
}
|
|
122
|
-
return token;
|
|
123
|
-
}
|
|
124
|
-
async function apiRequest(method, endpoint, body) {
|
|
125
|
-
const [acctId, token] = await Promise.all([getAccountId(), getToken()]);
|
|
126
|
-
const url = `https://api.cloudflare.com/client/v4/accounts/${acctId}/vectorize/v2/indexes/${indexName}${endpoint}`;
|
|
127
|
-
const response = await fetch(url, {
|
|
128
|
-
method,
|
|
129
|
-
headers: {
|
|
130
|
-
Authorization: `Bearer ${token}`,
|
|
131
|
-
"Content-Type": "application/json"
|
|
132
|
-
},
|
|
133
|
-
body: body ? JSON.stringify(body) : undefined
|
|
134
|
-
});
|
|
135
|
-
if (!response.ok) {
|
|
136
|
-
const errorText = await response.text();
|
|
137
|
-
throw new Error(`Vectorize API error (${response.status}): ${errorText}`);
|
|
138
|
-
}
|
|
139
|
-
const result = await response.json();
|
|
140
|
-
if (!result.success) {
|
|
141
|
-
const message = result.errors?.[0]?.message || "Unknown Vectorize error";
|
|
142
|
-
throw new Error(`Vectorize API error: ${message}`);
|
|
143
|
-
}
|
|
144
|
-
return result.result;
|
|
145
|
-
}
|
|
146
|
-
async function ndjsonRequest(endpoint, vectors) {
|
|
147
|
-
const [acctId, token] = await Promise.all([getAccountId(), getToken()]);
|
|
148
|
-
const url = `https://api.cloudflare.com/client/v4/accounts/${acctId}/vectorize/v2/indexes/${indexName}${endpoint}`;
|
|
149
|
-
const ndjson = vectors.map((v) => JSON.stringify(v)).join(`
|
|
150
|
-
`);
|
|
151
|
-
const response = await fetch(url, {
|
|
152
|
-
method: "POST",
|
|
153
|
-
headers: {
|
|
154
|
-
Authorization: `Bearer ${token}`,
|
|
155
|
-
"Content-Type": "application/x-ndjson"
|
|
156
|
-
},
|
|
157
|
-
body: ndjson
|
|
158
|
-
});
|
|
159
|
-
if (!response.ok) {
|
|
160
|
-
const errorText = await response.text();
|
|
161
|
-
throw new Error(`Vectorize API error (${response.status}): ${errorText}`);
|
|
162
|
-
}
|
|
163
|
-
const result = await response.json();
|
|
164
|
-
if (!result.success) {
|
|
165
|
-
const message = result.errors?.[0]?.message || "Unknown Vectorize error";
|
|
166
|
-
throw new Error(`Vectorize API error: ${message}`);
|
|
167
|
-
}
|
|
168
|
-
return result.result;
|
|
169
|
-
}
|
|
170
|
-
const vectorize = {
|
|
171
|
-
async describe() {
|
|
172
|
-
return apiRequest("GET", "");
|
|
173
|
-
},
|
|
174
|
-
async query(vector, options) {
|
|
175
|
-
const vectorArray = Array.isArray(vector) ? vector : Array.from(vector);
|
|
176
|
-
return apiRequest("POST", "/query", {
|
|
177
|
-
vector: vectorArray,
|
|
178
|
-
topK: options?.topK ?? 10,
|
|
179
|
-
returnValues: options?.returnValues ?? false,
|
|
180
|
-
returnMetadata: options?.returnMetadata ?? "none",
|
|
181
|
-
namespace: options?.namespace,
|
|
182
|
-
filter: options?.filter
|
|
183
|
-
});
|
|
184
|
-
},
|
|
185
|
-
async insert(vectors) {
|
|
186
|
-
const result = await ndjsonRequest("/insert", vectors);
|
|
187
|
-
return {
|
|
188
|
-
count: result.count,
|
|
189
|
-
ids: result.ids || vectors.map((v) => v.id)
|
|
190
|
-
};
|
|
191
|
-
},
|
|
192
|
-
async upsert(vectors) {
|
|
193
|
-
const result = await ndjsonRequest("/upsert", vectors);
|
|
194
|
-
return {
|
|
195
|
-
count: result.count,
|
|
196
|
-
ids: result.ids || vectors.map((v) => v.id)
|
|
197
|
-
};
|
|
198
|
-
},
|
|
199
|
-
async deleteByIds(ids) {
|
|
200
|
-
const result = await apiRequest("POST", "/delete-by-ids", { ids });
|
|
201
|
-
return {
|
|
202
|
-
count: result.count,
|
|
203
|
-
ids
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
async getByIds(ids) {
|
|
207
|
-
return apiRequest("POST", "/get-by-ids", { ids });
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
return vectorize;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// src/test/resolve-service-bindings.ts
|
|
214
|
-
import { dirname, join, resolve } from "path";
|
|
215
|
-
import { existsSync, readFileSync } from "fs";
|
|
216
|
-
function getBunRuntime() {
|
|
217
|
-
const g = globalThis;
|
|
218
|
-
if (typeof g.Bun === "object" && g.Bun !== null) {
|
|
219
|
-
return g.Bun;
|
|
220
|
-
}
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
function discoverDOFilesSync(dir) {
|
|
224
|
-
const classToPath = new Map;
|
|
225
|
-
try {
|
|
226
|
-
const files = findFilesSync(DEFAULT_DO_PATTERN, { cwd: dir });
|
|
227
|
-
for (const filePath of files) {
|
|
228
|
-
try {
|
|
229
|
-
const code = readFileSync(filePath, "utf-8");
|
|
230
|
-
const classNames = findDurableObjectClasses(code);
|
|
231
|
-
for (const className of classNames) {
|
|
232
|
-
if (!classToPath.has(className)) {
|
|
233
|
-
classToPath.set(className, filePath);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
} catch {}
|
|
237
|
-
}
|
|
238
|
-
} catch {}
|
|
239
|
-
return classToPath;
|
|
240
|
-
}
|
|
241
|
-
var bundleCache = new Map;
|
|
242
|
-
function clearBundleCache() {
|
|
243
|
-
bundleCache.clear();
|
|
244
|
-
}
|
|
245
|
-
function hasServiceBindings(config) {
|
|
246
|
-
const services = config.bindings?.services;
|
|
247
|
-
if (!services)
|
|
248
|
-
return false;
|
|
249
|
-
return Object.keys(services).length > 0;
|
|
250
|
-
}
|
|
251
|
-
async function resolveServiceBindings(config, configDir) {
|
|
252
|
-
const services = config.bindings?.services;
|
|
253
|
-
if (!services) {
|
|
254
|
-
return { workers: [], primaryServiceBindings: {} };
|
|
255
|
-
}
|
|
256
|
-
const workersByName = new Map;
|
|
257
|
-
const primaryServiceBindings = {};
|
|
258
|
-
for (const [bindingName, binding] of Object.entries(services)) {
|
|
259
|
-
const workerBinding = binding;
|
|
260
|
-
const ref = workerBinding.__ref;
|
|
261
|
-
if (ref) {
|
|
262
|
-
if ("__import" in ref && typeof ref.__import === "function") {
|
|
263
|
-
await ref.resolve();
|
|
264
|
-
}
|
|
265
|
-
const workerName = ref.name;
|
|
266
|
-
const entrypoint = workerBinding.entrypoint;
|
|
267
|
-
if (!workersByName.has(workerName)) {
|
|
268
|
-
const worker = await resolveRefWorker(ref, entrypoint, configDir);
|
|
269
|
-
if (worker) {
|
|
270
|
-
workersByName.set(workerName, worker);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
primaryServiceBindings[bindingName] = {
|
|
274
|
-
name: workerName,
|
|
275
|
-
...entrypoint && { entrypoint }
|
|
276
|
-
};
|
|
277
|
-
} else {
|
|
278
|
-
primaryServiceBindings[bindingName] = {
|
|
279
|
-
name: workerBinding.service,
|
|
280
|
-
...workerBinding.entrypoint && { entrypoint: workerBinding.entrypoint }
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return {
|
|
285
|
-
workers: [...workersByName.values()],
|
|
286
|
-
primaryServiceBindings
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
async function resolveRefWorker(ref, _entrypoint, parentConfigDir) {
|
|
290
|
-
const config = ref.config;
|
|
291
|
-
if (!config)
|
|
292
|
-
return null;
|
|
293
|
-
const configPath = ref.configPath;
|
|
294
|
-
if (!configPath || configPath === "<resolved>") {
|
|
295
|
-
console.warn(`[devflare] Cannot resolve worker "${ref.name}" - configPath not available`);
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
const refConfigDir = resolve(parentConfigDir, dirname(configPath));
|
|
299
|
-
const entrypoints = [];
|
|
300
|
-
const files = config.files;
|
|
301
|
-
const mainPath = files?.fetch ?? "src/worker.ts";
|
|
302
|
-
const workerTsPath = resolve(refConfigDir, mainPath);
|
|
303
|
-
if (existsSync(workerTsPath)) {
|
|
304
|
-
const isWorkerTs = mainPath.endsWith("worker.ts") || mainPath.endsWith("worker.js");
|
|
305
|
-
entrypoints.push({
|
|
306
|
-
path: workerTsPath,
|
|
307
|
-
className: "Worker",
|
|
308
|
-
isWorkerTs
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
const discoveredEntrypoints = discoverEntrypointsSync(refConfigDir);
|
|
312
|
-
for (const ep of discoveredEntrypoints) {
|
|
313
|
-
entrypoints.push({
|
|
314
|
-
path: ep.filePath,
|
|
315
|
-
className: ep.className,
|
|
316
|
-
isWorkerTs: false
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
if (entrypoints.length === 0) {
|
|
320
|
-
console.warn(`[devflare] Worker "${ref.name}" has no entry points`);
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
const script = await bundleAllEntrypoints(entrypoints, ref.name);
|
|
324
|
-
if (!script)
|
|
325
|
-
return null;
|
|
326
|
-
return {
|
|
327
|
-
name: ref.name,
|
|
328
|
-
script,
|
|
329
|
-
modules: true,
|
|
330
|
-
compatibilityDate: config.compatibilityDate ?? "2025-01-01"
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
async function bundleAllEntrypoints(entrypoints, workerName) {
|
|
334
|
-
const cacheKey = entrypoints.map((ep) => `${ep.path}::${ep.className}`).join("|");
|
|
335
|
-
const cached = bundleCache.get(cacheKey);
|
|
336
|
-
if (cached) {
|
|
337
|
-
return cached;
|
|
338
|
-
}
|
|
339
|
-
const bun = getBunRuntime();
|
|
340
|
-
if (!bun) {
|
|
341
|
-
console.warn("[devflare] Bun runtime required for bundling worker scripts");
|
|
342
|
-
return null;
|
|
343
|
-
}
|
|
344
|
-
try {
|
|
345
|
-
const { readFileSync: readFileSync2, writeFileSync, mkdirSync, unlinkSync } = await import("fs");
|
|
346
|
-
const imports = [];
|
|
347
|
-
const exports = [];
|
|
348
|
-
let defaultExportClass = null;
|
|
349
|
-
for (let i = 0;i < entrypoints.length; i++) {
|
|
350
|
-
const ep = entrypoints[i];
|
|
351
|
-
const sourceCode = readFileSync2(ep.path, "utf-8");
|
|
352
|
-
if (ep.isWorkerTs) {
|
|
353
|
-
const result = transformWorkerEntrypoint(sourceCode, ep.path, {
|
|
354
|
-
className: ep.className,
|
|
355
|
-
injectContext: false
|
|
356
|
-
});
|
|
357
|
-
if (result) {
|
|
358
|
-
const tempDir2 = join(dirname(ep.path), ".devflare");
|
|
359
|
-
mkdirSync(tempDir2, { recursive: true });
|
|
360
|
-
const tempPath = join(tempDir2, `__${ep.className}_${i}.ts`);
|
|
361
|
-
writeFileSync(tempPath, result.code);
|
|
362
|
-
imports.push(`import { ${ep.className} } from '${tempPath.replace(/\\/g, "/")}'`);
|
|
363
|
-
exports.push(ep.className);
|
|
364
|
-
if (!defaultExportClass) {
|
|
365
|
-
defaultExportClass = ep.className;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
} else {
|
|
369
|
-
imports.push(`import { ${ep.className} } from '${ep.path.replace(/\\/g, "/")}'`);
|
|
370
|
-
exports.push(ep.className);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
const defaultExport = defaultExportClass ? `
|
|
374
|
-
export default ${defaultExportClass}` : "";
|
|
375
|
-
const entryCode = `
|
|
376
|
-
${imports.join(`
|
|
377
|
-
`)}
|
|
378
|
-
export { ${exports.join(", ")} }${defaultExport}
|
|
379
|
-
`;
|
|
380
|
-
const tempDir = join(dirname(entrypoints[0].path), ".devflare");
|
|
381
|
-
mkdirSync(tempDir, { recursive: true });
|
|
382
|
-
const entryPath = join(tempDir, `__entry_${workerName}.ts`);
|
|
383
|
-
writeFileSync(entryPath, entryCode);
|
|
384
|
-
try {
|
|
385
|
-
const result = await bun.build({
|
|
386
|
-
entrypoints: [entryPath],
|
|
387
|
-
target: "browser",
|
|
388
|
-
format: "esm",
|
|
389
|
-
minify: false,
|
|
390
|
-
external: ["cloudflare:workers", "cloudflare:*"]
|
|
391
|
-
});
|
|
392
|
-
if (!result.success) {
|
|
393
|
-
console.warn(`[devflare] Failed to bundle worker "${workerName}": ${result.logs.join(`
|
|
394
|
-
`)}`);
|
|
395
|
-
return null;
|
|
396
|
-
}
|
|
397
|
-
const bundledCode = await result.outputs[0].text();
|
|
398
|
-
bundleCache.set(cacheKey, bundledCode);
|
|
399
|
-
return bundledCode;
|
|
400
|
-
} finally {
|
|
401
|
-
try {
|
|
402
|
-
unlinkSync(entryPath);
|
|
403
|
-
} catch {}
|
|
404
|
-
}
|
|
405
|
-
} catch (error) {
|
|
406
|
-
console.warn(`[devflare] Error bundling worker "${workerName}":`, error);
|
|
407
|
-
return null;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
function hasCrossWorkerDOs(config) {
|
|
411
|
-
const dos = config.bindings?.durableObjects;
|
|
412
|
-
if (!dos)
|
|
413
|
-
return false;
|
|
414
|
-
for (const doConfig of Object.values(dos)) {
|
|
415
|
-
const normalized = normalizeDOBinding(doConfig);
|
|
416
|
-
if (normalized.__ref)
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
return false;
|
|
420
|
-
}
|
|
421
|
-
async function resolveDOBindings(config, configDir) {
|
|
422
|
-
const dos = config.bindings?.durableObjects;
|
|
423
|
-
if (!dos) {
|
|
424
|
-
return { workers: [], crossWorkerDOBindings: {} };
|
|
425
|
-
}
|
|
426
|
-
const workersByName = new Map;
|
|
427
|
-
const crossWorkerDOBindings = {};
|
|
428
|
-
for (const [bindingName, rawDoConfig] of Object.entries(dos)) {
|
|
429
|
-
const hasRef = typeof rawDoConfig === "object" && "__ref" in rawDoConfig;
|
|
430
|
-
if (!hasRef) {
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
const ref = rawDoConfig.__ref;
|
|
434
|
-
if ("__import" in ref && typeof ref.__import === "function") {
|
|
435
|
-
await ref.resolve();
|
|
436
|
-
}
|
|
437
|
-
const doConfig = normalizeDOBinding(rawDoConfig);
|
|
438
|
-
const workerName = ref.name;
|
|
439
|
-
if (!workersByName.has(workerName)) {
|
|
440
|
-
const worker = await resolveDORefWorker(ref, configDir);
|
|
441
|
-
if (worker) {
|
|
442
|
-
workersByName.set(workerName, worker);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
crossWorkerDOBindings[bindingName] = {
|
|
446
|
-
className: doConfig.className,
|
|
447
|
-
scriptName: workerName
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
return {
|
|
451
|
-
workers: [...workersByName.values()],
|
|
452
|
-
crossWorkerDOBindings
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
async function resolveDORefWorker(ref, parentConfigDir) {
|
|
456
|
-
const config = ref.config;
|
|
457
|
-
if (!config)
|
|
458
|
-
return null;
|
|
459
|
-
const configPath = ref.configPath;
|
|
460
|
-
if (!configPath || configPath === "<resolved>") {
|
|
461
|
-
console.warn(`[devflare] Cannot resolve DO worker "${ref.name}" - configPath not available`);
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
const resolvedConfigPath = resolvePackageSpecifier(configPath, parentConfigDir);
|
|
465
|
-
const refConfigDir = dirname(resolvedConfigPath);
|
|
466
|
-
const dosConfig = config.bindings?.durableObjects;
|
|
467
|
-
if (!dosConfig || Object.keys(dosConfig).length === 0) {
|
|
468
|
-
console.warn(`[devflare] Referenced worker "${ref.name}" has no Durable Objects`);
|
|
469
|
-
return null;
|
|
470
|
-
}
|
|
471
|
-
const discoveredDOs = discoverDOFilesSync(refConfigDir);
|
|
472
|
-
const doClasses = [];
|
|
473
|
-
for (const [bindingName, rawDoConfig] of Object.entries(dosConfig)) {
|
|
474
|
-
const doConfig = normalizeDOBinding(rawDoConfig);
|
|
475
|
-
const className = doConfig.className;
|
|
476
|
-
const scriptName = doConfig.scriptName;
|
|
477
|
-
if (scriptName) {
|
|
478
|
-
const scriptPath = resolve(refConfigDir, "src", scriptName);
|
|
479
|
-
if (!existsSync(scriptPath)) {
|
|
480
|
-
const altPath = resolve(refConfigDir, scriptName);
|
|
481
|
-
if (!existsSync(altPath)) {
|
|
482
|
-
console.warn(`[devflare] DO script not found: ${scriptPath} or ${altPath}`);
|
|
483
|
-
continue;
|
|
484
|
-
}
|
|
485
|
-
doClasses.push({ bindingName, className, scriptPath: altPath });
|
|
486
|
-
} else {
|
|
487
|
-
doClasses.push({ bindingName, className, scriptPath });
|
|
488
|
-
}
|
|
489
|
-
} else {
|
|
490
|
-
const discoveredPath = discoveredDOs.get(className);
|
|
491
|
-
if (discoveredPath) {
|
|
492
|
-
doClasses.push({ bindingName, className, scriptPath: discoveredPath });
|
|
493
|
-
} else {
|
|
494
|
-
console.warn(`[devflare] DO "${bindingName}" (class: ${className}) not found in do.*.ts files in "${ref.name}"`);
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
if (doClasses.length === 0) {
|
|
500
|
-
console.warn(`[devflare] No valid DO classes found in "${ref.name}"`);
|
|
501
|
-
return null;
|
|
502
|
-
}
|
|
503
|
-
const script = await bundleDOClasses(doClasses, ref.name);
|
|
504
|
-
if (!script)
|
|
505
|
-
return null;
|
|
506
|
-
const durableObjects = {};
|
|
507
|
-
for (const do_ of doClasses) {
|
|
508
|
-
durableObjects[do_.bindingName] = do_.className;
|
|
509
|
-
}
|
|
510
|
-
return {
|
|
511
|
-
name: ref.name,
|
|
512
|
-
script,
|
|
513
|
-
modules: true,
|
|
514
|
-
compatibilityDate: config.compatibilityDate ?? "2025-01-01",
|
|
515
|
-
durableObjects
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
async function bundleDOClasses(doClasses, workerName) {
|
|
519
|
-
const cacheKey = `do:${doClasses.map((d) => `${d.scriptPath}::${d.className}`).join("|")}`;
|
|
520
|
-
const cached = bundleCache.get(cacheKey);
|
|
521
|
-
if (cached)
|
|
522
|
-
return cached;
|
|
523
|
-
const bun = getBunRuntime();
|
|
524
|
-
if (!bun) {
|
|
525
|
-
console.warn("[devflare] Bun runtime required for bundling DO classes");
|
|
526
|
-
return null;
|
|
527
|
-
}
|
|
528
|
-
try {
|
|
529
|
-
const { writeFileSync, mkdirSync, unlinkSync } = await import("fs");
|
|
530
|
-
const imports = doClasses.map((d) => `import { ${d.className} } from '${d.scriptPath.replace(/\\/g, "/")}'`).join(`
|
|
531
|
-
`);
|
|
532
|
-
const exports = doClasses.map((d) => d.className).join(", ");
|
|
533
|
-
const entryCode = `
|
|
534
|
-
${imports}
|
|
535
|
-
|
|
536
|
-
// Re-export DO classes for Miniflare binding
|
|
537
|
-
export { ${exports} }
|
|
538
|
-
|
|
539
|
-
// Default export with fetch handler
|
|
540
|
-
export default {
|
|
541
|
-
async fetch(request, env) {
|
|
542
|
-
return new Response('DO Worker: ${workerName}')
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
`;
|
|
546
|
-
const tempDir = join(dirname(doClasses[0].scriptPath), ".devflare");
|
|
547
|
-
mkdirSync(tempDir, { recursive: true });
|
|
548
|
-
const entryPath = join(tempDir, `__do_entry_${workerName}.ts`);
|
|
549
|
-
writeFileSync(entryPath, entryCode);
|
|
550
|
-
try {
|
|
551
|
-
const result = await bun.build({
|
|
552
|
-
entrypoints: [entryPath],
|
|
553
|
-
target: "browser",
|
|
554
|
-
format: "esm",
|
|
555
|
-
minify: false,
|
|
556
|
-
external: ["cloudflare:workers", "cloudflare:*"]
|
|
557
|
-
});
|
|
558
|
-
if (!result.success) {
|
|
559
|
-
console.warn(`[devflare] Failed to bundle DO worker "${workerName}": ${result.logs.join(`
|
|
560
|
-
`)}`);
|
|
561
|
-
return null;
|
|
562
|
-
}
|
|
563
|
-
const bundledCode = await result.outputs[0].text();
|
|
564
|
-
bundleCache.set(cacheKey, bundledCode);
|
|
565
|
-
return bundledCode;
|
|
566
|
-
} finally {
|
|
567
|
-
try {
|
|
568
|
-
unlinkSync(entryPath);
|
|
569
|
-
} catch {}
|
|
570
|
-
}
|
|
571
|
-
} catch (error) {
|
|
572
|
-
console.warn(`[devflare] Error bundling DO worker "${workerName}":`, error);
|
|
573
|
-
return null;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
// src/runtime/context.ts
|
|
578
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
579
|
-
var storage = new AsyncLocalStorage;
|
|
580
|
-
function runWithContext(env, ctx, request, fn, type = "fetch") {
|
|
581
|
-
const context = {
|
|
582
|
-
env,
|
|
583
|
-
ctx,
|
|
584
|
-
request,
|
|
585
|
-
locals: {},
|
|
586
|
-
type
|
|
587
|
-
};
|
|
588
|
-
return storage.run(context, fn);
|
|
589
|
-
}
|
|
590
|
-
function getContextOrNull() {
|
|
591
|
-
const context = storage.getStore();
|
|
592
|
-
return context ?? null;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// src/env.ts
|
|
596
|
-
var testContextEnv = null;
|
|
597
|
-
var testContextDispose = null;
|
|
598
|
-
function __setTestContext(envBindings, dispose) {
|
|
599
|
-
testContextEnv = envBindings;
|
|
600
|
-
testContextDispose = dispose;
|
|
601
|
-
}
|
|
602
|
-
function __clearTestContext() {
|
|
603
|
-
testContextEnv = null;
|
|
604
|
-
testContextDispose = null;
|
|
605
|
-
}
|
|
606
|
-
var env = new Proxy({}, {
|
|
607
|
-
get(_target, prop) {
|
|
608
|
-
if (prop === "dispose") {
|
|
609
|
-
return async () => {
|
|
610
|
-
if (testContextDispose) {
|
|
611
|
-
await testContextDispose();
|
|
612
|
-
__clearTestContext();
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
const ctx = getContextOrNull();
|
|
617
|
-
if (ctx?.env) {
|
|
618
|
-
return ctx.env[prop];
|
|
619
|
-
}
|
|
620
|
-
if (testContextEnv) {
|
|
621
|
-
return testContextEnv[prop];
|
|
622
|
-
}
|
|
623
|
-
return bridgeEnv[prop];
|
|
624
|
-
},
|
|
625
|
-
has(_target, prop) {
|
|
626
|
-
if (prop === "dispose")
|
|
627
|
-
return true;
|
|
628
|
-
const ctx = getContextOrNull();
|
|
629
|
-
if (ctx?.env) {
|
|
630
|
-
return prop in ctx.env;
|
|
631
|
-
}
|
|
632
|
-
if (testContextEnv) {
|
|
633
|
-
return prop in testContextEnv;
|
|
634
|
-
}
|
|
635
|
-
return prop in bridgeEnv;
|
|
636
|
-
},
|
|
637
|
-
ownKeys(_target) {
|
|
638
|
-
const ctx = getContextOrNull();
|
|
639
|
-
if (ctx?.env) {
|
|
640
|
-
return Reflect.ownKeys(ctx.env);
|
|
641
|
-
}
|
|
642
|
-
if (testContextEnv) {
|
|
643
|
-
return Reflect.ownKeys(testContextEnv);
|
|
644
|
-
}
|
|
645
|
-
return Reflect.ownKeys(bridgeEnv);
|
|
646
|
-
},
|
|
647
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
648
|
-
if (prop === "dispose") {
|
|
649
|
-
return { configurable: true, enumerable: false, writable: false };
|
|
650
|
-
}
|
|
651
|
-
const ctx = getContextOrNull();
|
|
652
|
-
const source = ctx?.env ?? testContextEnv ?? bridgeEnv;
|
|
653
|
-
return Reflect.getOwnPropertyDescriptor(source, prop);
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
// src/test/queue.ts
|
|
658
|
-
import { join as join2 } from "path";
|
|
659
|
-
var queueHandlerPath = null;
|
|
660
|
-
var configDir = null;
|
|
661
|
-
var testEnvGetter = null;
|
|
662
|
-
function configureQueue(options) {
|
|
663
|
-
queueHandlerPath = options.handlerPath;
|
|
664
|
-
configDir = options.configDir;
|
|
665
|
-
testEnvGetter = options.getEnv;
|
|
666
|
-
}
|
|
667
|
-
function resetQueueState() {
|
|
668
|
-
queueHandlerPath = null;
|
|
669
|
-
configDir = null;
|
|
670
|
-
testEnvGetter = null;
|
|
671
|
-
}
|
|
672
|
-
function createMessage(options) {
|
|
673
|
-
const id = options.id ?? crypto.randomUUID();
|
|
674
|
-
const timestamp = options.timestamp ?? new Date;
|
|
675
|
-
const attempts = options.attempts ?? 1;
|
|
676
|
-
let state = "pending";
|
|
677
|
-
return {
|
|
678
|
-
id,
|
|
679
|
-
timestamp,
|
|
680
|
-
body: options.body,
|
|
681
|
-
attempts,
|
|
682
|
-
ack() {
|
|
683
|
-
state = "acked";
|
|
684
|
-
},
|
|
685
|
-
retry(opts) {
|
|
686
|
-
state = "retried";
|
|
687
|
-
},
|
|
688
|
-
retryAll() {
|
|
689
|
-
state = "retried";
|
|
690
|
-
},
|
|
691
|
-
get _state() {
|
|
692
|
-
return state;
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
function createMessageBatch(messages) {
|
|
697
|
-
return {
|
|
698
|
-
queue: "test-queue",
|
|
699
|
-
messages,
|
|
700
|
-
ackAll() {
|
|
701
|
-
for (const msg of messages) {
|
|
702
|
-
msg.ack();
|
|
703
|
-
}
|
|
704
|
-
},
|
|
705
|
-
retryAll() {
|
|
706
|
-
for (const msg of messages) {
|
|
707
|
-
msg.retry();
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
async function trigger(messages) {
|
|
713
|
-
if (!queueHandlerPath) {
|
|
714
|
-
throw new Error("Queue handler not configured. Make sure your devflare.config.ts has files.queue set, " + "and the file exists at the specified path (default: src/queue.ts)");
|
|
715
|
-
}
|
|
716
|
-
if (!configDir || !testEnvGetter) {
|
|
717
|
-
throw new Error("Queue helper not initialized. Call createTestContext() before using cf.queue.trigger()");
|
|
718
|
-
}
|
|
719
|
-
const absolutePath = join2(configDir, queueHandlerPath);
|
|
720
|
-
const handlerModule = await import(absolutePath);
|
|
721
|
-
const queueHandler = handlerModule.default ?? handlerModule.queue;
|
|
722
|
-
if (typeof queueHandler !== "function") {
|
|
723
|
-
throw new Error(`Queue handler at "${queueHandlerPath}" must export a default function or named "queue" export.
|
|
724
|
-
Expected: export default async function queue(batch, env, ctx) { ... }
|
|
725
|
-
Or: export async function queue(batch, env, ctx) { ... }`);
|
|
726
|
-
}
|
|
727
|
-
const normalizedMessages = messages.map((msg) => {
|
|
728
|
-
if (typeof msg === "object" && msg !== null && "body" in msg) {
|
|
729
|
-
return msg;
|
|
730
|
-
}
|
|
731
|
-
return { body: msg };
|
|
732
|
-
});
|
|
733
|
-
const mockMessages = normalizedMessages.map((opts) => createMessage(opts));
|
|
734
|
-
const batch = createMessageBatch(mockMessages);
|
|
735
|
-
const waitUntilPromises = [];
|
|
736
|
-
const ctx = {
|
|
737
|
-
waitUntil(promise) {
|
|
738
|
-
waitUntilPromises.push(promise);
|
|
739
|
-
},
|
|
740
|
-
passThroughOnException() {},
|
|
741
|
-
props: {}
|
|
742
|
-
};
|
|
743
|
-
const env2 = testEnvGetter();
|
|
744
|
-
await queueHandler(batch, env2, ctx);
|
|
745
|
-
await Promise.all(waitUntilPromises);
|
|
746
|
-
const acked = [];
|
|
747
|
-
const retried = [];
|
|
748
|
-
const failed = [];
|
|
749
|
-
for (const msg of mockMessages) {
|
|
750
|
-
switch (msg._state) {
|
|
751
|
-
case "acked":
|
|
752
|
-
acked.push(msg.id);
|
|
753
|
-
break;
|
|
754
|
-
case "retried":
|
|
755
|
-
retried.push(msg.id);
|
|
756
|
-
break;
|
|
757
|
-
case "failed":
|
|
758
|
-
failed.push(msg.id);
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return {
|
|
763
|
-
acked,
|
|
764
|
-
retried,
|
|
765
|
-
failed,
|
|
766
|
-
total: mockMessages.length
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
async function send(message) {
|
|
770
|
-
return trigger([message]);
|
|
771
|
-
}
|
|
772
|
-
var queue = {
|
|
773
|
-
trigger,
|
|
774
|
-
send
|
|
775
|
-
};
|
|
776
|
-
|
|
777
|
-
// src/test/scheduled.ts
|
|
778
|
-
import { join as join3 } from "path";
|
|
779
|
-
var scheduledHandlerPath = null;
|
|
780
|
-
var configDir2 = null;
|
|
781
|
-
var testEnvGetter2 = null;
|
|
782
|
-
function configureScheduled(options) {
|
|
783
|
-
scheduledHandlerPath = options.handlerPath;
|
|
784
|
-
configDir2 = options.configDir;
|
|
785
|
-
testEnvGetter2 = options.getEnv;
|
|
786
|
-
}
|
|
787
|
-
function resetScheduledState() {
|
|
788
|
-
scheduledHandlerPath = null;
|
|
789
|
-
configDir2 = null;
|
|
790
|
-
testEnvGetter2 = null;
|
|
791
|
-
}
|
|
792
|
-
async function trigger2(cronOrOptions) {
|
|
793
|
-
if (!scheduledHandlerPath) {
|
|
794
|
-
throw new Error("Scheduled handler not configured. Make sure your devflare.config.ts has files.scheduled set, " + "and the file exists at the specified path (default: src/scheduled.ts)");
|
|
795
|
-
}
|
|
796
|
-
if (!configDir2 || !testEnvGetter2) {
|
|
797
|
-
throw new Error("Scheduled helper not initialized. Call createTestContext() before using cf.scheduled.trigger()");
|
|
798
|
-
}
|
|
799
|
-
const options = typeof cronOrOptions === "string" ? { cron: cronOrOptions } : cronOrOptions ?? {};
|
|
800
|
-
const cron = options.cron ?? "* * * * *";
|
|
801
|
-
const scheduledTime = options.scheduledTime instanceof Date ? options.scheduledTime.getTime() : options.scheduledTime ?? Date.now();
|
|
802
|
-
const absolutePath = join3(configDir2, scheduledHandlerPath);
|
|
803
|
-
const handlerModule = await import(absolutePath);
|
|
804
|
-
const scheduledHandler = handlerModule.default ?? handlerModule.scheduled;
|
|
805
|
-
if (typeof scheduledHandler !== "function") {
|
|
806
|
-
throw new Error(`Scheduled handler at "${scheduledHandlerPath}" must export a default function or named "scheduled" export.
|
|
807
|
-
Expected: export default async function scheduled(controller, env, ctx) { ... }
|
|
808
|
-
Or: export async function scheduled(controller, env, ctx) { ... }`);
|
|
809
|
-
}
|
|
810
|
-
const controller = {
|
|
811
|
-
scheduledTime,
|
|
812
|
-
cron,
|
|
813
|
-
noRetry() {}
|
|
814
|
-
};
|
|
815
|
-
const waitUntilPromises = [];
|
|
816
|
-
const ctx = {
|
|
817
|
-
waitUntil(promise) {
|
|
818
|
-
waitUntilPromises.push(promise);
|
|
819
|
-
},
|
|
820
|
-
passThroughOnException() {},
|
|
821
|
-
props: {}
|
|
822
|
-
};
|
|
823
|
-
const env2 = testEnvGetter2();
|
|
824
|
-
try {
|
|
825
|
-
await scheduledHandler(controller, env2, ctx);
|
|
826
|
-
await Promise.all(waitUntilPromises);
|
|
827
|
-
return {
|
|
828
|
-
success: true,
|
|
829
|
-
cron,
|
|
830
|
-
scheduledTime
|
|
831
|
-
};
|
|
832
|
-
} catch (error) {
|
|
833
|
-
return {
|
|
834
|
-
success: false,
|
|
835
|
-
error: error instanceof Error ? error.message : String(error),
|
|
836
|
-
cron,
|
|
837
|
-
scheduledTime
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
var scheduled = {
|
|
842
|
-
trigger: trigger2
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
// src/test/worker.ts
|
|
846
|
-
import { join as join4 } from "path";
|
|
847
|
-
var fetchHandlerPath = null;
|
|
848
|
-
var configDir3 = null;
|
|
849
|
-
var testEnvGetter3 = null;
|
|
850
|
-
function configureWorker(options) {
|
|
851
|
-
fetchHandlerPath = options.handlerPath;
|
|
852
|
-
configDir3 = options.configDir;
|
|
853
|
-
testEnvGetter3 = options.getEnv;
|
|
854
|
-
}
|
|
855
|
-
function resetWorkerState() {
|
|
856
|
-
fetchHandlerPath = null;
|
|
857
|
-
configDir3 = null;
|
|
858
|
-
testEnvGetter3 = null;
|
|
859
|
-
}
|
|
860
|
-
async function fetch2(request, options) {
|
|
861
|
-
if (!fetchHandlerPath) {
|
|
862
|
-
throw new Error("Fetch handler not configured. Make sure your devflare.config.ts has files.fetch set, " + "and the file exists at the specified path (default: src/fetch.ts)");
|
|
863
|
-
}
|
|
864
|
-
if (!configDir3 || !testEnvGetter3) {
|
|
865
|
-
throw new Error("Worker helper not initialized. Call createTestContext() before using cf.worker.fetch()");
|
|
866
|
-
}
|
|
867
|
-
let req;
|
|
868
|
-
if (typeof request === "string") {
|
|
869
|
-
const url = request.startsWith("http") ? request : `http://localhost${request.startsWith("/") ? "" : "/"}${request}`;
|
|
870
|
-
const headers = new Headers(options?.headers);
|
|
871
|
-
let body;
|
|
872
|
-
if (options?.body !== undefined) {
|
|
873
|
-
if (typeof options.body === "string") {
|
|
874
|
-
body = options.body;
|
|
875
|
-
} else {
|
|
876
|
-
body = JSON.stringify(options.body);
|
|
877
|
-
if (!headers.has("Content-Type")) {
|
|
878
|
-
headers.set("Content-Type", "application/json");
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
req = new Request(url, {
|
|
883
|
-
method: options?.method ?? "GET",
|
|
884
|
-
headers,
|
|
885
|
-
body
|
|
886
|
-
});
|
|
887
|
-
} else {
|
|
888
|
-
req = request;
|
|
889
|
-
}
|
|
890
|
-
const absolutePath = join4(configDir3, fetchHandlerPath);
|
|
891
|
-
const handlerModule = await import(absolutePath);
|
|
892
|
-
const fetchHandler = handlerModule.default ?? handlerModule.fetch;
|
|
893
|
-
if (typeof fetchHandler !== "function") {
|
|
894
|
-
throw new Error(`Fetch handler at "${fetchHandlerPath}" must export a default function or named "fetch" export.
|
|
895
|
-
Expected: export default async function fetch(request, env, ctx) { ... }
|
|
896
|
-
Or: export async function fetch(request, env, ctx) { ... }`);
|
|
897
|
-
}
|
|
898
|
-
const waitUntilPromises = [];
|
|
899
|
-
const ctx = {
|
|
900
|
-
waitUntil(promise) {
|
|
901
|
-
waitUntilPromises.push(promise);
|
|
902
|
-
},
|
|
903
|
-
passThroughOnException() {},
|
|
904
|
-
props: {}
|
|
905
|
-
};
|
|
906
|
-
const env2 = testEnvGetter3();
|
|
907
|
-
const response = await fetchHandler(req, env2, ctx);
|
|
908
|
-
return response;
|
|
909
|
-
}
|
|
910
|
-
async function get(path, headers) {
|
|
911
|
-
return fetch2(path, { method: "GET", headers });
|
|
912
|
-
}
|
|
913
|
-
async function post(path, body, headers) {
|
|
914
|
-
return fetch2(path, { method: "POST", body, headers });
|
|
915
|
-
}
|
|
916
|
-
async function put(path, body, headers) {
|
|
917
|
-
return fetch2(path, { method: "PUT", body, headers });
|
|
918
|
-
}
|
|
919
|
-
async function del(path, headers) {
|
|
920
|
-
return fetch2(path, { method: "DELETE", headers });
|
|
921
|
-
}
|
|
922
|
-
async function patch(path, body, headers) {
|
|
923
|
-
return fetch2(path, { method: "PATCH", body, headers });
|
|
924
|
-
}
|
|
925
|
-
var worker = {
|
|
926
|
-
fetch: fetch2,
|
|
927
|
-
get,
|
|
928
|
-
post,
|
|
929
|
-
put,
|
|
930
|
-
delete: del,
|
|
931
|
-
patch
|
|
932
|
-
};
|
|
933
|
-
|
|
934
|
-
// src/test/tail.ts
|
|
935
|
-
import { join as join5 } from "path";
|
|
936
|
-
var tailHandlerPath = null;
|
|
937
|
-
var configDir4 = null;
|
|
938
|
-
var testEnvGetter4 = null;
|
|
939
|
-
function configureTail(options) {
|
|
940
|
-
tailHandlerPath = options.handlerPath;
|
|
941
|
-
configDir4 = options.configDir;
|
|
942
|
-
testEnvGetter4 = options.getEnv;
|
|
943
|
-
}
|
|
944
|
-
function resetTailState() {
|
|
945
|
-
tailHandlerPath = null;
|
|
946
|
-
configDir4 = null;
|
|
947
|
-
testEnvGetter4 = null;
|
|
948
|
-
}
|
|
949
|
-
function createTraceItem(options) {
|
|
950
|
-
return {
|
|
951
|
-
scriptName: options.scriptName ?? "test-worker",
|
|
952
|
-
outcome: options.outcome ?? "ok",
|
|
953
|
-
eventTimestamp: options.eventTimestamp ?? Date.now(),
|
|
954
|
-
event: options.event ?? {
|
|
955
|
-
request: {
|
|
956
|
-
url: "https://example.com/",
|
|
957
|
-
method: "GET"
|
|
958
|
-
}
|
|
959
|
-
},
|
|
960
|
-
logs: options.logs ?? [],
|
|
961
|
-
exceptions: options.exceptions ?? [],
|
|
962
|
-
diagnosticsChannelEvents: options.diagnosticsChannelEvents ?? [],
|
|
963
|
-
scriptVersion: options.scriptVersion ?? { id: "test-version" },
|
|
964
|
-
dispatchNamespace: options.dispatchNamespace,
|
|
965
|
-
scriptTags: options.scriptTags ?? []
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
|
-
async function trigger3(items) {
|
|
969
|
-
if (!tailHandlerPath) {
|
|
970
|
-
throw new Error("Tail handler not configured. Make sure your devflare.config.ts has files.tail set, " + "or the file exists at src/tail.ts");
|
|
971
|
-
}
|
|
972
|
-
if (!configDir4 || !testEnvGetter4) {
|
|
973
|
-
throw new Error("Tail helper not initialized. Call createTestContext() before using cf.tail.trigger()");
|
|
974
|
-
}
|
|
975
|
-
const traceItems = items.map((item) => {
|
|
976
|
-
if ("eventTimestamp" in item && "outcome" in item && "scriptName" in item) {
|
|
977
|
-
return item;
|
|
978
|
-
}
|
|
979
|
-
return createTraceItem(item);
|
|
980
|
-
});
|
|
981
|
-
const absolutePath = join5(configDir4, tailHandlerPath);
|
|
982
|
-
const handlerModule = await import(absolutePath);
|
|
983
|
-
const tailHandler = handlerModule.default ?? handlerModule.tail;
|
|
984
|
-
if (typeof tailHandler !== "function") {
|
|
985
|
-
throw new Error(`Tail handler at "${tailHandlerPath}" must export a default function or named "tail" export.
|
|
986
|
-
Expected: export default async function tail(events, env, ctx) { ... }
|
|
987
|
-
Or: export async function tail(events, env, ctx) { ... }`);
|
|
988
|
-
}
|
|
989
|
-
const waitUntilPromises = [];
|
|
990
|
-
const ctx = {
|
|
991
|
-
waitUntil(promise) {
|
|
992
|
-
waitUntilPromises.push(promise);
|
|
993
|
-
},
|
|
994
|
-
passThroughOnException() {},
|
|
995
|
-
props: {}
|
|
996
|
-
};
|
|
997
|
-
const env2 = testEnvGetter4();
|
|
998
|
-
try {
|
|
999
|
-
await tailHandler(traceItems, env2, ctx);
|
|
1000
|
-
await Promise.all(waitUntilPromises);
|
|
1001
|
-
return {
|
|
1002
|
-
success: true,
|
|
1003
|
-
itemCount: traceItems.length
|
|
1004
|
-
};
|
|
1005
|
-
} catch (error) {
|
|
1006
|
-
return {
|
|
1007
|
-
success: false,
|
|
1008
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1009
|
-
itemCount: traceItems.length
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
function create(options = {}) {
|
|
1014
|
-
return createTraceItem(options);
|
|
1015
|
-
}
|
|
1016
|
-
var tail = {
|
|
1017
|
-
trigger: trigger3,
|
|
1018
|
-
create
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
// src/test/email.ts
|
|
1022
|
-
var miniflarePort = 8787;
|
|
1023
|
-
var emailListeners = [];
|
|
1024
|
-
var sentEmails = [];
|
|
1025
|
-
function configureEmail(options = {}) {
|
|
1026
|
-
if (options.port) {
|
|
1027
|
-
miniflarePort = options.port;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
function buildRawEmail(options) {
|
|
1031
|
-
if (options.raw) {
|
|
1032
|
-
return options.raw;
|
|
1033
|
-
}
|
|
1034
|
-
const lines = [];
|
|
1035
|
-
const messageId = `<${Date.now()}-${Math.random().toString(36).slice(2)}@devflare.dev>`;
|
|
1036
|
-
const date = new Date().toUTCString();
|
|
1037
|
-
lines.push(`From: ${options.from}`);
|
|
1038
|
-
lines.push(`To: ${options.to}`);
|
|
1039
|
-
lines.push(`Date: ${date}`);
|
|
1040
|
-
lines.push(`Message-ID: ${messageId}`);
|
|
1041
|
-
if (options.subject) {
|
|
1042
|
-
lines.push(`Subject: ${options.subject}`);
|
|
1043
|
-
}
|
|
1044
|
-
if (options.headers) {
|
|
1045
|
-
for (const [key, value] of Object.entries(options.headers)) {
|
|
1046
|
-
lines.push(`${key}: ${value}`);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
lines.push("MIME-Version: 1.0");
|
|
1050
|
-
lines.push("Content-Type: text/plain; charset=UTF-8");
|
|
1051
|
-
lines.push("");
|
|
1052
|
-
lines.push(options.body ?? "");
|
|
1053
|
-
return lines.join(`\r
|
|
1054
|
-
`);
|
|
1055
|
-
}
|
|
1056
|
-
async function send2(options) {
|
|
1057
|
-
const raw = buildRawEmail(options);
|
|
1058
|
-
const url = new URL(`http://localhost:${miniflarePort}/cdn-cgi/handler/email`);
|
|
1059
|
-
url.searchParams.set("from", options.from);
|
|
1060
|
-
url.searchParams.set("to", options.to);
|
|
1061
|
-
const response = await fetch(url.toString(), {
|
|
1062
|
-
method: "POST",
|
|
1063
|
-
headers: {
|
|
1064
|
-
"Content-Type": "text/plain"
|
|
1065
|
-
},
|
|
1066
|
-
body: raw
|
|
1067
|
-
});
|
|
1068
|
-
return response;
|
|
1069
|
-
}
|
|
1070
|
-
function onReceive(callback) {
|
|
1071
|
-
emailListeners.push(callback);
|
|
1072
|
-
return () => {
|
|
1073
|
-
emailListeners = emailListeners.filter((cb) => cb !== callback);
|
|
1074
|
-
};
|
|
1075
|
-
}
|
|
1076
|
-
function getSentEmails() {
|
|
1077
|
-
return [...sentEmails];
|
|
1078
|
-
}
|
|
1079
|
-
function clearSentEmails() {
|
|
1080
|
-
sentEmails = [];
|
|
1081
|
-
}
|
|
1082
|
-
function resetEmailState() {
|
|
1083
|
-
emailListeners = [];
|
|
1084
|
-
sentEmails = [];
|
|
1085
|
-
}
|
|
1086
|
-
var email = {
|
|
1087
|
-
send: send2,
|
|
1088
|
-
onReceive,
|
|
1089
|
-
getSentEmails,
|
|
1090
|
-
clearSentEmails
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
// src/test/simple-context.ts
|
|
1094
|
-
function findExportedClasses(code) {
|
|
1095
|
-
const classes = [];
|
|
1096
|
-
const classPattern = /export\s+class\s+(\w+)/g;
|
|
1097
|
-
let match;
|
|
1098
|
-
while ((match = classPattern.exec(code)) !== null) {
|
|
1099
|
-
classes.push(match[1]);
|
|
1100
|
-
}
|
|
1101
|
-
return classes;
|
|
1102
|
-
}
|
|
1103
|
-
function getBunRuntime2() {
|
|
1104
|
-
const g = globalThis;
|
|
1105
|
-
if (typeof g.Bun === "object" && g.Bun !== null) {
|
|
1106
|
-
return g.Bun;
|
|
1107
|
-
}
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
1110
|
-
var globalClient = null;
|
|
1111
|
-
var globalMiniflare = null;
|
|
1112
|
-
var globalEnvProxy = null;
|
|
1113
|
-
var globalTransportDecode = null;
|
|
1114
|
-
var globalRemoteBindings = null;
|
|
1115
|
-
var globalMiniflareBindings = null;
|
|
1116
|
-
function getCallerDirectory() {
|
|
1117
|
-
const bun = getBunRuntime2();
|
|
1118
|
-
if (bun?.main) {
|
|
1119
|
-
const mainPath = bun.main;
|
|
1120
|
-
if (!mainPath.includes("[") && existsSync2(mainPath)) {
|
|
1121
|
-
return dirname2(mainPath);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
const originalPrepare = Error.prepareStackTrace;
|
|
1125
|
-
Error.prepareStackTrace = (_, stack2) => stack2;
|
|
1126
|
-
const err = new Error;
|
|
1127
|
-
const stack = err.stack;
|
|
1128
|
-
Error.prepareStackTrace = originalPrepare;
|
|
1129
|
-
for (const site of stack) {
|
|
1130
|
-
const filename = site.getFileName?.();
|
|
1131
|
-
if (filename && !filename.includes("simple-context") && !filename.includes("node_modules") && !filename.includes("[") && existsSync2(filename)) {
|
|
1132
|
-
return dirname2(filename);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
return process.cwd();
|
|
1136
|
-
}
|
|
1137
|
-
function findNearestConfig(startDir) {
|
|
1138
|
-
const configNames = ["devflare.config.ts", "devflare.config.js"];
|
|
1139
|
-
let currentDir = startDir;
|
|
1140
|
-
while (true) {
|
|
1141
|
-
for (const name of configNames) {
|
|
1142
|
-
const configPath = join6(currentDir, name);
|
|
1143
|
-
if (existsSync2(configPath)) {
|
|
1144
|
-
return configPath;
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
const parentDir = dirname2(currentDir);
|
|
1148
|
-
if (parentDir === currentDir) {
|
|
1149
|
-
return null;
|
|
1150
|
-
}
|
|
1151
|
-
currentDir = parentDir;
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
async function createTestContext(configPath) {
|
|
1155
|
-
const callerDir = getCallerDirectory();
|
|
1156
|
-
let absolutePath;
|
|
1157
|
-
if (configPath) {
|
|
1158
|
-
absolutePath = resolve2(callerDir, configPath);
|
|
1159
|
-
} else {
|
|
1160
|
-
const found = findNearestConfig(callerDir);
|
|
1161
|
-
if (!found) {
|
|
1162
|
-
throw new Error(`Could not find devflare.config.ts. Searched upward from: ${callerDir}
|
|
1163
|
-
` + `Either create a config file or provide an explicit path: createTestContext('./path/to/config.ts')`);
|
|
1164
|
-
}
|
|
1165
|
-
absolutePath = found;
|
|
1166
|
-
}
|
|
1167
|
-
const configDir5 = dirname2(absolutePath);
|
|
1168
|
-
const config = await loadConfig({
|
|
1169
|
-
cwd: configDir5,
|
|
1170
|
-
configFile: absolutePath.split(/[/\\]/).pop()
|
|
1171
|
-
});
|
|
1172
|
-
globalRemoteBindings = {};
|
|
1173
|
-
if (isRemoteModeActive()) {
|
|
1174
|
-
if (config.bindings?.ai) {
|
|
1175
|
-
const aiBindingName = config.bindings.ai.binding || "AI";
|
|
1176
|
-
globalRemoteBindings[aiBindingName] = createRemoteAI(config.accountId);
|
|
1177
|
-
}
|
|
1178
|
-
if (config.bindings?.vectorize) {
|
|
1179
|
-
for (const [name, vectorConfig] of Object.entries(config.bindings.vectorize)) {
|
|
1180
|
-
globalRemoteBindings[name] = createRemoteVectorize(vectorConfig.indexName, config.accountId);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
if (config.vars) {
|
|
1185
|
-
for (const [key, value] of Object.entries(config.vars)) {
|
|
1186
|
-
globalRemoteBindings[key] = value;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
const hints = {};
|
|
1190
|
-
if (config.bindings?.kv) {
|
|
1191
|
-
for (const name of Object.keys(config.bindings.kv))
|
|
1192
|
-
hints[name] = "kv";
|
|
1193
|
-
}
|
|
1194
|
-
if (config.bindings?.r2) {
|
|
1195
|
-
for (const name of Object.keys(config.bindings.r2))
|
|
1196
|
-
hints[name] = "r2";
|
|
1197
|
-
}
|
|
1198
|
-
if (config.bindings?.d1) {
|
|
1199
|
-
for (const name of Object.keys(config.bindings.d1))
|
|
1200
|
-
hints[name] = "d1";
|
|
1201
|
-
}
|
|
1202
|
-
if (config.bindings?.durableObjects) {
|
|
1203
|
-
for (const name of Object.keys(config.bindings.durableObjects))
|
|
1204
|
-
hints[name] = "do";
|
|
1205
|
-
}
|
|
1206
|
-
if (config.bindings?.services) {
|
|
1207
|
-
for (const name of Object.keys(config.bindings.services))
|
|
1208
|
-
hints[name] = "service";
|
|
1209
|
-
}
|
|
1210
|
-
const needsMultiWorkerForServices = hasServiceBindings(config);
|
|
1211
|
-
const needsMultiWorkerForDOs = hasCrossWorkerDOs(config);
|
|
1212
|
-
const needsMultiWorker = needsMultiWorkerForServices || needsMultiWorkerForDOs;
|
|
1213
|
-
let serviceBindingResolution = null;
|
|
1214
|
-
let doBindingResolution = null;
|
|
1215
|
-
if (needsMultiWorkerForServices) {
|
|
1216
|
-
serviceBindingResolution = await resolveServiceBindings(config, configDir5);
|
|
1217
|
-
}
|
|
1218
|
-
if (needsMultiWorkerForDOs) {
|
|
1219
|
-
doBindingResolution = await resolveDOBindings(config, configDir5);
|
|
1220
|
-
}
|
|
1221
|
-
const randomPort = 1e4 + Math.floor(Math.random() * 50000);
|
|
1222
|
-
const mfConfig = {
|
|
1223
|
-
modules: true,
|
|
1224
|
-
port: randomPort
|
|
1225
|
-
};
|
|
1226
|
-
if (config.bindings?.kv)
|
|
1227
|
-
mfConfig.kvNamespaces = Object.keys(config.bindings.kv);
|
|
1228
|
-
if (config.bindings?.r2)
|
|
1229
|
-
mfConfig.r2Buckets = Object.keys(config.bindings.r2);
|
|
1230
|
-
if (config.bindings?.d1)
|
|
1231
|
-
mfConfig.d1Databases = Object.keys(config.bindings.d1);
|
|
1232
|
-
if (config.bindings?.queues?.producers) {
|
|
1233
|
-
const queueProducers = {};
|
|
1234
|
-
for (const [bindingName, queueName] of Object.entries(config.bindings.queues.producers)) {
|
|
1235
|
-
queueProducers[bindingName] = { queueName };
|
|
1236
|
-
}
|
|
1237
|
-
mfConfig.queueProducers = queueProducers;
|
|
1238
|
-
}
|
|
1239
|
-
const transportFile = config.files?.transport;
|
|
1240
|
-
if (transportFile) {
|
|
1241
|
-
const transportPath = join6(configDir5, transportFile);
|
|
1242
|
-
const transportModule = await import(transportPath);
|
|
1243
|
-
if (!transportModule.transport) {
|
|
1244
|
-
console.warn(`[devflare] Warning: Transport file "${transportFile}" does not export a named "transport" object.
|
|
1245
|
-
Expected: export const transport = { ... }
|
|
1246
|
-
Transport encoding/decoding will be disabled.`);
|
|
1247
|
-
} else {
|
|
1248
|
-
globalTransportDecode = new Map;
|
|
1249
|
-
for (const [typeName, transporter] of Object.entries(transportModule.transport)) {
|
|
1250
|
-
const t = transporter;
|
|
1251
|
-
globalTransportDecode.set(typeName, t.decode);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
if (config.bindings?.durableObjects) {
|
|
1256
|
-
const doConfig = {};
|
|
1257
|
-
const doInfos = [];
|
|
1258
|
-
const classToFilePath = new Map;
|
|
1259
|
-
const doPatternConfig = config.files?.durableObjects;
|
|
1260
|
-
const doPattern = typeof doPatternConfig === "string" ? doPatternConfig : DEFAULT_DO_PATTERN;
|
|
1261
|
-
if (doPatternConfig !== false) {
|
|
1262
|
-
const fs = await import("fs/promises");
|
|
1263
|
-
const doFiles = await findFiles(doPattern, { cwd: configDir5 });
|
|
1264
|
-
for (const filePath of doFiles) {
|
|
1265
|
-
try {
|
|
1266
|
-
const code = await fs.readFile(filePath, "utf-8");
|
|
1267
|
-
const classNames = findExportedClasses(code);
|
|
1268
|
-
for (const className of classNames) {
|
|
1269
|
-
classToFilePath.set(className, filePath);
|
|
1270
|
-
}
|
|
1271
|
-
} catch {}
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
for (const [name, rawDoInfo] of Object.entries(config.bindings.durableObjects)) {
|
|
1275
|
-
const doInfo = normalizeDOBinding(rawDoInfo);
|
|
1276
|
-
if (doInfo.__ref) {
|
|
1277
|
-
continue;
|
|
1278
|
-
}
|
|
1279
|
-
let scriptPath;
|
|
1280
|
-
if (doInfo.scriptName) {
|
|
1281
|
-
scriptPath = join6(configDir5, "src", doInfo.scriptName);
|
|
1282
|
-
} else {
|
|
1283
|
-
const discoveredPath = classToFilePath.get(doInfo.className);
|
|
1284
|
-
if (!discoveredPath) {
|
|
1285
|
-
throw new Error(`Durable object ${name} (className: '${doInfo.className}') not found.
|
|
1286
|
-
Either:
|
|
1287
|
-
1. Set files.durableObjects pattern in config (e.g., 'src/do.*.ts')
|
|
1288
|
-
2. Use explicit scriptName: { className: '${doInfo.className}', scriptName: 'do.file.ts' }`);
|
|
1289
|
-
}
|
|
1290
|
-
scriptPath = discoveredPath;
|
|
1291
|
-
}
|
|
1292
|
-
doConfig[name] = doInfo.className;
|
|
1293
|
-
doInfos.push({ name, className: doInfo.className, scriptPath });
|
|
1294
|
-
}
|
|
1295
|
-
const virtualImports = [];
|
|
1296
|
-
const virtualExports = [];
|
|
1297
|
-
if (transportFile) {
|
|
1298
|
-
const transportPath = join6(configDir5, transportFile);
|
|
1299
|
-
virtualImports.push(`import { transport } from '${transportPath.replace(/\\/g, "/")}'`);
|
|
1300
|
-
virtualExports.push("export { transport }");
|
|
1301
|
-
}
|
|
1302
|
-
for (const info of doInfos) {
|
|
1303
|
-
virtualImports.push(`import { ${info.className} } from '${info.scriptPath.replace(/\\/g, "/")}'`);
|
|
1304
|
-
virtualExports.push(`export { ${info.className} }`);
|
|
1305
|
-
}
|
|
1306
|
-
let bundledCode = "";
|
|
1307
|
-
if (virtualImports.length > 0) {
|
|
1308
|
-
const virtualEntry = [...virtualImports, "", ...virtualExports].join(`
|
|
1309
|
-
`);
|
|
1310
|
-
const virtualPath = join6(configDir5, ".devflare", "__test_entry.ts");
|
|
1311
|
-
const { writeFileSync, mkdirSync } = await import("fs");
|
|
1312
|
-
mkdirSync(dirname2(virtualPath), { recursive: true });
|
|
1313
|
-
writeFileSync(virtualPath, virtualEntry);
|
|
1314
|
-
const bun = getBunRuntime2();
|
|
1315
|
-
if (!bun) {
|
|
1316
|
-
throw new Error("Bun runtime is required for createTestContext with Durable Objects");
|
|
1317
|
-
}
|
|
1318
|
-
const result = await bun.build({
|
|
1319
|
-
entrypoints: [virtualPath],
|
|
1320
|
-
target: "browser",
|
|
1321
|
-
format: "esm",
|
|
1322
|
-
minify: false,
|
|
1323
|
-
external: ["cloudflare:workers", "cloudflare:*"]
|
|
1324
|
-
});
|
|
1325
|
-
if (!result.success) {
|
|
1326
|
-
throw new Error(`Failed to bundle test entry: ${result.logs.join(`
|
|
1327
|
-
`)}`);
|
|
1328
|
-
}
|
|
1329
|
-
bundledCode = await result.outputs[0].text();
|
|
1330
|
-
}
|
|
1331
|
-
mfConfig.durableObjects = doConfig;
|
|
1332
|
-
mfConfig.script = buildGatewayScript(bundledCode, "");
|
|
1333
|
-
} else {
|
|
1334
|
-
mfConfig.script = buildGatewayScript("", "");
|
|
1335
|
-
}
|
|
1336
|
-
const hasMultiWorkerServices = serviceBindingResolution && serviceBindingResolution.workers.length > 0;
|
|
1337
|
-
const hasMultiWorkerDOs = doBindingResolution && doBindingResolution.workers.length > 0;
|
|
1338
|
-
if (hasMultiWorkerServices || hasMultiWorkerDOs) {
|
|
1339
|
-
const primaryDurableObjects = {
|
|
1340
|
-
...mfConfig.durableObjects || {},
|
|
1341
|
-
...doBindingResolution?.crossWorkerDOBindings || {}
|
|
1342
|
-
};
|
|
1343
|
-
const primaryWorker = {
|
|
1344
|
-
name: config.name ?? "primary",
|
|
1345
|
-
modules: true,
|
|
1346
|
-
script: mfConfig.script,
|
|
1347
|
-
compatibilityDate: config.compatibilityDate ?? "2025-01-01",
|
|
1348
|
-
...mfConfig.kvNamespaces && { kvNamespaces: mfConfig.kvNamespaces },
|
|
1349
|
-
...mfConfig.r2Buckets && { r2Buckets: mfConfig.r2Buckets },
|
|
1350
|
-
...mfConfig.d1Databases && { d1Databases: mfConfig.d1Databases },
|
|
1351
|
-
...Object.keys(primaryDurableObjects).length > 0 && { durableObjects: primaryDurableObjects },
|
|
1352
|
-
...serviceBindingResolution?.primaryServiceBindings && { serviceBindings: serviceBindingResolution.primaryServiceBindings }
|
|
1353
|
-
};
|
|
1354
|
-
const additionalWorkers = [
|
|
1355
|
-
...serviceBindingResolution?.workers || [],
|
|
1356
|
-
...doBindingResolution?.workers || []
|
|
1357
|
-
];
|
|
1358
|
-
const workersByName = new Map;
|
|
1359
|
-
for (const worker2 of additionalWorkers) {
|
|
1360
|
-
if (!workersByName.has(worker2.name)) {
|
|
1361
|
-
workersByName.set(worker2.name, worker2);
|
|
1362
|
-
} else {
|
|
1363
|
-
const existing = workersByName.get(worker2.name);
|
|
1364
|
-
if (worker2.durableObjects) {
|
|
1365
|
-
existing.durableObjects = {
|
|
1366
|
-
...existing.durableObjects || {},
|
|
1367
|
-
...worker2.durableObjects
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
const workers = [primaryWorker, ...workersByName.values()];
|
|
1373
|
-
delete mfConfig.script;
|
|
1374
|
-
delete mfConfig.modules;
|
|
1375
|
-
delete mfConfig.kvNamespaces;
|
|
1376
|
-
delete mfConfig.r2Buckets;
|
|
1377
|
-
delete mfConfig.d1Databases;
|
|
1378
|
-
delete mfConfig.durableObjects;
|
|
1379
|
-
mfConfig.workers = workers;
|
|
1380
|
-
}
|
|
1381
|
-
const { Miniflare } = await import("miniflare");
|
|
1382
|
-
globalMiniflare = new Miniflare(mfConfig);
|
|
1383
|
-
await globalMiniflare.ready;
|
|
1384
|
-
globalMiniflareBindings = await globalMiniflare.getBindings();
|
|
1385
|
-
const disposeContext = async () => {
|
|
1386
|
-
if (globalClient) {
|
|
1387
|
-
await globalClient.disconnect();
|
|
1388
|
-
globalClient = null;
|
|
1389
|
-
}
|
|
1390
|
-
if (globalMiniflare) {
|
|
1391
|
-
await globalMiniflare.dispose();
|
|
1392
|
-
globalMiniflare = null;
|
|
1393
|
-
}
|
|
1394
|
-
globalEnvProxy = null;
|
|
1395
|
-
globalTransportDecode = null;
|
|
1396
|
-
globalRemoteBindings = null;
|
|
1397
|
-
globalMiniflareBindings = null;
|
|
1398
|
-
resetQueueState();
|
|
1399
|
-
resetScheduledState();
|
|
1400
|
-
resetWorkerState();
|
|
1401
|
-
resetTailState();
|
|
1402
|
-
resetEmailState();
|
|
1403
|
-
__clearTestContext();
|
|
1404
|
-
};
|
|
1405
|
-
const getTestEnv = () => {
|
|
1406
|
-
if (globalMiniflareBindings)
|
|
1407
|
-
return globalMiniflareBindings;
|
|
1408
|
-
if (globalRemoteBindings)
|
|
1409
|
-
return globalRemoteBindings;
|
|
1410
|
-
if (globalEnvProxy)
|
|
1411
|
-
return globalEnvProxy;
|
|
1412
|
-
return {};
|
|
1413
|
-
};
|
|
1414
|
-
const queuePath = config.files?.queue;
|
|
1415
|
-
const scheduledPath = config.files?.scheduled;
|
|
1416
|
-
const fetchPath = config.files?.fetch;
|
|
1417
|
-
const DEFAULT_FETCH_PATH = "src/fetch.ts";
|
|
1418
|
-
const DEFAULT_QUEUE_PATH = "src/queue.ts";
|
|
1419
|
-
const DEFAULT_SCHEDULED_PATH = "src/scheduled.ts";
|
|
1420
|
-
const resolvePath = async (configValue, defaultPath) => {
|
|
1421
|
-
if (typeof configValue === "string")
|
|
1422
|
-
return configValue;
|
|
1423
|
-
if (configValue === false)
|
|
1424
|
-
return null;
|
|
1425
|
-
const defaultAbsolute = join6(configDir5, defaultPath);
|
|
1426
|
-
try {
|
|
1427
|
-
const fs = await import("fs/promises");
|
|
1428
|
-
await fs.access(defaultAbsolute);
|
|
1429
|
-
return defaultPath;
|
|
1430
|
-
} catch {
|
|
1431
|
-
return null;
|
|
1432
|
-
}
|
|
1433
|
-
};
|
|
1434
|
-
const [resolvedFetchPath, resolvedQueuePath, resolvedScheduledPath] = await Promise.all([
|
|
1435
|
-
resolvePath(fetchPath, DEFAULT_FETCH_PATH),
|
|
1436
|
-
resolvePath(queuePath, DEFAULT_QUEUE_PATH),
|
|
1437
|
-
resolvePath(scheduledPath, DEFAULT_SCHEDULED_PATH)
|
|
1438
|
-
]);
|
|
1439
|
-
configureQueue({
|
|
1440
|
-
handlerPath: resolvedQueuePath,
|
|
1441
|
-
configDir: configDir5,
|
|
1442
|
-
getEnv: getTestEnv
|
|
1443
|
-
});
|
|
1444
|
-
configureScheduled({
|
|
1445
|
-
handlerPath: resolvedScheduledPath,
|
|
1446
|
-
configDir: configDir5,
|
|
1447
|
-
getEnv: getTestEnv
|
|
1448
|
-
});
|
|
1449
|
-
configureWorker({
|
|
1450
|
-
handlerPath: resolvedFetchPath,
|
|
1451
|
-
configDir: configDir5,
|
|
1452
|
-
getEnv: getTestEnv
|
|
1453
|
-
});
|
|
1454
|
-
configureTail({
|
|
1455
|
-
handlerPath: null,
|
|
1456
|
-
configDir: configDir5,
|
|
1457
|
-
getEnv: getTestEnv
|
|
1458
|
-
});
|
|
1459
|
-
configureEmail({ port: randomPort });
|
|
1460
|
-
if (hasMultiWorkerServices || hasMultiWorkerDOs) {
|
|
1461
|
-
setBindingHints(hints);
|
|
1462
|
-
const envAccessor2 = new Proxy({}, {
|
|
1463
|
-
get(_, prop) {
|
|
1464
|
-
if (globalRemoteBindings && prop in globalRemoteBindings) {
|
|
1465
|
-
return globalRemoteBindings[prop];
|
|
1466
|
-
}
|
|
1467
|
-
if (globalMiniflareBindings && prop in globalMiniflareBindings) {
|
|
1468
|
-
return globalMiniflareBindings[prop];
|
|
1469
|
-
}
|
|
1470
|
-
return;
|
|
1471
|
-
},
|
|
1472
|
-
has(_, prop) {
|
|
1473
|
-
return Boolean(globalRemoteBindings && prop in globalRemoteBindings || globalMiniflareBindings && prop in globalMiniflareBindings);
|
|
1474
|
-
}
|
|
1475
|
-
});
|
|
1476
|
-
__setTestContext(envAccessor2, disposeContext);
|
|
1477
|
-
return;
|
|
1478
|
-
}
|
|
1479
|
-
globalClient = new BridgeClient({
|
|
1480
|
-
url: `ws://localhost:${randomPort}`
|
|
1481
|
-
});
|
|
1482
|
-
await globalClient.connect();
|
|
1483
|
-
setBindingHints(hints);
|
|
1484
|
-
globalEnvProxy = createEnvProxy({
|
|
1485
|
-
client: globalClient,
|
|
1486
|
-
transformResult: (result) => decodeTransport(result)
|
|
1487
|
-
});
|
|
1488
|
-
const envAccessor = new Proxy({}, {
|
|
1489
|
-
get(_, prop) {
|
|
1490
|
-
if (globalRemoteBindings && prop in globalRemoteBindings) {
|
|
1491
|
-
return globalRemoteBindings[prop];
|
|
1492
|
-
}
|
|
1493
|
-
if (globalMiniflareBindings && prop in globalMiniflareBindings) {
|
|
1494
|
-
return globalMiniflareBindings[prop];
|
|
1495
|
-
}
|
|
1496
|
-
if (globalEnvProxy) {
|
|
1497
|
-
return globalEnvProxy[prop];
|
|
1498
|
-
}
|
|
1499
|
-
return;
|
|
1500
|
-
},
|
|
1501
|
-
has(_, prop) {
|
|
1502
|
-
return Boolean(globalRemoteBindings && prop in globalRemoteBindings || globalMiniflareBindings && prop in globalMiniflareBindings || globalEnvProxy !== null);
|
|
1503
|
-
}
|
|
1504
|
-
});
|
|
1505
|
-
__setTestContext(envAccessor, disposeContext);
|
|
1506
|
-
}
|
|
1507
|
-
function decodeTransport(value) {
|
|
1508
|
-
if (!globalTransportDecode || value === null || typeof value !== "object") {
|
|
1509
|
-
return value;
|
|
1510
|
-
}
|
|
1511
|
-
if ("__transport" in value) {
|
|
1512
|
-
const encoded = value;
|
|
1513
|
-
const decoder = globalTransportDecode.get(encoded.__transport);
|
|
1514
|
-
if (decoder) {
|
|
1515
|
-
return decoder(encoded.value);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
if (Array.isArray(value)) {
|
|
1519
|
-
return value.map(decodeTransport);
|
|
1520
|
-
}
|
|
1521
|
-
const result = {};
|
|
1522
|
-
for (const [k, v] of Object.entries(value)) {
|
|
1523
|
-
result[k] = decodeTransport(v);
|
|
1524
|
-
}
|
|
1525
|
-
return result;
|
|
1526
|
-
}
|
|
1527
|
-
function buildGatewayScript(bundledCode, wrappers) {
|
|
1528
|
-
return `
|
|
1529
|
-
// Bundled transport + DO classes
|
|
1530
|
-
${bundledCode}
|
|
1531
|
-
|
|
1532
|
-
// DO Wrappers with RPC
|
|
1533
|
-
${wrappers}
|
|
1534
|
-
|
|
1535
|
-
// Transport encoding helper
|
|
1536
|
-
const __transportEncoders = typeof transport !== 'undefined' ? transport : {}
|
|
1537
|
-
|
|
1538
|
-
function __encodeTransport(value) {
|
|
1539
|
-
if (value === null || value === undefined) return value
|
|
1540
|
-
|
|
1541
|
-
// Try each encoder
|
|
1542
|
-
for (const [typeName, transporter] of Object.entries(__transportEncoders)) {
|
|
1543
|
-
const encoded = transporter.encode(value)
|
|
1544
|
-
if (encoded !== false && encoded !== undefined) {
|
|
1545
|
-
return { __transport: typeName, value: encoded }
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
// Recursively encode arrays and objects
|
|
1550
|
-
if (Array.isArray(value)) {
|
|
1551
|
-
return value.map(__encodeTransport)
|
|
1552
|
-
}
|
|
1553
|
-
if (typeof value === 'object') {
|
|
1554
|
-
const result = {}
|
|
1555
|
-
for (const [k, v] of Object.entries(value)) {
|
|
1556
|
-
result[k] = __encodeTransport(v)
|
|
1557
|
-
}
|
|
1558
|
-
return result
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
return value
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
// Gateway with WebSocket RPC
|
|
1565
|
-
export default {
|
|
1566
|
-
async fetch(request, env) {
|
|
1567
|
-
if (request.headers.get('Upgrade') === 'websocket') {
|
|
1568
|
-
const { 0: client, 1: server } = new WebSocketPair()
|
|
1569
|
-
server.accept()
|
|
1570
|
-
server.addEventListener('message', async (e) => {
|
|
1571
|
-
try {
|
|
1572
|
-
const m = JSON.parse(e.data)
|
|
1573
|
-
if (m.t === 'rpc.call') {
|
|
1574
|
-
const result = await executeRpc(env, m.method, m.params)
|
|
1575
|
-
server.send(JSON.stringify({ t: 'rpc.ok', id: m.id, result }))
|
|
1576
|
-
}
|
|
1577
|
-
} catch (error) {
|
|
1578
|
-
server.send(JSON.stringify({ t: 'rpc.err', id: 'unknown', error: { code: 'RPC_ERROR', message: error.message } }))
|
|
1579
|
-
}
|
|
1580
|
-
})
|
|
1581
|
-
return new Response(null, { status: 101, webSocket: client })
|
|
1582
|
-
}
|
|
1583
|
-
return new Response('Gateway')
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
async function executeRpc(env, method, params) {
|
|
1588
|
-
const [bindingName, ...rest] = method.split('.')
|
|
1589
|
-
const op = rest.join('.')
|
|
1590
|
-
const binding = env[bindingName]
|
|
1591
|
-
if (!binding) throw new Error('Binding not found: ' + bindingName)
|
|
1592
|
-
|
|
1593
|
-
// KV operations
|
|
1594
|
-
if (op === 'get') return binding.get(params[0], params[1])
|
|
1595
|
-
if (op === 'put') return binding.put(params[0], params[1], params[2])
|
|
1596
|
-
if (op === 'delete') return binding.delete(params[0])
|
|
1597
|
-
if (op === 'list') return binding.list(params[0])
|
|
1598
|
-
if (op === 'getWithMetadata') return binding.getWithMetadata(params[0], params[1])
|
|
1599
|
-
|
|
1600
|
-
// R2 operations
|
|
1601
|
-
if (op === 'r2.get') return binding.get(params[0], params[1])
|
|
1602
|
-
if (op === 'r2.put') return binding.put(params[0], params[1], params[2])
|
|
1603
|
-
if (op === 'r2.delete') return binding.delete(params[0])
|
|
1604
|
-
if (op === 'r2.list') return binding.list(params[0])
|
|
1605
|
-
if (op === 'head') return binding.head(params[0])
|
|
1606
|
-
|
|
1607
|
-
// D1 operations
|
|
1608
|
-
if (op === 'exec') return binding.exec(params[0])
|
|
1609
|
-
if (op === 'dump') return binding.dump()
|
|
1610
|
-
if (op === 'batch') {
|
|
1611
|
-
const stmts = params[0].map(s => {
|
|
1612
|
-
const stmt = binding.prepare(s.sql)
|
|
1613
|
-
return s.bindings?.length ? stmt.bind(...s.bindings) : stmt
|
|
1614
|
-
})
|
|
1615
|
-
return binding.batch(stmts)
|
|
1616
|
-
}
|
|
1617
|
-
if (op === 'prepare.run') return binding.prepare(params[0]).bind(...(params[1] || [])).run()
|
|
1618
|
-
if (op === 'prepare.all') return binding.prepare(params[0]).bind(...(params[1] || [])).all()
|
|
1619
|
-
if (op === 'prepare.first') return binding.prepare(params[0]).bind(...(params[1] || [])).first(params[2])
|
|
1620
|
-
if (op === 'prepare.raw') return binding.prepare(params[0]).bind(...(params[1] || [])).raw({ columnNames: params[2] })
|
|
1621
|
-
|
|
1622
|
-
// DO operations
|
|
1623
|
-
if (op === 'idFromName') {
|
|
1624
|
-
return { __type: 'DOId', hex: binding.idFromName(params[0]).toString() }
|
|
1625
|
-
}
|
|
1626
|
-
if (op === 'stub.rpc') {
|
|
1627
|
-
const [, idSerialized, rpcMethod, rpcParams] = params
|
|
1628
|
-
const stub = binding.get(binding.idFromString(idSerialized.hex))
|
|
1629
|
-
|
|
1630
|
-
// Use native RPC: call method directly on stub
|
|
1631
|
-
// This works for DOs extending DurableObject from cloudflare:workers
|
|
1632
|
-
let result = await stub[rpcMethod](...(rpcParams || []))
|
|
1633
|
-
// Apply transport encoding
|
|
1634
|
-
result = __encodeTransport(result)
|
|
1635
|
-
return result
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
throw new Error('Unknown operation: ' + method)
|
|
1639
|
-
}
|
|
1640
|
-
`;
|
|
1641
|
-
}
|
|
1642
|
-
// src/test/cf.ts
|
|
1643
|
-
var cf = {
|
|
1644
|
-
email,
|
|
1645
|
-
queue,
|
|
1646
|
-
scheduled,
|
|
1647
|
-
worker,
|
|
1648
|
-
tail
|
|
1649
|
-
};
|
|
1650
|
-
// src/test/multi-worker-context.ts
|
|
1651
|
-
async function createMultiWorkerContext(options) {
|
|
1652
|
-
const { workers, primary } = options;
|
|
1653
|
-
const primaryName = primary ?? workers[0]?.name;
|
|
1654
|
-
if (!primaryName) {
|
|
1655
|
-
throw new Error("At least one worker must be configured");
|
|
1656
|
-
}
|
|
1657
|
-
const { Miniflare } = await import("miniflare");
|
|
1658
|
-
const mfWorkers = workers.map((worker2) => {
|
|
1659
|
-
const serviceBindings = {};
|
|
1660
|
-
if (worker2.serviceBindings) {
|
|
1661
|
-
for (const [bindingName, target] of Object.entries(worker2.serviceBindings)) {
|
|
1662
|
-
if (typeof target === "string") {
|
|
1663
|
-
serviceBindings[bindingName] = { name: target };
|
|
1664
|
-
} else {
|
|
1665
|
-
serviceBindings[bindingName] = target;
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
return {
|
|
1670
|
-
name: worker2.name,
|
|
1671
|
-
modules: worker2.modules ?? true,
|
|
1672
|
-
script: worker2.script,
|
|
1673
|
-
compatibilityDate: worker2.compatibilityDate ?? "2025-01-01",
|
|
1674
|
-
...Object.keys(serviceBindings).length > 0 ? { serviceBindings } : {}
|
|
1675
|
-
};
|
|
1676
|
-
});
|
|
1677
|
-
const mf = new Miniflare({
|
|
1678
|
-
workers: mfWorkers
|
|
1679
|
-
});
|
|
1680
|
-
const env2 = await mf.getBindings();
|
|
1681
|
-
const fetch3 = async (input, init) => {
|
|
1682
|
-
const response = await mf.dispatchFetch(input, init);
|
|
1683
|
-
return response;
|
|
1684
|
-
};
|
|
1685
|
-
const dispose = async () => {
|
|
1686
|
-
await new Promise((r) => setTimeout(r, 50));
|
|
1687
|
-
await mf.dispose();
|
|
1688
|
-
};
|
|
1689
|
-
return {
|
|
1690
|
-
mf,
|
|
1691
|
-
env: env2,
|
|
1692
|
-
fetch: fetch3,
|
|
1693
|
-
dispose
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
function createEntrypointScript(className, methods) {
|
|
1697
|
-
const methodDefs = Object.entries(methods).map(([name, body]) => ` ${name}${body}`).join(`
|
|
1698
|
-
|
|
1699
|
-
`);
|
|
1700
|
-
return `import { WorkerEntrypoint } from 'cloudflare:workers'
|
|
1701
|
-
|
|
1702
|
-
export class ${className} extends WorkerEntrypoint {
|
|
1703
|
-
${methodDefs}
|
|
1704
|
-
}
|
|
1705
|
-
`;
|
|
1706
|
-
}
|
|
1707
|
-
// src/test/should-skip.ts
|
|
1708
|
-
var REMOTE_ONLY_SERVICES = new Set([
|
|
1709
|
-
"ai",
|
|
1710
|
-
"vectorize"
|
|
1711
|
-
]);
|
|
1712
|
-
function isRemoteModeEnabled() {
|
|
1713
|
-
return isRemoteModeActive();
|
|
1714
|
-
}
|
|
1715
|
-
var skipResults = new Map;
|
|
1716
|
-
var EXPECTED_ERROR_PATTERNS = [
|
|
1717
|
-
"ECONNREFUSED",
|
|
1718
|
-
"ETIMEDOUT",
|
|
1719
|
-
"ENOTFOUND",
|
|
1720
|
-
"fetch failed",
|
|
1721
|
-
"network",
|
|
1722
|
-
"401",
|
|
1723
|
-
"403",
|
|
1724
|
-
"429",
|
|
1725
|
-
"500",
|
|
1726
|
-
"502",
|
|
1727
|
-
"503",
|
|
1728
|
-
"504",
|
|
1729
|
-
"rate limit",
|
|
1730
|
-
"unauthorized",
|
|
1731
|
-
"forbidden",
|
|
1732
|
-
"timeout"
|
|
1733
|
-
];
|
|
1734
|
-
function isExpectedError(error) {
|
|
1735
|
-
if (!(error instanceof Error))
|
|
1736
|
-
return false;
|
|
1737
|
-
const msg = error.message.toLowerCase();
|
|
1738
|
-
return EXPECTED_ERROR_PATTERNS.some((pattern) => msg.includes(pattern.toLowerCase()));
|
|
1739
|
-
}
|
|
1740
|
-
async function computeSkip(service) {
|
|
1741
|
-
try {
|
|
1742
|
-
if (REMOTE_ONLY_SERVICES.has(service) && !isRemoteModeActive()) {
|
|
1743
|
-
const status = getRemoteModeStatus();
|
|
1744
|
-
console.log(`⏭️ ${service.toUpperCase()} tests skipped: Remote-only service.
|
|
1745
|
-
` + ` Enable with: ${status.isEnabled ? "" : "devflare remote enable"}
|
|
1746
|
-
` + ` Or set: DEVFLARE_REMOTE=1
|
|
1747
|
-
` + ` See: https://github.com/ArthurvdVenne/devflare#remote-testing`);
|
|
1748
|
-
return true;
|
|
1749
|
-
}
|
|
1750
|
-
const isAuth = await isAuthenticated();
|
|
1751
|
-
if (!isAuth) {
|
|
1752
|
-
console.log(`⏭️ ${service.toUpperCase()} tests skipped: Not authenticated. Run: bunx wrangler login
|
|
1753
|
-
` + ` See: https://github.com/ArthurvdVenne/devflare#authentication`);
|
|
1754
|
-
return true;
|
|
1755
|
-
}
|
|
1756
|
-
const primary = await getPrimaryAccount();
|
|
1757
|
-
if (!primary) {
|
|
1758
|
-
console.log(`⏭️ ${service.toUpperCase()} tests skipped: No Cloudflare account found
|
|
1759
|
-
` + ` See: https://github.com/ArthurvdVenne/devflare#authentication`);
|
|
1760
|
-
return true;
|
|
1761
|
-
}
|
|
1762
|
-
const { accountId } = await getEffectiveAccountId(primary.id);
|
|
1763
|
-
try {
|
|
1764
|
-
const { allowed, reason } = await canProceedWithTest(accountId, service);
|
|
1765
|
-
if (!allowed) {
|
|
1766
|
-
console.log(`⏭️ ${service.toUpperCase()} tests skipped: ${reason}`);
|
|
1767
|
-
return true;
|
|
1768
|
-
}
|
|
1769
|
-
} catch {}
|
|
1770
|
-
return false;
|
|
1771
|
-
} catch (error) {
|
|
1772
|
-
if (isExpectedError(error)) {
|
|
1773
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1774
|
-
console.log(`⏭️ ${service.toUpperCase()} tests skipped: ${message}`);
|
|
1775
|
-
return true;
|
|
1776
|
-
}
|
|
1777
|
-
throw error;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
function getSkipResult(service) {
|
|
1781
|
-
let result = skipResults.get(service);
|
|
1782
|
-
if (!result) {
|
|
1783
|
-
result = computeSkip(service);
|
|
1784
|
-
skipResults.set(service, result);
|
|
1785
|
-
}
|
|
1786
|
-
return result;
|
|
1787
|
-
}
|
|
1788
|
-
var shouldSkip = {
|
|
1789
|
-
get ai() {
|
|
1790
|
-
return getSkipResult("ai");
|
|
1791
|
-
},
|
|
1792
|
-
get vectorize() {
|
|
1793
|
-
return getSkipResult("vectorize");
|
|
1794
|
-
},
|
|
1795
|
-
get workers() {
|
|
1796
|
-
return getSkipResult("workers");
|
|
1797
|
-
},
|
|
1798
|
-
get kv() {
|
|
1799
|
-
return getSkipResult("kv");
|
|
1800
|
-
},
|
|
1801
|
-
get d1() {
|
|
1802
|
-
return getSkipResult("d1");
|
|
1803
|
-
},
|
|
1804
|
-
get r2() {
|
|
1805
|
-
return getSkipResult("r2");
|
|
1806
|
-
},
|
|
1807
|
-
get queues() {
|
|
1808
|
-
return getSkipResult("queues");
|
|
1809
|
-
},
|
|
1810
|
-
get durableObjects() {
|
|
1811
|
-
return getSkipResult("durable_objects");
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
// src/test/utilities.ts
|
|
1815
|
-
function createMockTestContext(options = {}) {
|
|
1816
|
-
const waitUntilPromises = [];
|
|
1817
|
-
const ctx = {
|
|
1818
|
-
waitUntil(promise) {
|
|
1819
|
-
waitUntilPromises.push(promise);
|
|
1820
|
-
},
|
|
1821
|
-
passThroughOnException() {},
|
|
1822
|
-
props: {}
|
|
1823
|
-
};
|
|
1824
|
-
return {
|
|
1825
|
-
env: options.env ?? {},
|
|
1826
|
-
ctx,
|
|
1827
|
-
request: options.request ?? null,
|
|
1828
|
-
waitUntilPromises
|
|
1829
|
-
};
|
|
1830
|
-
}
|
|
1831
|
-
async function withTestContext(options, handler) {
|
|
1832
|
-
const testCtx = createMockTestContext(options);
|
|
1833
|
-
return runWithContext(testCtx.env, testCtx.ctx, options.request ?? null, handler, options.type ?? "fetch");
|
|
1834
|
-
}
|
|
1835
|
-
function createMockKV(initialData = {}) {
|
|
1836
|
-
const store = new Map(Object.entries(initialData));
|
|
1837
|
-
const metadata = new Map;
|
|
1838
|
-
return {
|
|
1839
|
-
async get(key, options) {
|
|
1840
|
-
const value = store.get(key);
|
|
1841
|
-
if (value === null || value === undefined)
|
|
1842
|
-
return null;
|
|
1843
|
-
const type = typeof options === "string" ? options : options?.type ?? "text";
|
|
1844
|
-
switch (type) {
|
|
1845
|
-
case "json":
|
|
1846
|
-
return JSON.parse(value);
|
|
1847
|
-
case "arrayBuffer":
|
|
1848
|
-
return new TextEncoder().encode(value).buffer;
|
|
1849
|
-
case "stream":
|
|
1850
|
-
return new ReadableStream({
|
|
1851
|
-
start(controller) {
|
|
1852
|
-
controller.enqueue(new TextEncoder().encode(value));
|
|
1853
|
-
controller.close();
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
default:
|
|
1857
|
-
return value;
|
|
1858
|
-
}
|
|
1859
|
-
},
|
|
1860
|
-
async put(key, value, options) {
|
|
1861
|
-
if (typeof value === "string") {
|
|
1862
|
-
store.set(key, value);
|
|
1863
|
-
} else if (value instanceof ArrayBuffer) {
|
|
1864
|
-
store.set(key, new TextDecoder().decode(value));
|
|
1865
|
-
} else {
|
|
1866
|
-
const reader = value.getReader();
|
|
1867
|
-
const chunks = [];
|
|
1868
|
-
let done = false;
|
|
1869
|
-
while (!done) {
|
|
1870
|
-
const result = await reader.read();
|
|
1871
|
-
done = result.done;
|
|
1872
|
-
if (result.value)
|
|
1873
|
-
chunks.push(result.value);
|
|
1874
|
-
}
|
|
1875
|
-
const combined = new Uint8Array(chunks.reduce((acc, c) => acc + c.length, 0));
|
|
1876
|
-
let offset = 0;
|
|
1877
|
-
for (const chunk of chunks) {
|
|
1878
|
-
combined.set(chunk, offset);
|
|
1879
|
-
offset += chunk.length;
|
|
1880
|
-
}
|
|
1881
|
-
store.set(key, new TextDecoder().decode(combined));
|
|
1882
|
-
}
|
|
1883
|
-
},
|
|
1884
|
-
async delete(key) {
|
|
1885
|
-
store.delete(key);
|
|
1886
|
-
},
|
|
1887
|
-
async list(options) {
|
|
1888
|
-
const prefix = options?.prefix ?? "";
|
|
1889
|
-
const limit = options?.limit ?? 1000;
|
|
1890
|
-
const keys = Array.from(store.keys()).filter((key) => key.startsWith(prefix)).slice(0, limit).map((name) => ({ name }));
|
|
1891
|
-
return {
|
|
1892
|
-
keys,
|
|
1893
|
-
list_complete: keys.length < limit,
|
|
1894
|
-
cursor: undefined
|
|
1895
|
-
};
|
|
1896
|
-
},
|
|
1897
|
-
async getWithMetadata(key, options) {
|
|
1898
|
-
return {
|
|
1899
|
-
value: store.get(key) ?? null,
|
|
1900
|
-
metadata: metadata.get(key) ?? null
|
|
1901
|
-
};
|
|
1902
|
-
}
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
function createMockD1(mockResults = []) {
|
|
1906
|
-
let boundValues = [];
|
|
1907
|
-
let currentResults = [...mockResults];
|
|
1908
|
-
const createStatement = () => ({
|
|
1909
|
-
bind(...values) {
|
|
1910
|
-
boundValues = values;
|
|
1911
|
-
return this;
|
|
1912
|
-
},
|
|
1913
|
-
async first(column) {
|
|
1914
|
-
const row = currentResults[0];
|
|
1915
|
-
if (!row)
|
|
1916
|
-
return null;
|
|
1917
|
-
if (column)
|
|
1918
|
-
return row[column];
|
|
1919
|
-
return row;
|
|
1920
|
-
},
|
|
1921
|
-
async all() {
|
|
1922
|
-
return {
|
|
1923
|
-
results: currentResults,
|
|
1924
|
-
success: true,
|
|
1925
|
-
meta: { duration: 0, changes: 0, last_row_id: 0 }
|
|
1926
|
-
};
|
|
1927
|
-
},
|
|
1928
|
-
async run() {
|
|
1929
|
-
return {
|
|
1930
|
-
results: [],
|
|
1931
|
-
success: true,
|
|
1932
|
-
meta: { duration: 0, changes: 1, last_row_id: 1 }
|
|
1933
|
-
};
|
|
1934
|
-
},
|
|
1935
|
-
async raw(options) {
|
|
1936
|
-
return currentResults.map((row) => Object.values(row));
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
return {
|
|
1940
|
-
prepare(query) {
|
|
1941
|
-
return createStatement();
|
|
1942
|
-
},
|
|
1943
|
-
async exec(query) {
|
|
1944
|
-
return {
|
|
1945
|
-
results: [],
|
|
1946
|
-
success: true,
|
|
1947
|
-
meta: { duration: 0, changes: 0, last_row_id: 0 }
|
|
1948
|
-
};
|
|
1949
|
-
},
|
|
1950
|
-
async batch(statements) {
|
|
1951
|
-
return statements.map(() => ({
|
|
1952
|
-
results: [],
|
|
1953
|
-
success: true,
|
|
1954
|
-
meta: { duration: 0, changes: 0, last_row_id: 0 }
|
|
1955
|
-
}));
|
|
1956
|
-
},
|
|
1957
|
-
async dump() {
|
|
1958
|
-
return new ArrayBuffer(0);
|
|
1959
|
-
},
|
|
1960
|
-
withSession(constraintOrBookmark) {
|
|
1961
|
-
return this;
|
|
1962
|
-
}
|
|
1963
|
-
};
|
|
1964
|
-
}
|
|
1965
|
-
function createMockR2() {
|
|
1966
|
-
const store = new Map;
|
|
1967
|
-
const createR2Object = (key, content, metadata) => {
|
|
1968
|
-
const encoder = new TextEncoder;
|
|
1969
|
-
const data = encoder.encode(content);
|
|
1970
|
-
return {
|
|
1971
|
-
key,
|
|
1972
|
-
version: "1",
|
|
1973
|
-
size: data.length,
|
|
1974
|
-
etag: `"${key}-etag"`,
|
|
1975
|
-
httpEtag: `"${key}-etag"`,
|
|
1976
|
-
uploaded: new Date,
|
|
1977
|
-
httpMetadata: metadata ?? {},
|
|
1978
|
-
customMetadata: {},
|
|
1979
|
-
checksums: {},
|
|
1980
|
-
storageClass: "Standard",
|
|
1981
|
-
body: new ReadableStream({
|
|
1982
|
-
start(controller) {
|
|
1983
|
-
controller.enqueue(data);
|
|
1984
|
-
controller.close();
|
|
1985
|
-
}
|
|
1986
|
-
}),
|
|
1987
|
-
bodyUsed: false,
|
|
1988
|
-
async arrayBuffer() {
|
|
1989
|
-
return new Uint8Array(data).buffer;
|
|
1990
|
-
},
|
|
1991
|
-
async text() {
|
|
1992
|
-
return content;
|
|
1993
|
-
},
|
|
1994
|
-
async json() {
|
|
1995
|
-
return JSON.parse(content);
|
|
1996
|
-
},
|
|
1997
|
-
async blob() {
|
|
1998
|
-
return new Blob([data]);
|
|
1999
|
-
},
|
|
2000
|
-
writeHttpMetadata(headers) {}
|
|
2001
|
-
};
|
|
2002
|
-
};
|
|
2003
|
-
return {
|
|
2004
|
-
async put(key, value, options) {
|
|
2005
|
-
let content;
|
|
2006
|
-
if (typeof value === "string") {
|
|
2007
|
-
content = value;
|
|
2008
|
-
} else if (value instanceof ArrayBuffer) {
|
|
2009
|
-
content = new TextDecoder().decode(value);
|
|
2010
|
-
} else if (value instanceof Blob) {
|
|
2011
|
-
content = await value.text();
|
|
2012
|
-
} else if (value === null) {
|
|
2013
|
-
content = "";
|
|
2014
|
-
} else {
|
|
2015
|
-
const reader = value.getReader();
|
|
2016
|
-
const chunks = [];
|
|
2017
|
-
let done = false;
|
|
2018
|
-
while (!done) {
|
|
2019
|
-
const result = await reader.read();
|
|
2020
|
-
done = result.done;
|
|
2021
|
-
if (result.value) {
|
|
2022
|
-
chunks.push(new TextDecoder().decode(result.value));
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
content = chunks.join("");
|
|
2026
|
-
}
|
|
2027
|
-
store.set(key, { content });
|
|
2028
|
-
return createR2Object(key, content);
|
|
2029
|
-
},
|
|
2030
|
-
async get(key, options) {
|
|
2031
|
-
const item = store.get(key);
|
|
2032
|
-
if (!item)
|
|
2033
|
-
return null;
|
|
2034
|
-
return createR2Object(key, item.content, item.metadata);
|
|
2035
|
-
},
|
|
2036
|
-
async head(key) {
|
|
2037
|
-
const item = store.get(key);
|
|
2038
|
-
if (!item)
|
|
2039
|
-
return null;
|
|
2040
|
-
return {
|
|
2041
|
-
key,
|
|
2042
|
-
version: "1",
|
|
2043
|
-
size: new TextEncoder().encode(item.content).length,
|
|
2044
|
-
etag: `"${key}-etag"`,
|
|
2045
|
-
httpEtag: `"${key}-etag"`,
|
|
2046
|
-
uploaded: new Date,
|
|
2047
|
-
httpMetadata: item.metadata ?? {},
|
|
2048
|
-
customMetadata: {},
|
|
2049
|
-
checksums: {},
|
|
2050
|
-
storageClass: "Standard",
|
|
2051
|
-
writeHttpMetadata(headers) {}
|
|
2052
|
-
};
|
|
2053
|
-
},
|
|
2054
|
-
async delete(keys) {
|
|
2055
|
-
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
2056
|
-
for (const key of keyArray) {
|
|
2057
|
-
store.delete(key);
|
|
2058
|
-
}
|
|
2059
|
-
},
|
|
2060
|
-
async list(options) {
|
|
2061
|
-
const objects = Array.from(store.entries()).map(([key, { content, metadata }]) => createR2Object(key, content, metadata));
|
|
2062
|
-
return {
|
|
2063
|
-
objects,
|
|
2064
|
-
truncated: false,
|
|
2065
|
-
delimitedPrefixes: []
|
|
2066
|
-
};
|
|
2067
|
-
},
|
|
2068
|
-
async createMultipartUpload(key, options) {
|
|
2069
|
-
throw new Error("Multipart upload not implemented in mock");
|
|
2070
|
-
},
|
|
2071
|
-
async resumeMultipartUpload(key, uploadId) {
|
|
2072
|
-
throw new Error("Multipart upload not implemented in mock");
|
|
2073
|
-
}
|
|
2074
|
-
};
|
|
2075
|
-
}
|
|
2076
|
-
function createMockQueue() {
|
|
2077
|
-
const messages = [];
|
|
2078
|
-
return {
|
|
2079
|
-
async send(message, options) {
|
|
2080
|
-
messages.push({ body: message, options });
|
|
2081
|
-
},
|
|
2082
|
-
async sendBatch(batch) {
|
|
2083
|
-
messages.push(...batch);
|
|
2084
|
-
},
|
|
2085
|
-
_getMessages() {
|
|
2086
|
-
return messages;
|
|
2087
|
-
}
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
|
-
function createMockEnv(options = {}) {
|
|
2091
|
-
const env2 = {};
|
|
2092
|
-
if (options.kv) {
|
|
2093
|
-
for (const name of options.kv) {
|
|
2094
|
-
env2[name] = createMockKV();
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
if (options.d1) {
|
|
2098
|
-
for (const name of options.d1) {
|
|
2099
|
-
env2[name] = createMockD1();
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
if (options.r2) {
|
|
2103
|
-
for (const name of options.r2) {
|
|
2104
|
-
env2[name] = createMockR2();
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
if (options.queues) {
|
|
2108
|
-
for (const name of options.queues) {
|
|
2109
|
-
env2[name] = createMockQueue();
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
if (options.vars) {
|
|
2113
|
-
Object.assign(env2, options.vars);
|
|
2114
|
-
}
|
|
2115
|
-
if (options.secrets) {
|
|
2116
|
-
Object.assign(env2, options.secrets);
|
|
2117
|
-
}
|
|
2118
|
-
if (options.custom) {
|
|
2119
|
-
Object.assign(env2, options.custom);
|
|
2120
|
-
}
|
|
2121
|
-
return env2;
|
|
2122
|
-
}
|
|
2123
|
-
// src/test/bridge-context.ts
|
|
2124
|
-
var globalTestContext = null;
|
|
2125
|
-
async function createBridgeTestContext(options = {}) {
|
|
2126
|
-
if (globalTestContext) {
|
|
2127
|
-
await globalTestContext.stop();
|
|
2128
|
-
}
|
|
2129
|
-
let config = options.config;
|
|
2130
|
-
if (options.configPath && !config) {
|
|
2131
|
-
config = await loadConfig({ cwd: options.configPath.replace(/[/\\][^/\\]+$/, ""), configFile: options.configPath.split(/[/\\]/).pop() });
|
|
2132
|
-
}
|
|
2133
|
-
let miniflare;
|
|
2134
|
-
if (config) {
|
|
2135
|
-
miniflare = await startMiniflareFromConfig(config, {
|
|
2136
|
-
...options.miniflare,
|
|
2137
|
-
port: options.port ?? 8787,
|
|
2138
|
-
persist: options.persist ?? false,
|
|
2139
|
-
verbose: options.verbose ?? false
|
|
2140
|
-
});
|
|
2141
|
-
} else {
|
|
2142
|
-
miniflare = await startMiniflare({
|
|
2143
|
-
...options.miniflare,
|
|
2144
|
-
port: options.port ?? 8787,
|
|
2145
|
-
persist: options.persist ?? false,
|
|
2146
|
-
verbose: options.verbose ?? false
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
const bindings = await miniflare.getBindings();
|
|
2150
|
-
if (config?.bindings) {
|
|
2151
|
-
const hints = {};
|
|
2152
|
-
if (config.bindings.kv) {
|
|
2153
|
-
Object.keys(config.bindings.kv).forEach((name) => {
|
|
2154
|
-
hints[name] = "kv";
|
|
2155
|
-
});
|
|
2156
|
-
}
|
|
2157
|
-
if (config.bindings.r2) {
|
|
2158
|
-
Object.keys(config.bindings.r2).forEach((name) => {
|
|
2159
|
-
hints[name] = "r2";
|
|
2160
|
-
});
|
|
2161
|
-
}
|
|
2162
|
-
if (config.bindings.d1) {
|
|
2163
|
-
Object.keys(config.bindings.d1).forEach((name) => {
|
|
2164
|
-
hints[name] = "d1";
|
|
2165
|
-
});
|
|
2166
|
-
}
|
|
2167
|
-
if (config.bindings.durableObjects) {
|
|
2168
|
-
Object.keys(config.bindings.durableObjects).forEach((name) => {
|
|
2169
|
-
hints[name] = "do";
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
if (config.bindings.queues?.consumers) {
|
|
2173
|
-
config.bindings.queues.consumers.forEach((c) => {
|
|
2174
|
-
hints[c.queue] = "queue";
|
|
2175
|
-
});
|
|
2176
|
-
}
|
|
2177
|
-
if (config.bindings.ai)
|
|
2178
|
-
hints[config.bindings.ai.binding] = "ai";
|
|
2179
|
-
setBindingHints(hints);
|
|
2180
|
-
}
|
|
2181
|
-
const ctx = {
|
|
2182
|
-
env: bindings,
|
|
2183
|
-
miniflare,
|
|
2184
|
-
async stop() {
|
|
2185
|
-
await miniflare.dispose();
|
|
2186
|
-
globalTestContext = null;
|
|
2187
|
-
},
|
|
2188
|
-
async reset() {
|
|
2189
|
-
for (const [name, binding] of Object.entries(bindings)) {
|
|
2190
|
-
if (isKVNamespace(binding)) {
|
|
2191
|
-
const kv = binding;
|
|
2192
|
-
const { keys } = await kv.list();
|
|
2193
|
-
for (const key of keys) {
|
|
2194
|
-
await kv.delete(key.name);
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
};
|
|
2200
|
-
globalTestContext = ctx;
|
|
2201
|
-
return ctx;
|
|
2202
|
-
}
|
|
2203
|
-
async function stopBridgeTestContext() {
|
|
2204
|
-
if (globalTestContext) {
|
|
2205
|
-
await globalTestContext.stop();
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
function getBridgeTestContext() {
|
|
2209
|
-
if (!globalTestContext) {
|
|
2210
|
-
throw new Error("Bridge test context not initialized. Call createBridgeTestContext() in beforeAll().");
|
|
2211
|
-
}
|
|
2212
|
-
return globalTestContext;
|
|
2213
|
-
}
|
|
2214
|
-
var testEnv = new Proxy({}, {
|
|
2215
|
-
get(target, prop) {
|
|
2216
|
-
if (typeof prop !== "string")
|
|
2217
|
-
return;
|
|
2218
|
-
const ctx = getBridgeTestContext();
|
|
2219
|
-
return ctx.env[prop];
|
|
2220
|
-
}
|
|
2221
|
-
});
|
|
2222
|
-
function isKVNamespace(binding) {
|
|
2223
|
-
return typeof binding === "object" && binding !== null && "get" in binding && "put" in binding && "delete" in binding && "list" in binding;
|
|
2224
|
-
}
|
|
2225
|
-
export { env, clearBundleCache, hasServiceBindings, resolveServiceBindings, hasCrossWorkerDOs, resolveDOBindings, queue, scheduled, worker, tail, email, createTestContext, cf, createMultiWorkerContext, createEntrypointScript, isRemoteModeEnabled, shouldSkip, createMockTestContext, withTestContext, createMockKV, createMockD1, createMockR2, createMockQueue, createMockEnv, createBridgeTestContext, stopBridgeTestContext, getBridgeTestContext, testEnv };
|