devflare 1.0.0-next.5 → 1.0.0-next.51
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/LICENSE +21 -0
- package/LLM.md +17312 -2139
- package/README.md +397 -605
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-Csog80ie.js +462 -0
- package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
- package/dist/_chunks/ai-CBEuLdoP.js +322 -0
- package/dist/_chunks/api-TzdliH-6.js +568 -0
- package/dist/_chunks/build-Ccza8VQz.js +24 -0
- package/dist/_chunks/build-artifacts-BNssqhxE.js +483 -0
- package/dist/_chunks/cli-CU7wSG1-.js +1163 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-_bGRraDR.js +45 -0
- package/dist/_chunks/compiler-BtLp9T9N.js +500 -0
- package/dist/_chunks/config-QU8UEWmA.js +78 -0
- package/dist/_chunks/config-path-1yI7BiDU.js +42 -0
- package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
- package/dist/_chunks/decorators-QmV57ixr.js +19 -0
- package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
- package/dist/_chunks/deploy-aifBaMVv.js +1032 -0
- package/dist/_chunks/dev-DF_3baGr.js +3483 -0
- package/dist/_chunks/doctor-tR9kGT_Z.js +219 -0
- package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
- package/dist/_chunks/env-S0_nMVz1.js +125 -0
- package/dist/_chunks/family-DKPp4wqj.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-DnkJOmpW.js +165 -0
- package/dist/_chunks/loader-OQ2AWpqm.js +1308 -0
- package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
- package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
- package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
- package/dist/_chunks/local-secrets-CYoHfvQ1.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-8d_mXh8T.js +90 -0
- package/dist/_chunks/login-rVWUZOKC.js +51 -0
- package/dist/_chunks/package-metadata-DjHBLB-z.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-C3Cdr8an.js +462 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-DRWR0gaB.js +359 -0
- package/dist/_chunks/previews-BxNq8Y_J.js +1134 -0
- package/dist/_chunks/productions-DK7xwbEs.js +411 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
- package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
- package/dist/_chunks/resolve-package-qizBfCIm.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-B6XiI8Sa.js +851 -0
- package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
- package/dist/_chunks/schema-normalization-GjhTATHL.js +666 -0
- package/dist/_chunks/secrets-qT1JaBGt.js +95 -0
- package/dist/_chunks/tail-CuWI04BL.js +239 -0
- package/dist/_chunks/token-Dmi0KXyX.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-BquPXsFg.js +484 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-D_wLDGBs.js +1267 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-DEF-e8LL.js +410 -0
- package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
- package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
- package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
- package/dist/bridge/client.d.ts +49 -7
- 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 +6 -6
- 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 +85 -2
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +12 -11
- package/dist/bridge/proxy.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 +46 -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/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/{serialization.d.ts → v2/value-serialization.d.ts} +40 -18
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
- 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 +2 -2
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +5705 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +80 -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 +3 -1
- 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 +2 -2
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/ai.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 +2 -2
- 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 +9 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- 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/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/tail.d.ts +44 -0
- package/dist/cli/commands/tail.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 +121 -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 +2 -2
- 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 +2 -1
- 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/gradual-deploy.d.ts +49 -0
- package/dist/cli/gradual-deploy.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 +2 -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/cli/wrangler-auth.d.ts +1 -1
- 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 +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +61 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -13
- 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/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts +44 -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 +31 -3
- 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 +309 -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/cron.d.ts +19 -0
- package/dist/config/cron.d.ts.map +1 -0
- package/dist/config/define.d.ts +8 -5
- package/dist/config/define.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/env-vars.d.ts +309 -0
- package/dist/config/env-vars.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 +12 -5
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +2 -1
- 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 +29 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +16 -25
- 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 +2087 -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 +3771 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +267 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +557 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +520 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +802 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime-server.d.ts +122 -0
- package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +913 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +458 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5699 -2021
- 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-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +3 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- 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/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +90 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +36 -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 +93 -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 +19 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- 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/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -298
- 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 +20 -44
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +70 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +10 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -111
- package/dist/runtime/middleware.d.ts +119 -67
- 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/validation.d.ts +18 -4
- 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/shims/local-hyperdrive.d.ts +12 -0
- package/dist/shims/local-hyperdrive.d.ts.map +1 -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.d.ts +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +313 -167
- 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 +20 -2
- 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/alarm.d.ts +55 -0
- package/dist/test/alarm.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +71 -35
- 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 +20 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4981 -70
- package/dist/test/offline-bindings.d.ts +115 -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 +64 -4
- 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 +8 -27
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +3 -2
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/analytics-engine.d.ts +22 -0
- package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
- 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 +43 -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 +41 -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 +2 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/stream-flagship.d.ts +27 -0
- package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
- package/dist/test/utilities/vectorize.d.ts +38 -0
- package/dist/test/utilities/vectorize.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 +13 -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/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/glob.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 +163 -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 +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +2 -339
- 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-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-entry/validate-fetch-style.d.ts +12 -0
- package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -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 +159 -116
- package/R2.md +0 -170
- package/dist/account-rvrj687w.js +0 -397
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/bridge/protocol.d.ts.map +0 -1
- package/dist/bridge/serialization.d.ts.map +0 -1
- 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/dev-b9dmrj7b.js +0 -2417
- package/dist/doctor-fmgb3d28.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-07q6yxyc.js +0 -168
- package/dist/index-18hvb6gb.js +0 -194
- package/dist/index-1xpj0m4r.js +0 -57
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-ep3445yc.js +0 -2225
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-m2q41jwa.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-pf5s73n9.js +0 -1413
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-z14anrqp.js +0 -226
- package/dist/init-f9mgmew3.js +0 -186
- package/dist/remote-q59qk463.js +0 -97
- package/dist/test/bridge-context.d.ts +0 -76
- package/dist/test/bridge-context.d.ts.map +0 -1
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
- package/dist/types-5nyrz1sz.js +0 -454
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/dist/sveltekit/index.js
CHANGED
|
@@ -1,182 +1,328 @@
|
|
|
1
|
-
import"../
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "../
|
|
6
|
-
import"../
|
|
7
|
-
import"../
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return bridgeUrl;
|
|
1
|
+
import { r as loadConfig } from "../_chunks/loader-OQ2AWpqm.js";
|
|
2
|
+
import { l as normalizeHyperdriveBinding } from "../_chunks/schema-normalization-GjhTATHL.js";
|
|
3
|
+
import { D as createFetchEvent, I as getClient, M as createEnvProxy, P as setBindingHints, v as runWithEventContext } from "../_chunks/context-CX50Y2Kb.js";
|
|
4
|
+
import { createLocalSendEmailBinding } from "../utils/send-email.js";
|
|
5
|
+
import { i as extractBindingHints, n as createLocalWorkerLoaderBinding, t as createLocalHyperdrive } from "../_chunks/local-hyperdrive-CJ90j46O.js";
|
|
6
|
+
import { t as buildLocalSecretNodeBindings } from "../_chunks/local-secrets-CYoHfvQ1.js";
|
|
7
|
+
import { n as createLocalImagesBinding, r as createLocalMediaBinding } from "../_chunks/local-media-bindings-DsAW4AMF.js";
|
|
8
|
+
//#region src/sveltekit/local-bindings.ts
|
|
9
|
+
function buildLocalHyperdriveBindings(config) {
|
|
10
|
+
const bindings = {};
|
|
11
|
+
for (const [name, binding] of Object.entries(config.bindings?.hyperdrive ?? {})) {
|
|
12
|
+
const normalized = normalizeHyperdriveBinding(binding);
|
|
13
|
+
if (normalized.localConnectionString) bindings[name] = createLocalHyperdrive(normalized.localConnectionString);
|
|
14
|
+
}
|
|
15
|
+
return bindings;
|
|
17
16
|
}
|
|
17
|
+
function buildSvelteKitLocalBindings(config, cwd) {
|
|
18
|
+
const bindings = {
|
|
19
|
+
...config.vars ?? {},
|
|
20
|
+
...buildLocalHyperdriveBindings(config),
|
|
21
|
+
...buildLocalSecretNodeBindings(config, cwd)
|
|
22
|
+
};
|
|
23
|
+
for (const [name, binding] of Object.entries(config.bindings?.sendEmail ?? {})) bindings[name] = createLocalSendEmailBinding(binding);
|
|
24
|
+
for (const name of Object.keys(config.bindings?.workerLoaders ?? {})) bindings[name] = createLocalWorkerLoaderBinding();
|
|
25
|
+
for (const name of Object.keys(config.bindings?.images ?? {})) bindings[name] = createLocalImagesBinding();
|
|
26
|
+
for (const name of Object.keys(config.bindings?.media ?? {})) bindings[name] = createLocalMediaBinding();
|
|
27
|
+
return bindings;
|
|
28
|
+
}
|
|
29
|
+
function overlayLocalBindings(baseEnv, localBindings) {
|
|
30
|
+
if (Object.keys(localBindings).length === 0) return baseEnv;
|
|
31
|
+
return new Proxy(baseEnv, {
|
|
32
|
+
get(target, prop, receiver) {
|
|
33
|
+
if (typeof prop === "string" && prop in localBindings) return localBindings[prop];
|
|
34
|
+
return Reflect.get(target, prop, receiver);
|
|
35
|
+
},
|
|
36
|
+
has(target, prop) {
|
|
37
|
+
return typeof prop === "string" && prop in localBindings || Reflect.has(target, prop);
|
|
38
|
+
},
|
|
39
|
+
ownKeys(target) {
|
|
40
|
+
return Array.from(new Set([...Reflect.ownKeys(target), ...Reflect.ownKeys(localBindings)]));
|
|
41
|
+
},
|
|
42
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
43
|
+
if (typeof prop === "string" && prop in localBindings) return {
|
|
44
|
+
configurable: true,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
writable: false,
|
|
47
|
+
value: localBindings[prop]
|
|
48
|
+
};
|
|
49
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/sveltekit/platform.ts
|
|
55
|
+
/** Cached platform keyed by bridgeUrl + binding hint fingerprint */
|
|
56
|
+
let platformCache = null;
|
|
57
|
+
/**
|
|
58
|
+
* Generate a stable fingerprint for binding hints so cached platforms are not
|
|
59
|
+
* shared across configs with differing hint sets.
|
|
60
|
+
*/
|
|
61
|
+
function fingerprintHints(hints) {
|
|
62
|
+
const entries = Object.keys(hints).sort().map((name) => [name, hints[name]]);
|
|
63
|
+
return JSON.stringify(entries);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Generate cache key from options
|
|
67
|
+
*/
|
|
68
|
+
function getPlatformCacheKey(bridgeUrl, hints) {
|
|
69
|
+
return `${bridgeUrl}\u0000${fingerprintHints(hints)}`;
|
|
70
|
+
}
|
|
71
|
+
function shouldUseCachedPlatform(localBindings) {
|
|
72
|
+
return Object.keys(localBindings).length === 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a dev-mode ExecutionContext that records `waitUntil()` rejections on
|
|
76
|
+
* the provided `pendingErrors` array. The original console.error log is kept
|
|
77
|
+
* for parity with existing behavior.
|
|
78
|
+
*/
|
|
79
|
+
function createDevExecutionContext(pendingErrors) {
|
|
80
|
+
return {
|
|
81
|
+
waitUntil: (promise) => {
|
|
82
|
+
promise.catch((err) => {
|
|
83
|
+
console.error("[devflare] waitUntil error:", err);
|
|
84
|
+
pendingErrors.push(err);
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
passThroughOnException: () => {}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a platform object that routes bindings through the bridge
|
|
92
|
+
*
|
|
93
|
+
* Use this in dev mode to get access to Miniflare bindings via WebSocket RPC.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // src/hooks.server.ts
|
|
98
|
+
* import { dev } from '$app/environment'
|
|
99
|
+
* import { createDevflarePlatform } from 'devflare/sveltekit'
|
|
100
|
+
*
|
|
101
|
+
* export async function handle({ event, resolve }) {
|
|
102
|
+
* if (dev && process.env.DEVFLARE_DEV) {
|
|
103
|
+
* // Override platform with bridge-connected proxy
|
|
104
|
+
* event.platform = await createDevflarePlatform({
|
|
105
|
+
* hints: {
|
|
106
|
+
* MY_KV: 'kv',
|
|
107
|
+
* MY_DO: 'do',
|
|
108
|
+
* MY_D1: 'd1',
|
|
109
|
+
* MY_R2: 'r2'
|
|
110
|
+
* }
|
|
111
|
+
* })
|
|
112
|
+
* }
|
|
113
|
+
* return resolve(event)
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
18
117
|
async function createDevflarePlatform(options = {}) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return platform;
|
|
118
|
+
const { bridgeUrl = `ws://localhost:${process.env.DEVFLARE_BRIDGE_PORT ?? 8787}`, hints = {}, localBindings = {} } = options;
|
|
119
|
+
const cacheKey = getPlatformCacheKey(bridgeUrl, hints);
|
|
120
|
+
if (shouldUseCachedPlatform(localBindings) && platformCache?.key === cacheKey) return platformCache.platform;
|
|
121
|
+
const client = getClient({ url: bridgeUrl });
|
|
122
|
+
await client.connect();
|
|
123
|
+
const env = overlayLocalBindings(createEnvProxy({
|
|
124
|
+
client,
|
|
125
|
+
hints,
|
|
126
|
+
strict: true
|
|
127
|
+
}), localBindings);
|
|
128
|
+
const pendingErrors = [];
|
|
129
|
+
const platform = {
|
|
130
|
+
env,
|
|
131
|
+
context: createDevExecutionContext(pendingErrors),
|
|
132
|
+
caches: {
|
|
133
|
+
default: createMockCache(),
|
|
134
|
+
open: async (cacheName) => createMockCache()
|
|
135
|
+
},
|
|
136
|
+
cf: {
|
|
137
|
+
colo: "DEV",
|
|
138
|
+
country: "XX",
|
|
139
|
+
city: "Development",
|
|
140
|
+
continent: "XX",
|
|
141
|
+
latitude: "0",
|
|
142
|
+
longitude: "0",
|
|
143
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
144
|
+
region: "Development",
|
|
145
|
+
regionCode: "DEV",
|
|
146
|
+
asn: 0,
|
|
147
|
+
asOrganization: "Devflare Dev"
|
|
148
|
+
},
|
|
149
|
+
pendingErrors
|
|
150
|
+
};
|
|
151
|
+
if (shouldUseCachedPlatform(localBindings)) platformCache = {
|
|
152
|
+
key: cacheKey,
|
|
153
|
+
platform
|
|
154
|
+
};
|
|
155
|
+
return platform;
|
|
58
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Create a simple mock cache for dev mode
|
|
159
|
+
* Note: Cloudflare's Cache interface differs from browser Cache API
|
|
160
|
+
*/
|
|
59
161
|
function createMockCache() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
162
|
+
const store = /* @__PURE__ */ new Map();
|
|
163
|
+
return {
|
|
164
|
+
async match(request) {
|
|
165
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
166
|
+
return store.get(key)?.clone();
|
|
167
|
+
},
|
|
168
|
+
async put(request, response) {
|
|
169
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
170
|
+
store.set(key, response.clone());
|
|
171
|
+
},
|
|
172
|
+
async delete(request) {
|
|
173
|
+
const key = typeof request === "string" ? request : request instanceof URL ? request.href : request.url;
|
|
174
|
+
return store.delete(key);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
75
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Reset the cached platform (for testing)
|
|
180
|
+
*/
|
|
76
181
|
function resetPlatform() {
|
|
77
|
-
|
|
182
|
+
platformCache = null;
|
|
78
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Reset the cached config (for testing)
|
|
186
|
+
*/
|
|
79
187
|
function resetConfigCache() {
|
|
80
|
-
|
|
188
|
+
configCache = null;
|
|
81
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Check if running in devflare dev mode
|
|
192
|
+
*/
|
|
82
193
|
function isDevflareDev() {
|
|
83
|
-
|
|
194
|
+
return process.env.DEVFLARE_DEV === "true";
|
|
84
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Get the bridge port from environment
|
|
198
|
+
*/
|
|
85
199
|
function getBridgePort() {
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
for (const name of Object.keys(bindings.durableObjects)) {
|
|
111
|
-
hints[name] = "do";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (bindings.queues?.producers) {
|
|
115
|
-
for (const name of Object.keys(bindings.queues.producers)) {
|
|
116
|
-
hints[name] = "queue";
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (bindings.services) {
|
|
120
|
-
for (const name of Object.keys(bindings.services)) {
|
|
121
|
-
hints[name] = "service";
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (bindings.ai?.binding) {
|
|
125
|
-
hints[bindings.ai.binding] = "ai";
|
|
126
|
-
}
|
|
127
|
-
return hints;
|
|
128
|
-
}
|
|
129
|
-
async function loadHintsFromConfig() {
|
|
130
|
-
const cwd = process.cwd();
|
|
131
|
-
if (configCache?.cwd === cwd) {
|
|
132
|
-
const config2 = await configCache.promise;
|
|
133
|
-
return config2 ? extractHintsFromConfig(config2) : {};
|
|
134
|
-
}
|
|
135
|
-
const promise = loadConfig({ cwd }).catch((err) => {
|
|
136
|
-
if (process.env.DEVFLARE_DEBUG) {
|
|
137
|
-
console.warn("[devflare] Failed to load config for hints:", err.message);
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
});
|
|
141
|
-
configCache = { cwd, promise };
|
|
142
|
-
const config = await promise;
|
|
143
|
-
return config ? extractHintsFromConfig(config) : {};
|
|
200
|
+
return Number.parseInt(process.env.DEVFLARE_BRIDGE_PORT ?? "8787", 10);
|
|
201
|
+
}
|
|
202
|
+
/** Cached config promise keyed by cwd + explicit config path */
|
|
203
|
+
let configCache = null;
|
|
204
|
+
function getConfigFileFromEnv() {
|
|
205
|
+
return process.env.DEVFLARE_CONFIG_PATH;
|
|
206
|
+
}
|
|
207
|
+
async function loadConfigFromCurrentCwd() {
|
|
208
|
+
const cwd = process.cwd();
|
|
209
|
+
const configFile = getConfigFileFromEnv();
|
|
210
|
+
if (configCache?.cwd === cwd && configCache.configFile === configFile) return configCache.promise;
|
|
211
|
+
const promise = loadConfig({
|
|
212
|
+
cwd,
|
|
213
|
+
configFile
|
|
214
|
+
}).catch((err) => {
|
|
215
|
+
if (process.env.DEVFLARE_DEBUG) console.warn("[devflare] Failed to load config for hints:", err.message);
|
|
216
|
+
return null;
|
|
217
|
+
});
|
|
218
|
+
configCache = {
|
|
219
|
+
cwd,
|
|
220
|
+
configFile,
|
|
221
|
+
promise
|
|
222
|
+
};
|
|
223
|
+
return promise;
|
|
144
224
|
}
|
|
225
|
+
async function loadPlatformOptionsFromConfig() {
|
|
226
|
+
const cwd = process.cwd();
|
|
227
|
+
const config = await loadConfigFromCurrentCwd();
|
|
228
|
+
if (!config) return {
|
|
229
|
+
hints: {},
|
|
230
|
+
localBindings: {}
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
hints: extractBindingHints(config),
|
|
234
|
+
localBindings: buildSvelteKitLocalBindings(config, cwd)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function resolveWithPlatformContext(event, resolve, platform) {
|
|
238
|
+
if (!(event.request instanceof Request)) return resolve(event);
|
|
239
|
+
return runWithEventContext(createFetchEvent(event.request, platform.env, platform.context), () => resolve(event));
|
|
240
|
+
}
|
|
241
|
+
async function createPlatformWithRequestContext(event, resolve, options) {
|
|
242
|
+
const platform = await createDevflarePlatform(options);
|
|
243
|
+
event.platform = platform;
|
|
244
|
+
return resolveWithPlatformContext(event, resolve, platform);
|
|
245
|
+
}
|
|
246
|
+
async function getAutoPlatformOptions() {
|
|
247
|
+
const options = await loadPlatformOptionsFromConfig();
|
|
248
|
+
setBindingHints(options.hints ?? {});
|
|
249
|
+
return options;
|
|
250
|
+
}
|
|
251
|
+
async function getCustomPlatformOptions(options) {
|
|
252
|
+
if (options.hints) setBindingHints(options.hints);
|
|
253
|
+
return options;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Create a SvelteKit handle that automatically injects the devflare platform
|
|
257
|
+
* in development mode. This eliminates the need for boilerplate in hooks.server.ts.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* // src/hooks.server.ts
|
|
262
|
+
* import { createHandle } from 'devflare/sveltekit'
|
|
263
|
+
*
|
|
264
|
+
* export const handle = createHandle({
|
|
265
|
+
* hints: {
|
|
266
|
+
* MY_KV: 'kv',
|
|
267
|
+
* MY_DO: 'do',
|
|
268
|
+
* MY_D1: 'd1',
|
|
269
|
+
* MY_R2: 'r2'
|
|
270
|
+
* }
|
|
271
|
+
* })
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @example Composing with other handles using SvelteKit's sequence
|
|
275
|
+
* ```ts
|
|
276
|
+
* import { sequence } from '@sveltejs/kit/hooks'
|
|
277
|
+
* import { createHandle } from 'devflare/sveltekit'
|
|
278
|
+
*
|
|
279
|
+
* const devflareHandle = createHandle({ hints: { ... } })
|
|
280
|
+
* const authHandle: Handle = async ({ event, resolve }) => { ... }
|
|
281
|
+
*
|
|
282
|
+
* export const handle = sequence(devflareHandle, authHandle)
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
145
285
|
function createHandle(options = {}) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
286
|
+
const { shouldEnable, ...platformOptions } = options;
|
|
287
|
+
return async ({ event, resolve }) => {
|
|
288
|
+
if (shouldEnable ? shouldEnable() : process.env.NODE_ENV !== "production" && process.env.DEVFLARE_DEV === "true") try {
|
|
289
|
+
return await createPlatformWithRequestContext(event, resolve, await getCustomPlatformOptions(platformOptions));
|
|
290
|
+
} catch (error) {
|
|
291
|
+
console.error("[devflare] Failed to create platform:", error);
|
|
292
|
+
}
|
|
293
|
+
return resolve(event);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Pre-configured SvelteKit handle that auto-loads binding hints from devflare.config.ts.
|
|
298
|
+
*
|
|
299
|
+
* This is the simplest way to integrate devflare with SvelteKit:
|
|
300
|
+
*
|
|
301
|
+
* @example Simplest usage — just re-export
|
|
302
|
+
* ```ts
|
|
303
|
+
* // src/hooks.server.ts
|
|
304
|
+
* export { handle } from 'devflare/sveltekit'
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @example With other handles
|
|
308
|
+
* ```ts
|
|
309
|
+
* // src/hooks.server.ts
|
|
310
|
+
* import { sequence } from '@sveltejs/kit/hooks'
|
|
311
|
+
* import { handle as devflareHandle } from 'devflare/sveltekit'
|
|
312
|
+
*
|
|
313
|
+
* const authHandle: Handle = async ({ event, resolve }) => { ... }
|
|
314
|
+
*
|
|
315
|
+
* export const handle = sequence(devflareHandle, authHandle)
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
const handle = async (input) => {
|
|
319
|
+
const { event, resolve } = input;
|
|
320
|
+
if (process.env.NODE_ENV !== "production" && process.env.DEVFLARE_DEV === "true") try {
|
|
321
|
+
return await createPlatformWithRequestContext(event, resolve, await getAutoPlatformOptions());
|
|
322
|
+
} catch (error) {
|
|
323
|
+
console.error("[devflare] Failed to create platform:", error);
|
|
324
|
+
}
|
|
325
|
+
return resolve(event);
|
|
182
326
|
};
|
|
327
|
+
//#endregion
|
|
328
|
+
export { createDevflarePlatform, createHandle, getBridgePort, handle, isDevflareDev, resetConfigCache, resetPlatform };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DevflareConfig } from '../config/index.js';
|
|
2
|
+
export declare function buildSvelteKitLocalBindings(config: DevflareConfig, cwd: string): Record<string, unknown>;
|
|
3
|
+
export declare function overlayLocalBindings(baseEnv: Record<string, unknown>, localBindings: Record<string, unknown>): Record<string, unknown>;
|
|
4
|
+
//# sourceMappingURL=local-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-bindings.d.ts","sourceRoot":"","sources":["../../src/sveltekit/local-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,WAAW,CAAA;AAoB3E,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwBzB;AAED,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgCzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BindingHints } from '../bridge';
|
|
1
|
+
import { type BindingHints } from '../bridge/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* SvelteKit platform object shape
|
|
4
4
|
*/
|
|
@@ -7,6 +7,11 @@ export interface Platform {
|
|
|
7
7
|
context: ExecutionContext;
|
|
8
8
|
caches: CacheStorage;
|
|
9
9
|
cf: Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Errors captured from `ctx.waitUntil()` rejections in dev mode.
|
|
12
|
+
* Drain via `drainWaitUntilErrors(platform)`.
|
|
13
|
+
*/
|
|
14
|
+
pendingErrors?: unknown[];
|
|
10
15
|
}
|
|
11
16
|
export interface DevflarePlatformOptions {
|
|
12
17
|
/**
|
|
@@ -19,7 +24,18 @@ export interface DevflarePlatformOptions {
|
|
|
19
24
|
* Keys are binding names, values are binding types
|
|
20
25
|
*/
|
|
21
26
|
hints?: BindingHints;
|
|
27
|
+
/**
|
|
28
|
+
* Local Node-side binding shims to prefer over the bridge-backed env.
|
|
29
|
+
* Used by the SvelteKit handle for bindings whose local API exposes
|
|
30
|
+
* synchronous properties or rich transformation objects.
|
|
31
|
+
*/
|
|
32
|
+
localBindings?: Record<string, unknown>;
|
|
22
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Drain errors captured from `ctx.waitUntil()` calls on a dev platform.
|
|
36
|
+
* Returns a snapshot of the pending errors and clears the buffer.
|
|
37
|
+
*/
|
|
38
|
+
export declare function drainWaitUntilErrors(platform: Platform): unknown[];
|
|
23
39
|
/**
|
|
24
40
|
* Create a platform object that routes bindings through the bridge
|
|
25
41
|
*
|
|
@@ -107,6 +123,7 @@ export interface CreateHandleOptions extends DevflarePlatformOptions {
|
|
|
107
123
|
export declare function createHandle<T extends {
|
|
108
124
|
event: {
|
|
109
125
|
platform?: unknown;
|
|
126
|
+
request?: Request;
|
|
110
127
|
};
|
|
111
128
|
resolve: (event: unknown) => Response | Promise<Response>;
|
|
112
129
|
}>(options?: CreateHandleOptions): (input: T) => Promise<Response>;
|
|
@@ -135,7 +152,8 @@ export declare function createHandle<T extends {
|
|
|
135
152
|
export declare const handle: <T extends {
|
|
136
153
|
event: {
|
|
137
154
|
platform?: unknown;
|
|
155
|
+
request?: Request;
|
|
138
156
|
};
|
|
139
|
-
resolve: (event: unknown) =>
|
|
157
|
+
resolve: (event: unknown) => Response | Promise<Response>;
|
|
140
158
|
}>(input: T) => Promise<Response>;
|
|
141
159
|
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/sveltekit/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/sveltekit/platform.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,YAAY,EAA8C,MAAM,WAAW,CAAA;AAUzF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5B,OAAO,EAAE,gBAAgB,CAAA;IACzB,MAAM,EAAE,YAAY,CAAA;IACpB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IAEpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAkDD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,EAAE,CAQlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,GAAE,uBAA4B,GACnC,OAAO,CAAC,QAAQ,CAAC,CAqDnB;AA4BD;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAgGD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IACnE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,CAC3B,CAAC,SAAS;IACT,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACzD,EACA,OAAO,GAAE,mBAAwB,GAAG,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAwBpE;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,MAAM,GAClB,CAAC,SAAS;IACT,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACzD,SAEM,CAAC,KACN,OAAO,CAAC,QAAQ,CAgBlB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type AISearchChunk = AiSearchSearchResponse['chunks'][number];
|
|
2
|
+
export interface MockAISearchItemFixture {
|
|
3
|
+
id?: string;
|
|
4
|
+
key: string;
|
|
5
|
+
content?: string;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
status?: AiSearchItemInfo['status'];
|
|
9
|
+
chunks?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface MockAISearchInstanceOptions {
|
|
12
|
+
id?: string;
|
|
13
|
+
namespace?: string;
|
|
14
|
+
info?: Partial<AiSearchInstanceInfo>;
|
|
15
|
+
items?: MockAISearchItemFixture[];
|
|
16
|
+
chatMessage?: string | ((chunks: AISearchChunk[], request: AiSearchChatCompletionsRequest) => string);
|
|
17
|
+
}
|
|
18
|
+
export interface MockAISearchNamespaceOptions {
|
|
19
|
+
namespace?: string;
|
|
20
|
+
instances?: Record<string, MockAISearchInstanceOptions | AiSearchInstance>;
|
|
21
|
+
}
|
|
22
|
+
export type MockAISearchInstance = AiSearchInstance & {
|
|
23
|
+
_getSearches(): AiSearchSearchRequest[];
|
|
24
|
+
_getItems(): AiSearchItemInfo[];
|
|
25
|
+
_getJobs(): AiSearchJobInfo[];
|
|
26
|
+
};
|
|
27
|
+
export type MockAISearchNamespace = AiSearchNamespace & {
|
|
28
|
+
_getInstances(): string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a deterministic AI Search instance binding for pure unit tests.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createMockAISearchInstance(options?: MockAISearchInstanceOptions): MockAISearchInstance;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a deterministic AI Search namespace binding for pure unit tests.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createMockAISearchNamespace(options?: MockAISearchNamespaceOptions): MockAISearchNamespace;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=ai-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-search.d.ts","sourceRoot":"","sources":["../../src/test/ai-search.ts"],"names":[],"mappings":"AAQA,KAAK,aAAa,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAG7D,MAAM,WAAW,uBAAuB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACnC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACpC,KAAK,CAAC,EAAE,uBAAuB,EAAE,CAAA;IACjC,WAAW,CAAC,EACT,MAAM,GACN,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,8BAA8B,KAAK,MAAM,CAAC,CAAA;CACjF;AAED,MAAM,WAAW,4BAA4B;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,GAAG,gBAAgB,CAAC,CAAA;CAC1E;AAED,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACrD,YAAY,IAAI,qBAAqB,EAAE,CAAA;IACvC,SAAS,IAAI,gBAAgB,EAAE,CAAA;IAC/B,QAAQ,IAAI,eAAe,EAAE,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACvD,aAAa,IAAI,MAAM,EAAE,CAAA;CACzB,CAAA;AAqJD;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,GAAE,2BAAgC,GACvC,oBAAoB,CAiXtB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,OAAO,GAAE,4BAAiC,GACxC,qBAAqB,CA2IvB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal shape a Durable Object instance must satisfy to have its alarm fired:
|
|
3
|
+
* an `alarm()` method, plus the `state`/`ctx` and `env` the runtime injects.
|
|
4
|
+
* Matches the wrapper the Devflare DO transform generates around `alarm()`.
|
|
5
|
+
*/
|
|
6
|
+
export interface AlarmTriggerTarget {
|
|
7
|
+
alarm?: (...args: unknown[]) => unknown;
|
|
8
|
+
state?: DurableObjectState;
|
|
9
|
+
ctx?: DurableObjectState;
|
|
10
|
+
env?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface AlarmTriggerOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Durable Object state to attach to the alarm event. Defaults to the
|
|
15
|
+
* instance's `state` (or `ctx`) when present.
|
|
16
|
+
*/
|
|
17
|
+
state?: DurableObjectState;
|
|
18
|
+
/**
|
|
19
|
+
* Env to attach to the alarm event. Defaults to the instance's `env` when
|
|
20
|
+
* present, otherwise an empty object.
|
|
21
|
+
*/
|
|
22
|
+
env?: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface AlarmTriggerResult {
|
|
25
|
+
/** Whether the alarm handler completed successfully. */
|
|
26
|
+
success: boolean;
|
|
27
|
+
/** Error message if the handler threw. */
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Trigger a Durable Object's `alarm()` handler.
|
|
32
|
+
*
|
|
33
|
+
* This mirrors how the Devflare runtime invokes a DO alarm: it builds a
|
|
34
|
+
* `durable-object-alarm` event with the instance's env + state, installs it into
|
|
35
|
+
* AsyncLocalStorage via `runWithEventContext`, and calls the instance's
|
|
36
|
+
* `alarm()` with that event (so `getDurableObjectAlarmEvent()` works inside the
|
|
37
|
+
* handler). The instance keeps using its own `this.env` / `this.ctx`; the event
|
|
38
|
+
* is supplied for context-aware code paths.
|
|
39
|
+
*
|
|
40
|
+
* @param target - The Durable Object instance whose `alarm()` should be fired.
|
|
41
|
+
* @param options - Optional explicit `state`/`env` for the alarm event.
|
|
42
|
+
* @returns Result object with success status.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const counter = new Counter(state, env)
|
|
46
|
+
* await counter.scheduleAlarm()
|
|
47
|
+
* const result = await cf.alarm.trigger(counter)
|
|
48
|
+
* expect(result.success).toBe(true)
|
|
49
|
+
*/
|
|
50
|
+
declare function trigger(target: AlarmTriggerTarget, options?: AlarmTriggerOptions): Promise<AlarmTriggerResult>;
|
|
51
|
+
export declare const alarm: {
|
|
52
|
+
trigger: typeof trigger;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=alarm.d.ts.map
|